@crombolo/backoffice-host 0.51.1 → 0.53.2
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/package.json +3 -3
- package/plugin/app-preview/umbraco-package.json +1 -1
- package/plugin/branding/localization-en.js +6 -8
- package/plugin/breadcrumb.js +6 -2
- package/plugin/content-home-dashboard.js +115 -0
- package/plugin/content-strip-items.js +65 -0
- package/plugin/content-strip.js +120 -0
- package/plugin/definition-tree-model.js +43 -0
- package/plugin/definition-tree.js +318 -0
- package/plugin/document-links.js +19 -0
- package/plugin/form-create-option.js +13 -0
- package/plugin/form-word-input-model.js +45 -0
- package/plugin/form-word-input.js +170 -0
- package/plugin/forms-client.js +21 -2
- package/plugin/forms-entries.js +77 -32
- package/plugin/forms-layout.js +6 -0
- package/plugin/forms-overview.js +200 -42
- package/plugin/localizations/umbraco-package.json +1 -1
- package/plugin/overview-dashboard.js +77 -7
- package/plugin/seo/umbraco-package.json +1 -1
- package/plugin/session-guard-model.js +54 -0
- package/plugin/session-guard.js +50 -0
- package/plugin/settings-cards.js +14 -31
- package/plugin/settings-section.js +157 -16
- package/plugin/sign-in/umbraco-package.json +1 -1
- package/plugin/theme-sync.js +69 -0
- package/plugin/tsx-editors.js +8 -5
- package/plugin/umbraco-package.json +132 -18
- package/plugin/view-parts.js +24 -0
- package/plugin/workflow-client.js +7 -2
- package/plugin/workflow-designer.js +44 -4
- package/src/paths.ts +1 -0
- package/plugin/theme-switch.js +0 -135
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Home (stories 236, 288), where the back office opens and the logo leads: the pages changed lately, how many are drafts or published, what people
|
|
3
|
+
* did, a way to start a new page, and the system's details. It is the fork's
|
|
4
|
+
* `homeView`, outside any section. Everything comes from `crombolo/api/overview`,
|
|
5
5
|
* already narrowed to what the signed-in user may see.
|
|
6
6
|
*/
|
|
7
|
+
import { UMB_AUTH_CONTEXT } from '@umbraco-cms/backoffice/auth'
|
|
7
8
|
import { UMB_CURRENT_USER_CONTEXT } from '@umbraco-cms/backoffice/current-user'
|
|
8
9
|
import { UMB_DOCUMENT_CREATE_OPTIONS_MODAL } from '@umbraco-cms/backoffice/document'
|
|
9
10
|
import { css, html, nothing } from '@umbraco-cms/backoffice/external/lit'
|
|
10
11
|
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'
|
|
11
12
|
import { umbOpenModal } from '@umbraco-cms/backoffice/modal'
|
|
13
|
+
import { UMB_SYSINFO_MODAL, UmbSysinfoRepository } from '@umbraco-cms/backoffice/sysinfo'
|
|
12
14
|
import { activityLine, ago, avatarHue, firstName, initials, STATES } from './overview-format.js'
|
|
13
15
|
|
|
14
16
|
const base = () =>
|
|
@@ -26,8 +28,13 @@ export default class CromboloOverviewDashboardElement extends UmbLitElement {
|
|
|
26
28
|
_take: { state: true },
|
|
27
29
|
_skip: { state: true },
|
|
28
30
|
_error: { state: true },
|
|
31
|
+
_server: { state: true },
|
|
29
32
|
}
|
|
30
33
|
|
|
34
|
+
/** The session had gone when it last asked, so signing back in is what to wait for. */
|
|
35
|
+
#signedOut = false
|
|
36
|
+
#auth
|
|
37
|
+
|
|
31
38
|
constructor() {
|
|
32
39
|
super()
|
|
33
40
|
this._list = 'recent'
|
|
@@ -38,6 +45,18 @@ export default class CromboloOverviewDashboardElement extends UmbLitElement {
|
|
|
38
45
|
this._name = current?.name
|
|
39
46
|
})
|
|
40
47
|
})
|
|
48
|
+
// Signing back in is a pop-up, so this page stays where it was and has to look again.
|
|
49
|
+
this.consumeContext(UMB_AUTH_CONTEXT, (auth) => {
|
|
50
|
+
this.#auth = auth
|
|
51
|
+
this.observe(auth?.isAuthorized, (authorized) => {
|
|
52
|
+
if (!authorized || !this.#signedOut) return
|
|
53
|
+
this.#signedOut = false
|
|
54
|
+
this.#load()
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
new UmbSysinfoRepository(this).requestServerInformation().then((server) => {
|
|
58
|
+
this._server = server
|
|
59
|
+
})
|
|
41
60
|
}
|
|
42
61
|
|
|
43
62
|
connectedCallback() {
|
|
@@ -52,10 +71,18 @@ export default class CromboloOverviewDashboardElement extends UmbLitElement {
|
|
|
52
71
|
take: String(this._take),
|
|
53
72
|
})
|
|
54
73
|
try {
|
|
74
|
+
// Plain `fetch` renews nothing, so a token left to lapse would be refused.
|
|
75
|
+
await (await this.getContext(UMB_AUTH_CONTEXT))?.getLatestToken().catch(() => undefined)
|
|
55
76
|
const response = await fetch(`${base()}/crombolo/api/overview?${query}`, {
|
|
56
77
|
credentials: 'include',
|
|
57
78
|
headers: { accept: 'application/json' },
|
|
58
79
|
})
|
|
80
|
+
if (response.status === 401) {
|
|
81
|
+
// Not this page's to report: the sign-in dialog says so, and it loads after.
|
|
82
|
+
this.#signedOut = true
|
|
83
|
+
if (this.#auth?.getIsAuthorized()) this.#auth.timeOut()
|
|
84
|
+
return
|
|
85
|
+
}
|
|
59
86
|
if (!response.ok) throw new Error(`overview responded ${response.status}`)
|
|
60
87
|
this._data = await response.json()
|
|
61
88
|
this._error = undefined
|
|
@@ -90,9 +117,9 @@ export default class CromboloOverviewDashboardElement extends UmbLitElement {
|
|
|
90
117
|
|
|
91
118
|
render() {
|
|
92
119
|
const name = firstName(this._name)
|
|
93
|
-
return html
|
|
120
|
+
return html`<div class="page">
|
|
94
121
|
<header>
|
|
95
|
-
<h1>
|
|
122
|
+
<h1>Home</h1>
|
|
96
123
|
<p>${name ? `Welcome back, ${name}. ` : ''}Here’s what’s happening in Crombolo.</p>
|
|
97
124
|
</header>
|
|
98
125
|
${this._error ? html`<uui-box><p class="error">${this._error}</p></uui-box>` : nothing}
|
|
@@ -107,9 +134,34 @@ export default class CromboloOverviewDashboardElement extends UmbLitElement {
|
|
|
107
134
|
<uui-icon name="icon-add"></uui-icon>
|
|
108
135
|
</button>
|
|
109
136
|
</div>
|
|
110
|
-
<div class="side"
|
|
137
|
+
<div class="side">
|
|
138
|
+
${this.#renderStats()} ${this.#renderActivity()} ${this.#renderSystem()}
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
</div>`
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
#renderSystem() {
|
|
145
|
+
return html`<uui-box headline="System information">
|
|
146
|
+
<dl class="system">
|
|
147
|
+
<dt>Version</dt>
|
|
148
|
+
<dd>${this._server?.version ?? '…'}</dd>
|
|
149
|
+
<dt>Mode</dt>
|
|
150
|
+
<dd>${this._server?.runtimeMode ?? '…'}</dd>
|
|
151
|
+
</dl>
|
|
152
|
+
<div class="system-links">
|
|
153
|
+
<a href="https://github.com/kineco-au/crombolo-cms" target="_blank" rel="noopener">
|
|
154
|
+
Crombolo on GitHub
|
|
155
|
+
</a>
|
|
156
|
+
<button class="link" type="button" @click=${() => this.#openSystemDetails()}>
|
|
157
|
+
All details
|
|
158
|
+
</button>
|
|
111
159
|
</div>
|
|
112
|
-
|
|
160
|
+
</uui-box>`
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
#openSystemDetails() {
|
|
164
|
+
umbOpenModal(this, UMB_SYSINFO_MODAL).catch(() => undefined)
|
|
113
165
|
}
|
|
114
166
|
|
|
115
167
|
#renderPages() {
|
|
@@ -231,9 +283,27 @@ export default class CromboloOverviewDashboardElement extends UmbLitElement {
|
|
|
231
283
|
static styles = css`
|
|
232
284
|
:host {
|
|
233
285
|
display: block;
|
|
286
|
+
height: 100%;
|
|
287
|
+
overflow: auto;
|
|
288
|
+
}
|
|
289
|
+
.page {
|
|
290
|
+
box-sizing: border-box;
|
|
234
291
|
padding: var(--uui-size-layout-1);
|
|
235
292
|
max-width: 1400px;
|
|
236
293
|
}
|
|
294
|
+
.system {
|
|
295
|
+
display: grid;
|
|
296
|
+
grid-template-columns: auto 1fr;
|
|
297
|
+
gap: var(--uui-size-space-2) var(--uui-size-space-4);
|
|
298
|
+
margin: 0 0 var(--uui-size-space-4);
|
|
299
|
+
}
|
|
300
|
+
.system dt { color: var(--uui-color-text-alt); }
|
|
301
|
+
.system dd { margin: 0; }
|
|
302
|
+
.system-links {
|
|
303
|
+
display: flex;
|
|
304
|
+
justify-content: space-between;
|
|
305
|
+
gap: var(--uui-size-space-4);
|
|
306
|
+
}
|
|
237
307
|
header h1 {
|
|
238
308
|
margin: 0 0 var(--uui-size-space-3);
|
|
239
309
|
font-size: 2rem;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a screen's own `fetch` does when a session has ended. Pure, given how to
|
|
3
|
+
* send and how to recover, so each is tested on its own.
|
|
4
|
+
*/
|
|
5
|
+
const SIGNING_IN = /\/(security|login|oauth_complete)(\/|$)/
|
|
6
|
+
|
|
7
|
+
const hasAuthorization = (input, init) => {
|
|
8
|
+
const headers = new Headers(
|
|
9
|
+
init?.headers ?? (input instanceof Request ? input.headers : undefined),
|
|
10
|
+
)
|
|
11
|
+
return headers.has('authorization')
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Whether a request is one of the back office's own, sent with the session cookie.
|
|
16
|
+
* The client's API calls carry a token and have a queue of their own, and signing
|
|
17
|
+
* in must never wait for itself.
|
|
18
|
+
*
|
|
19
|
+
* @param {RequestInfo | URL} input
|
|
20
|
+
* @param {RequestInit | undefined} init
|
|
21
|
+
* @param {string} base the back office's address, e.g. `http://localhost/crombolo`
|
|
22
|
+
*/
|
|
23
|
+
export function covers(input, init, base) {
|
|
24
|
+
const url = input instanceof Request ? input.url : new URL(String(input), `${base}/`).href
|
|
25
|
+
if (!url.startsWith(`${base}/`)) return false
|
|
26
|
+
return !SIGNING_IN.test(new URL(url).pathname) && !hasAuthorization(input, init)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** A consumed request cannot be sent twice, but a 401 means none of it was acted on. */
|
|
30
|
+
const canResend = (input) => !(input instanceof Request) || input.method === 'GET'
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A `fetch` that waits for someone to sign in, rather than answering a 401.
|
|
34
|
+
*
|
|
35
|
+
* @param {typeof fetch} send
|
|
36
|
+
* @param {{
|
|
37
|
+
* covers: (input: RequestInfo | URL, init?: RequestInit) => boolean,
|
|
38
|
+
* signedIn: () => Promise<void>,
|
|
39
|
+
* recover: () => Promise<void>,
|
|
40
|
+
* }} session `signedIn` settles at once unless the session has ended; `recover`
|
|
41
|
+
* renews it, or asks the person to sign in, and settles when it is back.
|
|
42
|
+
*/
|
|
43
|
+
export function guardedFetch(send, session) {
|
|
44
|
+
return async (input, init) => {
|
|
45
|
+
if (!session.covers(input, init)) return send(input, init)
|
|
46
|
+
await session.signedIn()
|
|
47
|
+
let response = await send(input, init)
|
|
48
|
+
for (let tries = 0; tries < 2 && response.status === 401 && canResend(input); tries++) {
|
|
49
|
+
await session.recover()
|
|
50
|
+
response = await send(input, init)
|
|
51
|
+
}
|
|
52
|
+
return response
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* When a session ends, a screen's own `fetch` gets a 401 that the client never
|
|
3
|
+
* hears of, so the screen shows an error and nothing asks anyone to sign in.
|
|
4
|
+
* This renews the session or opens the sign-in dialog, and each request waits
|
|
5
|
+
* and carries on, so the screen underneath never sees the 401.
|
|
6
|
+
*/
|
|
7
|
+
import { UMB_AUTH_CONTEXT } from '@umbraco-cms/backoffice/auth'
|
|
8
|
+
import { UmbContextConsumerController } from '@umbraco-cms/backoffice/context-api'
|
|
9
|
+
import { covers, guardedFetch } from './session-guard-model.js'
|
|
10
|
+
|
|
11
|
+
const base = () =>
|
|
12
|
+
new URL(
|
|
13
|
+
document.querySelector('base')?.getAttribute('href') ?? '/umbraco/',
|
|
14
|
+
location.href,
|
|
15
|
+
).href.replace(/\/$/, '')
|
|
16
|
+
|
|
17
|
+
const sessionOf = (auth) => {
|
|
18
|
+
let authorized = true
|
|
19
|
+
/** Those waiting for someone to sign in. */
|
|
20
|
+
const waiting = []
|
|
21
|
+
let recovering
|
|
22
|
+
|
|
23
|
+
auth.isAuthorized.subscribe((now) => {
|
|
24
|
+
authorized = now
|
|
25
|
+
if (now) for (const resume of waiting.splice(0)) resume()
|
|
26
|
+
})
|
|
27
|
+
const signedIn = () =>
|
|
28
|
+
authorized ? Promise.resolve() : new Promise((resume) => waiting.push(resume))
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
covers: (input, init) => covers(input, init, base()),
|
|
32
|
+
signedIn,
|
|
33
|
+
recover: () => {
|
|
34
|
+
recovering ??= (async () => {
|
|
35
|
+
const renewed = await auth.makeRefreshTokenRequest().catch(() => false)
|
|
36
|
+
if (!renewed && authorized) auth.timeOut()
|
|
37
|
+
await signedIn()
|
|
38
|
+
})().finally(() => {
|
|
39
|
+
recovering = undefined
|
|
40
|
+
})
|
|
41
|
+
return recovering
|
|
42
|
+
},
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const onInit = (host) => {
|
|
47
|
+
new UmbContextConsumerController(host, UMB_AUTH_CONTEXT, (auth) => {
|
|
48
|
+
if (auth) window.fetch = guardedFetch(window.fetch.bind(window), sessionOf(auth))
|
|
49
|
+
})
|
|
50
|
+
}
|
package/plugin/settings-cards.js
CHANGED
|
@@ -13,31 +13,10 @@ export const SIDEBAR_APPS = {
|
|
|
13
13
|
code: 'Umb.SectionSidebarMenu.Templating',
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export const GROUPS = ['
|
|
16
|
+
export const GROUPS = ['Site', 'Health', 'History', 'Developers', 'Extensions', 'Other']
|
|
17
17
|
|
|
18
18
|
/** Our words for each tool, by the alias of its dashboard or menu item. */
|
|
19
19
|
export const CARDS = {
|
|
20
|
-
structure: {
|
|
21
|
-
group: 'Build',
|
|
22
|
-
title: 'Structure',
|
|
23
|
-
description: 'Content, media and member types, data types and languages.',
|
|
24
|
-
},
|
|
25
|
-
code: {
|
|
26
|
-
group: 'Build',
|
|
27
|
-
title: 'Code',
|
|
28
|
-
description: 'Components, stylesheets and scripts.',
|
|
29
|
-
},
|
|
30
|
-
'Umb.Dashboard.ModelsBuilder': {
|
|
31
|
-
group: 'Build',
|
|
32
|
-
title: 'Types for code',
|
|
33
|
-
description: 'The TypeScript types written from the schema, and whether they are out of date.',
|
|
34
|
-
},
|
|
35
|
-
'Crombolo.Dashboard.Workflows': {
|
|
36
|
-
group: 'Build',
|
|
37
|
-
title: 'Workflows',
|
|
38
|
-
description:
|
|
39
|
-
'The approval steps a page goes through before it is published, and who decides each.',
|
|
40
|
-
},
|
|
41
20
|
'Crombolo.Dashboard.Seo': {
|
|
42
21
|
group: 'Site',
|
|
43
22
|
title: 'Search & sharing',
|
|
@@ -110,6 +89,11 @@ export const CARDS = {
|
|
|
110
89
|
title: 'CI access',
|
|
111
90
|
description: 'The CI jobs that may pull and push here without a person, and what each may do.',
|
|
112
91
|
},
|
|
92
|
+
'Umb.Dashboard.ModelsBuilder': {
|
|
93
|
+
group: 'Developers',
|
|
94
|
+
title: 'Types for code',
|
|
95
|
+
description: 'The TypeScript types written from the schema, and whether they are out of date.',
|
|
96
|
+
},
|
|
113
97
|
'Crombolo.Dashboard.Bundles': {
|
|
114
98
|
group: 'Extensions',
|
|
115
99
|
title: 'Bundles',
|
|
@@ -128,15 +112,11 @@ export const CARDS = {
|
|
|
128
112
|
* @param {{
|
|
129
113
|
* dashboards?: { alias: string, label?: string, description?: string, bundle?: { name: string, packageName: string }, path: string }[],
|
|
130
114
|
* advanced?: { alias: string, label?: string, description?: string, bundle?: { name: string, packageName: string }, entityType: string }[],
|
|
131
|
-
* structure?: boolean,
|
|
132
|
-
* code?: boolean,
|
|
133
115
|
* }} from
|
|
134
116
|
* @returns {{ group: string, bundle?: { name: string, packageName: string, path: string }, cards: any[] }[]}
|
|
135
117
|
*/
|
|
136
|
-
export function settingsCards({ dashboards = [], advanced = []
|
|
118
|
+
export function settingsCards({ dashboards = [], advanced = [] }) {
|
|
137
119
|
const found = []
|
|
138
|
-
if (structure) found.push({ alias: 'structure', path: 'structure' })
|
|
139
|
-
if (code) found.push({ alias: 'code', path: 'code' })
|
|
140
120
|
for (const d of dashboards)
|
|
141
121
|
found.push({
|
|
142
122
|
alias: d.alias,
|
|
@@ -210,15 +190,18 @@ export function treeFor(entityType) {
|
|
|
210
190
|
|
|
211
191
|
/**
|
|
212
192
|
* The trail above a Settings page: Settings, then the tree or tool it is in.
|
|
213
|
-
* Paths are relative to the section; the last crumb is the page itself
|
|
193
|
+
* Paths are relative to the section; the last crumb is the page itself, and `home`
|
|
194
|
+
* marks the crumb for the root of the back office, which is outside the section.
|
|
214
195
|
*
|
|
215
196
|
* @param {{ tree?: 'structure' | 'code', title?: string }} at
|
|
216
197
|
*/
|
|
217
198
|
export function crumbsFor({ tree, title } = {}) {
|
|
199
|
+
const home = { label: 'Home', home: true }
|
|
218
200
|
const settings = { label: 'Settings', path: '' }
|
|
219
|
-
|
|
220
|
-
if (
|
|
221
|
-
return []
|
|
201
|
+
// A tree is reached from the menu under Content, which says where it is (story 289).
|
|
202
|
+
if (tree) return []
|
|
203
|
+
if (title) return [home, settings, { label: title }]
|
|
204
|
+
return [home, { label: 'Settings' }]
|
|
222
205
|
}
|
|
223
206
|
|
|
224
207
|
/**
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* manifest.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import { UMB_CURRENT_USER_CONTEXT } from '@umbraco-cms/backoffice/current-user'
|
|
9
10
|
import {
|
|
10
11
|
createExtensionApi,
|
|
11
12
|
createExtensionElement,
|
|
@@ -30,6 +31,8 @@ import {
|
|
|
30
31
|
treeFor,
|
|
31
32
|
} from './settings-cards.js'
|
|
32
33
|
import './breadcrumb.js'
|
|
34
|
+
import './definition-tree.js'
|
|
35
|
+
import { readOnlyWords } from './definition-tree-model.js'
|
|
33
36
|
import './settings-card.js'
|
|
34
37
|
|
|
35
38
|
const base = () =>
|
|
@@ -47,15 +50,25 @@ const emailStatus = async () => {
|
|
|
47
50
|
|
|
48
51
|
const menuOf = (manifest, menu) => manifest.meta?.menus?.includes(menu) === true
|
|
49
52
|
|
|
53
|
+
/** Each tree, and the part of Settings that opens it. */
|
|
54
|
+
const TREE_SECTIONS = [
|
|
55
|
+
['structure', 'Crombolo.Section.Structure'],
|
|
56
|
+
['code', 'Crombolo.Section.Components'],
|
|
57
|
+
]
|
|
58
|
+
|
|
50
59
|
export class CromboloSettingsSectionElement extends UmbLitElement {
|
|
51
60
|
static properties = {
|
|
61
|
+
_mayForms: { state: true },
|
|
52
62
|
_routes: { state: true },
|
|
53
63
|
_sidebarApps: { state: true },
|
|
54
64
|
_tree: { state: true },
|
|
55
65
|
_crumbs: { state: true },
|
|
66
|
+
_readOnly: { state: true },
|
|
56
67
|
}
|
|
57
68
|
|
|
58
69
|
#dashboards = []
|
|
70
|
+
/** The sections the current user holds, which say how much of Settings they have. */
|
|
71
|
+
#held
|
|
59
72
|
#menuItems = []
|
|
60
73
|
#sectionRoutes = []
|
|
61
74
|
#landing
|
|
@@ -64,6 +77,24 @@ export class CromboloSettingsSectionElement extends UmbLitElement {
|
|
|
64
77
|
|
|
65
78
|
constructor() {
|
|
66
79
|
super()
|
|
80
|
+
this.consumeContext(UMB_CURRENT_USER_CONTEXT, (user) => {
|
|
81
|
+
this.observe(user?.currentUser, (current) => {
|
|
82
|
+
this._mayForms =
|
|
83
|
+
current?.isAdmin === true ||
|
|
84
|
+
(current?.fallbackPermissions ?? []).includes('Crombolo.Form.Read')
|
|
85
|
+
this.#held = current?.allowedSections ?? []
|
|
86
|
+
this.#createRoutes()
|
|
87
|
+
})
|
|
88
|
+
})
|
|
89
|
+
// An explanation, not a control: a failure leaves it out.
|
|
90
|
+
fetch(`${base()}/crombolo/api/site-files`, { credentials: 'include' })
|
|
91
|
+
.then((response) => (response.ok ? response.json() : { writable: true }))
|
|
92
|
+
.then(
|
|
93
|
+
(files) => {
|
|
94
|
+
this._readOnly = !files.writable
|
|
95
|
+
},
|
|
96
|
+
() => {},
|
|
97
|
+
)
|
|
67
98
|
new UmbExtensionsElementInitializer(
|
|
68
99
|
this,
|
|
69
100
|
umbExtensionsRegistry,
|
|
@@ -154,8 +185,6 @@ export class CromboloSettingsSectionElement extends UmbLitElement {
|
|
|
154
185
|
path: this.#dashboardPath(d),
|
|
155
186
|
})),
|
|
156
187
|
advanced: this.#advanced(),
|
|
157
|
-
structure: this.#menuItems.some((m) => menuOf(m, STRUCTURE_MENU)),
|
|
158
|
-
code: this.#menuItems.some((m) => menuOf(m, CODE_MENU)),
|
|
159
188
|
})
|
|
160
189
|
}
|
|
161
190
|
|
|
@@ -193,9 +222,20 @@ export class CromboloSettingsSectionElement extends UmbLitElement {
|
|
|
193
222
|
}
|
|
194
223
|
|
|
195
224
|
#createRoutes() {
|
|
225
|
+
// Someone with a part of Settings has its tree, and not the cards or the tools.
|
|
226
|
+
const whole = this.#held?.includes('Crombolo.Section.AllSettings') ?? false
|
|
227
|
+
const mine = TREE_SECTIONS.filter(([, section]) => this.#held?.includes(section)).map(
|
|
228
|
+
([tree]) => tree,
|
|
229
|
+
)
|
|
230
|
+
const toTree = (name) =>
|
|
231
|
+
history.replaceState(null, '', new URL(`section/settings/${name}`, document.baseURI).pathname)
|
|
196
232
|
const landing = {
|
|
197
233
|
component: () => document.createElement('crombolo-settings-landing'),
|
|
198
234
|
setup: (element) => {
|
|
235
|
+
if (this.#held && !whole && mine[0]) {
|
|
236
|
+
toTree(mine[0])
|
|
237
|
+
return
|
|
238
|
+
}
|
|
199
239
|
this.#landing = element
|
|
200
240
|
this.#refreshLanding()
|
|
201
241
|
this.#showing(undefined)
|
|
@@ -205,6 +245,10 @@ export class CromboloSettingsSectionElement extends UmbLitElement {
|
|
|
205
245
|
path: name,
|
|
206
246
|
component: () => document.createElement('crombolo-settings-tree-start'),
|
|
207
247
|
setup: (element) => {
|
|
248
|
+
if (this.#held && !mine.includes(name) && mine[0]) {
|
|
249
|
+
toTree(mine[0])
|
|
250
|
+
return
|
|
251
|
+
}
|
|
208
252
|
element.tree = name
|
|
209
253
|
this.#showing(name)
|
|
210
254
|
},
|
|
@@ -223,16 +267,41 @@ export class CromboloSettingsSectionElement extends UmbLitElement {
|
|
|
223
267
|
this.#showing(undefined, { title: this.#label(manifest) })
|
|
224
268
|
},
|
|
225
269
|
}))
|
|
270
|
+
// Forms is a node in Structure, so its tree stays on screen beside the form.
|
|
271
|
+
const forms = (path, tag, load) => ({
|
|
272
|
+
path,
|
|
273
|
+
component: async () => {
|
|
274
|
+
await load()
|
|
275
|
+
return document.createElement(tag)
|
|
276
|
+
},
|
|
277
|
+
setup: () => this.#showing('structure'),
|
|
278
|
+
})
|
|
226
279
|
this._routes = [
|
|
280
|
+
forms('forms/entries', 'crombolo-forms-entries', () => import('./forms-entries.js')),
|
|
281
|
+
forms('forms', 'crombolo-forms-overview', () => import('./forms-overview.js')),
|
|
227
282
|
tree('structure'),
|
|
228
283
|
tree('code'),
|
|
229
284
|
// Umbraco's welcome, which this page replaces: an address people have.
|
|
230
285
|
{ path: 'dashboard/welcome', ...landing },
|
|
231
|
-
|
|
286
|
+
// Workflows moved beside forms (story 289): an address people have.
|
|
287
|
+
{
|
|
288
|
+
path: 'dashboard/workflows',
|
|
289
|
+
component: () => document.createElement('div'),
|
|
290
|
+
setup: () => {
|
|
291
|
+
history.replaceState(
|
|
292
|
+
null,
|
|
293
|
+
'',
|
|
294
|
+
new URL('section/forms/view/workflows', document.baseURI).pathname,
|
|
295
|
+
)
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
...(this.#held && !whole ? [] : dashboards),
|
|
232
299
|
...this.#sectionRoutes,
|
|
233
300
|
{ path: '', pathMatch: 'full', ...landing },
|
|
234
301
|
{ path: '**', component: UmbRouteNotFoundElement },
|
|
235
302
|
]
|
|
303
|
+
// The router keeps a page it already shows, so the cards need telling.
|
|
304
|
+
this.#refreshLanding()
|
|
236
305
|
}
|
|
237
306
|
|
|
238
307
|
#sectionPath() {
|
|
@@ -244,7 +313,13 @@ export class CromboloSettingsSectionElement extends UmbLitElement {
|
|
|
244
313
|
const section = this.#sectionPath()
|
|
245
314
|
const crumbs = (this._crumbs ?? []).map((c) => ({
|
|
246
315
|
label: c.label,
|
|
247
|
-
href: c.
|
|
316
|
+
href: c.home
|
|
317
|
+
? document.baseURI
|
|
318
|
+
: c.path === undefined
|
|
319
|
+
? undefined
|
|
320
|
+
: c.path
|
|
321
|
+
? `${section}/${c.path}`
|
|
322
|
+
: section,
|
|
248
323
|
}))
|
|
249
324
|
const main = html`<umb-section-main>
|
|
250
325
|
${
|
|
@@ -258,9 +333,21 @@ export class CromboloSettingsSectionElement extends UmbLitElement {
|
|
|
258
333
|
// Settings keeps its menus. A tree taken out and put back breaks: the trees
|
|
259
334
|
// share the section's expansion state, and a detached one still answers it.
|
|
260
335
|
return html`<umb-section-sidebar ?hidden=${!shown}>
|
|
336
|
+
${
|
|
337
|
+
this._tree === 'structure' && this._readOnly
|
|
338
|
+
? html`<p class="read-only" role="status">
|
|
339
|
+
${readOnlyWords('Content types, data types and languages', 'site')}
|
|
340
|
+
</p>`
|
|
341
|
+
: nothing
|
|
342
|
+
}
|
|
261
343
|
${(this._sidebarApps ?? []).map(
|
|
262
344
|
(app) => html`<div class="tree" ?hidden=${app.alias !== shown}>${app.component}</div>`,
|
|
263
345
|
)}
|
|
346
|
+
${
|
|
347
|
+
this._tree === 'structure' && this._mayForms
|
|
348
|
+
? html`<crombolo-definition-tree kind="Forms"></crombolo-definition-tree>`
|
|
349
|
+
: nothing
|
|
350
|
+
}
|
|
264
351
|
</umb-section-sidebar>
|
|
265
352
|
${main}`
|
|
266
353
|
}
|
|
@@ -291,6 +378,13 @@ export class CromboloSettingsSectionElement extends UmbLitElement {
|
|
|
291
378
|
min-height: 0;
|
|
292
379
|
overflow-y: auto;
|
|
293
380
|
}
|
|
381
|
+
.read-only {
|
|
382
|
+
margin: 0;
|
|
383
|
+
padding: var(--uui-size-space-3) var(--uui-size-space-4);
|
|
384
|
+
font-size: var(--uui-type-small-size);
|
|
385
|
+
line-height: 1.5;
|
|
386
|
+
color: var(--uui-color-text-alt);
|
|
387
|
+
}
|
|
294
388
|
.crumbs {
|
|
295
389
|
display: block;
|
|
296
390
|
padding: var(--uui-size-space-4) var(--uui-size-layout-1) 0;
|
|
@@ -317,18 +411,24 @@ export class CromboloSettingsLandingElement extends UmbLitElement {
|
|
|
317
411
|
#email() {
|
|
318
412
|
const status = this._email
|
|
319
413
|
if (!status || status.available) return nothing
|
|
320
|
-
return html`<
|
|
321
|
-
<
|
|
322
|
-
|
|
414
|
+
return html`<details class="banner" role="status">
|
|
415
|
+
<summary>
|
|
416
|
+
<uui-icon name="icon-alert"></uui-icon>
|
|
323
417
|
<strong>E-mail is not set up.</strong>
|
|
324
|
-
|
|
418
|
+
<uui-icon class="chevron" name="icon-navigation-right"></uui-icon>
|
|
419
|
+
</summary>
|
|
420
|
+
<div class="banner-details">
|
|
421
|
+
<p>${status.reason}</p>
|
|
325
422
|
${
|
|
326
423
|
status.affects?.length > 0
|
|
327
|
-
? html
|
|
424
|
+
? html`<p>Until it is, these are unavailable:</p>
|
|
425
|
+
<ul class="affected">
|
|
426
|
+
${status.affects.map((feature) => html`<li>${feature}</li>`)}
|
|
427
|
+
</ul>`
|
|
328
428
|
: nothing
|
|
329
429
|
}
|
|
330
|
-
</
|
|
331
|
-
</
|
|
430
|
+
</div>
|
|
431
|
+
</details>`
|
|
332
432
|
}
|
|
333
433
|
|
|
334
434
|
render() {
|
|
@@ -401,9 +501,6 @@ export class CromboloSettingsLandingElement extends UmbLitElement {
|
|
|
401
501
|
gap: var(--uui-size-space-5);
|
|
402
502
|
}
|
|
403
503
|
.banner {
|
|
404
|
-
display: flex;
|
|
405
|
-
gap: var(--uui-size-space-4);
|
|
406
|
-
align-items: flex-start;
|
|
407
504
|
margin-bottom: var(--uui-size-layout-1);
|
|
408
505
|
padding: var(--uui-size-space-4) var(--uui-size-space-5);
|
|
409
506
|
border: 1px solid color-mix(in srgb, var(--uui-color-warning) 45%, transparent);
|
|
@@ -412,15 +509,59 @@ export class CromboloSettingsLandingElement extends UmbLitElement {
|
|
|
412
509
|
background: color-mix(in srgb, var(--uui-color-warning) 12%, var(--uui-color-surface));
|
|
413
510
|
color: var(--uui-color-text);
|
|
414
511
|
}
|
|
512
|
+
.banner summary {
|
|
513
|
+
display: flex;
|
|
514
|
+
gap: var(--uui-size-space-4);
|
|
515
|
+
align-items: center;
|
|
516
|
+
cursor: pointer;
|
|
517
|
+
list-style: none;
|
|
518
|
+
}
|
|
519
|
+
.banner summary::-webkit-details-marker {
|
|
520
|
+
display: none;
|
|
521
|
+
}
|
|
522
|
+
.banner summary:focus-visible {
|
|
523
|
+
outline: 2px solid var(--uui-color-focus);
|
|
524
|
+
outline-offset: 2px;
|
|
525
|
+
}
|
|
415
526
|
.banner uui-icon {
|
|
416
527
|
flex: none;
|
|
417
|
-
margin-top: 0.15em;
|
|
418
528
|
color: var(--uui-color-warning-standalone, var(--uui-color-warning));
|
|
419
529
|
}
|
|
530
|
+
.banner .chevron {
|
|
531
|
+
margin-left: auto;
|
|
532
|
+
transition: transform 120ms;
|
|
533
|
+
}
|
|
534
|
+
.banner[open] .chevron {
|
|
535
|
+
transform: rotate(90deg);
|
|
536
|
+
}
|
|
537
|
+
.banner-details {
|
|
538
|
+
margin-top: var(--uui-size-space-3);
|
|
539
|
+
padding-left: calc(1em + var(--uui-size-space-4));
|
|
540
|
+
}
|
|
420
541
|
.banner p {
|
|
421
|
-
margin: 0;
|
|
542
|
+
margin: 0 0 var(--uui-size-space-2);
|
|
422
543
|
line-height: 1.5;
|
|
423
544
|
}
|
|
545
|
+
.affected {
|
|
546
|
+
margin: 0;
|
|
547
|
+
padding: 0;
|
|
548
|
+
list-style: none;
|
|
549
|
+
}
|
|
550
|
+
.affected li {
|
|
551
|
+
position: relative;
|
|
552
|
+
padding-left: var(--uui-size-space-5);
|
|
553
|
+
line-height: 1.6;
|
|
554
|
+
}
|
|
555
|
+
.affected li::before {
|
|
556
|
+
content: '';
|
|
557
|
+
position: absolute;
|
|
558
|
+
left: 0.2em;
|
|
559
|
+
top: 0.6em;
|
|
560
|
+
width: 0.45em;
|
|
561
|
+
height: 0.45em;
|
|
562
|
+
border-radius: 50%;
|
|
563
|
+
background: var(--uui-color-warning-standalone, var(--uui-color-warning));
|
|
564
|
+
}
|
|
424
565
|
`,
|
|
425
566
|
]
|
|
426
567
|
}
|