@signalk/app-dock 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/package.json +1 -1
- package/public/dock.js +19 -1
package/README.md
CHANGED
|
@@ -102,6 +102,8 @@ Open **Plugin Config > App Dock** in the admin UI. The embedded configurator pro
|
|
|
102
102
|
| `showFullscreenButton` | `false` | Show fullscreen toggle in dock; hidden automatically where the Fullscreen API is unavailable |
|
|
103
103
|
| `showExitButton` | `false` | Show X button that returns to the Signal K admin UI |
|
|
104
104
|
|
|
105
|
+
In either `iframeMode`, the server's admin UI (an app whose URL is under `/admin/`, such as the Settings tile) opens fresh every time, at the URL its tile points to. A webapp or page opened from inside the admin UI does not come back the next time Settings is tapped.
|
|
106
|
+
|
|
105
107
|
## Access
|
|
106
108
|
|
|
107
109
|
With security enabled, what the dock offers depends on the visitor:
|
package/package.json
CHANGED
package/public/dock.js
CHANGED
|
@@ -614,6 +614,18 @@
|
|
|
614
614
|
}
|
|
615
615
|
|
|
616
616
|
// ─── Switch to app ────────────────────────────────────────────────────────────
|
|
617
|
+
// The server's admin UI leads anywhere: into a webapp, a plugin's page or
|
|
618
|
+
// another of its own screens. Its tile opens it fresh every time, at the
|
|
619
|
+
// URL the tile points to, so it never resumes wherever it was left.
|
|
620
|
+
function opensFresh(app) {
|
|
621
|
+
try {
|
|
622
|
+
const url = new URL(app.url, window.location.href)
|
|
623
|
+
return url.origin === window.location.origin && /^\/admin(\/|$)/.test(url.pathname)
|
|
624
|
+
} catch {
|
|
625
|
+
return false
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
|
|
617
629
|
function switchToApp(index) {
|
|
618
630
|
const app = cfg.apps[index]
|
|
619
631
|
if (!app) return
|
|
@@ -626,7 +638,8 @@
|
|
|
626
638
|
el.classList.toggle('active', el.dataset.index === String(index))
|
|
627
639
|
})
|
|
628
640
|
|
|
629
|
-
const
|
|
641
|
+
const fresh = opensFresh(app)
|
|
642
|
+
const alreadyLoaded = !fresh && !!iframes[app.url]
|
|
630
643
|
|
|
631
644
|
if (cfg.iframeMode === 'destroy') {
|
|
632
645
|
$iframeContainer.innerHTML = ''
|
|
@@ -635,6 +648,11 @@
|
|
|
635
648
|
Object.values(iframes).forEach((f) => f.classList.remove('active'))
|
|
636
649
|
}
|
|
637
650
|
|
|
651
|
+
if (fresh && iframes[app.url]) {
|
|
652
|
+
iframes[app.url].remove()
|
|
653
|
+
delete iframes[app.url]
|
|
654
|
+
}
|
|
655
|
+
|
|
638
656
|
if (!iframes[app.url]) {
|
|
639
657
|
if (!alreadyLoaded) showLoading(app.label)
|
|
640
658
|
|