@crombolo/backoffice-host 0.60.0 → 0.62.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/localization-en.js +1 -2
- package/plugin/bundles-activity-words.js +72 -0
- package/plugin/bundles-activity.js +171 -0
- package/plugin/bundles-client.js +30 -6
- package/plugin/bundles-installed.js +179 -69
- package/plugin/bundles-level-words.js +79 -0
- package/plugin/bundles-level.js +91 -0
- package/plugin/bundles-marketplace.js +64 -84
- package/plugin/content-strip-items.js +5 -13
- package/plugin/extension-screen-model.js +124 -0
- package/plugin/extension-screen.js +551 -0
- package/plugin/forms-client.js +7 -0
- package/plugin/forms-overview.js +79 -0
- package/plugin/forms-workflows.js +18 -0
- package/plugin/localizations/umbraco-package.json +1 -1
- package/plugin/seo/umbraco-package.json +1 -1
- package/plugin/settings-section.js +1 -31
- package/plugin/sign-in/umbraco-package.json +1 -1
- package/plugin/template-picker.js +3 -3
- package/plugin/umbraco-package.json +4 -34
- package/src/bundle-package.ts +105 -13
- package/src/bundle-permissions.ts +152 -6
- package/src/extension-roots.ts +128 -0
- package/src/extensions.ts +24 -1
- package/src/index.ts +1 -0
- package/src/manifests.ts +12 -1
- package/src/registry.ts +1 -0
- package/plugin/bundles-backoffice-code-words.js +0 -34
- package/plugin/bundles-backoffice-code.js +0 -51
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crombolo/backoffice-host",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.62.0",
|
|
4
4
|
"description": "Internal to crombolo, with no compatibility promise: use @crombolo/crombolo. Serves the Umbraco backoffice SPA: shell HTML, import map and package manifests.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Crombolo",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@crombolo/core": "0.
|
|
36
|
-
"@crombolo/backoffice-dist": "0.
|
|
35
|
+
"@crombolo/core": "0.62.0",
|
|
36
|
+
"@crombolo/backoffice-dist": "0.62.0"
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -32,8 +32,7 @@ export default {
|
|
|
32
32
|
'Welcome to Crombolo! Unfortunately your invite has expired. Please contact your administrator to get a new one.',
|
|
33
33
|
},
|
|
34
34
|
user: {
|
|
35
|
-
sectionsHelp:
|
|
36
|
-
'Pages needs Content. Structure, Components and Workflow setup change the whole site, so give them with care.',
|
|
35
|
+
sectionsHelp: 'Pages needs Content. Settings changes the whole site, so give it with care.',
|
|
37
36
|
changePasswordDescription:
|
|
38
37
|
"You can change your password for accessing the Crombolo backoffice by filling out the form below and click the 'Change Password' button",
|
|
39
38
|
createUserHelp:
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How the Activity view says what an extension did (story 327), one sentence
|
|
3
|
+
* per row and one line of counts. Pure, so it is tested without a browser.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const plural = (count, one, many = `${one}s`) => `${count} ${count === 1 ? one : many}`
|
|
7
|
+
|
|
8
|
+
const AREAS = {
|
|
9
|
+
content: 'pages',
|
|
10
|
+
media: 'media',
|
|
11
|
+
members: 'members',
|
|
12
|
+
users: 'back-office users',
|
|
13
|
+
forms: 'forms',
|
|
14
|
+
formEntries: 'form entries',
|
|
15
|
+
dictionary: 'dictionary words',
|
|
16
|
+
contentTypes: 'content types',
|
|
17
|
+
webhooks: 'webhooks',
|
|
18
|
+
workflows: 'approval workflows',
|
|
19
|
+
redirects: 'redirects',
|
|
20
|
+
identityProviders: 'sign-in providers',
|
|
21
|
+
documents: 'pages',
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const areaWords = (area) => AREAS[area] ?? area ?? 'the site'
|
|
25
|
+
|
|
26
|
+
/** One row of activity as a sentence. */
|
|
27
|
+
export function activitySentence(row) {
|
|
28
|
+
const area = areaWords(row.area)
|
|
29
|
+
switch (row.kind) {
|
|
30
|
+
case 'read':
|
|
31
|
+
return `read ${area}, ${plural(row.count, 'time')}`
|
|
32
|
+
case 'write':
|
|
33
|
+
return `changed ${area}${row.entityKey ? ` (${row.entityKey})` : ''}`
|
|
34
|
+
case 'request':
|
|
35
|
+
return `sent a request to ${row.area}${row.outcome === 'failed' ? ', which failed' : ''}`
|
|
36
|
+
case 'rows':
|
|
37
|
+
return row.verb === 'delete'
|
|
38
|
+
? `deleted ${plural(row.count, 'row')} from ${row.area}`
|
|
39
|
+
: `wrote ${plural(row.count, 'row')} to ${row.area}`
|
|
40
|
+
case 'call':
|
|
41
|
+
return `ran its ${row.area}${row.outcome === 'failed' ? ', which failed' : ''}`
|
|
42
|
+
case 'screen':
|
|
43
|
+
return row.verb === 'view'
|
|
44
|
+
? `opened the ${row.area} screen`
|
|
45
|
+
: `pressed ${row.verb} on the ${row.area} screen`
|
|
46
|
+
case 'refused':
|
|
47
|
+
return `was refused: ${row.verb ?? area}`
|
|
48
|
+
default:
|
|
49
|
+
return String(row.kind)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const COUNT_WORDS = [
|
|
54
|
+
['write', 'write'],
|
|
55
|
+
['read', 'read'],
|
|
56
|
+
['request', 'request out', 'requests out'],
|
|
57
|
+
['rows', 'row written', 'rows written'],
|
|
58
|
+
['call', 'call'],
|
|
59
|
+
['screen', 'screen opened', 'screens opened'],
|
|
60
|
+
['refused', 'refused', 'refused'],
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
/** The counts by kind as one line, leaving out what it never did. */
|
|
64
|
+
export function countsLine(counts) {
|
|
65
|
+
const parts = COUNT_WORDS.filter(([kind]) => (counts?.[kind] ?? 0) > 0).map(([kind, one, many]) =>
|
|
66
|
+
plural(counts[kind], one, many),
|
|
67
|
+
)
|
|
68
|
+
return parts.length > 0 ? parts.join(', ') : 'Nothing yet'
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Who a row was for. */
|
|
72
|
+
export const personWords = (row) => row.personName ?? 'itself'
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What one extension did (story 327), opened from Installed: its counts by kind
|
|
3
|
+
* at the top, then everything it did, newest first, filterable by kind and by
|
|
4
|
+
* the person it acted for, with what its grant refused, and an export.
|
|
5
|
+
*/
|
|
6
|
+
import { css, html, nothing, repeat } from '@umbraco-cms/backoffice/external/lit'
|
|
7
|
+
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'
|
|
8
|
+
import { activitySentence, countsLine, personWords } from './bundles-activity-words.js'
|
|
9
|
+
import { activityCsvUrl, activityPage, activitySummary } from './bundles-client.js'
|
|
10
|
+
import { downloadFile } from './download.js'
|
|
11
|
+
|
|
12
|
+
const KINDS = [
|
|
13
|
+
['', 'Everything'],
|
|
14
|
+
['write', 'Changes'],
|
|
15
|
+
['read', 'Reads'],
|
|
16
|
+
['request', 'Requests out'],
|
|
17
|
+
['rows', 'Its own data'],
|
|
18
|
+
['call', 'Calls'],
|
|
19
|
+
['screen', 'Screens'],
|
|
20
|
+
['refused', 'Refused'],
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
export class CromboloBundlesActivityElement extends UmbLitElement {
|
|
24
|
+
static properties = {
|
|
25
|
+
extension: { attribute: false },
|
|
26
|
+
_summary: { state: true },
|
|
27
|
+
_rows: { state: true },
|
|
28
|
+
_next: { state: true },
|
|
29
|
+
_kind: { state: true },
|
|
30
|
+
_person: { state: true },
|
|
31
|
+
_problem: { state: true },
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
constructor() {
|
|
35
|
+
super()
|
|
36
|
+
this._rows = []
|
|
37
|
+
this._next = null
|
|
38
|
+
this._kind = ''
|
|
39
|
+
this._person = ''
|
|
40
|
+
this._problem = ''
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
connectedCallback() {
|
|
44
|
+
super.connectedCallback()
|
|
45
|
+
this.#load()
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
get #filters() {
|
|
49
|
+
return { kind: this._kind || undefined, person: this._person || undefined }
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async #load() {
|
|
53
|
+
try {
|
|
54
|
+
this._summary = await activitySummary(this.extension.id)
|
|
55
|
+
const page = await activityPage(this.extension.id, this.#filters)
|
|
56
|
+
this._rows = page.items ?? []
|
|
57
|
+
this._next = page.next ?? null
|
|
58
|
+
this._problem = ''
|
|
59
|
+
} catch (error) {
|
|
60
|
+
this._problem = error instanceof Error ? error.message : String(error)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async #more() {
|
|
65
|
+
const page = await activityPage(this.extension.id, { ...this.#filters, before: this._next })
|
|
66
|
+
this._rows = [...this._rows, ...(page.items ?? [])]
|
|
67
|
+
this._next = page.next ?? null
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async #export() {
|
|
71
|
+
try {
|
|
72
|
+
await downloadFile(
|
|
73
|
+
activityCsvUrl(this.extension.id, this.#filters),
|
|
74
|
+
`${this.extension.id}-activity.csv`,
|
|
75
|
+
)
|
|
76
|
+
} catch (error) {
|
|
77
|
+
this._problem = error instanceof Error ? error.message : String(error)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
render() {
|
|
82
|
+
const people = this._summary?.people ?? []
|
|
83
|
+
return html`<uui-box headline=${`What ${this.extension.name} did`}>
|
|
84
|
+
<p class="counts">
|
|
85
|
+
${countsLine(this._summary?.counts)}
|
|
86
|
+
<span class="window">in the last ${this._summary?.days ?? 14} days</span>
|
|
87
|
+
</p>
|
|
88
|
+
<div class="filters">
|
|
89
|
+
<uui-select
|
|
90
|
+
label="Kind"
|
|
91
|
+
.options=${KINDS.map(([value, name]) => ({ value, name, selected: value === this._kind }))}
|
|
92
|
+
@change=${(event) => {
|
|
93
|
+
this._kind = event.target.value
|
|
94
|
+
this.#load()
|
|
95
|
+
}}></uui-select>
|
|
96
|
+
<uui-select
|
|
97
|
+
label="Person"
|
|
98
|
+
.options=${[
|
|
99
|
+
{ value: '', name: 'Anyone', selected: !this._person },
|
|
100
|
+
{ value: 'itself', name: 'Itself', selected: this._person === 'itself' },
|
|
101
|
+
...people.map((person) => ({
|
|
102
|
+
value: person.key,
|
|
103
|
+
name: person.name,
|
|
104
|
+
selected: person.key === this._person,
|
|
105
|
+
})),
|
|
106
|
+
]}
|
|
107
|
+
@change=${(event) => {
|
|
108
|
+
this._person = event.target.value
|
|
109
|
+
this.#load()
|
|
110
|
+
}}></uui-select>
|
|
111
|
+
<uui-button look="secondary" label="Export" @click=${() => this.#export()}></uui-button>
|
|
112
|
+
</div>
|
|
113
|
+
${this._problem ? html`<p class="problem">${this._problem}</p>` : nothing}
|
|
114
|
+
${
|
|
115
|
+
this._rows.length === 0
|
|
116
|
+
? html`<p>Nothing recorded.</p>`
|
|
117
|
+
: html`<uui-table>
|
|
118
|
+
<uui-table-head>
|
|
119
|
+
<uui-table-head-cell>When</uui-table-head-cell>
|
|
120
|
+
<uui-table-head-cell>For</uui-table-head-cell>
|
|
121
|
+
<uui-table-head-cell>What it did</uui-table-head-cell>
|
|
122
|
+
</uui-table-head>
|
|
123
|
+
${repeat(
|
|
124
|
+
this._rows,
|
|
125
|
+
(row) => row.id,
|
|
126
|
+
(row) => html`<uui-table-row class=${row.kind === 'refused' ? 'refused' : ''}>
|
|
127
|
+
<uui-table-cell>${new Date(row.occurredAt).toLocaleString()}</uui-table-cell>
|
|
128
|
+
<uui-table-cell>${personWords(row)}</uui-table-cell>
|
|
129
|
+
<uui-table-cell>${activitySentence(row)}</uui-table-cell>
|
|
130
|
+
</uui-table-row>`,
|
|
131
|
+
)}
|
|
132
|
+
</uui-table>`
|
|
133
|
+
}
|
|
134
|
+
${
|
|
135
|
+
this._next !== null
|
|
136
|
+
? html`<uui-button look="secondary" label="Load more" @click=${() => this.#more()}></uui-button>`
|
|
137
|
+
: nothing
|
|
138
|
+
}
|
|
139
|
+
<uui-button
|
|
140
|
+
look="secondary"
|
|
141
|
+
label="Back"
|
|
142
|
+
@click=${() => this.dispatchEvent(new CustomEvent('close'))}></uui-button>
|
|
143
|
+
</uui-box>`
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
static styles = css`
|
|
147
|
+
.counts {
|
|
148
|
+
font-weight: bold;
|
|
149
|
+
}
|
|
150
|
+
.window {
|
|
151
|
+
font-weight: normal;
|
|
152
|
+
color: var(--uui-color-text-alt);
|
|
153
|
+
margin-left: var(--uui-size-space-2);
|
|
154
|
+
}
|
|
155
|
+
.filters {
|
|
156
|
+
display: flex;
|
|
157
|
+
gap: var(--uui-size-space-3);
|
|
158
|
+
align-items: center;
|
|
159
|
+
margin-bottom: var(--uui-size-space-4);
|
|
160
|
+
}
|
|
161
|
+
.refused {
|
|
162
|
+
color: var(--uui-color-danger-standalone, var(--uui-color-danger));
|
|
163
|
+
}
|
|
164
|
+
.problem {
|
|
165
|
+
color: var(--uui-color-danger-standalone, var(--uui-color-danger));
|
|
166
|
+
}
|
|
167
|
+
`
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (!customElements.get('crombolo-bundles-activity'))
|
|
171
|
+
customElements.define('crombolo-bundles-activity', CromboloBundlesActivityElement)
|
package/plugin/bundles-client.js
CHANGED
|
@@ -39,12 +39,11 @@ export const installBundle = (
|
|
|
39
39
|
version,
|
|
40
40
|
applyContent = true,
|
|
41
41
|
grant = [],
|
|
42
|
-
actAs = undefined,
|
|
43
42
|
settings = undefined,
|
|
44
43
|
) =>
|
|
45
44
|
json('/install', {
|
|
46
45
|
method: 'POST',
|
|
47
|
-
body: JSON.stringify({ name, version, applyContent, grant,
|
|
46
|
+
body: JSON.stringify({ name, version, applyContent, grant, settings }),
|
|
48
47
|
})
|
|
49
48
|
|
|
50
49
|
/** Turns an installed bundle's server features off until it is enabled again (story 225). */
|
|
@@ -52,8 +51,8 @@ export const disableBundle = (id) =>
|
|
|
52
51
|
json('/disable', { method: 'POST', body: JSON.stringify({ id }) })
|
|
53
52
|
|
|
54
53
|
/** Grants an installed extension exactly what it asks for, and whom it acts for (story 309). */
|
|
55
|
-
export const grantBundle = (id, grant
|
|
56
|
-
json('/grant', { method: 'POST', body: JSON.stringify({ id, grant
|
|
54
|
+
export const grantBundle = (id, grant) =>
|
|
55
|
+
json('/grant', { method: 'POST', body: JSON.stringify({ id, grant }) })
|
|
57
56
|
|
|
58
57
|
/** Saves an extension's settings: `null` takes one back to its default (story 310). */
|
|
59
58
|
export const saveSettings = (id, values) =>
|
|
@@ -63,8 +62,13 @@ export const saveSettings = (id, values) =>
|
|
|
63
62
|
export const enableBundle = (id) =>
|
|
64
63
|
json('/enable', { method: 'POST', body: JSON.stringify({ id }) })
|
|
65
64
|
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
/** Removes an extension; its data and the content it added stay unless asked (story 328). */
|
|
66
|
+
export const uninstallBundle = (name, { dropData = false, dropContent = false } = {}) =>
|
|
67
|
+
json('/uninstall', { method: 'POST', body: JSON.stringify({ name, dropData, dropContent }) })
|
|
68
|
+
|
|
69
|
+
/** Deletes the data an extension removed earlier left behind (story 328). */
|
|
70
|
+
export const dropLeftData = (id) =>
|
|
71
|
+
json('/drop-left-data', { method: 'POST', body: JSON.stringify({ id }) })
|
|
68
72
|
|
|
69
73
|
/** Where a created bundle's package downloads from, with `?withMedia=true` to carry its media files. */
|
|
70
74
|
export const createdDownloadUrl = (id, query = '') =>
|
|
@@ -87,3 +91,23 @@ export const readSchemaPicks = (id) => json(`/created/${encodeURIComponent(id)}/
|
|
|
87
91
|
|
|
88
92
|
export const saveSchemaPicks = (id, picks) =>
|
|
89
93
|
json(`/created/${encodeURIComponent(id)}/schema`, { method: 'PUT', body: JSON.stringify(picks) })
|
|
94
|
+
|
|
95
|
+
/** What one extension did (story 327): its counts by kind and the people it acted for. */
|
|
96
|
+
export const activitySummary = (id) => json(`/installed/${encodeURIComponent(id)}/activity/summary`)
|
|
97
|
+
|
|
98
|
+
/** A page of what it did, newest first, below `before`, with the filters given. */
|
|
99
|
+
export const activityPage = (id, { before, kind, person } = {}) => {
|
|
100
|
+
const query = new URLSearchParams({ limit: '50' })
|
|
101
|
+
if (before !== undefined) query.set('before', String(before))
|
|
102
|
+
if (kind) query.set('kind', kind)
|
|
103
|
+
if (person) query.set('person', person)
|
|
104
|
+
return json(`/installed/${encodeURIComponent(id)}/activity?${query}`)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Where the same, as a CSV file, is served. */
|
|
108
|
+
export const activityCsvUrl = (id, { kind, person } = {}) => {
|
|
109
|
+
const query = new URLSearchParams()
|
|
110
|
+
if (kind) query.set('kind', kind)
|
|
111
|
+
if (person) query.set('person', person)
|
|
112
|
+
return `${base()}/installed/${encodeURIComponent(id)}/activity.csv${query.size ? `?${query}` : ''}`
|
|
113
|
+
}
|