Replaces the Photos/Calendar/Whiteboard tabs with a single Layout page
(now the frame's landing route) where each widget gets a gear icon
opening a dialog scoped to that specific widget's own settings. This
was the missing piece for genuinely independent same-type widgets --
"the Calendar tab" never made sense once a frame could hold more than
one calendar widget with different settings.
Data layer: FrameCalendar re-keyed from frame_id to widget_id, so each
calendar widget has its own independent included-calendars set. The
rekey runs as an unconditional post-startup step (like the existing
widget backfill), not a numbered migration -- it depends on calendar
widgets already existing, which themselves come from that same
backfill step, not from schema migration. Registering it as a numbered
migration would have run it first during a real upgrade, silently
dropping every row; caught by a new test that exercises the raw-SQL
upgrade path instead of the fresh-install create_all() shortcut every
other migration test takes.
API layer: every endpoint that used to assume "the frame's widget of
this type" (photo queue/thumbnail/preview, calendar select/color/
tasks/weather, whiteboard source/browse/preview) moved into
api_widgets.py under /api/frames/{id}/widgets/{widget_id}/..., with a
new require_widget_view/control dependency pair mirroring the existing
frame-level ones. Device status (battery/last-seen/firmware) got its
own frame-level /status endpoint, split out of the old photo-specific
/queue it used to piggyback on -- fixes the status bar going silently
blank on any frame without a photo widget.
UI layer: each widget type's existing settings markup/JS was ported
into a dialog partial + an explicit init/close function pair (the
content is now fetched and injected on demand, not loaded at page load
time). window.FRAME_API is repointed to the open dialog's widget-scoped
API base for its duration and restored on close; a separate
window.FRAME_BASE_API stays stable for the always-present header/
status-bar scripts.
Caught during manual browser testing: the consolidated config-save
endpoint initially expected a JSON body while the copied-over dialog JS
posts form-urlencoded data (the old convention) -- fixed to match, with
new HTTP-level test coverage that would have caught it immediately.
59 lines
2.9 KiB
HTML
59 lines
2.9 KiB
HTML
<h2 class="dialog-title">Whiteboard widget</h2>
|
|
|
|
<section class="card">
|
|
<h2 class="card-title">Whiteboard source</h2>
|
|
<p class="sub">Renders a Nextcloud Whiteboard (or any Excalidraw
|
|
scene) fetched over WebDAV -- credentials set up in
|
|
<a href="/settings">Settings</a>.</p>
|
|
|
|
<div id="whiteboard-current-source">
|
|
{% if whiteboard_source %}
|
|
<p class="sub" style="margin-top: 10px;">
|
|
Currently showing <strong>{{ whiteboard_source.url }}</strong>
|
|
using <strong>{{ whiteboard_source.display_name }}</strong>'s
|
|
WebDAV account.
|
|
<button type="button" class="btn-inline secondary" id="whiteboard-source-clear">Clear</button>
|
|
</p>
|
|
{% else %}
|
|
<p class="sub" style="margin-top: 10px;">No whiteboard configured yet.</p>
|
|
{% endif %}
|
|
</div>
|
|
|
|
{% if viewer_has_webdav_creds %}
|
|
<form id="whiteboard-source-form" style="margin-top: 16px;">
|
|
<label><span id="whiteboard-source-form-label">{{ "Change to one of your own files" if whiteboard_source else "Use one of your own files" }}</span>
|
|
<input type="text" id="whiteboard-url-input"
|
|
placeholder="https://cloud.example.com/remote.php/dav/files/you/Boards/family.whiteboard"
|
|
value="{{ whiteboard_source.url if whiteboard_source and whiteboard_source.user_id == user.id else '' }}">
|
|
</label>
|
|
<p class="sub" style="margin-top: 4px;">The direct WebDAV URL
|
|
to the specific file -- in Nextcloud's Files app, this is
|
|
the file's path under
|
|
<code>remote.php/dav/files/<your-username>/</code>.
|
|
<button type="button" class="btn-inline secondary" id="whiteboard-browse-toggle">Browse...</button></p>
|
|
|
|
<div id="whiteboard-browser" style="display: none; margin-top: 8px; border: 1px solid var(--border-color, #ccc); border-radius: 6px; padding: 8px;">
|
|
<div style="display: flex; align-items: center; gap: 8px; margin-bottom: 6px;">
|
|
<button type="button" class="btn-inline secondary" id="whiteboard-browse-up" disabled>Up</button>
|
|
<span class="sub" id="whiteboard-browse-current" style="word-break: break-all;"></span>
|
|
</div>
|
|
<ul id="whiteboard-browse-list" style="list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto;"></ul>
|
|
<p class="sub" id="whiteboard-browse-error" style="display: none; color: var(--error-color, #c00);"></p>
|
|
</div>
|
|
|
|
<button type="submit">Save</button>
|
|
</form>
|
|
{% else %}
|
|
<p class="sub" style="margin-top: 10px;">Set up WebDAV credentials
|
|
in <a href="/settings">Settings</a> first to point this widget at
|
|
one of your own files.</p>
|
|
{% endif %}
|
|
</section>
|
|
|
|
<section class="card" style="margin-top: 20px;">
|
|
<h2 class="card-title">Preview</h2>
|
|
<p class="sub">How this widget currently renders.</p>
|
|
<img class="preview-img" id="whiteboard-preview" alt="Whiteboard preview">
|
|
<button type="button" class="secondary" id="whiteboard-preview-refresh">Refresh now</button>
|
|
</section>
|