@crombolo/backoffice-host 0.43.1 → 0.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/plugin/app-preview/umbraco-package.json +1 -1
- package/plugin/branding/theme-dark.css +2 -0
- package/plugin/branding/theme.css +3 -0
- package/plugin/bundle-editor.js +1 -1
- package/plugin/bundles-created-overview.js +1 -1
- package/plugin/bundles-created.js +13 -4
- package/plugin/bundles-installed.js +3 -3
- package/plugin/bundles-marketplace.js +2 -2
- package/plugin/bundles-tool.js +79 -0
- package/plugin/ci-access-words.js +57 -0
- package/plugin/ci-access.js +270 -0
- package/plugin/form-picker-options.js +61 -5
- package/plugin/form-picker.js +27 -18
- package/plugin/form-type-note.js +53 -0
- package/plugin/forms-client.js +6 -0
- package/plugin/forms-entries.js +39 -0
- package/plugin/localizations/umbraco-package.json +1 -1
- package/plugin/overview-dashboard.js +4 -4
- package/plugin/seo/umbraco-package.json +1 -1
- package/plugin/settings-card.js +57 -0
- package/plugin/settings-cards.js +67 -17
- package/plugin/settings-section.js +57 -27
- package/plugin/sign-in/umbraco-package.json +1 -1
- package/plugin/umbraco-package.json +42 -40
- package/src/extensions.ts +7 -3
package/plugin/form-picker.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The Form Picker property editor.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* It picks a Library form (story 239), the editor's words over a form a
|
|
5
|
+
* developer defined in `schema/forms/`, and stores its key. A page saved before
|
|
6
|
+
* Library forms stores a form's own key, which still renders in that form's
|
|
7
|
+
* own words.
|
|
8
8
|
*/
|
|
9
9
|
import { css, html, nothing } from '@umbraco-cms/backoffice/external/lit'
|
|
10
10
|
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'
|
|
11
|
-
import { formPickerOptions, NO_FORM_VALUE } from './form-picker-options.js'
|
|
12
|
-
import { listForms, readForm } from './forms-client.js'
|
|
11
|
+
import { formPickerOptions, NO_FORM_VALUE, pickedForm } from './form-picker-options.js'
|
|
12
|
+
import { listForms, listLibraryForms, readForm } from './forms-client.js'
|
|
13
13
|
|
|
14
14
|
export default class CromboloFormPickerElement extends UmbLitElement {
|
|
15
15
|
static properties = {
|
|
@@ -29,10 +29,10 @@ export default class CromboloFormPickerElement extends UmbLitElement {
|
|
|
29
29
|
|
|
30
30
|
connectedCallback() {
|
|
31
31
|
super.connectedCallback()
|
|
32
|
-
listForms().then(
|
|
33
|
-
(
|
|
32
|
+
Promise.all([listForms(), listLibraryForms()]).then(
|
|
33
|
+
([forms, libraryForms]) => {
|
|
34
34
|
this._failed = false
|
|
35
|
-
this._items =
|
|
35
|
+
this._items = { forms, libraryForms }
|
|
36
36
|
},
|
|
37
37
|
() => {
|
|
38
38
|
this._failed = true
|
|
@@ -45,14 +45,16 @@ export default class CromboloFormPickerElement extends UmbLitElement {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
async #loadFields() {
|
|
48
|
-
const
|
|
48
|
+
const value = this.value
|
|
49
49
|
this._detail = undefined
|
|
50
|
-
|
|
50
|
+
const picked = this._items && pickedForm(this._items, value)
|
|
51
|
+
if (!picked) return
|
|
52
|
+
const key = picked.form.key
|
|
51
53
|
try {
|
|
52
54
|
const detail = await readForm(key)
|
|
53
|
-
if (this.value ===
|
|
55
|
+
if (this.value === value) this._detail = { key: value, definition: detail.definition }
|
|
54
56
|
} catch {
|
|
55
|
-
if (this.value ===
|
|
57
|
+
if (this.value === value) this._detail = { key: value, failed: true }
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
60
|
|
|
@@ -72,10 +74,14 @@ export default class CromboloFormPickerElement extends UmbLitElement {
|
|
|
72
74
|
render() {
|
|
73
75
|
if (this._failed) return html`<uui-box><p>The list of forms could not be loaded.</p></uui-box>`
|
|
74
76
|
if (this._items === undefined) return html`<uui-loader></uui-loader>`
|
|
75
|
-
if (this._items.length === 0 && !this.value)
|
|
77
|
+
if (this._items.libraryForms.length === 0 && !this.value)
|
|
76
78
|
return html`
|
|
77
79
|
<p class="empty">
|
|
78
|
-
|
|
80
|
+
${
|
|
81
|
+
this._items.forms.length === 0
|
|
82
|
+
? 'This site has no forms yet. A developer adds them in the Forms section.'
|
|
83
|
+
: 'No Library forms yet. Create one in the Library, then pick it here.'
|
|
84
|
+
}
|
|
79
85
|
</p>
|
|
80
86
|
`
|
|
81
87
|
return html`
|
|
@@ -86,7 +92,7 @@ export default class CromboloFormPickerElement extends UmbLitElement {
|
|
|
86
92
|
></uui-select>
|
|
87
93
|
${this.value ? html`<p class="detail">${this.#describe()}</p>` : nothing}
|
|
88
94
|
${
|
|
89
|
-
this._items
|
|
95
|
+
pickedForm(this._items, this.value)
|
|
90
96
|
? html`<details>
|
|
91
97
|
<summary>View form fields</summary>
|
|
92
98
|
${this.#fields()}
|
|
@@ -97,8 +103,11 @@ export default class CromboloFormPickerElement extends UmbLitElement {
|
|
|
97
103
|
}
|
|
98
104
|
|
|
99
105
|
#describe() {
|
|
100
|
-
const
|
|
101
|
-
if (!
|
|
106
|
+
const picked = this._items && pickedForm(this._items, this.value)
|
|
107
|
+
if (!picked) return 'The selected form is no longer available.'
|
|
108
|
+
const { form, library } = picked
|
|
109
|
+
if (library && !library.published)
|
|
110
|
+
return 'Not published yet: the page shows no form until it is.'
|
|
102
111
|
const fields = `${form.fieldCount} field${form.fieldCount === 1 ? '' : 's'}`
|
|
103
112
|
const pages = `${form.pageCount} page${form.pageCount === 1 ? '' : 's'}`
|
|
104
113
|
return `${fields} over ${pages}${form.storeEntries ? '' : '; entries are not stored'}`
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A note in the document-type workspace footer for a type made from a form
|
|
3
|
+
* (story 239): it follows the form, so it is changed there, and saving it here
|
|
4
|
+
* is refused.
|
|
5
|
+
*/
|
|
6
|
+
import { UMB_DOCUMENT_TYPE_WORKSPACE_CONTEXT } from '@umbraco-cms/backoffice/document-type'
|
|
7
|
+
import { UmbElementMixin } from '@umbraco-cms/backoffice/element-api'
|
|
8
|
+
import { css, html, LitElement, nothing } from '@umbraco-cms/backoffice/external/lit'
|
|
9
|
+
import { listLibraryTypes } from './forms-client.js'
|
|
10
|
+
|
|
11
|
+
export default class CromboloFormTypeNoteElement extends UmbElementMixin(LitElement) {
|
|
12
|
+
static properties = { _formName: { state: true } }
|
|
13
|
+
|
|
14
|
+
constructor() {
|
|
15
|
+
super()
|
|
16
|
+
this._formName = undefined
|
|
17
|
+
this.consumeContext(UMB_DOCUMENT_TYPE_WORKSPACE_CONTEXT, (context) => {
|
|
18
|
+
if (!context) return
|
|
19
|
+
this.observe(context.unique, (unique) => this.#lookUp(unique))
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async #lookUp(unique) {
|
|
24
|
+
this._formName = undefined
|
|
25
|
+
if (!unique) return
|
|
26
|
+
try {
|
|
27
|
+
const made = (await listLibraryTypes()).find((item) => item.typeKey === unique)
|
|
28
|
+
this._formName = made?.formName
|
|
29
|
+
} catch {
|
|
30
|
+
// Without the list there is nothing to say; the server still refuses a save.
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
render() {
|
|
35
|
+
if (!this._formName) return nothing
|
|
36
|
+
return html`<uui-tag
|
|
37
|
+
color="default"
|
|
38
|
+
look="secondary"
|
|
39
|
+
title="This type follows the ${this._formName} form. Change the form in Forms, and this type changes with it."
|
|
40
|
+
>
|
|
41
|
+
Made from the ${this._formName} form: change it in Forms
|
|
42
|
+
</uui-tag>`
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static styles = css`
|
|
46
|
+
:host {
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
}
|
|
50
|
+
`
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
customElements.define('crombolo-form-type-note', CromboloFormTypeNoteElement)
|
package/plugin/forms-client.js
CHANGED
|
@@ -27,6 +27,12 @@ const call = async (path, init) => {
|
|
|
27
27
|
|
|
28
28
|
export const listForms = async () => (await call('')).body.items ?? []
|
|
29
29
|
|
|
30
|
+
/** The content types made from forms (story 239), by key, with each form's name. */
|
|
31
|
+
export const listLibraryTypes = async () => (await call('/library-types')).body.items ?? []
|
|
32
|
+
|
|
33
|
+
/** Every Library form (story 239), with the form each is made from. */
|
|
34
|
+
export const listLibraryForms = async () => (await call('/library-forms')).body.items ?? []
|
|
35
|
+
|
|
30
36
|
/** The field and workflow types this site has, built in and from its bundles. */
|
|
31
37
|
export const listFormTypes = async () => (await call('/available-types')).body
|
|
32
38
|
|
package/plugin/forms-entries.js
CHANGED
|
@@ -10,11 +10,13 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { css, html, nothing, repeat } from '@umbraco-cms/backoffice/external/lit'
|
|
12
12
|
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'
|
|
13
|
+
import { entriesLibraryOptions } from './form-picker-options.js'
|
|
13
14
|
import {
|
|
14
15
|
deleteEntry,
|
|
15
16
|
downloadEntriesCsv,
|
|
16
17
|
listEntries,
|
|
17
18
|
listForms,
|
|
19
|
+
listLibraryForms,
|
|
18
20
|
setEntryState,
|
|
19
21
|
} from './forms-client.js'
|
|
20
22
|
|
|
@@ -22,6 +24,8 @@ export default class CromboloFormsEntriesElement extends UmbLitElement {
|
|
|
22
24
|
static properties = {
|
|
23
25
|
_forms: { state: true },
|
|
24
26
|
_selected: { state: true },
|
|
27
|
+
_libraryForms: { state: true },
|
|
28
|
+
_library: { state: true },
|
|
25
29
|
_entries: { state: true },
|
|
26
30
|
_total: { state: true },
|
|
27
31
|
_state: { state: true },
|
|
@@ -34,6 +38,8 @@ export default class CromboloFormsEntriesElement extends UmbLitElement {
|
|
|
34
38
|
super()
|
|
35
39
|
this._forms = undefined
|
|
36
40
|
this._selected = ''
|
|
41
|
+
this._libraryForms = []
|
|
42
|
+
this._library = ''
|
|
37
43
|
this._entries = []
|
|
38
44
|
this._total = 0
|
|
39
45
|
this._state = ''
|
|
@@ -44,6 +50,13 @@ export default class CromboloFormsEntriesElement extends UmbLitElement {
|
|
|
44
50
|
|
|
45
51
|
connectedCallback() {
|
|
46
52
|
super.connectedCallback()
|
|
53
|
+
// Only for the filter and the names on entries: a failure leaves both out.
|
|
54
|
+
listLibraryForms().then(
|
|
55
|
+
(items) => {
|
|
56
|
+
this._libraryForms = items
|
|
57
|
+
},
|
|
58
|
+
() => {},
|
|
59
|
+
)
|
|
47
60
|
listForms().then(
|
|
48
61
|
(forms) => {
|
|
49
62
|
this._forms = forms
|
|
@@ -62,6 +75,7 @@ export default class CromboloFormsEntriesElement extends UmbLitElement {
|
|
|
62
75
|
try {
|
|
63
76
|
const page = await listEntries(this._selected, {
|
|
64
77
|
state: this._state,
|
|
78
|
+
library: this._library,
|
|
65
79
|
search: this._search,
|
|
66
80
|
includeSpam: this._includeSpam ? 'true' : '',
|
|
67
81
|
take: 200,
|
|
@@ -94,6 +108,23 @@ export default class CromboloFormsEntriesElement extends UmbLitElement {
|
|
|
94
108
|
}
|
|
95
109
|
}
|
|
96
110
|
|
|
111
|
+
#libraryFilter() {
|
|
112
|
+
const options = entriesLibraryOptions(this._libraryForms, this._selected, this._library)
|
|
113
|
+
if (options.length === 0) return nothing
|
|
114
|
+
return html`<uui-select
|
|
115
|
+
label="Library form"
|
|
116
|
+
.options=${options}
|
|
117
|
+
@change=${(event) => {
|
|
118
|
+
this._library = event.target.value
|
|
119
|
+
this.#load()
|
|
120
|
+
}}
|
|
121
|
+
></uui-select>`
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
#libraryName(key) {
|
|
125
|
+
return this._libraryForms.find((item) => item.key === key)?.name ?? 'A deleted Library form'
|
|
126
|
+
}
|
|
127
|
+
|
|
97
128
|
render() {
|
|
98
129
|
if (this._forms === undefined) return html`<uui-loader></uui-loader>`
|
|
99
130
|
if (this._forms.length === 0)
|
|
@@ -111,9 +142,11 @@ export default class CromboloFormsEntriesElement extends UmbLitElement {
|
|
|
111
142
|
}))}
|
|
112
143
|
@change=${(event) => {
|
|
113
144
|
this._selected = event.target.value
|
|
145
|
+
this._library = ''
|
|
114
146
|
this.#load()
|
|
115
147
|
}}
|
|
116
148
|
></uui-select>
|
|
149
|
+
${this.#libraryFilter()}
|
|
117
150
|
<uui-select
|
|
118
151
|
label="State"
|
|
119
152
|
.options=${[
|
|
@@ -172,6 +205,11 @@ export default class CromboloFormsEntriesElement extends UmbLitElement {
|
|
|
172
205
|
<strong>${new Date(entry.createDate).toLocaleString()}</strong>
|
|
173
206
|
<span class="state">${entry.state}</span>
|
|
174
207
|
${entry.spam ? html`<span class="spam">spam</span>` : nothing}
|
|
208
|
+
${
|
|
209
|
+
entry.libraryKey
|
|
210
|
+
? html`<span class="library">${this.#libraryName(entry.libraryKey)}</span>`
|
|
211
|
+
: nothing
|
|
212
|
+
}
|
|
175
213
|
</div>
|
|
176
214
|
<dl>
|
|
177
215
|
${entry.values.map(
|
|
@@ -223,6 +261,7 @@ export default class CromboloFormsEntriesElement extends UmbLitElement {
|
|
|
223
261
|
align-items: baseline;
|
|
224
262
|
}
|
|
225
263
|
.state,
|
|
264
|
+
.library,
|
|
226
265
|
.spam {
|
|
227
266
|
font-size: var(--uui-type-small-size, 0.8rem);
|
|
228
267
|
text-transform: uppercase;
|
|
@@ -93,7 +93,7 @@ export default class CromboloOverviewDashboardElement extends UmbLitElement {
|
|
|
93
93
|
return html`
|
|
94
94
|
<header>
|
|
95
95
|
<h1>Overview</h1>
|
|
96
|
-
<p>${name ? `Welcome back, ${name}. ` : ''}Here’s what’s happening
|
|
96
|
+
<p>${name ? `Welcome back, ${name}. ` : ''}Here’s what’s happening in Crombolo.</p>
|
|
97
97
|
</header>
|
|
98
98
|
${this._error ? html`<uui-box><p class="error">${this._error}</p></uui-box>` : nothing}
|
|
99
99
|
<div class="grid">
|
|
@@ -102,7 +102,7 @@ export default class CromboloOverviewDashboardElement extends UmbLitElement {
|
|
|
102
102
|
<button class="new" type="button" @click=${() => this.#newPage()}>
|
|
103
103
|
<span>
|
|
104
104
|
<strong>New content</strong>
|
|
105
|
-
<small>
|
|
105
|
+
<small>Create a new page</small>
|
|
106
106
|
</span>
|
|
107
107
|
<uui-icon name="icon-add"></uui-icon>
|
|
108
108
|
</button>
|
|
@@ -176,7 +176,7 @@ export default class CromboloOverviewDashboardElement extends UmbLitElement {
|
|
|
176
176
|
#emptyText() {
|
|
177
177
|
if (this._list === 'drafts') return 'No drafts: every page you can see is published.'
|
|
178
178
|
if (this._list === 'published') return 'Nothing is published yet.'
|
|
179
|
-
return 'No pages yet
|
|
179
|
+
return 'No pages created yet'
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
#renderStats() {
|
|
@@ -212,7 +212,7 @@ export default class CromboloOverviewDashboardElement extends UmbLitElement {
|
|
|
212
212
|
!activity
|
|
213
213
|
? html`<uui-loader></uui-loader>`
|
|
214
214
|
: activity.length === 0
|
|
215
|
-
? html`<p class="empty">
|
|
215
|
+
? html`<p class="empty">No recent activity</p>`
|
|
216
216
|
: html`<ul class="feed">
|
|
217
217
|
${activity.map(
|
|
218
218
|
(a) => html`<li>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One card on the Settings landing page (story 234): a link headed by its title
|
|
3
|
+
* on a dark band, with what it opens beneath.
|
|
4
|
+
*/
|
|
5
|
+
import { css, html, nothing } from '@umbraco-cms/backoffice/external/lit'
|
|
6
|
+
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'
|
|
7
|
+
|
|
8
|
+
export class CromboloSettingsCardElement extends UmbLitElement {
|
|
9
|
+
static properties = { href: {}, heading: {}, description: {} }
|
|
10
|
+
|
|
11
|
+
render() {
|
|
12
|
+
return html`<a href=${this.href}>
|
|
13
|
+
<strong>${this.heading}</strong>
|
|
14
|
+
${this.description ? html`<span>${this.description}</span>` : nothing}
|
|
15
|
+
</a>`
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static styles = css`
|
|
19
|
+
:host {
|
|
20
|
+
display: block;
|
|
21
|
+
}
|
|
22
|
+
a {
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
height: 100%;
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
background: var(--uui-color-surface);
|
|
29
|
+
border: 1px solid var(--uui-color-border);
|
|
30
|
+
border-radius: 12px;
|
|
31
|
+
box-shadow: var(--crombolo-card-shadow, none);
|
|
32
|
+
color: var(--uui-color-text);
|
|
33
|
+
text-decoration: none;
|
|
34
|
+
}
|
|
35
|
+
a:hover,
|
|
36
|
+
a:focus-visible {
|
|
37
|
+
border-color: var(--uui-color-interactive-emphasis);
|
|
38
|
+
}
|
|
39
|
+
a:focus-visible {
|
|
40
|
+
outline: 2px solid var(--uui-color-focus);
|
|
41
|
+
outline-offset: 2px;
|
|
42
|
+
}
|
|
43
|
+
strong {
|
|
44
|
+
padding: var(--uui-size-space-4) var(--uui-size-space-5);
|
|
45
|
+
background: var(--crombolo-card-header-background, var(--uui-color-header-surface));
|
|
46
|
+
color: var(--crombolo-card-header-text, var(--uui-color-header-contrast-emphasis));
|
|
47
|
+
font-weight: 700;
|
|
48
|
+
}
|
|
49
|
+
span {
|
|
50
|
+
padding: var(--uui-size-space-4) var(--uui-size-space-5) var(--uui-size-space-5);
|
|
51
|
+
color: var(--uui-color-text-alt);
|
|
52
|
+
font-size: var(--uui-type-small-size);
|
|
53
|
+
}
|
|
54
|
+
`
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
customElements.define('crombolo-settings-card', CromboloSettingsCardElement)
|
package/plugin/settings-cards.js
CHANGED
|
@@ -13,7 +13,7 @@ export const SIDEBAR_APPS = {
|
|
|
13
13
|
code: 'Umb.SectionSidebarMenu.Templating',
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export const GROUPS = ['Build', 'Site', 'Health', 'History', 'Other']
|
|
16
|
+
export const GROUPS = ['Build', '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 = {
|
|
@@ -74,11 +74,6 @@ export const CARDS = {
|
|
|
74
74
|
title: 'Background jobs',
|
|
75
75
|
description: 'Scheduled and queued work, how far each got, and running a failed one again.',
|
|
76
76
|
},
|
|
77
|
-
'Umb.MenuItem.Extensions': {
|
|
78
|
-
group: 'Site',
|
|
79
|
-
title: 'Extensions',
|
|
80
|
-
description: 'What the back office has loaded, and from which package.',
|
|
81
|
-
},
|
|
82
77
|
'Umb.Dashboard.HealthCheck': {
|
|
83
78
|
group: 'Health',
|
|
84
79
|
title: 'Health check',
|
|
@@ -104,28 +99,60 @@ export const CARDS = {
|
|
|
104
99
|
title: 'Audit log',
|
|
105
100
|
description: 'Who did what, when and from where.',
|
|
106
101
|
},
|
|
102
|
+
// Story 238: a developer's view of what is loaded, apart from installing bundles.
|
|
103
|
+
'Umb.MenuItem.Extensions': {
|
|
104
|
+
group: 'Developers',
|
|
105
|
+
title: 'Extension insights',
|
|
106
|
+
description: 'What the back office has loaded, and from which bundle.',
|
|
107
|
+
},
|
|
108
|
+
'Crombolo.Dashboard.CiAccess': {
|
|
109
|
+
group: 'Developers',
|
|
110
|
+
title: 'CI access',
|
|
111
|
+
description: 'The CI jobs that may pull and push here without a person, and what each may do.',
|
|
112
|
+
},
|
|
113
|
+
'Crombolo.Dashboard.Bundles': {
|
|
114
|
+
group: 'Extensions',
|
|
115
|
+
title: 'Bundles',
|
|
116
|
+
description: 'Find, install and build bundles: what they add, and turning them off.',
|
|
117
|
+
},
|
|
107
118
|
}
|
|
108
119
|
|
|
109
120
|
/**
|
|
110
121
|
* The landing page's groups, in order, each with its cards in the order above.
|
|
111
|
-
* `dashboards` are `{ alias, label, path }`; `advanced`
|
|
112
|
-
*
|
|
113
|
-
*
|
|
122
|
+
* `dashboards` are `{ alias, label, description?, bundle?, path }`; `advanced`
|
|
123
|
+
* are `{ alias, label, description?, bundle?, entityType }`. A card this file
|
|
124
|
+
* has no words for takes its manifest's description, and a bundle's card goes
|
|
125
|
+
* under the bundle's name, its group linking to the bundle. `structure` and `code` say whether the user may
|
|
126
|
+
* open an item of that tree. Paths are relative to the section.
|
|
114
127
|
*
|
|
115
128
|
* @param {{
|
|
116
|
-
* dashboards?: { alias: string, label?: string, path: string }[],
|
|
117
|
-
* advanced?: { alias: string, label?: string, entityType: string }[],
|
|
129
|
+
* dashboards?: { alias: string, label?: string, description?: string, bundle?: { name: string, packageName: string }, path: string }[],
|
|
130
|
+
* advanced?: { alias: string, label?: string, description?: string, bundle?: { name: string, packageName: string }, entityType: string }[],
|
|
118
131
|
* structure?: boolean,
|
|
119
132
|
* code?: boolean,
|
|
120
133
|
* }} from
|
|
134
|
+
* @returns {{ group: string, bundle?: { name: string, packageName: string, path: string }, cards: any[] }[]}
|
|
121
135
|
*/
|
|
122
136
|
export function settingsCards({ dashboards = [], advanced = [], structure = false, code = false }) {
|
|
123
137
|
const found = []
|
|
124
138
|
if (structure) found.push({ alias: 'structure', path: 'structure' })
|
|
125
139
|
if (code) found.push({ alias: 'code', path: 'code' })
|
|
126
|
-
for (const d of dashboards)
|
|
140
|
+
for (const d of dashboards)
|
|
141
|
+
found.push({
|
|
142
|
+
alias: d.alias,
|
|
143
|
+
label: d.label,
|
|
144
|
+
description: d.description,
|
|
145
|
+
bundle: d.bundle,
|
|
146
|
+
path: d.path,
|
|
147
|
+
})
|
|
127
148
|
for (const item of advanced)
|
|
128
|
-
found.push({
|
|
149
|
+
found.push({
|
|
150
|
+
alias: item.alias,
|
|
151
|
+
label: item.label,
|
|
152
|
+
description: item.description,
|
|
153
|
+
bundle: item.bundle,
|
|
154
|
+
path: `workspace/${item.entityType}`,
|
|
155
|
+
})
|
|
129
156
|
|
|
130
157
|
const order = Object.keys(CARDS)
|
|
131
158
|
const cards = found
|
|
@@ -133,15 +160,38 @@ export function settingsCards({ dashboards = [], advanced = [], structure = fals
|
|
|
133
160
|
const words = CARDS[card.alias]
|
|
134
161
|
return words
|
|
135
162
|
? { alias: card.alias, path: card.path, ...words }
|
|
136
|
-
: {
|
|
163
|
+
: {
|
|
164
|
+
alias: card.alias,
|
|
165
|
+
path: card.path,
|
|
166
|
+
group: card.bundle?.name ?? 'Other',
|
|
167
|
+
bundle: card.bundle,
|
|
168
|
+
title: card.label ?? card.alias,
|
|
169
|
+
description: card.description,
|
|
170
|
+
}
|
|
137
171
|
})
|
|
138
172
|
.sort((a, b) => rank(order, a.alias) - rank(order, b.alias))
|
|
139
173
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
174
|
+
const builtIn = GROUPS.map((group) => ({
|
|
175
|
+
group,
|
|
176
|
+
cards: cards.filter((c) => !c.bundle && c.group === group),
|
|
177
|
+
}))
|
|
178
|
+
// A bundle's cards are a group of their own, after ours, by the bundle's name.
|
|
179
|
+
const bundles = [
|
|
180
|
+
...new Map(cards.flatMap((c) => (c.bundle ? [[c.bundle.packageName, c.bundle]] : []))).values(),
|
|
181
|
+
]
|
|
182
|
+
.sort((a, b) => a.name.localeCompare(b.name))
|
|
183
|
+
.map((bundle) => ({
|
|
184
|
+
group: bundle.name,
|
|
185
|
+
bundle: { ...bundle, path: bundlePath(bundle.packageName) },
|
|
186
|
+
cards: cards.filter((c) => c.bundle?.packageName === bundle.packageName),
|
|
187
|
+
}))
|
|
188
|
+
return [...builtIn, ...bundles].filter((g) => g.cards.length > 0)
|
|
143
189
|
}
|
|
144
190
|
|
|
191
|
+
/** Where the Bundles section shows an installed bundle, relative to the back office. */
|
|
192
|
+
export const bundlePath = (packageName) =>
|
|
193
|
+
`section/settings/dashboard/bundles/installed?bundle=${encodeURIComponent(packageName)}`
|
|
194
|
+
|
|
145
195
|
const rank = (order, alias) => {
|
|
146
196
|
const at = order.indexOf(alias)
|
|
147
197
|
return at === -1 ? order.length : at
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
treeFor,
|
|
31
31
|
} from './settings-cards.js'
|
|
32
32
|
import './breadcrumb.js'
|
|
33
|
+
import './settings-card.js'
|
|
33
34
|
|
|
34
35
|
const base = () =>
|
|
35
36
|
(document.querySelector('base')?.getAttribute('href') ?? '/umbraco/').replace(/\/$/, '')
|
|
@@ -134,6 +135,11 @@ export class CromboloSettingsSectionElement extends UmbLitElement {
|
|
|
134
135
|
return this.localize.string(label)
|
|
135
136
|
}
|
|
136
137
|
|
|
138
|
+
#description(manifest) {
|
|
139
|
+
const text = manifest.meta?.description
|
|
140
|
+
return text ? this.localize.string(text) : undefined
|
|
141
|
+
}
|
|
142
|
+
|
|
137
143
|
#dashboardPath(manifest) {
|
|
138
144
|
return `dashboard/${manifest.meta?.pathname || pathFolderName(manifest.meta?.label ?? manifest.name ?? manifest.alias)}`
|
|
139
145
|
}
|
|
@@ -143,6 +149,8 @@ export class CromboloSettingsSectionElement extends UmbLitElement {
|
|
|
143
149
|
dashboards: this.#dashboards.map((d) => ({
|
|
144
150
|
alias: d.alias,
|
|
145
151
|
label: this.#label(d),
|
|
152
|
+
description: this.#description(d),
|
|
153
|
+
bundle: d.cromboloBundle,
|
|
146
154
|
path: this.#dashboardPath(d),
|
|
147
155
|
})),
|
|
148
156
|
advanced: this.#advanced(),
|
|
@@ -164,7 +172,13 @@ export class CromboloSettingsSectionElement extends UmbLitElement {
|
|
|
164
172
|
#advanced() {
|
|
165
173
|
return this.#menuItems
|
|
166
174
|
.filter((m) => menuOf(m, ADVANCED_MENU))
|
|
167
|
-
.map((m) => ({
|
|
175
|
+
.map((m) => ({
|
|
176
|
+
alias: m.alias,
|
|
177
|
+
label: this.#label(m),
|
|
178
|
+
description: this.#description(m),
|
|
179
|
+
bundle: m.cromboloBundle,
|
|
180
|
+
entityType: m.meta?.entityType,
|
|
181
|
+
}))
|
|
168
182
|
}
|
|
169
183
|
|
|
170
184
|
#viewContext(manifest) {
|
|
@@ -269,6 +283,14 @@ export class CromboloSettingsSectionElement extends UmbLitElement {
|
|
|
269
283
|
umb-section-main {
|
|
270
284
|
flex: 1 1 auto;
|
|
271
285
|
}
|
|
286
|
+
/* Umbraco's own views scroll inside their layout; the landing page and a
|
|
287
|
+
tree's start page have none, so the area under the trail scrolls them. */
|
|
288
|
+
umb-router-slot {
|
|
289
|
+
display: block;
|
|
290
|
+
flex: 1 1 auto;
|
|
291
|
+
min-height: 0;
|
|
292
|
+
overflow-y: auto;
|
|
293
|
+
}
|
|
272
294
|
.crumbs {
|
|
273
295
|
display: block;
|
|
274
296
|
padding: var(--uui-size-space-4) var(--uui-size-layout-1) 0;
|
|
@@ -313,14 +335,25 @@ export class CromboloSettingsLandingElement extends UmbLitElement {
|
|
|
313
335
|
return html`
|
|
314
336
|
${this.#email()}
|
|
315
337
|
${(this.groups ?? []).map(
|
|
316
|
-
({ group, cards }) => html`<section>
|
|
317
|
-
<h2
|
|
338
|
+
({ group, bundle, cards }) => html`<section>
|
|
339
|
+
<h2>
|
|
340
|
+
${group}
|
|
341
|
+
${
|
|
342
|
+
bundle
|
|
343
|
+
? html`<a class="tag" href=${bundle.path} title=${`The ${bundle.name} bundle, which adds these`}
|
|
344
|
+
>Bundle: ${bundle.packageName}</a
|
|
345
|
+
>`
|
|
346
|
+
: nothing
|
|
347
|
+
}
|
|
348
|
+
</h2>
|
|
318
349
|
<div class="cards">
|
|
319
350
|
${cards.map(
|
|
320
|
-
(card) =>
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
351
|
+
(card) =>
|
|
352
|
+
html`<crombolo-settings-card
|
|
353
|
+
href=${`section/settings/${card.path}`}
|
|
354
|
+
heading=${card.title}
|
|
355
|
+
description=${card.description ?? ''}
|
|
356
|
+
></crombolo-settings-card>`,
|
|
324
357
|
)}
|
|
325
358
|
</div>
|
|
326
359
|
</section>`,
|
|
@@ -345,30 +378,27 @@ export class CromboloSettingsLandingElement extends UmbLitElement {
|
|
|
345
378
|
letter-spacing: -0.01em;
|
|
346
379
|
margin: 0 0 var(--uui-size-space-4);
|
|
347
380
|
}
|
|
348
|
-
.
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
background: var(--uui-color-surface);
|
|
359
|
-
border: 1px solid var(--uui-color-border);
|
|
360
|
-
border-radius: 12px;
|
|
361
|
-
box-shadow: var(--crombolo-card-shadow, none);
|
|
362
|
-
color: var(--uui-color-text);
|
|
381
|
+
h2 .tag {
|
|
382
|
+
margin-left: var(--uui-size-space-2);
|
|
383
|
+
padding: 0.1em 0.6em;
|
|
384
|
+
border: 1px solid var(--uui-color-border-standalone);
|
|
385
|
+
border-radius: 999px;
|
|
386
|
+
color: var(--uui-color-text-alt);
|
|
387
|
+
font-size: var(--uui-type-small-size);
|
|
388
|
+
font-weight: 600;
|
|
389
|
+
letter-spacing: 0;
|
|
390
|
+
vertical-align: middle;
|
|
363
391
|
text-decoration: none;
|
|
364
392
|
}
|
|
365
|
-
.
|
|
366
|
-
.
|
|
393
|
+
h2 a.tag:hover,
|
|
394
|
+
h2 a.tag:focus-visible {
|
|
367
395
|
border-color: var(--uui-color-interactive-emphasis);
|
|
396
|
+
color: var(--uui-color-interactive-emphasis);
|
|
368
397
|
}
|
|
369
|
-
.
|
|
370
|
-
|
|
371
|
-
|
|
398
|
+
.cards {
|
|
399
|
+
display: grid;
|
|
400
|
+
grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
|
|
401
|
+
gap: var(--uui-size-space-5);
|
|
372
402
|
}
|
|
373
403
|
.banner {
|
|
374
404
|
display: flex;
|