@crombolo/backoffice-host 0.42.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/NOTICE +9 -0
- package/package.json +3 -3
- package/plugin/app-preview/umbraco-package.json +1 -1
- package/plugin/approvals-active.js +40 -0
- package/plugin/branding/theme-dark.css +21 -5
- package/plugin/branding/theme.css +44 -19
- package/plugin/breadcrumb.js +29 -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 +412 -0
- package/plugin/overview-format.js +71 -0
- package/plugin/seo/umbraco-package.json +1 -1
- package/plugin/settings-card.js +57 -0
- package/plugin/settings-cards.js +239 -0
- package/plugin/settings-section.js +466 -0
- package/plugin/sign-in/umbraco-package.json +1 -1
- package/plugin/umbraco-package.json +67 -70
- package/plugin/workflow-client.js +3 -0
- package/plugin/workflow-designer.js +17 -2
- package/src/branding.ts +4 -0
- package/src/extensions.ts +7 -3
- package/plugin/settings-dashboard.js +0 -123
- package/plugin/welcome-dashboard.js +0 -103
package/NOTICE
CHANGED
|
@@ -27,6 +27,15 @@ The Umbraco backoffice
|
|
|
27
27
|
@umbraco-cms/backoffice 18.2.0 — MIT — https://github.com/umbraco/Umbraco-CMS
|
|
28
28
|
@umbraco-ui/uui 2.0.2 — MIT — https://github.com/umbraco/Umbraco.UI
|
|
29
29
|
|
|
30
|
+
The Lato fonts
|
|
31
|
+
-------------
|
|
32
|
+
LatoLatin-*.woff2 — Copyright (c) 2011-2015 by tyPoland Lukasz Dziedzic, with
|
|
33
|
+
Reserved Font Name "Lato" — SIL Open Font License 1.1 — https://www.latofonts.com
|
|
34
|
+
Shipped unmodified, as @umbraco-ui/uui ships them, in @crombolo/backoffice-dist
|
|
35
|
+
under `dist/assets/fonts/`, with the licence beside them as `OFL.txt`
|
|
36
|
+
(`packages/backoffice-dist/licenses/Lato-OFL.txt` in this repository). The
|
|
37
|
+
fonts carry the same notice in their own metadata.
|
|
38
|
+
|
|
30
39
|
Static files from the Umbraco client source tree
|
|
31
40
|
------------------------------------------------
|
|
32
41
|
css/umb-css.css, css/rte-content.css, css/umbraco-blockgridlayout.css
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crombolo/backoffice-host",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.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.44.0",
|
|
36
|
+
"@crombolo/backoffice-dist": "0.44.0"
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Crombolo.Condition.ApprovalsActive`: the Approvals section and a page's
|
|
3
|
+
* Workflow tab show only while the site has a workflow or a request is open
|
|
4
|
+
* (story 234). The designer calls `approvalsChanged()` after a save or a delete,
|
|
5
|
+
* so the first workflow brings them in without a reload.
|
|
6
|
+
*/
|
|
7
|
+
import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry'
|
|
8
|
+
import { approvalsActive } from './workflow-client.js'
|
|
9
|
+
|
|
10
|
+
const listeners = new Set()
|
|
11
|
+
|
|
12
|
+
/** Asks every condition to check again. */
|
|
13
|
+
export function approvalsChanged() {
|
|
14
|
+
for (const listener of listeners) listener()
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export class CromboloApprovalsActiveCondition extends UmbConditionBase {
|
|
18
|
+
#listener = () => this.#check()
|
|
19
|
+
|
|
20
|
+
constructor(host, args) {
|
|
21
|
+
super(host, args)
|
|
22
|
+
listeners.add(this.#listener)
|
|
23
|
+
this.#check()
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async #check() {
|
|
27
|
+
const answer = await approvalsActive()
|
|
28
|
+
// A failed check leaves Approvals where people can still reach their requests.
|
|
29
|
+
this.permitted = answer.ok ? answer.active === true : true
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
destroy() {
|
|
33
|
+
listeners.delete(this.#listener)
|
|
34
|
+
super.destroy()
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default CromboloApprovalsActiveCondition
|
|
39
|
+
|
|
40
|
+
export { CromboloApprovalsActiveCondition as api }
|
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
--crombolo-night-alt: #342922;
|
|
20
20
|
--crombolo-night-header: #2b1d15;
|
|
21
21
|
--crombolo-cocoa-deep: #25160e;
|
|
22
|
+
/* Terracotta light enough to read as text on the night surfaces (7.7:1 and up). */
|
|
23
|
+
--crombolo-terracotta-light: #e8a688;
|
|
22
24
|
|
|
23
25
|
--uui-color-background: var(--crombolo-night);
|
|
24
26
|
--uui-color-surface: var(--crombolo-night-surface);
|
|
@@ -27,7 +29,7 @@
|
|
|
27
29
|
--uui-color-text: var(--crombolo-ink);
|
|
28
30
|
--uui-color-text-alt: var(--crombolo-ink-dimmed);
|
|
29
31
|
--uui-color-interactive: var(--crombolo-ink);
|
|
30
|
-
--uui-color-interactive-emphasis: var(--crombolo-
|
|
32
|
+
--uui-color-interactive-emphasis: var(--crombolo-terracotta-light);
|
|
31
33
|
|
|
32
34
|
/* The accent is light, so what sits on it is dark, as in the light mode. */
|
|
33
35
|
--uui-color-default: var(--crombolo-orange);
|
|
@@ -38,16 +40,30 @@
|
|
|
38
40
|
--uui-color-selected-emphasis: var(--crombolo-orange-light);
|
|
39
41
|
--uui-color-selected-standalone: var(--crombolo-orange);
|
|
40
42
|
--uui-color-selected-contrast: var(--crombolo-cocoa-deep);
|
|
41
|
-
|
|
43
|
+
/* "Current" marks the active tab; the tree's current item has its own tokens (237). */
|
|
44
|
+
--uui-color-current: var(--crombolo-terracotta-light);
|
|
42
45
|
--uui-color-current-emphasis: var(--crombolo-orange-light);
|
|
43
46
|
--uui-color-current-contrast: var(--crombolo-cocoa-deep);
|
|
47
|
+
--uui-menu-item-background-color-active: var(--crombolo-night-alt);
|
|
48
|
+
--uui-menu-item-background-color-active-hover: #3b2e26;
|
|
49
|
+
--uui-menu-item-color-active: var(--crombolo-terracotta-light);
|
|
44
50
|
--uui-color-focus: var(--crombolo-orange);
|
|
45
51
|
|
|
46
|
-
/*
|
|
47
|
-
|
|
52
|
+
/*
|
|
53
|
+
* The header is a panel like the cards, with a hairline under it; the current
|
|
54
|
+
* section's name and marker are terracotta, as in light (story 237).
|
|
55
|
+
*/
|
|
56
|
+
--uui-color-header-surface: var(--crombolo-night-surface);
|
|
48
57
|
--uui-color-header-contrast: rgb(246 237 228 / 80%);
|
|
49
58
|
--uui-color-header-contrast-emphasis: var(--crombolo-ink);
|
|
50
|
-
--crombolo-header-current: var(--crombolo-
|
|
59
|
+
--crombolo-header-current: var(--crombolo-terracotta-light);
|
|
60
|
+
--crombolo-header-current-text: var(--crombolo-terracotta-light);
|
|
61
|
+
--crombolo-header-line: #3b2e25;
|
|
62
|
+
--crombolo-section-sidebar-background: var(--crombolo-night-surface);
|
|
63
|
+
--crombolo-card-shadow: none;
|
|
64
|
+
--crombolo-card-header-background: #4a2a1a;
|
|
65
|
+
--crombolo-card-header-text: #ffffff;
|
|
66
|
+
--crombolo-terracotta-tint: var(--crombolo-night-alt);
|
|
51
67
|
|
|
52
68
|
/* The SEO view's search-result preview, in Google's dark-mode link blue. */
|
|
53
69
|
--crombolo-snippet-title: #8ab4f8;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Crombolo's colour scheme: white
|
|
2
|
+
* Crombolo's colour scheme: white cards on a cream ground, a light header, and one
|
|
3
|
+
* deep terracotta accent taken from the logo (story 237).
|
|
3
4
|
*
|
|
4
5
|
* Loaded by both shells immediately after the vendored `light.css`, rather than
|
|
5
6
|
* registered as a `theme` extension, so it reaches the login page too — the
|
|
@@ -17,6 +18,14 @@
|
|
|
17
18
|
--crombolo-orange-deep: #cb6f48;
|
|
18
19
|
/* The darkest of the three, and the only one that clears AA as body text. */
|
|
19
20
|
--crombolo-orange-text: #974b2b;
|
|
21
|
+
/*
|
|
22
|
+
* The accent: the logo's terracotta, deepened until white on it clears AA
|
|
23
|
+
* (5.3:1). It fills buttons and the selected item, and is the links' colour.
|
|
24
|
+
*/
|
|
25
|
+
--crombolo-terracotta: #ad4f2c;
|
|
26
|
+
--crombolo-terracotta-hover: #9b4526;
|
|
27
|
+
/* A pale tint of it, behind the current tree item and the Overview's labels. */
|
|
28
|
+
--crombolo-terracotta-tint: #fbeee7;
|
|
20
29
|
--crombolo-cocoa: #54321f;
|
|
21
30
|
--crombolo-cream: #fff7ea;
|
|
22
31
|
|
|
@@ -24,8 +33,8 @@
|
|
|
24
33
|
* `light.css` routes default, selected and interactive-emphasis through the
|
|
25
34
|
* violet-blue palette, so swapping the palette carries all of them at once.
|
|
26
35
|
*/
|
|
27
|
-
--uui-palette-violet-blue: var(--crombolo-
|
|
28
|
-
--uui-palette-violet-blue-light: var(--crombolo-
|
|
36
|
+
--uui-palette-violet-blue: var(--crombolo-terracotta);
|
|
37
|
+
--uui-palette-violet-blue-light: var(--crombolo-terracotta-hover);
|
|
29
38
|
--uui-palette-violet-blue-dark: var(--crombolo-orange-text);
|
|
30
39
|
--uui-palette-violet-blue-dimmed: #bd8b75;
|
|
31
40
|
|
|
@@ -39,9 +48,12 @@
|
|
|
39
48
|
--uui-palette-space-cadet-dark: #25160e;
|
|
40
49
|
--uui-palette-space-cadet-dimmed: #8a6c5c;
|
|
41
50
|
|
|
42
|
-
/*
|
|
43
|
-
|
|
44
|
-
|
|
51
|
+
/*
|
|
52
|
+
* "Current": the accent, which is what marks the active tab. The tree's
|
|
53
|
+
* current item takes its own tokens below, so it can be a tint instead.
|
|
54
|
+
*/
|
|
55
|
+
--uui-palette-spanish-pink: var(--crombolo-terracotta);
|
|
56
|
+
--uui-palette-spanish-pink-light: var(--crombolo-terracotta-hover);
|
|
45
57
|
--uui-palette-spanish-pink-dark: #ebc7b8;
|
|
46
58
|
--uui-palette-spanish-pink-dimmed: #f3e3ce;
|
|
47
59
|
|
|
@@ -56,20 +68,34 @@
|
|
|
56
68
|
--uui-palette-white-dark: #fffaf2;
|
|
57
69
|
--uui-palette-white-dimmed: #f4ede1;
|
|
58
70
|
|
|
71
|
+
/* White on the deep accent, 5.3:1. */
|
|
72
|
+
--uui-color-default-contrast: #fff;
|
|
73
|
+
--uui-color-selected-contrast: #fff;
|
|
74
|
+
--uui-color-current-contrast: #fff;
|
|
75
|
+
/* The tree's current item: a pale tint, its text and icon in the accent (4.7:1). */
|
|
76
|
+
--uui-menu-item-background-color-active: var(--crombolo-terracotta-tint);
|
|
77
|
+
--uui-menu-item-background-color-active-hover: #faeae1;
|
|
78
|
+
--uui-menu-item-color-active: var(--crombolo-terracotta);
|
|
79
|
+
|
|
59
80
|
/*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
81
|
+
* A white header with a hairline under it. The current section's name and
|
|
82
|
+
* marker are the accent; the fork reads the line and the name's colour from
|
|
83
|
+
* these tokens.
|
|
63
84
|
*/
|
|
64
|
-
--uui-color-
|
|
65
|
-
--uui-color-selected-contrast: var(--crombolo-cocoa);
|
|
66
|
-
|
|
67
|
-
/* An orange header bar, with its own text dark for the same reason. */
|
|
68
|
-
--uui-color-header-surface: var(--crombolo-orange);
|
|
85
|
+
--uui-color-header-surface: #fff;
|
|
69
86
|
--uui-color-header-contrast: rgb(84 50 31 / 80%);
|
|
70
87
|
--uui-color-header-contrast-emphasis: var(--crombolo-cocoa);
|
|
71
|
-
|
|
72
|
-
--crombolo-header-current: var(--crombolo-
|
|
88
|
+
--crombolo-header-current: var(--crombolo-terracotta);
|
|
89
|
+
--crombolo-header-current-text: var(--crombolo-terracotta);
|
|
90
|
+
--crombolo-header-line: #efe3d6;
|
|
91
|
+
|
|
92
|
+
/* The sidebar is a white panel, like the cards, beside the cream page. */
|
|
93
|
+
--crombolo-section-sidebar-background: #fff;
|
|
94
|
+
/* Crombolo's own cards (the Overview, Settings) stand off the page; Umbraco's stay flat. */
|
|
95
|
+
/* A Settings card's title sits on a dark band. */
|
|
96
|
+
--crombolo-card-header-background: var(--crombolo-cocoa);
|
|
97
|
+
--crombolo-card-header-text: #fff;
|
|
98
|
+
--crombolo-card-shadow: 0 1px 2px rgb(84 50 31 / 6%), 0 10px 28px -18px rgb(84 50 31 / 30%);
|
|
73
99
|
|
|
74
100
|
/* Pure white panels on a warm off-white page, so cards still separate. */
|
|
75
101
|
--uui-color-background: var(--crombolo-cream);
|
|
@@ -79,9 +105,8 @@
|
|
|
79
105
|
|
|
80
106
|
--uui-color-focus: var(--crombolo-orange-deep);
|
|
81
107
|
|
|
82
|
-
/* Hover text
|
|
83
|
-
|
|
84
|
-
--uui-color-interactive-emphasis: var(--crombolo-orange-text);
|
|
108
|
+
/* Hover text and links: the accent itself, 5.0:1 on cream and 5.3:1 on white. */
|
|
109
|
+
--uui-color-interactive-emphasis: var(--crombolo-terracotta);
|
|
85
110
|
|
|
86
111
|
--uui-color-border: #e7dcd2;
|
|
87
112
|
--uui-color-border-standalone: #cdbcac;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A trail of links to where a page sits (story 234): UUI's breadcrumbs, as
|
|
3
|
+
* Umbraco's own editors show them, given `items` of `{ label, href? }`. The last
|
|
4
|
+
* item is the page itself; an item without `href` is not a link.
|
|
5
|
+
*/
|
|
6
|
+
import { html, ifDefined } from '@umbraco-cms/backoffice/external/lit'
|
|
7
|
+
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'
|
|
8
|
+
|
|
9
|
+
export class CromboloBreadcrumbElement extends UmbLitElement {
|
|
10
|
+
static properties = { items: { attribute: false } }
|
|
11
|
+
|
|
12
|
+
constructor() {
|
|
13
|
+
super()
|
|
14
|
+
this.items = []
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
render() {
|
|
18
|
+
return html`<nav aria-label="Breadcrumb">
|
|
19
|
+
<uui-breadcrumbs>
|
|
20
|
+
${this.items.map(
|
|
21
|
+
(item) =>
|
|
22
|
+
html`<uui-breadcrumb-item href=${ifDefined(item.href)}>${item.label}</uui-breadcrumb-item>`,
|
|
23
|
+
)}
|
|
24
|
+
</uui-breadcrumbs>
|
|
25
|
+
</nav>`
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
customElements.define('crombolo-breadcrumb', CromboloBreadcrumbElement)
|
package/plugin/bundle-editor.js
CHANGED
|
@@ -83,7 +83,7 @@ export default class CromboloBundleEditorElement extends UmbLitElement {
|
|
|
83
83
|
|
|
84
84
|
render() {
|
|
85
85
|
return html`
|
|
86
|
-
<umb-workspace-editor back-path="section/
|
|
86
|
+
<umb-workspace-editor back-path="section/settings/dashboard/bundles/created">
|
|
87
87
|
${
|
|
88
88
|
this._definition
|
|
89
89
|
? html`<div id="header" slot="header">
|
|
@@ -20,7 +20,7 @@ import { downloadFile } from './download.js'
|
|
|
20
20
|
const TAKE = 10
|
|
21
21
|
|
|
22
22
|
/** Where the builder lives, which is Umbraco's route and not ours to rename. */
|
|
23
|
-
export const BUILDER_PATH = 'section/
|
|
23
|
+
export const BUILDER_PATH = 'section/settings/dashboard/bundles/created/package-builder'
|
|
24
24
|
|
|
25
25
|
export default class CromboloBundlesCreatedOverviewElement extends UmbLitElement {
|
|
26
26
|
static properties = {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The Created view, in place of Umbraco's.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* `overview` and every `package-builder` workspace at `package-builder/create`
|
|
4
|
+
* A tab of the Bundles tool in Settings (story 238). Umbraco's view is a
|
|
5
|
+
* router, not a screen: it mounts its own overview at `overview` and every `package-builder` workspace at `package-builder/create`
|
|
7
6
|
* and `package-builder/edit/:unique`. Those two routes are the only way to
|
|
8
7
|
* reach the builder, so this reproduces them exactly — replacing the view
|
|
9
8
|
* without them would have left the builder unreachable rather than renamed.
|
|
@@ -12,7 +11,7 @@
|
|
|
12
11
|
*/
|
|
13
12
|
import { createExtensionElement } from '@umbraco-cms/backoffice/extension-api'
|
|
14
13
|
import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry'
|
|
15
|
-
import { html } from '@umbraco-cms/backoffice/external/lit'
|
|
14
|
+
import { css, html } from '@umbraco-cms/backoffice/external/lit'
|
|
16
15
|
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'
|
|
17
16
|
import { editorsOf } from './bundle-editor-routing.js'
|
|
18
17
|
|
|
@@ -42,6 +41,16 @@ export default class CromboloBundlesCreatedElement extends UmbLitElement {
|
|
|
42
41
|
render() {
|
|
43
42
|
return html`<umb-router-slot .routes=${this._routes}></umb-router-slot>`
|
|
44
43
|
}
|
|
44
|
+
|
|
45
|
+
// A tab of the Bundles tool, which gives it the space under the tabs; the
|
|
46
|
+
// builder's workspace fills that.
|
|
47
|
+
static styles = css`
|
|
48
|
+
:host,
|
|
49
|
+
umb-router-slot {
|
|
50
|
+
display: block;
|
|
51
|
+
height: 100%;
|
|
52
|
+
}
|
|
53
|
+
`
|
|
45
54
|
}
|
|
46
55
|
|
|
47
56
|
/** Umbraco's own route table, with our overview in place of its own. */
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The Installed view, in place of Umbraco's.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* Umbraco's view is built around package migrations — it lists installed
|
|
4
|
+
* A tab of the Bundles tool in Settings (story 238). Umbraco's view is built around package migrations — it lists installed
|
|
6
5
|
* packages so that pending C# migrations can be run. Nothing carries those here
|
|
7
6
|
* (`docs/bundles.md`), so the view would be a list of nothing with a button
|
|
8
7
|
* that cannot apply.
|
|
@@ -58,7 +57,8 @@ export default class CromboloBundlesInstalledElement extends UmbLitElement {
|
|
|
58
57
|
this._notice = ''
|
|
59
58
|
this._installs = true
|
|
60
59
|
this._filter = ''
|
|
61
|
-
|
|
60
|
+
// Settings links a bundle's cards here, naming it in `?bundle=`.
|
|
61
|
+
this._selected = new URLSearchParams(window.location.search).get('bundle') ?? ''
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
connectedCallback() {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The Marketplace view, in place of Umbraco's.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* What it replaces is an iframe of marketplace.umbraco.com, which cannot work
|
|
4
|
+
* A tab of the Bundles tool in Settings (story 238), where Umbraco's Packages
|
|
5
|
+
* section had its Marketplace. What it replaces is an iframe of marketplace.umbraco.com, which cannot work
|
|
6
6
|
* here twice over: npm refuses to be framed (`x-frame-options: SAMEORIGIN`), and
|
|
7
7
|
* an Umbraco package does not install into this CMS anyway.
|
|
8
8
|
*
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bundles, a Settings tool (story 238): Marketplace, Installed and Created as
|
|
3
|
+
* tabs, each at an address of its own under `dashboard/bundles/`. The views
|
|
4
|
+
* are the ones Umbraco's Packages section showed, which this replaces.
|
|
5
|
+
*/
|
|
6
|
+
import { css, html } from '@umbraco-cms/backoffice/external/lit'
|
|
7
|
+
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'
|
|
8
|
+
|
|
9
|
+
/** The tabs, in order: each one's segment, its label, and its view. */
|
|
10
|
+
export const BUNDLE_TABS = [
|
|
11
|
+
{ path: 'marketplace', label: 'Marketplace', load: () => import('./bundles-marketplace.js') },
|
|
12
|
+
{ path: 'installed', label: 'Installed', load: () => import('./bundles-installed.js') },
|
|
13
|
+
{ path: 'created', label: 'Created', load: () => import('./bundles-created.js') },
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
/** Where the tool is, relative to the back office. */
|
|
17
|
+
export const BUNDLES_PATH = 'section/settings/dashboard/bundles'
|
|
18
|
+
|
|
19
|
+
export default class CromboloBundlesToolElement extends UmbLitElement {
|
|
20
|
+
static properties = { _routerPath: { state: true }, _active: { state: true } }
|
|
21
|
+
|
|
22
|
+
constructor() {
|
|
23
|
+
super()
|
|
24
|
+
this._routerPath = BUNDLES_PATH
|
|
25
|
+
this._active = BUNDLE_TABS[0].path
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
#routes = [
|
|
29
|
+
...BUNDLE_TABS.map((tab) => ({ path: tab.path, component: tab.load })),
|
|
30
|
+
{ path: '', pathMatch: 'full', redirectTo: BUNDLE_TABS[0].path },
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
render() {
|
|
34
|
+
return html`
|
|
35
|
+
<uui-tab-group>
|
|
36
|
+
${BUNDLE_TABS.map(
|
|
37
|
+
(tab) => html`<uui-tab
|
|
38
|
+
label=${tab.label}
|
|
39
|
+
href=${`${this._routerPath}/${tab.path}`}
|
|
40
|
+
?active=${this._active === tab.path}
|
|
41
|
+
>${tab.label}</uui-tab>`,
|
|
42
|
+
)}
|
|
43
|
+
</uui-tab-group>
|
|
44
|
+
<umb-router-slot
|
|
45
|
+
.routes=${this.#routes}
|
|
46
|
+
@init=${(event) => {
|
|
47
|
+
this._routerPath = event.target.absoluteRouterPath
|
|
48
|
+
}}
|
|
49
|
+
@change=${(event) => {
|
|
50
|
+
const active = event.target.absoluteActiveViewPath ?? ''
|
|
51
|
+
this._active = BUNDLE_TABS.find((tab) => active.endsWith(`/${tab.path}`))?.path ?? ''
|
|
52
|
+
}}
|
|
53
|
+
></umb-router-slot>
|
|
54
|
+
`
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static styles = css`
|
|
58
|
+
:host {
|
|
59
|
+
display: flex;
|
|
60
|
+
flex-direction: column;
|
|
61
|
+
height: 100%;
|
|
62
|
+
}
|
|
63
|
+
uui-tab-group {
|
|
64
|
+
/* UUI's tab group fills its container's height; here it is a strip. */
|
|
65
|
+
flex: none;
|
|
66
|
+
height: auto;
|
|
67
|
+
padding: 0 var(--uui-size-layout-1);
|
|
68
|
+
border-bottom: 1px solid var(--uui-color-border);
|
|
69
|
+
--uui-tab-divider: transparent;
|
|
70
|
+
}
|
|
71
|
+
umb-router-slot {
|
|
72
|
+
display: block;
|
|
73
|
+
flex: 1 1 auto;
|
|
74
|
+
min-height: 0;
|
|
75
|
+
}
|
|
76
|
+
`
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
customElements.define('crombolo-bundles-tool', CromboloBundlesToolElement)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/** CI access's words and its one API call (story 160). Pure but for `trustApi`. */
|
|
2
|
+
|
|
3
|
+
/** What a rule may hold, in the order a person reads them. */
|
|
4
|
+
export const CI_PERMISSIONS = [
|
|
5
|
+
{
|
|
6
|
+
verb: 'Crombolo.Remote.Pull',
|
|
7
|
+
label: 'Pull',
|
|
8
|
+
explain: "Download the site's content, without its private parts.",
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
verb: 'Crombolo.Remote.PullFull',
|
|
12
|
+
label: 'Pull everything',
|
|
13
|
+
explain: 'Download the site with people and private data too.',
|
|
14
|
+
},
|
|
15
|
+
{ verb: 'Crombolo.Remote.Push', label: 'Push', explain: 'Replace this site from a file.' },
|
|
16
|
+
{
|
|
17
|
+
verb: 'Crombolo.Remote.PushProtected',
|
|
18
|
+
label: 'Push to a protected site',
|
|
19
|
+
explain: 'Change a site people rely on, such as production, with nobody approving it.',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
verb: 'Crombolo.Remote.ApplyStructure',
|
|
23
|
+
label: 'Change structure and code',
|
|
24
|
+
explain: 'Push a whole site, or apply a bundle that changes its types, views, styles or code.',
|
|
25
|
+
},
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
/** A provider by the address its tokens come from. */
|
|
29
|
+
export function providerName(issuer) {
|
|
30
|
+
if (issuer === 'https://token.actions.githubusercontent.com') return 'GitHub Actions'
|
|
31
|
+
if (issuer === 'https://gitlab.com') return 'GitLab'
|
|
32
|
+
return `GitLab at ${issuer.replace(/^https?:\/\//, '')}`
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const base = () =>
|
|
36
|
+
`${(document.querySelector('base')?.getAttribute('href') ?? '/umbraco/').replace(/\/$/, '')}/crombolo/api/remote-trust`
|
|
37
|
+
|
|
38
|
+
/** Calls the trust rules; a refusal throws with the server's reasons as `items`. */
|
|
39
|
+
export async function trustApi(method, path = '', body) {
|
|
40
|
+
const response = await fetch(`${base()}${path}`, {
|
|
41
|
+
method,
|
|
42
|
+
credentials: 'include',
|
|
43
|
+
headers: {
|
|
44
|
+
accept: 'application/json',
|
|
45
|
+
...(body ? { 'content-type': 'application/json' } : {}),
|
|
46
|
+
},
|
|
47
|
+
...(body ? { body: JSON.stringify(body) } : {}),
|
|
48
|
+
})
|
|
49
|
+
if (response.status === 204) return undefined
|
|
50
|
+
const result = await response.json().catch(() => ({}))
|
|
51
|
+
if (!response.ok) {
|
|
52
|
+
const error = new Error(result.title ?? `CI access responded ${response.status}`)
|
|
53
|
+
error.items = result.items
|
|
54
|
+
throw error
|
|
55
|
+
}
|
|
56
|
+
return result
|
|
57
|
+
}
|