domma-cms 1.4.0 → 1.5.0

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.
@@ -32,7 +32,7 @@
32
32
  * @module services/widgets
33
33
  */
34
34
 
35
- import {getRegisteredSidebarItems, registerSidebarItem} from './hooks.js';
35
+ import {getRegisteredSidebarItems} from './hooks.js';
36
36
 
37
37
  /** Widths on the board's four-column grid. */
38
38
  export const WIDGET_SIZES = ['s', 'm', 'l', 'xl'];
@@ -226,7 +226,6 @@ export function layoutProblems(input) {
226
226
  // ---------------------------------------------------------------------------
227
227
 
228
228
  const owners = new Set();
229
- let sidebarRegistered = false;
230
229
 
231
230
  /**
232
231
  * A Pro Tool switches the board on (plugins.js hands it to each plugin as
@@ -239,14 +238,8 @@ let sidebarRegistered = false;
239
238
  export function enableDashboardPro({owner, tier, closedSource} = {}) {
240
239
  if (typeof owner !== 'string' || !owner.trim()) return false;
241
240
  if (tier !== 'paid' || closedSource !== true) return false;
242
- // The board's own address in the sidebar (Overview), once: `#/` can belong to
243
- // another Tool (the fleet manager's Dashboard), and My Dashboard still reaches it.
244
- if (!sidebarRegistered) {
245
- sidebarRegistered = true;
246
- try {
247
- registerSidebarItem({folder: 'overview', item: {source: 'Dashboard Pro', text: 'My Dashboard', url: '#/my-dashboard', icon: 'layout'}});
248
- } catch { /* a sidebar without folders still has the route */ }
249
- }
241
+ // No sidebar entry of its own: the Dashboard entry becomes Dashboards (routes/api/sidebar.js),
242
+ // whose first tab is the primary Dashboard and the rest the boards (admin lib/dashboards-arrange.js).
250
243
  owners.add(owner.trim());
251
244
  return true;
252
245
  }
@@ -274,7 +267,8 @@ export function _resetWidgetsForTests() {
274
267
 
275
268
  export const MAX_BOARDS = 12;
276
269
  export const BOARD_NAME_MAX = 40;
277
- const BOARD_ID_RE = /^[a-z0-9][a-z0-9-]{0,39}$/;
270
+ // `overview` is the primary Dashboard's tab (admin lib/dashboards-arrange.js), never a board.
271
+ const BOARD_ID_RE = /^(?!overview$)[a-z0-9][a-z0-9-]{0,39}$/;
278
272
 
279
273
  const boardName = (v, fallback) => String(v ?? '').replace(/[\u0000-\u001f<>]/g, '').replace(/\s+/g, ' ').trim().slice(0, BOARD_NAME_MAX) || fallback;
280
274
 
@@ -1,3 +0,0 @@
1
- <!-- My Dashboard - the Dashboard Pro board at its own address (admin/js/views/my-dashboard.js), for a site
2
- whose `#/` belongs to another Tool (the fleet manager's Dashboard, a chosen admin home). -->
3
- <div class="dbx"></div>
@@ -1 +0,0 @@
1
- import{apiRequest as r}from"../api.js";import{viewLifetime as m}from"../lib/tool-kit.js";const o=/^#\/my-dashboard\/?(\?.*)?$/,a=m(o);export const myDashboardView={templateUrl:"/admin/js/templates/my-dashboard.html",async onMount(t){a.reset();const e=await r("/dashboard/pro",{method:"GET"}).catch(()=>null);if(!o.test(location.hash))return;const i=t.get(0).querySelector(".dbx")||t.get(0);if(!e?.enabled){i.innerHTML='<p class="dbp-empty">My Dashboard comes with Dashboard Pro, which is not switched on for this site. Find it in the Marketplace.</p>';return}const{mountBoard:s}=await import("./dashboard-board.js");await s(t,a,{isAdmin:e.isAdmin===!0})}};