@stacksjs/defaults 0.75.712 → 0.75.717
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/ai/skills/stacks-dashboard/SKILL.md +20 -6
- package/ai/skills/stacks-dns/SKILL.md +17 -2
- package/ai/skills/stacks-native/CATALOG.md +7 -7
- package/app/Actions/Dashboard/Infrastructure/dns-overview.ts +2 -2
- package/app/Actions/Dashboard/Infrastructure/environment-file.ts +1 -12
- package/functions/dashboard-api.ts +5 -0
- package/ide/vscode/package.json +1 -1
- package/package.json +6 -5
- package/resources/components/Dashboard/Buddy/BuddyAssistant.stx +1 -1
- package/resources/components/Dashboard/DashboardSectionSidebar.stx +12 -3
- package/resources/components/Dashboard/Environment/EnvironmentDashboard.stx +88 -68
- package/resources/components/Dashboard/Infrastructure/DnsDashboard.stx +1 -0
- package/resources/components/Dashboard/Projects/GitHubIssuesDashboard.stx +165 -0
- package/resources/components/Dashboard/Settings/DashboardSettingsIntro.stx +10 -0
- package/resources/components/Dashboard/Settings/DashboardSettingsSearch.stx +32 -0
- package/resources/components/Dashboard/Settings/DnsRecordsSettings.stx +181 -0
- package/resources/components/Dashboard/Settings/MailSettingsDashboard.stx +7 -5
- package/resources/components/Dashboard/Settings/SettingsCodeEditor.stx +27 -0
- package/resources/components/Dashboard/Settings/SettingsDashboard.stx +187 -270
- package/resources/components/Dashboard/Settings/SettingsPicker.stx +87 -0
- package/resources/functions/dashboard/environment-value.ts +11 -0
- package/resources/functions/dashboard/page-availability.ts +1 -1
- package/resources/functions/dashboard/project-config-sections.ts +105 -0
- package/resources/functions/dashboard/section-landing.ts +1 -1
- package/resources/functions/dashboard/settings-panes.ts +26 -0
- package/resources/functions/dashboard/sidebar.ts +7 -7
- package/styles/dashboard-theme.css +281 -25
- package/views/dashboard/composables/dashboard-theme-bootstrap.ts +7 -0
- package/views/dashboard/composables/settings-dialog.ts +22 -0
- package/views/dashboard/composables/settings-window.ts +10 -4
- package/views/dashboard/composables/useProjectConfigEditor.ts +244 -0
- package/views/dashboard/composables/useSettingsWindow.ts +23 -1
- package/views/dashboard/github-issues.stx +18 -0
- package/views/dashboard/layouts/default.stx +1 -1
- package/views/dashboard/layouts/settings.stx +147 -10
- package/views/dashboard/settings/appearance.stx +2 -3
- package/views/dashboard/settings/billing.stx +2 -3
- package/views/dashboard/settings/config/[section].stx +22 -0
- package/views/dashboard/{environment/index.stx → settings/environment.stx} +1 -1
- package/views/dashboard/settings/index.stx +1 -3
- package/views/dashboard/settings/mail.stx +2 -3
- package/views/dashboard/settings/software-update.stx +2 -3
- package/resources/components/Dashboard/CodeEditor.stx +0 -73
- package/resources/components/Dashboard/Settings/DashboardSettingsFrame.stx +0 -101
- package/resources/functions/dashboard/config-io.ts +0 -401
|
@@ -1,319 +1,236 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
interface ConfigFile {
|
|
5
|
-
name: string
|
|
6
|
-
title: string
|
|
7
|
-
size: number
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface ConfigField {
|
|
11
|
-
key: string
|
|
12
|
-
value: string | number | boolean | null | unknown[] | Record<string, unknown>
|
|
13
|
-
type: string
|
|
14
|
-
editable: boolean
|
|
15
|
-
reason?: string
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface ConfigListResponse {
|
|
19
|
-
ok: boolean
|
|
20
|
-
files: ConfigFile[]
|
|
21
|
-
error?: string
|
|
22
|
-
}
|
|
1
|
+
<script server>
|
|
2
|
+
import type { ProjectConfigSection } from '@stacksjs/defaults/resources/functions/dashboard/project-config-sections'
|
|
23
3
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
4
|
+
const { section } = defineProps<{ section?: ProjectConfigSection }>()
|
|
5
|
+
export const configSectionId = section ?? 'general'
|
|
6
|
+
defineClientPayload({ configSectionId })
|
|
7
|
+
</script>
|
|
29
8
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
9
|
+
<script client>
|
|
10
|
+
import type { ConfigField, EditorMode } from '@stacksjs/defaults/views/dashboard/composables/useProjectConfigEditor'
|
|
11
|
+
import { configLabel, projectConfigSection } from '@stacksjs/defaults/resources/functions/dashboard/project-config-sections'
|
|
12
|
+
import { confirmSettingsDiscard } from '@stacksjs/defaults/views/dashboard/composables/settings-dialog'
|
|
13
|
+
import { projectConfigEditor, rememberProjectConfigFile, requestedProjectConfigFile } from '@stacksjs/defaults/views/dashboard/composables/useProjectConfigEditor'
|
|
14
|
+
|
|
15
|
+
const configSection = projectConfigSection({{ configSectionId }})
|
|
16
|
+
const { files, current, drafts, sourceDraft, selected, mode, setMode, loading, saving, message, error, isDirty, setDocument, selectFile, save, initialize } = projectConfigEditor({{ configSectionId }})
|
|
17
|
+
|
|
18
|
+
const pending = state<'reload' | EditorMode | null>(null)
|
|
19
|
+
const confirming = state(false)
|
|
20
|
+
const visibleMode = state<EditorMode>('fields')
|
|
21
|
+
const fieldQuery = state('')
|
|
22
|
+
const fieldLimit = state(40)
|
|
23
|
+
const dnsFile = derived(() => selected() === 'dns')
|
|
24
|
+
|
|
25
|
+
const fileOptions = derived(() => files().map(file => ({ value: file.name, label: file.title })))
|
|
26
|
+
const editorModes = derived(() => [
|
|
27
|
+
{ value: 'fields', label: dnsFile() ? 'Records' : 'Fields' },
|
|
28
|
+
{ value: 'source', label: 'TypeScript' },
|
|
29
|
+
])
|
|
30
|
+
const selectedFile = derived(() => files().find(file => file.name === selected()))
|
|
31
|
+
const discardTitle = 'Discard unsaved changes?'
|
|
32
|
+
const discardDescription = 'Your changes to this configuration file will be lost.'
|
|
33
|
+
effect(() => visibleMode.set(mode()))
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
results?: ConfigUpdateResult[]
|
|
38
|
-
error?: string
|
|
35
|
+
function displayPart(part: string | number): string {
|
|
36
|
+
return typeof part === 'number' ? `Item ${part + 1}` : configLabel(part)
|
|
39
37
|
}
|
|
40
38
|
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
39
|
+
const fields = derived(() => (current()?.fields ?? []).map((field) => {
|
|
40
|
+
const labels = field.path.map(displayPart)
|
|
41
|
+
const label = labels.at(-1) ?? 'Value'
|
|
42
|
+
return { ...field, label, group: JSON.stringify(field.path.slice(0, -1)), heading: labels.slice(0, -1).join(' › '), accessibleLabel: labels.join(' › ') || label }
|
|
43
|
+
}))
|
|
44
|
+
const filteredFields = derived(() => {
|
|
45
|
+
const needle = fieldQuery().trim().toLowerCase()
|
|
46
|
+
return fields().filter(field => `${field.key} ${field.accessibleLabel} ${field.description ?? ''}`.toLowerCase().includes(needle))
|
|
47
|
+
})
|
|
48
|
+
const displayRows = derived(() => {
|
|
49
|
+
const groups = new Map<string, ReturnType<typeof filteredFields>>()
|
|
50
|
+
for (const field of filteredFields()) {
|
|
51
|
+
const group = groups.get(field.group)
|
|
52
|
+
if (group)
|
|
53
|
+
group.push(field)
|
|
54
|
+
else
|
|
55
|
+
groups.set(field.group, [field])
|
|
56
|
+
}
|
|
57
|
+
let remaining = fieldLimit()
|
|
58
|
+
return [...groups.values()].flatMap((group) => {
|
|
59
|
+
const chosen = group.slice(0, remaining)
|
|
60
|
+
remaining -= chosen.length
|
|
61
|
+
return chosen.map((field, index) => ({
|
|
62
|
+
...field,
|
|
63
|
+
sectionHeading: index === 0 && groups.size > 1 ? field.heading || 'General' : '',
|
|
64
|
+
}))
|
|
65
|
+
})
|
|
60
66
|
})
|
|
61
67
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if (field.type === 'object' || field.type === 'array')
|
|
70
|
-
return JSON.stringify(field.value)
|
|
71
|
-
return String(field.value ?? '')
|
|
68
|
+
function openFile(name: string, reload = false): Promise<void> {
|
|
69
|
+
if (name !== selected()) {
|
|
70
|
+
fieldQuery.set('')
|
|
71
|
+
fieldLimit.set(40)
|
|
72
|
+
rememberProjectConfigFile(name)
|
|
73
|
+
}
|
|
74
|
+
return selectFile(name, { reload })
|
|
72
75
|
}
|
|
73
76
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
throw new Error(body.error || 'Unable to list configuration files')
|
|
81
|
-
if (!Array.isArray(body.files))
|
|
82
|
-
throw new TypeError('Configuration files were not returned in the expected shape.')
|
|
83
|
-
|
|
84
|
-
files.set(body.files)
|
|
85
|
-
const first = body.files[0]?.name
|
|
86
|
-
if (first)
|
|
87
|
-
await selectFile(first)
|
|
77
|
+
function requestMode(next: EditorMode): void {
|
|
78
|
+
if (saving() || next === mode())
|
|
79
|
+
return
|
|
80
|
+
if (isDirty()) {
|
|
81
|
+
visibleMode.set(mode())
|
|
82
|
+
void requestDiscard(next)
|
|
88
83
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
finally {
|
|
93
|
-
loading.set(false)
|
|
84
|
+
else {
|
|
85
|
+
setMode(next)
|
|
94
86
|
}
|
|
95
87
|
}
|
|
96
88
|
|
|
97
|
-
async function
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
loading.set(true)
|
|
89
|
+
async function requestDiscard(destination: 'reload' | EditorMode): Promise<void> {
|
|
90
|
+
if (confirming() || pending())
|
|
91
|
+
return
|
|
92
|
+
const file = selected()
|
|
93
|
+
confirming.set(true)
|
|
103
94
|
try {
|
|
104
|
-
const
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
drafts,
|
|
112
|
-
Object.fromEntries(
|
|
113
|
-
body.fields
|
|
114
|
-
.filter((field: ConfigField) => field.editable)
|
|
115
|
-
.map((field: ConfigField) => [field.key, field.value]),
|
|
116
|
-
),
|
|
117
|
-
)
|
|
118
|
-
fields.set(body.fields)
|
|
119
|
-
}
|
|
120
|
-
catch (cause) {
|
|
121
|
-
error.set(cause instanceof Error ? cause.message : `Unable to read config/${name}.ts`)
|
|
95
|
+
const confirmed = await confirmSettingsDiscard(discardTitle, discardDescription, 'Discard Changes')
|
|
96
|
+
if (selected() !== file || saving())
|
|
97
|
+
return
|
|
98
|
+
if (confirmed === null)
|
|
99
|
+
pending.set(destination)
|
|
100
|
+
else if (confirmed)
|
|
101
|
+
discardAndContinue(destination)
|
|
122
102
|
}
|
|
123
103
|
finally {
|
|
124
|
-
|
|
104
|
+
confirming.set(false)
|
|
125
105
|
}
|
|
126
106
|
}
|
|
127
107
|
|
|
128
|
-
function
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
pendingSelection.set(name)
|
|
108
|
+
function discardAndContinue(destination = pending()): void {
|
|
109
|
+
pending.set(null)
|
|
110
|
+
if (destination === 'reload') {
|
|
111
|
+
void openFile(selected(), true)
|
|
133
112
|
return
|
|
134
113
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
114
|
+
const loaded = current()
|
|
115
|
+
if (destination && loaded) {
|
|
116
|
+
setDocument(loaded)
|
|
117
|
+
setMode(destination)
|
|
118
|
+
error.set('')
|
|
119
|
+
}
|
|
140
120
|
}
|
|
141
121
|
|
|
142
|
-
function
|
|
143
|
-
|
|
144
|
-
pendingSelection.set('')
|
|
145
|
-
if (name)
|
|
146
|
-
void selectFile(name)
|
|
122
|
+
function fieldInputType(field: ConfigField): string {
|
|
123
|
+
return /password|secret|api[-_]?key|private[-_]?key|access[-_]?token/i.test(field.key) ? 'password' : 'text'
|
|
147
124
|
}
|
|
148
125
|
|
|
149
|
-
function
|
|
150
|
-
|
|
151
|
-
return
|
|
152
|
-
event.preventDefault()
|
|
153
|
-
event.returnValue = ''
|
|
126
|
+
function loadSection(): Promise<void> {
|
|
127
|
+
return initialize(requestedProjectConfigFile())
|
|
154
128
|
}
|
|
155
129
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
error.set('')
|
|
164
|
-
try {
|
|
165
|
-
const updates = fields()
|
|
166
|
-
.filter(field => field.editable)
|
|
167
|
-
.map(field => ({ key: field.key, value: drafts[field.key] }))
|
|
168
|
-
const body = await dashboardApi<ConfigUpdateResponse>('/api/config/update', {
|
|
169
|
-
method: 'POST',
|
|
170
|
-
body: { file, updates },
|
|
171
|
-
})
|
|
172
|
-
if (!body.ok) {
|
|
173
|
-
const failed = body.results?.filter((result: { ok: boolean }) => !result.ok)
|
|
174
|
-
throw new Error(failed?.map((result: { error?: string }) => result.error).filter(Boolean).join(', ') || body.error || 'Unable to save configuration')
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
message.set(`Saved config/${file}.ts`)
|
|
178
|
-
await selectFile(file)
|
|
179
|
-
message.set(`Saved config/${file}.ts`)
|
|
180
|
-
}
|
|
181
|
-
catch (cause) {
|
|
182
|
-
error.set(cause instanceof Error ? cause.message : 'Unable to save configuration')
|
|
183
|
-
}
|
|
184
|
-
finally {
|
|
185
|
-
saving.set(false)
|
|
130
|
+
onMount(loadSection)
|
|
131
|
+
useEventListener('stx:load', loadSection)
|
|
132
|
+
useEventListener('keydown', (event: KeyboardEvent) => {
|
|
133
|
+
if (!event.defaultPrevented && (event.metaKey || event.ctrlKey) && !event.altKey && !event.shiftKey && event.key.toLowerCase() === 's') {
|
|
134
|
+
event.preventDefault()
|
|
135
|
+
if (!confirming() && !pending())
|
|
136
|
+
void save()
|
|
186
137
|
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
useEventListener('beforeunload', handleBeforeUnload)
|
|
190
|
-
void loadFiles()
|
|
138
|
+
})
|
|
191
139
|
</script>
|
|
192
140
|
|
|
193
141
|
<template>
|
|
194
142
|
<div class="dashboard-settings-stack">
|
|
195
|
-
<
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
</span>
|
|
204
|
-
</summary>
|
|
205
|
-
<div class="pt-2 px-2">
|
|
206
|
-
<SearchFilter v-model:searchValue="configQuery" placeholder="Search config" ariaLabel="Search configuration" />
|
|
207
|
-
</div>
|
|
208
|
-
|
|
209
|
-
<nav class="overflow-y-auto p-2 max-h-[68vh]" aria-label="Configuration files">
|
|
210
|
-
<button :for="file in filteredFiles"
|
|
211
|
-
type="button"
|
|
212
|
-
:class="selected() === file.name ? 'flex items-center gap-3 px-3 py-2.5 w-full text-left text-blue-700 dark:text-blue-300 bg-blue-50 dark:bg-blue-500/10 rounded-lg' : 'flex items-center gap-3 px-3 py-2.5 w-full text-left text-neutral-700 dark:text-neutral-300 hover:bg-neutral-100 dark:hover:bg-white/5 rounded-lg'"
|
|
213
|
-
@click="requestSelectFile(file.name)"
|
|
214
|
-
>
|
|
215
|
-
<span class="flex-none h-4 w-4 i-hugeicons-settings-02"></span>
|
|
216
|
-
<span class="flex-1 font-medium text-sm truncate">{{ file.title }}</span>
|
|
217
|
-
<span class="text-[10px] text-neutral-500 dark:text-neutral-400">{{ file.size < 1024 ? file.size + ' B' : Math.round(file.size / 1024) + ' KB' }}</span>
|
|
218
|
-
</button>
|
|
219
|
-
</nav>
|
|
220
|
-
</details>
|
|
143
|
+
<p class="dashboard-config-intro" :text="configSection?.description"></p>
|
|
144
|
+
|
|
145
|
+
<div :if="files().length > 1">
|
|
146
|
+
<SettingsGroup>
|
|
147
|
+
<SettingsRow label="Configuration file">
|
|
148
|
+
<SettingsPicker :options="fileOptions()" :value="selected()" ariaLabel="Configuration file"
|
|
149
|
+
:disabled="saving() || confirming()" @change="openFile($event)" />
|
|
150
|
+
</SettingsRow>
|
|
221
151
|
</SettingsGroup>
|
|
222
152
|
</div>
|
|
223
153
|
|
|
224
|
-
<
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
<p class="mt-1 text-neutral-500 text-sm dark:text-neutral-400">Add a TypeScript config file under config to manage it here.</p>
|
|
241
|
-
</div>
|
|
242
|
-
@elseif(selectedFile())
|
|
243
|
-
<div class="flex flex-wrap gap-4 items-center justify-between px-4 py-3 border-b border-neutral-200/60 dark:border-white/5">
|
|
244
|
-
<div>
|
|
245
|
-
<h2 class="font-semibold text-lg text-neutral-900 dark:text-white">{{ selectedFile()?.title }}</h2>
|
|
246
|
-
<p class="mt-1 font-mono text-neutral-500 text-xs dark:text-neutral-400">config/{{ selectedFile()?.name }}.ts</p>
|
|
154
|
+
<p :if="loading()" class="dashboard-config-intro" role="status">Loading configuration…</p>
|
|
155
|
+
<div :if="error()" class="text-red-700 text-sm dark:text-red-400" role="alert">
|
|
156
|
+
<p :text="error()"></p>
|
|
157
|
+
<Button :if="!current() && !loading()" variant="secondary" size="sm" @click="selected() ? openFile(selected(), true) : loadSection()">Retry</Button>
|
|
158
|
+
<Button :if="current() && isDirty()" variant="secondary" size="sm" @click="requestDiscard('reload')">Reopen file</Button>
|
|
159
|
+
</div>
|
|
160
|
+
<p :if="!loading() && !error() && files().length === 0" class="dashboard-config-intro">This project has no configuration files in this section.</p>
|
|
161
|
+
<p :if="message()" class="text-green-700 text-sm dark:text-green-400" role="status" :text="message()"></p>
|
|
162
|
+
|
|
163
|
+
<div :if="current()" class="min-w-0">
|
|
164
|
+
<SettingsGroup>
|
|
165
|
+
<form @submit.prevent="save()">
|
|
166
|
+
<div class="dashboard-config-header">
|
|
167
|
+
<div class="min-w-0">
|
|
168
|
+
<h2 :text="selectedFile()?.title"></h2>
|
|
169
|
+
<p class="dashboard-config-path" data-config-path :text="'config/' + selected() + '.ts'"></p>
|
|
247
170
|
</div>
|
|
248
|
-
<div class="flex gap-2 items-center">
|
|
249
|
-
<
|
|
250
|
-
|
|
251
|
-
<Button
|
|
252
|
-
{{ saving() ? 'Saving...' : 'Save changes' }}
|
|
253
|
-
</Button>
|
|
171
|
+
<div class="flex flex-wrap gap-2 items-center">
|
|
172
|
+
<SegmentedControl v-model:value="visibleMode" :options="editorModes()" label="Configuration editor" variant="mac"
|
|
173
|
+
:disabled="saving() || confirming()" @change="requestMode($event)" />
|
|
174
|
+
<Button :if="!dnsFile() || mode() === 'source'" type="submit" size="sm" :loading="saving()" :disabled="saving() || !isDirty()">Save changes</Button>
|
|
254
175
|
</div>
|
|
255
176
|
</div>
|
|
256
177
|
|
|
257
|
-
|
|
258
|
-
<
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
@endif
|
|
262
|
-
@if(error())
|
|
263
|
-
<div class="mt-3 mx-4 px-4 py-3 text-red-700 text-sm dark:text-red-300 bg-red-50 dark:bg-red-500/10 border border-red-200 rounded-lg dark:border-red-500/20">
|
|
264
|
-
{{ error() }}
|
|
265
|
-
</div>
|
|
266
|
-
@endif
|
|
178
|
+
<div :if="mode() === 'source'" class="flex flex-col gap-2 p-4 pt-0">
|
|
179
|
+
<p :if="current()?.diagnostic" class="text-amber-700 text-sm dark:text-amber-300" :text="current()?.diagnostic"></p>
|
|
180
|
+
<SettingsCodeEditor v-model:value="sourceDraft" language="typescript" :label="'config/' + selected() + '.ts'" :readonly="saving()" @save="save()" />
|
|
181
|
+
</div>
|
|
267
182
|
|
|
268
|
-
<
|
|
269
|
-
<div
|
|
270
|
-
<
|
|
271
|
-
|
|
272
|
-
<
|
|
183
|
+
<div :if="mode() === 'fields' && !dnsFile()" class="min-w-0">
|
|
184
|
+
<div class="dashboard-config-field-tools">
|
|
185
|
+
<p class="dashboard-config-intro">Use TypeScript for expressions, environment bindings, and new keys.</p>
|
|
186
|
+
<div :if="fields().length > 6">
|
|
187
|
+
<SearchFilter v-model:searchValue="fieldQuery" placeholder="Filter fields" ariaLabel="Filter configuration fields" />
|
|
273
188
|
</div>
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
>
|
|
290
|
-
@elseif(field.editable)
|
|
291
|
-
<input
|
|
292
|
-
:id="'config-' + field.key"
|
|
293
|
-
type="text"
|
|
294
|
-
x-model="drafts[field.key]"
|
|
295
|
-
class="block px-3 py-2 w-full text-neutral-900 text-sm dark:text-white bg-white dark:bg-white/5 border border-black/10 rounded-lg dark:border-white/15 focus:border-blue-500/50 focus:outline-none focus:ring-2 focus:ring-blue-500/40"
|
|
296
|
-
>
|
|
189
|
+
</div>
|
|
190
|
+
<p :if="displayRows().length === 0" class="pb-4 px-4 text-neutral-500 text-sm dark:text-neutral-400"
|
|
191
|
+
:text="fieldQuery() ? 'No matching fields' : 'Open TypeScript to edit this file.'"></p>
|
|
192
|
+
|
|
193
|
+
<div :for="(field, index) in displayRows()" :key="field.key">
|
|
194
|
+
<h3 :if="field.sectionHeading" class="dashboard-config-subheading" :text="field.sectionHeading"></h3>
|
|
195
|
+
@if(field.type === 'boolean')
|
|
196
|
+
<SettingsRow :label="field.label" :description="field.description">
|
|
197
|
+
<Switch v-model:checked="drafts[field.key]" variant="mac" :disabled="saving()" />
|
|
198
|
+
</SettingsRow>
|
|
199
|
+
@else
|
|
200
|
+
<div class="dashboard-config-field" :data-config-type="field.type">
|
|
201
|
+
@if(field.type === 'null')
|
|
202
|
+
<span class="dashboard-config-field-label" :title="field.key" :text="field.label"></span>
|
|
203
|
+
<span class="dashboard-config-intro">Unset</span>
|
|
297
204
|
@else
|
|
298
|
-
<div class="
|
|
299
|
-
|
|
205
|
+
<div class="min-w-0">
|
|
206
|
+
<label :for="'dashboard-config-field-' + index" class="dashboard-config-field-label" :title="field.key" :text="field.label"></label>
|
|
207
|
+
<p :if="field.description" :id="'dashboard-config-help-' + index" class="dashboard-config-field-description" :text="field.description"></p>
|
|
300
208
|
</div>
|
|
301
|
-
|
|
209
|
+
@if(field.type === 'number')
|
|
210
|
+
<input :id="'dashboard-config-field-' + index" data-dashboard-field type="number" step="any" required
|
|
211
|
+
:aria-describedby="field.description ? 'dashboard-config-help-' + index : null"
|
|
212
|
+
class="dashboard-config-input" x-model="drafts[field.key]" :disabled="saving()">
|
|
213
|
+
@else
|
|
214
|
+
<input :id="'dashboard-config-field-' + index" data-dashboard-field :type="fieldInputType(field)" autocomplete="off"
|
|
215
|
+
:aria-describedby="field.description ? 'dashboard-config-help-' + index : null"
|
|
216
|
+
class="dashboard-config-input" x-model="drafts[field.key]" :disabled="saving()">
|
|
217
|
+
@endif
|
|
302
218
|
@endif
|
|
303
219
|
</div>
|
|
220
|
+
@endif
|
|
221
|
+
</div>
|
|
222
|
+
<div :if="filteredFields().length > fieldLimit()" class="p-3">
|
|
223
|
+
<Button variant="secondary" size="sm" @click="fieldLimit.update(limit => limit + 40)">Show more fields</Button>
|
|
304
224
|
</div>
|
|
305
|
-
</
|
|
306
|
-
|
|
307
|
-
|
|
225
|
+
</div>
|
|
226
|
+
</form>
|
|
227
|
+
<div :if="dnsFile() && mode() === 'fields'">
|
|
228
|
+
<DnsRecordsSettings @saved="setDocument($event)" />
|
|
229
|
+
</div>
|
|
230
|
+
</SettingsGroup>
|
|
231
|
+
</div>
|
|
308
232
|
|
|
309
|
-
<ConfirmDialog
|
|
310
|
-
|
|
311
|
-
title="Discard unsaved changes?"
|
|
312
|
-
description="Switching configuration files will discard the edits in this file."
|
|
313
|
-
confirmLabel="Discard changes"
|
|
314
|
-
variant="warning"
|
|
315
|
-
@close="cancelPendingSelection"
|
|
316
|
-
@confirm="discardAndSelect"
|
|
317
|
-
/>
|
|
233
|
+
<ConfirmDialog :isOpen="Boolean(pending())" :title="discardTitle" :description="discardDescription"
|
|
234
|
+
confirmLabel="Discard Changes" variant="warning" @close="pending.set(null)" @confirm="discardAndContinue()" />
|
|
318
235
|
</div>
|
|
319
236
|
</template>
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<script client>
|
|
2
|
+
import { contextMenu } from '@stacksjs/desktop/browser'
|
|
3
|
+
|
|
4
|
+
interface PickerOption {
|
|
5
|
+
value: string
|
|
6
|
+
label: string
|
|
7
|
+
disabled?: boolean
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const value = useReactiveProp('value', '')
|
|
11
|
+
const options = useReactiveProp<PickerOption[]>('options', [])
|
|
12
|
+
const label = useReactiveProp('label', '')
|
|
13
|
+
const ariaLabel = useReactiveProp('ariaLabel', '')
|
|
14
|
+
const hint = useReactiveProp('hint', '')
|
|
15
|
+
const error = useReactiveProp('error', '')
|
|
16
|
+
const disabled = useReactiveProp('disabled', false)
|
|
17
|
+
const native = state(contextMenu.available())
|
|
18
|
+
const showingMenu = state(false)
|
|
19
|
+
const emit = defineEmits(['change'])
|
|
20
|
+
const hintId = useId('settings-picker-hint')
|
|
21
|
+
const selectedLabel = derived(() => options().find(option => option.value === value())?.label ?? '')
|
|
22
|
+
const accessibleLabel = derived(() => ariaLabel() || label())
|
|
23
|
+
const describedBy = derived(() => error() || hint() ? hintId : null)
|
|
24
|
+
|
|
25
|
+
useEventListener('craft:ready', () => native.set(contextMenu.available()))
|
|
26
|
+
|
|
27
|
+
async function showMenu(event: Event): Promise<void> {
|
|
28
|
+
if (disabled() || showingMenu())
|
|
29
|
+
return
|
|
30
|
+
const anchor = event.currentTarget as HTMLButtonElement
|
|
31
|
+
const { left, bottom } = anchor.getBoundingClientRect()
|
|
32
|
+
const current = options()
|
|
33
|
+
const selected = value()
|
|
34
|
+
showingMenu.set(true)
|
|
35
|
+
try {
|
|
36
|
+
const id = await contextMenu.pick({
|
|
37
|
+
x: Math.round(left),
|
|
38
|
+
y: Math.round(bottom),
|
|
39
|
+
items: current.map((option, index) => ({
|
|
40
|
+
id: String(index),
|
|
41
|
+
title: option.label,
|
|
42
|
+
disabled: option.disabled,
|
|
43
|
+
checked: option.value === selected,
|
|
44
|
+
})),
|
|
45
|
+
})
|
|
46
|
+
const choice = id == null ? undefined : current[Number(id)]
|
|
47
|
+
if (choice && !disabled() && options().some(option => option.value === choice.value && !option.disabled) && choice.value !== value())
|
|
48
|
+
emit('change', choice.value)
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
native.set(false)
|
|
52
|
+
}
|
|
53
|
+
finally {
|
|
54
|
+
showingMenu.set(false)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function change(event: Event): void {
|
|
59
|
+
const select = event.currentTarget as HTMLSelectElement
|
|
60
|
+
const next = select.value
|
|
61
|
+
select.value = value()
|
|
62
|
+
if (next !== value())
|
|
63
|
+
emit('change', next)
|
|
64
|
+
}
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
<label class="dashboard-settings-picker">
|
|
68
|
+
<span :if="label()" class="dashboard-settings-picker-label" :text="label()"></span>
|
|
69
|
+
<span class="dashboard-settings-picker-control">
|
|
70
|
+
<button :if="native()" class="dashboard-settings-picker-button" type="button" aria-haspopup="menu"
|
|
71
|
+
:aria-expanded="String(showingMenu())" :aria-label="accessibleLabel() + (selectedLabel() ? ', ' + selectedLabel() : '')"
|
|
72
|
+
:aria-describedby="describedBy()" :aria-invalid="error() ? 'true' : null"
|
|
73
|
+
:disabled="disabled() || options().length === 0"
|
|
74
|
+
@click="showMenu">
|
|
75
|
+
<span :text="selectedLabel()"></span>
|
|
76
|
+
</button>
|
|
77
|
+
<select :else class="dashboard-settings-picker-button" data-ui-select data-dashboard-field
|
|
78
|
+
:aria-label="accessibleLabel()" :aria-describedby="describedBy()" :aria-invalid="error() ? 'true' : null"
|
|
79
|
+
:disabled="disabled() || options().length === 0" @change="change">
|
|
80
|
+
<option :for="option in options()" :key="option.value" :value="option.value"
|
|
81
|
+
:selected="option.value === value()" :disabled="option.disabled" :text="option.label"></option>
|
|
82
|
+
</select>
|
|
83
|
+
<span class="dashboard-settings-picker-glyph i-f7-chevron-up-chevron-down" aria-hidden="true"></span>
|
|
84
|
+
</span>
|
|
85
|
+
<span :if="error() || hint()" :id="hintId" :data-invalid="String(Boolean(error()))"
|
|
86
|
+
class="dashboard-settings-picker-hint" :text="error() || hint()"></span>
|
|
87
|
+
</label>
|
|
@@ -46,7 +46,7 @@ const sectionPages = {
|
|
|
46
46
|
analytics: ['/analytics'],
|
|
47
47
|
management: ['/management', '/cloud', '/servers', '/remote', '/serverless', '/dns', '/mailboxes', '/logs', '/health', '/insights', '/kanban'],
|
|
48
48
|
// Settings is also opened by the native application menu and the browser account menu.
|
|
49
|
-
utilities: ['/buddy', '/
|
|
49
|
+
utilities: ['/buddy', '/access-tokens'],
|
|
50
50
|
ci: ['/ci'],
|
|
51
51
|
} as const satisfies Partial<Record<keyof ResolvedDashboardToggles, readonly string[]>>
|
|
52
52
|
|