@stacksjs/defaults 0.75.701 → 0.75.706

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.
@@ -666,9 +666,10 @@ buddy test:types # typecheck (alias: typecheck)
666
666
  ```bash
667
667
  buddy fresh # reinstall dependencies
668
668
  buddy install # install deps
669
+ buddy install --frozen-lockfile --ignore-scripts # verify the locked install without lifecycle scripts
669
670
  buddy clean # remove node_modules
670
671
  buddy outdated # check outdated deps
671
- buddy add # add dependency
672
+ buddy add <stack> # install a registered stack scaffold
672
673
 
673
674
  buddy upgrade # upgrade Stacks framework (alias: update)
674
675
  -V/--version <version> # install specific version (e.g., 0.70.23)
@@ -794,6 +794,20 @@ custom layer only when the shared dialog or drawer semantics do not fit. It
794
794
  must still use `dashboard-modal-layer` and provide complete keyboard, focus,
795
795
  and ARIA behavior. Do not solve sidebar overlap by increasing z-index alone.
796
796
 
797
+ ### Which pages are available
798
+
799
+ `config/dashboard.ts` controls bundled page sections through `sections`.
800
+ Set a section or data row to `{ enabled: false }` to remove its bundled views
801
+ and navigation. Content, Commerce, and Marketing require their corresponding
802
+ installed features. Pages backed by optional schema models, the serverless
803
+ mail inbox, or remote hosts are available when those resources are configured.
804
+
805
+ The standalone Buddy dashboard can still run when `dashboard.enabled` is
806
+ false. That flag controls dashboard integration in the app's own server.
807
+ Settings remains reachable for the dashboard itself. Disabling All Models
808
+ removes the index and keeps individual model pages. App views in
809
+ `resources/views/dashboard` keep precedence, and `nav` adds their links.
810
+
797
811
  ### Live dashboard audit
798
812
 
799
813
  Start `./buddy dev --dashboard`, then run the dependency-free live audit from
@@ -1,7 +1,9 @@
1
1
  #!/usr/bin/env bun
2
2
 
3
3
  import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs'
4
- import { join, relative, resolve } from 'node:path'
4
+ import { dirname, join, relative, resolve, sep } from 'node:path'
5
+ import { overridesReady } from '@stacksjs/config'
6
+ import { dashboardViewExclusions, readDashboardPageAvailability } from '../../../../resources/functions/dashboard/page-availability'
5
7
 
6
8
  interface ModelSummary {
7
9
  href: string
@@ -28,7 +30,7 @@ const baseUrlFlag = baseUrlFlagIndex >= 0
28
30
  ? args[baseUrlFlagIndex + 1]
29
31
  : args.find(arg => arg.startsWith('--base-url='))?.slice('--base-url='.length)
30
32
  const positionalBaseUrl = args.find((arg, index) =>
31
- !arg.startsWith('-') && index !== baseUrlFlagIndex + 1)
33
+ !arg.startsWith('-') && (baseUrlFlagIndex < 0 || index !== baseUrlFlagIndex + 1))
32
34
  const baseUrl = (baseUrlFlag || positionalBaseUrl || process.env.DASHBOARD_URL || 'http://127.0.0.1:3002')
33
35
  .replace(/\/+$/, '')
34
36
  const timeoutMs = 15_000
@@ -44,36 +46,42 @@ function files(directory: string): string[] {
44
46
  })
45
47
  }
46
48
 
47
- function dashboardViewRoots(): string[] {
48
- return [
49
- resolve(projectRoot, 'storage/framework/defaults/views/dashboard'),
50
- resolve(projectRoot, 'resources/views/dashboard'),
51
- ].filter(existsSync)
49
+ function dashboardDefaultsRoot(): string {
50
+ const vendored = resolve(projectRoot, 'storage/framework/defaults')
51
+ if (existsSync(join(vendored, 'views/dashboard')))
52
+ return vendored
53
+
54
+ return dirname(Bun.resolveSync('@stacksjs/defaults/package.json', projectRoot))
52
55
  }
53
56
 
54
57
  function viewRoute(root: string, path: string): string {
55
- const relativePath = relative(root, path).replace(/\.stx$/, '')
58
+ const relativePath = relative(root, path).split(sep).join('/').replace(/\.stx$/, '')
56
59
  return relativePath === 'index'
57
60
  ? '/'
58
61
  : `/${relativePath.replace(/\/index$/, '')}`
59
62
  }
60
63
 
61
- function discoveredViewRoutes(): { dynamic: string[], static: string[] } {
62
- const routeMap = new Map<string, string>()
64
+ function discoveredViewRoutes(): { dynamic: string[], static: string[], excluded: string[] } {
65
+ const framework = join(dashboardDefaultsRoot(), 'views/dashboard')
66
+ const app = resolve(projectRoot, 'resources/views/dashboard')
67
+ const exclusions = dashboardViewExclusions(framework, readDashboardPageAvailability())
68
+ const routes = new Map<string, boolean>()
63
69
 
64
- for (const root of dashboardViewRoots()) {
70
+ for (const root of [framework, app]) {
65
71
  for (const path of files(root)) {
66
- if (!path.endsWith('.stx') || path.includes('/layouts/'))
72
+ if (!path.endsWith('.stx') || relative(root, path).startsWith(`layouts${sep}`))
67
73
  continue
68
-
69
- routeMap.set(viewRoute(root, path), path)
74
+ const route = viewRoute(root, path)
75
+ if (route !== '/[...all]')
76
+ routes.set(route, !exclusions.some(excluded => path === excluded || path.startsWith(`${excluded}${sep}`)))
70
77
  }
71
78
  }
72
79
 
73
- const routes = [...routeMap.keys()].filter(route => route !== '/[...all]')
80
+ const enabled = [...routes].filter(([, available]) => available).map(([route]) => route)
74
81
  return {
75
- dynamic: routes.filter(route => route.includes('[')).sort(),
76
- static: routes.filter(route => !route.includes('[')).sort(),
82
+ dynamic: enabled.filter(route => route.includes('[')).sort(),
83
+ static: enabled.filter(route => !route.includes('[')).sort(),
84
+ excluded: [...routes].filter(([route, available]) => !available && !route.includes('[')).map(([route]) => route).sort(),
77
85
  }
78
86
  }
79
87
 
@@ -213,10 +221,7 @@ async function discoverDynamicPages(
213
221
  }
214
222
 
215
223
  function dashboardApiRoutes(): string[] {
216
- const path = resolve(
217
- projectRoot,
218
- 'storage/framework/defaults/routes/dashboard-api.ts',
219
- )
224
+ const path = join(dashboardDefaultsRoot(), 'routes/dashboard-api.ts')
220
225
  const source = readFileSync(path, 'utf8')
221
226
  return [...source.matchAll(/route\.get\(\s*['"]([^'"]+)['"]/g)]
222
227
  .map(match => `/api/dashboard${match[1]}`)
@@ -318,6 +323,7 @@ async function auditApi(
318
323
  return statuses
319
324
  }
320
325
 
326
+ await overridesReady
321
327
  const views = discoveredViewRoutes()
322
328
  if (views.static.length === 0) {
323
329
  failures.push({
@@ -331,11 +337,11 @@ const modelRoutes = (modelIndex.categoryGroups || [])
331
337
  .flatMap(group => group.models || [])
332
338
  .map(model => model.href)
333
339
  .filter(Boolean)
334
- if (modelRoutes.length === 0) {
340
+ if (!Array.isArray(modelIndex.categoryGroups)) {
335
341
  failures.push({
336
342
  path: '/api/dashboard/models',
337
343
  kind: 'model-route-discovery',
338
- error: 'No model destinations were discovered',
344
+ error: 'The model index did not return category groups',
339
345
  })
340
346
  }
341
347
  const dynamicPages = await discoverDynamicPages(views.dynamic, modelRoutes)
@@ -344,6 +350,17 @@ for (const path of views.static)
344
350
  await auditPage(path)
345
351
  for (const path of dynamicPages)
346
352
  await auditPage(path)
353
+ for (const path of views.excluded) {
354
+ try {
355
+ const response = await request(path, { redirect: 'manual' })
356
+ await response.body?.cancel()
357
+ if (response.status !== 404)
358
+ failures.push({ path, kind: 'excluded-page', status: response.status })
359
+ }
360
+ catch (error) {
361
+ failures.push({ path, kind: 'excluded-page', error: String(error) })
362
+ }
363
+ }
347
364
 
348
365
  const apiRoutes = dashboardApiRoutes()
349
366
  if (apiRoutes.length === 0) {
@@ -359,6 +376,7 @@ const remainingDynamicCount = dynamicPages.length - modelRoutes.length
359
376
  console.log(JSON.stringify({
360
377
  baseUrl,
361
378
  pages: {
379
+ excluded: views.excluded.length,
362
380
  static: { routes: views.static.length, requests: views.static.length * 2 },
363
381
  models: { routes: modelRoutes.length, requests: modelRoutes.length * 2 },
364
382
  dynamic: {
@@ -21,7 +21,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
21
21
  | `@stacksjs/auth` | [`stacks-auth`](../stacks-auth/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/index.ts) | 136 |
22
22
  | `@stacksjs/browser` | [`stacks-browser`](../stacks-browser/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/browser/src/index.ts) | 11 |
23
23
  | `@stacksjs/browser-extension` | [`stacks-browser-extension`](../stacks-browser-extension/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/browser-extension/src/index.ts) | 9 |
24
- | `@stacksjs/buddy` | [`stacks-buddy`](../stacks-buddy/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/buddy/src/index.ts) | 229 |
24
+ | `@stacksjs/buddy` | [`stacks-buddy`](../stacks-buddy/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/buddy/src/index.ts) | 230 |
25
25
  | `@stacksjs/build` | [`stacks-build`](../stacks-build/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/build/src/index.ts) | 7 |
26
26
  | `@stacksjs/cache` | [`stacks-cache`](../stacks-cache/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/cache/src/index.ts) | 24 |
27
27
  | `@stacksjs/calendar-api` | [`stacks-calendar`](../stacks-calendar/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/calendar-api/src/index.ts) | 5 |
@@ -223,7 +223,7 @@ Read the entrypoint and package export map for re-exported or type-only surfaces
223
223
 
224
224
  Local source modules: [src/commands/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/buddy/src/commands/index.ts).
225
225
 
226
- Evidence directory: [229 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/buddy/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
226
+ Evidence directory: [230 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/buddy/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
227
227
 
228
228
  ### @stacksjs/build
229
229
 
@@ -2,7 +2,7 @@
2
2
  "publisher": "Stacks",
3
3
  "name": "vscode-stacks",
4
4
  "displayName": "Stacks",
5
- "version": "0.75.701",
5
+ "version": "0.75.706",
6
6
  "description": "Stacks, built into VS Code: stx templates, pickier linting and formatting, encrypted env files, the dev server preview and every buddy command. No other extensions required.",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/chrisbbreuer",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/defaults",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.701",
5
+ "version": "0.75.706",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/stacksjs/stacks.git",
@@ -45,15 +45,15 @@
45
45
  "dependencies": {
46
46
  "@iconify-json/f7": "^1.2.2",
47
47
  "@iconify-json/hugeicons": "^1.2.35",
48
- "@stacksjs/desktop": "^0.2.948",
49
- "@stacksjs/mobile": "0.75.701",
50
- "@stacksjs/sanitizer": "^0.2.948",
51
- "@stacksjs/stx": "^0.2.948",
52
- "@stacksjs/strings": "0.75.701",
48
+ "@stacksjs/desktop": "^0.2.957",
49
+ "@stacksjs/mobile": "0.75.706",
50
+ "@stacksjs/sanitizer": "^0.2.957",
51
+ "@stacksjs/stx": "^0.2.957",
52
+ "@stacksjs/strings": "0.75.706",
53
53
  "@xterm/addon-fit": "^0.11.0",
54
54
  "@xterm/xterm": "^6.0.0",
55
55
  "ts-qr-codes": "^0.1.8",
56
- "@stacksjs/support": "0.75.701",
57
- "@stacksjs/browser": "0.75.701"
56
+ "@stacksjs/support": "0.75.706",
57
+ "@stacksjs/browser": "0.75.706"
58
58
  }
59
59
  }
@@ -1,25 +1,9 @@
1
1
  <script server>
2
- import { loadDiscoveredManifest } from '@stacksjs/defaults/resources/functions/dashboard/sidebar'
2
+ import { dashboardPageVisibility } from '@stacksjs/defaults/resources/functions/dashboard/page-availability'
3
3
 
4
- // The Commerce card follows the sidebar's commerce section: with the feature
5
- // off its models are never loaded, so the page it opens could only answer
6
- // 503 (stacksjs/stacks#3183).
7
- export const commerceAnalytics = loadDiscoveredManifest().sections.commerce
4
+ const analyticsPageAvailable = dashboardPageVisibility()
8
5
 
9
- // Declared, so the client block gets it typed rather than off the implicit
10
- // bridge, as the dashboard layout does with its role map.
11
- defineClientPayload({ commerceAnalytics })
12
- </script>
13
-
14
- <script client>
15
- import type { AnalyticsOverview } from '../../../../functions/analytics'
16
- import { fetchWebAnalytics } from '../../../../functions/analytics'
17
-
18
- const overview = state<AnalyticsOverview | null>(null)
19
- const loading = state(true)
20
- const loadError = state('')
21
-
22
- const analyticsCards = [
6
+ export const analyticsCards = [
23
7
  { name: 'Web Analytics', description: 'Page views, visitors, and request performance', icon: 'i-hugeicons-chart-line-data-02', to: '/analytics/web' },
24
8
  { name: 'Blog Analytics', description: 'Recorded traffic to blog routes', icon: 'i-hugeicons-edit-02', to: '/analytics/blog' },
25
9
  { name: 'Commerce Analytics', description: 'Persisted sales and revenue', icon: 'i-hugeicons-shopping-cart-01', to: '/analytics/commerce/sales' },
@@ -30,7 +14,18 @@ const analyticsCards = [
30
14
  { name: 'Countries', description: 'Geographic data when provided', icon: 'i-hugeicons-globe-02', to: '/analytics/countries' },
31
15
  { name: 'Devices', description: 'Device classes from user agents', icon: 'i-hugeicons-smart-phone-01', to: '/analytics/devices' },
32
16
  { name: 'Browsers', description: 'Browser families from user agents', icon: 'i-hugeicons-browser', to: '/analytics/browsers' },
33
- ].filter(card => commerceAnalytics || !card.to.startsWith('/analytics/commerce/'))
17
+ ].filter(card => analyticsPageAvailable(card.to))
18
+
19
+ defineClientPayload({ analyticsCards })
20
+ </script>
21
+
22
+ <script client>
23
+ import type { AnalyticsOverview } from '../../../../functions/analytics'
24
+ import { fetchWebAnalytics } from '../../../../functions/analytics'
25
+
26
+ const overview = state<AnalyticsOverview | null>(null)
27
+ const loading = state(true)
28
+ const loadError = state('')
34
29
 
35
30
  function formatNumber(value: number | undefined): string {
36
31
  return new Intl.NumberFormat().format(value || 0)
@@ -1,3 +1,9 @@
1
+ <script server>
2
+ import { dashboardPageVisibility } from '@stacksjs/defaults/resources/functions/dashboard/page-availability'
3
+
4
+ export const dashboardLinkAvailable = dashboardPageVisibility()
5
+ </script>
6
+
1
7
  <script client>
2
8
  const active = useReactiveProp('active', 'inbox')
3
9
 
@@ -9,16 +15,22 @@ function linkClass(name: string): string {
9
15
  </script>
10
16
 
11
17
  <nav aria-label="Mail sections" class="flex overflow-x-auto gap-0.5 sm:gap-1 p-1 max-w-full bg-gray-100 dark:bg-neutral-900 rounded-lg">
18
+ @if(dashboardLinkAvailable('/inbox'))
12
19
  <StxLink to="/inbox" :class="'px-2 sm:px-3 py-1.5 font-medium text-sm rounded-md transition-colors ' + linkClass('inbox')">
13
20
  Inbox
14
21
  </StxLink>
22
+ @endif
23
+ @if(dashboardLinkAvailable('/inbox/activity'))
15
24
  <StxLink to="/inbox/activity" :class="'px-2 sm:px-3 py-1.5 font-medium text-sm rounded-md transition-colors ' + linkClass('activity')">
16
25
  Activity
17
26
  </StxLink>
27
+ @endif
18
28
  <StxLink to="/inbox/captured" :class="'px-2 sm:px-3 py-1.5 font-medium text-sm rounded-md transition-colors ' + linkClass('captured')">
19
29
  Captured
20
30
  </StxLink>
31
+ @if(dashboardLinkAvailable('/inbox/settings'))
21
32
  <StxLink to="/inbox/settings" :class="'px-2 sm:px-3 py-1.5 font-medium text-sm rounded-md transition-colors ' + linkClass('settings')">
22
33
  Settings
23
34
  </StxLink>
35
+ @endif
24
36
  </nav>
@@ -1,31 +1,21 @@
1
1
  <script server>
2
+ import { dashboardPageVisibility } from '@stacksjs/defaults/resources/functions/dashboard/page-availability'
2
3
  import { buildDashboardSectionHubs } from '@stacksjs/defaults/resources/functions/dashboard/section-navigation'
3
4
  import { buildWebSidebarSections } from '@stacksjs/defaults/resources/functions/dashboard/sidebar'
4
5
 
5
6
  export const homeSectionCards = buildDashboardSectionHubs(buildWebSidebarSections())
6
7
  .map(({ id, href, label, icon, description, section, roleOptions }) => ({ id, href, label, icon, description, section, roleOptions }))
7
- </script>
8
-
9
- <script client>
10
- import { useDashboard } from '../../../../functions/dashboard'
8
+ const isDashboardPageAvailable = dashboardPageVisibility()
9
+ export const showRequestHistory = isDashboardPageAvailable('/requests')
10
+ export const showActivityLink = isDashboardPageAvailable('/data/activity')
11
11
 
12
- const dashboard = useDashboard()
13
- const loadingCards = [1, 2, 3, 4]
14
-
15
- /**
16
- * `section` names the feature-backed dashboard section a card belongs to.
17
- * A card with one is only offered when the server says that section exists -
18
- * otherwise the home page links to pages the sidebar has hidden and that
19
- * cannot load. See stacksjs/stacks#2928.
20
- */
21
- const allQuickLinks = [
12
+ export const homeQuickLinks = [
22
13
  {
23
14
  title: 'Blog',
24
15
  description: 'Manage posts and pages',
25
16
  href: '/content/dashboard',
26
17
  icon: 'i-hugeicons-book-open-01',
27
18
  tone: 'blue',
28
- section: 'content',
29
19
  },
30
20
  {
31
21
  title: 'Commerce',
@@ -33,7 +23,6 @@ const allQuickLinks = [
33
23
  href: '/commerce/dashboard',
34
24
  icon: 'i-hugeicons-store-01',
35
25
  tone: 'green',
36
- section: 'commerce',
37
26
  },
38
27
  {
39
28
  title: 'Cloud',
@@ -49,22 +38,14 @@ const allQuickLinks = [
49
38
  icon: 'i-hugeicons-settings-02',
50
39
  tone: 'neutral',
51
40
  },
52
- ]
41
+ ].filter(link => isDashboardPageAvailable(link.href))
42
+ </script>
53
43
 
54
- /**
55
- * Cards without a `section` are always offered. A card with one waits for the
56
- * server to say that section exists, so the home page never links to a
57
- * section the sidebar has hidden and whose pages cannot load.
58
- *
59
- * Waits, as in `=== true`: until the answer arrives nothing is known, and
60
- * "not false" showed the Blog and Commerce cards for a moment on every load -
61
- * long enough for their links to be prefetched and answer 404 in an app with
62
- * both features off.
63
- */
64
- function quickLinks() {
65
- const available = dashboard.sections.value
66
- return allQuickLinks.filter(link => !link.section || available[link.section] === true)
67
- }
44
+ <script client>
45
+ import { useDashboard } from '../../../../functions/dashboard'
46
+
47
+ const dashboard = useDashboard()
48
+ const loadingCards = [1, 2, 3, 4]
68
49
 
69
50
  /** Orders are part of the feed only with commerce on, so they are named only then. */
70
51
  function activityDescription(): string {
@@ -194,10 +175,12 @@ onMount(() => {
194
175
  </Button>
195
176
  </div>
196
177
 
178
+ @if(homeSectionCards.length > 0)
197
179
  <section data-dashboard-section-overview aria-labelledby="dashboard-sections" class="mb-6">
198
180
  <h2 id="dashboard-sections" data-dashboard-ink class="mb-3 font-semibold text-base text-neutral-900 dark:text-white">Sections</h2>
199
181
  <DashboardNavigationCards :navigationCards="homeSectionCards" />
200
182
  </section>
183
+ @endif
201
184
 
202
185
  <details :if="issues().length > 0" class="mb-4 px-4 py-3 text-amber-800 text-sm dark:text-amber-200 overview-panel">
203
186
  <summary class="font-medium cursor-pointer">Some dashboard data is unavailable</summary>
@@ -209,7 +192,9 @@ onMount(() => {
209
192
  <section data-dashboard-metrics aria-labelledby="application-overview" class="mb-5 p-3 sm:p-4 overview-panel">
210
193
  <div class="flex flex-wrap gap-2 items-center justify-between mb-3">
211
194
  <h2 data-dashboard-ink id="application-overview" class="font-semibold text-base text-neutral-900 dark:text-white">Overview</h2>
195
+ @if(showRequestHistory)
212
196
  <StxLink data-dashboard-muted to="/requests" class="text-neutral-500 text-sm hover:text-neutral-700 dark:hover:text-neutral-300">Request history</StxLink>
197
+ @endif
213
198
  </div>
214
199
  <div class="overview-metrics">
215
200
  <StatsCard :for="item in loadingCards" :if="dashboard.isLoading.value && stats().length === 0" loading />
@@ -237,11 +222,15 @@ onMount(() => {
237
222
  <ServiceHealth :services="services()" :loading="dashboard.isLoading.value" />
238
223
  <ActivityTable :activities="activities()" :description="activityDescription()" :loading="dashboard.isLoading.value">
239
224
  <template #actions>
225
+ @if(showActivityLink)
240
226
  <StxLink data-dashboard-muted to="/data/activity" class="text-neutral-500 text-sm hover:text-neutral-700 dark:hover:text-neutral-300">View all</StxLink>
227
+ @endif
241
228
  </template>
242
229
  </ActivityTable>
243
230
  </div>
244
231
 
245
- <div class="mt-5"><QuickLinks :links="quickLinks()" /></div>
232
+ @if(homeQuickLinks.length > 0)
233
+ <div class="mt-5"><QuickLinks :links="homeQuickLinks" /></div>
234
+ @endif
246
235
  <div class="mt-5"><QuickLinks title="Resources" :links="resourceLinks" /></div>
247
236
  </div>
@@ -1,3 +1,9 @@
1
+ <script server>
2
+ import { dashboardPageVisibility } from '@stacksjs/defaults/resources/functions/dashboard/page-availability'
3
+
4
+ export const dashboardLinkAvailable = dashboardPageVisibility()
5
+ </script>
6
+
1
7
  <script client>
2
8
  import { dashboardApi } from '../../../../functions/dashboard-api'
3
9
 
@@ -398,7 +404,9 @@ onMount(() => {
398
404
  <h2 class="font-semibold text-neutral-900 dark:text-white">Slowest request observations</h2>
399
405
  <p class="mt-1 text-neutral-500 text-xs dark:text-neutral-400">The five longest durations retained by the Request model.</p>
400
406
  </div>
407
+ @if(dashboardLinkAvailable('/requests'))
401
408
  <a href="/requests" class="font-medium text-blue-600 text-xs dark:text-blue-400 hover:underline">All requests</a>
409
+ @endif
402
410
  </div>
403
411
  <div :if="insights().requests.slowest.length === 0" class="px-5 py-12 text-center">
404
412
  <span class="block mx-auto h-8 w-8 text-neutral-400 i-hugeicons-mouse-left-click-02"></span>
@@ -422,7 +430,9 @@ onMount(() => {
422
430
  <h2 class="font-semibold text-neutral-900 dark:text-white">Slow query observations</h2>
423
431
  <p class="mt-1 text-neutral-500 text-xs dark:text-neutral-400">Queries at or above the configured {{ formatDuration(insights().queries.slowThresholdMs) }} threshold.</p>
424
432
  </div>
433
+ @if(dashboardLinkAvailable('/queries'))
425
434
  <a href="/queries" class="font-medium text-blue-600 text-xs dark:text-blue-400 hover:underline">All queries</a>
435
+ @endif
426
436
  </div>
427
437
  <div :if="insights().queries.slowest.length === 0" class="px-5 py-12 text-center">
428
438
  <span class="block mx-auto h-8 w-8 text-neutral-400 i-hugeicons-database-02"></span>
@@ -1,6 +1,9 @@
1
1
  @import('./UI/Button')
2
2
 
3
3
  <script server>
4
+ import { dashboardPageVisibility } from '@stacksjs/defaults/resources/functions/dashboard/page-availability'
5
+
6
+ export const dashboardLinkAvailable = dashboardPageVisibility()
4
7
  interface NavbarProps {
5
8
  showDropdown?: boolean
6
9
  isSidebarCollapsed?: boolean
@@ -69,30 +72,40 @@ useClickOutside(userMenu, () => setDropdownOpen(false))
69
72
  </StxLink>
70
73
 
71
74
  <nav class="flex gap-x-4 items-center lg:gap-x-6" aria-label="Dashboard utilities">
75
+ @if(dashboardLinkAvailable('/errors'))
72
76
  <a href="/errors" data-stx-link class="header-icon-button header-link {{ isActiveRoute('/errors') ? 'active-header-link' : '' }}" x-tooltip="View errors" title="View errors">
73
77
  <span class="sr-only">View errors</span>
74
78
  <span aria-hidden="true" class="h-6 w-6 duration-150 ease-in-out transition i-hugeicons-alert-01"></span>
75
79
  </a>
80
+ @endif
76
81
 
82
+ @if(dashboardLinkAvailable('/health'))
77
83
  <a href="/health" data-stx-link class="header-icon-button header-link {{ isActiveRoute('/health') ? 'active-header-link' : '' }}" x-tooltip="View health" title="View health">
78
84
  <span class="sr-only">View health</span>
79
85
  <span aria-hidden="true" class="h-6 w-6 duration-150 ease-in-out transition i-hugeicons-health"></span>
80
86
  </a>
87
+ @endif
81
88
 
89
+ @if(dashboardLinkAvailable('/insights'))
82
90
  <a href="/insights" data-stx-link class="header-icon-button header-link {{ isActiveRoute('/insights') ? 'active-header-link' : '' }}" x-tooltip="View cloud insights" title="View cloud insights">
83
91
  <span class="sr-only">View cloud insights</span>
84
92
  <span aria-hidden="true" class="h-6 w-6 duration-150 ease-in-out transition i-hugeicons-pulse-01"></span>
85
93
  </a>
94
+ @endif
86
95
 
96
+ @if(dashboardLinkAvailable('/inbox'))
87
97
  <a href="/inbox" data-stx-link class="header-icon-button header-link {{ isActiveRoute('/inbox') ? 'active-header-link' : '' }}" x-tooltip="View inbox" title="View inbox">
88
98
  <span class="sr-only">View inbox</span>
89
99
  <span aria-hidden="true" class="h-6 w-6 duration-150 ease-in-out transition i-hugeicons-mail-02"></span>
90
100
  </a>
101
+ @endif
91
102
 
103
+ @if(dashboardLinkAvailable('/notifications/dashboard'))
92
104
  <a href="/notifications/dashboard" data-stx-link class="header-icon-button header-link {{ isActiveRoute('/notifications/dashboard') ? 'active-header-link' : '' }}" x-tooltip="View notifications" title="View notifications">
93
105
  <span class="sr-only">View notifications</span>
94
106
  <span aria-hidden="true" class="h-6 w-6 i-hugeicons-notification-02"></span>
95
107
  </a>
108
+ @endif
96
109
 
97
110
  <span class="h-6 w-px bg-gray-200 dark:bg-neutral-700" aria-hidden="true"></span>
98
111
 
@@ -116,8 +129,12 @@ useClickOutside(userMenu, () => setDropdownOpen(false))
116
129
  aria-labelledby="user-menu-button"
117
130
  >
118
131
  <a href="/settings" data-stx-link class="block px-4 py-2 text-gray-700 text-sm dark:text-neutral-200 hover:bg-gray-100 dark:hover:bg-neutral-700" role="menuitem" @click="setDropdownOpen(false)">Account settings</a>
132
+ @if(dashboardLinkAvailable('/library/components'))
119
133
  <a href="/library/components" data-stx-link class="block px-4 py-2 text-gray-700 text-sm dark:text-neutral-200 hover:bg-gray-100 dark:hover:bg-neutral-700" role="menuitem" @click="setDropdownOpen(false)">Components</a>
134
+ @endif
135
+ @if(dashboardLinkAvailable('/settings/billing'))
120
136
  <a href="/settings/billing" data-stx-link class="block px-4 py-2 text-gray-700 text-sm dark:text-neutral-200 hover:bg-gray-100 dark:hover:bg-neutral-700" role="menuitem" @click="setDropdownOpen(false)">Billing</a>
137
+ @endif
121
138
  <div class="px-2 py-1">
122
139
  <Button type="button" variant="danger" size="sm" fullWidth :loading="signingOut()" @click="signOut()">Sign out</Button>
123
140
  </div>
@@ -1,3 +1,9 @@
1
+ <script server>
2
+ import { dashboardPageVisibility } from '@stacksjs/defaults/resources/functions/dashboard/page-availability'
3
+
4
+ export const dashboardLinkAvailable = dashboardPageVisibility()
5
+ </script>
6
+
1
7
  <template>
2
8
  <div class="flex items-center justify-center pb-12 pt-6 px-6 min-h-[80vh]">
3
9
  <div class="mx-auto space-y-6 max-w-7xl w-full">
@@ -37,6 +43,7 @@
37
43
  </div>
38
44
  </div>
39
45
  </StxLink>
46
+ @if(dashboardLinkAvailable('/models'))
40
47
  <StxLink to="/models" class="overflow-hidden bg-white dark:bg-neutral-800 rounded-lg shadow hover:shadow-md duration-200 transition-shadow">
41
48
  <div class="p-5">
42
49
  <div class="flex items-center">
@@ -54,6 +61,7 @@
54
61
  </div>
55
62
  </div>
56
63
  </StxLink>
64
+ @endif
57
65
  <StxLink to="/settings" class="overflow-hidden bg-white dark:bg-neutral-800 rounded-lg shadow hover:shadow-md duration-200 transition-shadow">
58
66
  <div class="p-5">
59
67
  <div class="flex items-center">
@@ -1,13 +1,16 @@
1
1
  <script server>
2
+ import { dashboardPageVisibility } from '@stacksjs/defaults/resources/functions/dashboard/page-availability'
3
+
2
4
  const { pane } = defineProps<{ pane: 'general' | 'appearance' | 'mail' | 'billing' | 'software-update' }>()
3
5
 
4
- export const panes = [
6
+ const isDashboardPageAvailable = dashboardPageVisibility()
7
+ export const panes = ([
5
8
  { id: 'general', label: 'General', href: '/settings', icon: 'i-f7-gear-alt-fill', tone: 'grey', description: 'Manage this project’s configuration and environment bindings.', keywords: 'config project environment' },
6
9
  { id: 'appearance', label: 'Appearance', href: '/settings/appearance', icon: 'i-f7-circle-lefthalf-fill', tone: 'purple', description: 'Choose how the dashboard looks and which sections are shown in the sidebar.', keywords: 'theme color mode dark light sidebar display' },
7
10
  { id: 'software-update', label: 'Software Update', href: '/settings/software-update', icon: 'i-f7-arrow-down-circle-fill', tone: 'blue', description: 'Check for Stacks releases and update your projects through Buddy.', keywords: 'upgrade framework version install dependencies' },
8
11
  { id: 'mail', label: 'Mail', href: '/settings/mail', icon: 'i-f7-envelope-fill', tone: 'blue', description: 'Set the sender, delivery driver, and credentials for outgoing mail.', keywords: 'email smtp sender transport' },
9
12
  { id: 'billing', label: 'Billing', href: '/settings/billing', icon: 'i-f7-creditcard-fill', tone: 'green', description: 'View your subscription, payment methods, and transactions.', keywords: 'subscription payment transaction invoice' },
10
- ] as const
13
+ ] as const).filter(item => isDashboardPageAvailable(item.href))
11
14
  export const activePane = panes.find(item => item.id === pane) ?? panes[0]
12
15
  defineClientPayload({ panes, activePane })
13
16
  </script>
@@ -0,0 +1,149 @@
1
+ import type { DashboardProviderOptions } from '@stacksjs/types'
2
+ import type { ResolvedDashboardToggles } from './toggles'
3
+ import { existsSync } from 'node:fs'
4
+ import { createRequire } from 'node:module'
5
+ import { join } from 'node:path'
6
+ import { resolveDashboardToggles } from './toggles'
7
+
8
+ interface DashboardPageAvailability {
9
+ sections?: ResolvedDashboardToggles
10
+ schemaModels?: readonly string[]
11
+ inbox?: boolean
12
+ remote?: boolean
13
+ providers?: DashboardProviderOptions
14
+ }
15
+
16
+ interface DashboardPageExclusion {
17
+ path: string
18
+ exact?: boolean
19
+ }
20
+
21
+ const modelRequirements = {
22
+ '/data/activity': ['Activity'],
23
+ '/data/teams': ['Team'],
24
+ '/data/subscribers': ['Subscriber'],
25
+ '/teams': ['Team'],
26
+ '/releases': ['Release'],
27
+ '/deployments': ['Deployment'],
28
+ '/requests': ['Request'],
29
+ '/queries': ['QueryLog'],
30
+ '/analytics/events': ['AnalyticsEvent'],
31
+ '/analytics/marketing': ['Campaign'],
32
+ '/notifications': ['Notification'],
33
+ '/settings/billing': ['PaymentTransaction'],
34
+ '/management/permissions': ['Role', 'Permission'],
35
+ '/kanban': ['Board', 'Card', 'Column'],
36
+ '/inbox/settings': ['MailPreference'],
37
+ }
38
+
39
+ const webAnalyticsPages = ['web', 'pages', 'referrers', 'countries', 'devices', 'browsers', 'blog', 'commerce/web']
40
+
41
+ const sectionPages = {
42
+ library: ['/library', '/functions', '/packages', '/releases', '/dependencies'],
43
+ content: ['/content'],
44
+ commerce: ['/commerce', '/analytics/commerce', '/marketing/abandoned-carts', '/marketing/reviews'],
45
+ marketing: ['/marketing'],
46
+ analytics: ['/analytics'],
47
+ management: ['/management', '/cloud', '/servers', '/remote', '/serverless', '/dns', '/mailboxes', '/logs', '/health', '/insights', '/kanban'],
48
+ // Settings is also opened by the native application menu and the browser account menu.
49
+ utilities: ['/buddy', '/environment', '/access-tokens'],
50
+ ci: ['/ci'],
51
+ } as const satisfies Partial<Record<keyof ResolvedDashboardToggles, readonly string[]>>
52
+
53
+ const dataPages = {
54
+ dashboard: '/data/dashboard',
55
+ activity: '/data/activity',
56
+ users: '/data/users',
57
+ teams: '/data/teams',
58
+ subscribers: '/data/subscribers',
59
+ allModels: '/models',
60
+ } as const satisfies Record<keyof ResolvedDashboardToggles['data'], string>
61
+
62
+ export function unavailableDashboardPages({ sections, schemaModels, inbox, remote, providers }: DashboardPageAvailability): DashboardPageExclusion[] {
63
+ const unavailable = new Map<string, DashboardPageExclusion>()
64
+ function exclude(path: string, exact = false): void {
65
+ if (!exact || !unavailable.has(path))
66
+ unavailable.set(path, { path, exact })
67
+ }
68
+
69
+ if (sections) {
70
+ for (const [section, paths] of Object.entries(sectionPages)) {
71
+ if (!sections[section as keyof typeof sectionPages]) {
72
+ for (const path of paths)
73
+ exclude(path)
74
+ }
75
+ }
76
+ for (const [row, path] of Object.entries(dataPages)) {
77
+ if (!sections.data[row as keyof typeof dataPages])
78
+ exclude(path, row === 'allModels')
79
+ }
80
+ }
81
+
82
+ if (schemaModels) {
83
+ const models = new Set(schemaModels)
84
+ for (const [path, required] of Object.entries(modelRequirements)) {
85
+ if (!required.every(model => models.has(model)))
86
+ exclude(path)
87
+ }
88
+ if (!models.has('Error') && providers?.errors?.driver !== 'hq')
89
+ exclude('/errors')
90
+ if (!models.has('Log') && providers?.logs?.driver !== 'hq')
91
+ exclude('/logs')
92
+
93
+ if (!models.has('Request') && providers?.analytics?.driver !== 'hq') {
94
+ exclude('/analytics', true)
95
+ for (const page of webAnalyticsPages)
96
+ exclude(`/analytics/${page}`)
97
+ }
98
+ }
99
+
100
+ if (inbox === false) {
101
+ exclude('/inbox', true)
102
+ exclude('/inbox/activity')
103
+ }
104
+
105
+ if (remote === false)
106
+ exclude('/remote')
107
+
108
+ return [...unavailable.values()]
109
+ }
110
+
111
+ export function dashboardPageAvailable(path: string, unavailable: readonly DashboardPageExclusion[]): boolean {
112
+ const pathname = path.split(/[?#]/, 1)[0]?.replace(/\/+$/, '') || '/'
113
+ return !unavailable.some(page => pathname === page.path || (!page.exact && pathname.startsWith(`${page.path}/`)))
114
+ }
115
+
116
+ /** Exclude only framework files, preserving app-owned pages at the same URLs. */
117
+ export function dashboardViewExclusions(root: string, availability: DashboardPageAvailability): string[] {
118
+ return unavailableDashboardPages(availability).flatMap(({ path, exact }) => {
119
+ const view = join(root, path.slice(1))
120
+ return [`${view}.stx`, exact ? join(view, 'index.stx') : view]
121
+ })
122
+ }
123
+
124
+ /** Both dashboard hosts and the STX server scripts read the settled app configuration. */
125
+ export function readDashboardPageAvailability(): Required<DashboardPageAvailability> {
126
+ const require = createRequire(import.meta.url)
127
+ const { config, feature } = require('@stacksjs/config') as typeof import('@stacksjs/config')
128
+ const { listModelSources } = require('@stacksjs/database/model-sources') as typeof import('@stacksjs/database/model-sources')
129
+ const { projectPath } = require('@stacksjs/path') as typeof import('@stacksjs/path')
130
+ const remoteConfig = projectPath('config/remote.ts')
131
+ const remote = existsSync(remoteConfig) && Boolean(require(remoteConfig).hosts?.length)
132
+ const mailServer = config.email?.server
133
+ const sections = resolveDashboardToggles(config.dashboard, feature)
134
+ const schemaModels = (listModelSources() ?? []).map(model => model.name)
135
+ return {
136
+ sections: { ...sections, ci: sections.management && sections.ci },
137
+ schemaModels,
138
+ // The live inbox reads the serverless mail store. Captured Mail and the
139
+ // database-backed Mail Settings page are available independently.
140
+ inbox: Boolean(mailServer?.enabled && mailServer.mode === 'serverless'),
141
+ remote,
142
+ providers: config.dashboard?.providers ?? {},
143
+ }
144
+ }
145
+
146
+ export function dashboardPageVisibility(): (path: string) => boolean {
147
+ const unavailable = unavailableDashboardPages(readDashboardPageAvailability())
148
+ return path => dashboardPageAvailable(path, unavailable)
149
+ }
@@ -5,10 +5,13 @@
5
5
  * native STX Sidebar component. Markup, icons, disclosure state, and
6
6
  * persistence stay inside the component instead of being serialized as HTML.
7
7
  */
8
+ import type { DashboardProviderOptions } from '@stacksjs/types'
9
+ import type { ResolvedDashboardToggles } from './toggles'
8
10
  import { capitalCase, plural } from '@stacksjs/strings'
9
11
  import { existsSync, readFileSync } from 'node:fs'
10
12
  import { createRequire } from 'node:module'
11
13
  import { resolve } from 'node:path'
14
+ import { dashboardPageAvailable, readDashboardPageAvailability, unavailableDashboardPages } from './page-availability'
12
15
 
13
16
  type ModelCategory = 'userland' | 'data' | 'commerce' | 'content' | 'marketing' | 'system'
14
17
 
@@ -202,22 +205,21 @@ function normalizeSchemaModels(value: unknown): string[] {
202
205
  return value as string[]
203
206
  }
204
207
 
205
- /** Hide built-in modules whose backing models are outside this app's schema. */
206
- export function filterSchemaNavSections(sections: Array<[string, string, NavItem[]]>, schemaModels?: readonly string[], capabilities: { inbox?: boolean } = {}): Array<[string, string, NavItem[]]> {
207
- if (!schemaModels && capabilities.inbox !== false) return sections
208
- const available = schemaModels ? new Set(schemaModels) : undefined
209
- const required: Record<string, string[]> = {
210
- '/activity': ['Activity'], '/teams': ['Team'], '/subscribers': ['Subscriber'],
211
- '/releases': ['Release'], '/deployments': ['Deployment'], '/requests': ['Request'],
212
- '/queries': ['QueryLog'], '/queries/slow': ['QueryLog'], '/queries/history': ['QueryLog'],
213
- '/errors': ['Error'], '/notifications/dashboard': ['Notification'], '/logs': ['Log'],
214
- '/management/permissions': ['Role', 'Permission'], '/kanban': ['Board', 'Card', 'Column'],
215
- '/data/activity': ['Activity'], '/data/teams': ['Team'], '/data/subscribers': ['Subscriber'],
216
- '/inbox/settings': ['MailPreference'],
217
- }
218
- return sections.map(([id, label, items]): [string, string, NavItem[]] => [id, label, id.startsWith('app-nav-') ? items : items.filter(item =>
219
- (!(capabilities.inbox === false && ['/inbox', '/inbox/activity'].includes(item.to))
220
- && (required[item.to] ?? []).every(model => !available || available.has(model))))])
208
+ /** Hide built-in navigation to pages the dashboard server does not serve. */
209
+ export function filterSchemaNavSections(
210
+ sections: Array<[string, string, NavItem[]]>,
211
+ schemaModels?: readonly string[],
212
+ capabilities: { inbox?: boolean, remote?: boolean, providers?: DashboardProviderOptions } = {},
213
+ toggles?: ResolvedDashboardToggles,
214
+ ): Array<[string, string, NavItem[]]> {
215
+ const unavailable = unavailableDashboardPages({ sections: toggles, schemaModels, ...capabilities })
216
+ if (!unavailable.length)
217
+ return sections
218
+
219
+ return sections
220
+ .map(([id, label, items]): [string, string, NavItem[]] => [
221
+ id, label, id.startsWith('app-nav-') ? items : items.filter(item => dashboardPageAvailable(item.to, unavailable)),
222
+ ])
221
223
  .filter(([, , items]) => items.length > 0)
222
224
  }
223
225
 
@@ -752,12 +754,8 @@ function loadAppNavFromConfig(configPath = resolve(process.cwd(), 'config/dashbo
752
754
  export function buildWebSidebarSections(): WebSidebarSection[] {
753
755
  const manifest = loadDiscoveredManifest()
754
756
  const appNav = manifest.nav.length > 0 ? manifest.nav : loadAppNavFromConfig()
755
- const { config } = createRequire(import.meta.url)('@stacksjs/config')
756
- // The current inbox SDK reads S3 objects. The native IMAP/SMTP server does
757
- // not write that bucket; linking its mailboxes to this UI only produces 503s.
758
- const mailServer = config.email?.server
759
- const inbox = !(mailServer?.enabled && (mailServer.mode ?? 'server') === 'server')
760
- const sections = filterSchemaNavSections(buildNavSections(manifest.models, manifest.sections, appNav), manifest.schemaModels, { inbox })
757
+ const { sections: toggles, schemaModels, ...capabilities } = readDashboardPageAvailability()
758
+ const sections = filterSchemaNavSections(buildNavSections(manifest.models, toggles, appNav), schemaModels, capabilities, toggles)
761
759
 
762
760
  const webItem = (item: NavItem): WebSidebarItem => ({
763
761
  id: item.id ?? navItemId(item.to),
@@ -71,7 +71,7 @@ const FEATURE_BACKED_SECTIONS = {
71
71
  *
72
72
  * Omitted, every section defaults on exactly as it did before.
73
73
  */
74
- export type FeatureResolver = (name: string) => boolean
74
+ export type FeatureResolver = (name: typeof FEATURE_BACKED_SECTIONS[keyof typeof FEATURE_BACKED_SECTIONS]) => boolean
75
75
 
76
76
  function sectionFallback(section: keyof typeof FEATURE_BACKED_SECTIONS, isFeatureEnabled?: FeatureResolver): boolean {
77
77
  if (!isFeatureEnabled)
@@ -111,11 +111,10 @@ export function resolveDashboardToggles(value: unknown, isFeatureEnabled?: Featu
111
111
 
112
112
  return {
113
113
  library: sectionEnabled(sections.library, 'library', true),
114
- // An explicit `enabled` in config/dashboard.ts still wins, both ways: an
115
- // app can show a section whose feature is off, or hide one that is on.
116
- content: sectionEnabled(sections.content, 'content', sectionFallback('content', isFeatureEnabled)),
117
- commerce: sectionEnabled(sections.commerce, 'commerce', sectionFallback('commerce', isFeatureEnabled)),
118
- marketing: sectionEnabled(sections.marketing, 'marketing', sectionFallback('marketing', isFeatureEnabled)),
114
+ // A section can opt out of an installed feature. Its pages need the feature's routes and models.
115
+ content: sectionEnabled(sections.content, 'content', true) && sectionFallback('content', isFeatureEnabled),
116
+ commerce: sectionEnabled(sections.commerce, 'commerce', true) && sectionFallback('commerce', isFeatureEnabled),
117
+ marketing: sectionEnabled(sections.marketing, 'marketing', true) && sectionFallback('marketing', isFeatureEnabled),
119
118
  analytics: sectionEnabled(sections.analytics, 'analytics', true),
120
119
  management: sectionEnabled(sections.management, 'management', true),
121
120
  utilities: sectionEnabled(sections.utilities, 'utilities', true),
@@ -16,7 +16,8 @@
16
16
  * unauthenticated.
17
17
  */
18
18
 
19
- import { feature } from '@stacksjs/config'
19
+ import { config, feature } from '@stacksjs/config'
20
+ import { listModelSources } from '@stacksjs/database/model-sources'
20
21
  import { isLocalDeployment } from '@stacksjs/env'
21
22
  import { route } from '@stacksjs/router'
22
23
 
@@ -552,15 +553,20 @@ route.group({ prefix: '/api/dashboard', apiResponse: true }, () => {
552
553
  // Error monitoring - the same native Error model aggregation exposed by
553
554
  // the token-authenticated `/api/monitoring` routes, projected through the
554
555
  // dashboard guard so the local dashboard session can read and manage it.
555
- guard(route.get('/monitoring/errors', 'Actions/Monitoring/ErrorIndexAction'))
556
- guard(route.get('/monitoring/errors/stats', 'Actions/Monitoring/ErrorStatsAction'))
557
- guard(route.get('/monitoring/errors/timeline', 'Actions/Monitoring/ErrorTimelineAction'))
558
- guard(route.get('/monitoring/errors/group', 'Actions/Monitoring/ErrorGroupAction'))
559
- guard(route.get('/monitoring/errors/{id}', 'Actions/Monitoring/ErrorShowAction'))
560
- guard(route.patch('/monitoring/errors/resolve', 'Actions/Monitoring/ErrorResolveAction'))
561
- guard(route.patch('/monitoring/errors/ignore', 'Actions/Monitoring/ErrorIgnoreAction'))
562
- guard(route.patch('/monitoring/errors/unresolve', 'Actions/Monitoring/ErrorUnresolveAction'))
563
- guard(route.delete('/monitoring/errors', 'Actions/Monitoring/ErrorDestroyAction'))
556
+ const hasErrorModel = listModelSources()?.some(model => model.name === 'Error')
557
+ if (hasErrorModel || config.dashboard?.providers?.errors?.driver === 'hq') {
558
+ guard(route.get('/monitoring/errors', 'Actions/Monitoring/ErrorIndexAction'))
559
+ guard(route.get('/monitoring/errors/stats', 'Actions/Monitoring/ErrorStatsAction'))
560
+ guard(route.get('/monitoring/errors/timeline', 'Actions/Monitoring/ErrorTimelineAction'))
561
+ guard(route.get('/monitoring/errors/group', 'Actions/Monitoring/ErrorGroupAction'))
562
+ guard(route.get('/monitoring/errors/{id}', 'Actions/Monitoring/ErrorShowAction'))
563
+ }
564
+ if (hasErrorModel) {
565
+ guard(route.patch('/monitoring/errors/resolve', 'Actions/Monitoring/ErrorResolveAction'))
566
+ guard(route.patch('/monitoring/errors/ignore', 'Actions/Monitoring/ErrorIgnoreAction'))
567
+ guard(route.patch('/monitoring/errors/unresolve', 'Actions/Monitoring/ErrorUnresolveAction'))
568
+ guard(route.delete('/monitoring/errors', 'Actions/Monitoring/ErrorDestroyAction'))
569
+ }
564
570
 
565
571
  guard(route.get('/queries', 'Actions/Dashboard/Queries/QueryDashboardAction'))
566
572
  guard(route.get('/queries/{id}', 'Actions/Dashboard/Queries/QueryShowAction'))