@crombolo/backoffice-host 0.43.1 → 0.45.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.
@@ -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)
@@ -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` are `{ alias, label,
112
- * entityType }`; `structure` and `code` say whether the user may open an item
113
- * of that tree. Paths are relative to the section.
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) found.push({ alias: d.alias, label: d.label, path: d.path })
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({ alias: item.alias, label: item.label, path: `workspace/${item.entityType}` })
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
- : { alias: card.alias, path: card.path, group: 'Other', title: card.label ?? card.alias }
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
- return GROUPS.map((group) => ({ group, cards: cards.filter((c) => c.group === group) })).filter(
141
- (g) => g.cards.length > 0,
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) => ({ alias: m.alias, label: this.#label(m), entityType: m.meta?.entityType }))
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>${group}</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) => html`<a class="card" href=${`section/settings/${card.path}`}>
321
- <strong>${card.title}</strong>
322
- ${card.description ? html`<span>${card.description}</span>` : nothing}
323
- </a>`,
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
- .cards {
349
- display: grid;
350
- grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
351
- gap: var(--uui-size-space-5);
352
- }
353
- .card {
354
- display: flex;
355
- flex-direction: column;
356
- gap: var(--uui-size-space-2);
357
- padding: var(--uui-size-space-5);
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
- .card:hover,
366
- .card:focus-visible {
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
- .card span {
370
- color: var(--uui-color-text-alt);
371
- font-size: var(--uui-type-small-size);
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;
@@ -2,7 +2,7 @@
2
2
  "$schema": "../../../backoffice-dist/dist/umbraco-package-schema.json",
3
3
  "name": "Crombolo Sign-in Dialog",
4
4
  "id": "Crombolo.SignInDialog",
5
- "version": "0.43.1",
5
+ "version": "0.45.0",
6
6
  "allowPublicAccess": true,
7
7
  "extensions": [
8
8
  {
@@ -2,7 +2,7 @@
2
2
  "$schema": "../../backoffice-dist/dist/umbraco-package-schema.json",
3
3
  "name": "Crombolo",
4
4
  "id": "Crombolo.Core",
5
- "version": "0.43.1",
5
+ "version": "0.45.0",
6
6
  "allowPublicAccess": false,
7
7
  "extensions": [
8
8
  {
@@ -71,6 +71,28 @@
71
71
  "description": "Replace a site people rely on, and approve or decline other people's pushes to it"
72
72
  }
73
73
  },
74
+ {
75
+ "type": "entityUserPermission",
76
+ "alias": "Crombolo.UserPermission.Remote.ApplyStructure",
77
+ "name": "Crombolo Remote ApplyStructure Permission",
78
+ "forEntityTypes": ["crombolo-remote"],
79
+ "meta": {
80
+ "verbs": ["Crombolo.Remote.ApplyStructure"],
81
+ "label": "Change a site's structure and code",
82
+ "description": "Push a whole site, or apply a bundle that changes its content types, views, styles or code"
83
+ }
84
+ },
85
+ {
86
+ "type": "entityUserPermission",
87
+ "alias": "Crombolo.UserPermission.Remote.InstallCode",
88
+ "name": "Crombolo Remote InstallCode Permission",
89
+ "forEntityTypes": ["crombolo-remote"],
90
+ "meta": {
91
+ "verbs": ["Crombolo.Remote.InstallCode"],
92
+ "label": "Install code on this site",
93
+ "description": "Install bundles and the code a bundle carries, which runs on the server after a restart. Administrators only have this when a group gives it to them: give it to a group of its own rather than Administrators"
94
+ }
95
+ },
74
96
  {
75
97
  "type": "entityUserPermission",
76
98
  "alias": "Crombolo.UserPermission.Media.Read",
@@ -133,40 +155,37 @@
133
155
  }
134
156
  },
135
157
  {
136
- "type": "sectionView",
137
- "alias": "Crombolo.SectionView.Bundles.Marketplace",
138
- "name": "Crombolo Packages Marketplace",
139
- "element": "/crombolo-plugin/bundles-marketplace.js",
140
- "weight": 300,
141
- "overwrites": ["Umb.SectionView.Packages.Marketplace"],
158
+ "type": "dashboard",
159
+ "alias": "Crombolo.Dashboard.CiAccess",
160
+ "name": "Crombolo CI Access",
161
+ "element": "/crombolo-plugin/ci-access.js",
142
162
  "meta": {
143
- "label": "Marketplace",
144
- "pathname": "packages",
145
- "icon": "icon-cloud"
163
+ "label": "CI access",
164
+ "pathname": "ci-access"
146
165
  },
147
166
  "conditions": [
148
167
  {
149
168
  "alias": "Umb.Condition.SectionAlias",
150
- "match": "Umb.Section.Packages"
169
+ "match": "Umb.Section.Settings"
170
+ },
171
+ {
172
+ "alias": "Umb.Condition.CurrentUser.IsAdmin"
151
173
  }
152
174
  ]
153
175
  },
154
176
  {
155
- "type": "sectionView",
156
- "alias": "Crombolo.SectionView.Bundles.Created",
157
- "name": "Crombolo Created Bundles",
158
- "element": "/crombolo-plugin/bundles-created.js",
159
- "weight": 100,
160
- "overwrites": ["Umb.SectionView.Packages.Builder"],
177
+ "type": "dashboard",
178
+ "alias": "Crombolo.Dashboard.Bundles",
179
+ "name": "Crombolo Bundles",
180
+ "element": "/crombolo-plugin/bundles-tool.js",
161
181
  "meta": {
162
- "label": "Created",
163
- "pathname": "created",
164
- "icon": "icon-files"
182
+ "label": "Bundles",
183
+ "pathname": "bundles"
165
184
  },
166
185
  "conditions": [
167
186
  {
168
187
  "alias": "Umb.Condition.SectionAlias",
169
- "match": "Umb.Section.Packages"
188
+ "match": "Umb.Section.Settings"
170
189
  }
171
190
  ]
172
191
  },
@@ -306,25 +325,6 @@
306
325
  }
307
326
  ]
308
327
  },
309
- {
310
- "type": "sectionView",
311
- "alias": "Crombolo.SectionView.Bundles.Installed",
312
- "name": "Crombolo Installed Packages",
313
- "element": "/crombolo-plugin/bundles-installed.js",
314
- "weight": 200,
315
- "overwrites": ["Umb.SectionView.Packages.Installed"],
316
- "meta": {
317
- "label": "Installed",
318
- "pathname": "installed",
319
- "icon": "icon-box"
320
- },
321
- "conditions": [
322
- {
323
- "alias": "Umb.Condition.SectionAlias",
324
- "match": "Umb.Section.Packages"
325
- }
326
- ]
327
- },
328
328
  {
329
329
  "type": "workspaceView",
330
330
  "alias": "Crombolo.WorkspaceView.Webhook.Storage",
@@ -499,6 +499,19 @@
499
499
  }
500
500
  ]
501
501
  },
502
+ {
503
+ "type": "workspaceFooterApp",
504
+ "alias": "Crombolo.WorkspaceFooterApp.FormTypeNote",
505
+ "name": "Crombolo Form Type Note",
506
+ "element": "/crombolo-plugin/form-type-note.js",
507
+ "weight": 910,
508
+ "conditions": [
509
+ {
510
+ "alias": "Umb.Condition.WorkspaceAlias",
511
+ "match": "Umb.Workspace.DocumentType"
512
+ }
513
+ ]
514
+ },
502
515
  {
503
516
  "type": "backofficeEntryPoint",
504
517
  "alias": "Crombolo.EntryPoint.HelpMenu",
package/src/extensions.ts CHANGED
@@ -94,9 +94,13 @@ export function extensionOf(bundle: BundlePackage): InstalledExtension | undefin
94
94
  version: bundle.version,
95
95
  allowPublicAccess: field.allowPublicAccess ?? false,
96
96
  allowTelemetry: field.allowTelemetry ?? false,
97
- extensions: (field.extensions ?? []).map((extension) =>
98
- rewriteAssets(extension, packageName),
99
- ),
97
+ // Each extension names its bundle, so Settings can group a bundle's cards and link to it.
98
+ extensions: (field.extensions ?? []).map((extension) => {
99
+ const rewritten = rewriteAssets(extension, packageName)
100
+ return rewritten && typeof rewritten === 'object'
101
+ ? { ...rewritten, cromboloBundle: { name: bundle.name, packageName } }
102
+ : rewritten
103
+ }),
100
104
  importmap: rewriteImportmap(field.importmap, packageName),
101
105
  },
102
106
  }