@crombolo/backoffice-host 0.38.1 → 0.39.1
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 +2 -2
- package/plugin/app-preview/umbraco-package.json +1 -1
- package/plugin/audit-dashboard.js +2 -1
- package/plugin/bundles-client.js +6 -5
- package/plugin/bundles-installed.js +21 -40
- package/plugin/localizations/umbraco-package.json +1 -1
- package/plugin/seo/umbraco-package.json +1 -1
- package/plugin/sign-in/umbraco-package.json +1 -1
- package/plugin/umbraco-package.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crombolo/backoffice-host",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.1",
|
|
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.
|
|
35
|
+
"@crombolo/core": "0.39.1",
|
|
36
36
|
"@crombolo/backoffice-dist": "18.2.0"
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -128,6 +128,7 @@ async function get(path, params) {
|
|
|
128
128
|
function fromWhere(entry) {
|
|
129
129
|
if (entry.source === 'cli') return 'Command line'
|
|
130
130
|
if (entry.source === 'job') return 'Scheduled'
|
|
131
|
+
if (entry.source === 'boot') return 'Site start-up'
|
|
131
132
|
const forwarded = entry.forwardedFor?.split(',')[0]?.trim()
|
|
132
133
|
return forwarded || entry.ipAddress || '—'
|
|
133
134
|
}
|
|
@@ -290,7 +291,7 @@ export default class CromboloAuditDashboardElement extends LitElement {
|
|
|
290
291
|
const failed = entry.action === 'SignInFailed' || entry.action === 'LockedOut'
|
|
291
292
|
return html`<uui-table-row>
|
|
292
293
|
<uui-table-cell title=${when.toISOString()}>${when.toLocaleString()}</uui-table-cell>
|
|
293
|
-
<uui-table-cell>${entry.user?.name ?? (entry.source === 'job' ? 'Scheduled publishing' : 'Unknown')}</uui-table-cell>
|
|
294
|
+
<uui-table-cell>${entry.user?.name ?? (entry.source === 'job' ? 'Scheduled publishing' : entry.source === 'boot' ? "The site's code" : 'Unknown')}</uui-table-cell>
|
|
294
295
|
<uui-table-cell>
|
|
295
296
|
${failed ? html`<uui-tag color="danger">${actionLabel(entry.action)}</uui-tag>` : actionLabel(entry.action)}
|
|
296
297
|
${entry.detail && entry.source !== 'cli' ? html`<small>${entry.detail}</small>` : nothing}
|
package/plugin/bundles-client.js
CHANGED
|
@@ -39,12 +39,13 @@ export const installBundle = (
|
|
|
39
39
|
body: JSON.stringify({ name, version, applyContent, acceptServerCode, grant }),
|
|
40
40
|
})
|
|
41
41
|
|
|
42
|
-
/**
|
|
43
|
-
export const
|
|
42
|
+
/** Turns an installed bundle's server features off until it is enabled again (story 225). */
|
|
43
|
+
export const disableBundle = (id) =>
|
|
44
|
+
json('/disable', { method: 'POST', body: JSON.stringify({ id }) })
|
|
44
45
|
|
|
45
|
-
/**
|
|
46
|
-
export const
|
|
47
|
-
json('/
|
|
46
|
+
/** Turns a disabled bundle's server features back on. */
|
|
47
|
+
export const enableBundle = (id) =>
|
|
48
|
+
json('/enable', { method: 'POST', body: JSON.stringify({ id }) })
|
|
48
49
|
|
|
49
50
|
export const uninstallBundle = (name) =>
|
|
50
51
|
json('/uninstall', { method: 'POST', body: JSON.stringify({ name }) })
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import { css, html, nothing, repeat } from '@umbraco-cms/backoffice/external/lit'
|
|
18
18
|
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'
|
|
19
19
|
import { carriesTags } from './bundles-carries.js'
|
|
20
|
-
import {
|
|
20
|
+
import { disableBundle, enableBundle, listInstalled, uninstallBundle } from './bundles-client.js'
|
|
21
21
|
|
|
22
22
|
/** Where each part of a bundle stands on this site, in the words of someone running it. */
|
|
23
23
|
function status(item) {
|
|
@@ -31,7 +31,7 @@ function status(item) {
|
|
|
31
31
|
if (item.carries?.server)
|
|
32
32
|
parts.push(
|
|
33
33
|
!item.on
|
|
34
|
-
? html`<span>
|
|
34
|
+
? html`<span>Server features turned off by ${item.disabledBy ?? 'an administrator'}</span>`
|
|
35
35
|
: item.wired
|
|
36
36
|
? html`<span>Server features on</span>`
|
|
37
37
|
: html`<span>Server features off until the site's configuration includes it</span>`,
|
|
@@ -94,11 +94,11 @@ export default class CromboloBundlesInstalledElement extends UmbLitElement {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
/**
|
|
98
|
-
async #
|
|
97
|
+
/** Turns its server features off, or back on (story 225). */
|
|
98
|
+
async #setEnabled(item, enabled) {
|
|
99
99
|
this._busy = item.packageName
|
|
100
100
|
try {
|
|
101
|
-
const outcome =
|
|
101
|
+
const outcome = enabled ? await enableBundle(item.id) : await disableBundle(item.id)
|
|
102
102
|
this._notice = outcome.message ?? ''
|
|
103
103
|
if (outcome.ok) await this.#load()
|
|
104
104
|
} catch (error) {
|
|
@@ -108,56 +108,40 @@ export default class CromboloBundlesInstalledElement extends UmbLitElement {
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
/** What it may do with the site, and the button that
|
|
111
|
+
/** What it may do with the site, who approved it, and the button that turns it off or on. */
|
|
112
112
|
#permissions(item) {
|
|
113
113
|
if (!item.carries?.server) return nothing
|
|
114
114
|
const asks = item.permissions ?? []
|
|
115
|
+
const approved = item.granted
|
|
116
|
+
? `Approved by ${item.granted.by ?? 'an administrator'} on ${new Date(item.granted.at).toLocaleDateString()}.`
|
|
117
|
+
: ''
|
|
115
118
|
return html`
|
|
116
119
|
<h4>What it may do</h4>
|
|
117
120
|
${
|
|
118
121
|
asks.length === 0
|
|
119
122
|
? html`<p>Nothing beyond its own data: it asks for no access to the site's content, members or settings.</p>`
|
|
120
123
|
: html`<ul class="asks">
|
|
121
|
-
${asks.map(
|
|
122
|
-
(ask) =>
|
|
123
|
-
html`<li class=${(item.missing ?? []).includes(ask.permission) ? 'waiting' : ''}>
|
|
124
|
-
${ask.allows}
|
|
125
|
-
</li>`,
|
|
126
|
-
)}
|
|
124
|
+
${asks.map((ask) => html`<li>${ask.allows}</li>`)}
|
|
127
125
|
</ul>`
|
|
128
126
|
}
|
|
129
127
|
${
|
|
130
128
|
item.on
|
|
131
|
-
? html`<p class="note"
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
${
|
|
139
|
-
item.granted
|
|
140
|
-
? html`<uui-button
|
|
141
|
-
look="secondary"
|
|
142
|
-
color="danger"
|
|
143
|
-
label="Withdraw approval"
|
|
144
|
-
.state=${this._busy === item.packageName ? 'waiting' : undefined}
|
|
145
|
-
@click=${() => this.#setGrant(item, false)}></uui-button>`
|
|
146
|
-
: nothing
|
|
147
|
-
}`
|
|
129
|
+
? html`${approved ? html`<p class="note">${approved}</p>` : nothing}
|
|
130
|
+
<uui-button
|
|
131
|
+
look="secondary"
|
|
132
|
+
color="danger"
|
|
133
|
+
label="Disable"
|
|
134
|
+
.state=${this._busy === item.packageName ? 'waiting' : undefined}
|
|
135
|
+
@click=${() => this.#setEnabled(item, false)}></uui-button>`
|
|
148
136
|
: html`<p class="note">
|
|
149
|
-
${
|
|
150
|
-
|
|
151
|
-
? 'This version asks for more than was approved, so it is off until you approve all of it.'
|
|
152
|
-
: 'It is off until you approve all of what it asks to do.'
|
|
153
|
-
}
|
|
137
|
+
Turned off by ${item.disabledBy ?? 'an administrator'}: its pages, jobs and screens
|
|
138
|
+
stay off, through updates, until it is enabled again.
|
|
154
139
|
</p>
|
|
155
140
|
<uui-button
|
|
156
141
|
look="primary"
|
|
157
|
-
|
|
158
|
-
label="Approve and turn on"
|
|
142
|
+
label="Enable"
|
|
159
143
|
.state=${this._busy === item.packageName ? 'waiting' : undefined}
|
|
160
|
-
@click=${() => this.#
|
|
144
|
+
@click=${() => this.#setEnabled(item, true)}></uui-button>`
|
|
161
145
|
}
|
|
162
146
|
`
|
|
163
147
|
}
|
|
@@ -261,9 +245,6 @@ export default class CromboloBundlesInstalledElement extends UmbLitElement {
|
|
|
261
245
|
.asks {
|
|
262
246
|
padding-left: 1.25em;
|
|
263
247
|
}
|
|
264
|
-
.asks li.waiting {
|
|
265
|
-
font-weight: 600;
|
|
266
|
-
}
|
|
267
248
|
:host {
|
|
268
249
|
display: block;
|
|
269
250
|
padding: var(--uui-size-layout-1, 24px);
|