@umbraco-cms/backoffice 14.0.0-a8030000 → 14.0.0-abd22b1c

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.
Files changed (21) hide show
  1. package/dist-cms/packages/core/content-type/content-type-container-structure-helper.class.js +2 -2
  2. package/dist-cms/packages/core/content-type/content-type-property-structure-helper.class.js +1 -1
  3. package/dist-cms/packages/core/content-type/content-type-structure-manager.class.d.ts +15 -15
  4. package/dist-cms/packages/core/content-type/content-type-structure-manager.class.js +79 -103
  5. package/dist-cms/packages/documents/document-types/entity-actions/manifests.js +1 -1
  6. package/dist-cms/packages/documents/document-types/repository/document-type-item.store.d.ts +20 -0
  7. package/dist-cms/packages/documents/document-types/repository/document-type-item.store.js +23 -0
  8. package/dist-cms/packages/documents/document-types/repository/document-type.repository.d.ts +5 -21
  9. package/dist-cms/packages/documents/document-types/repository/document-type.repository.js +26 -20
  10. package/dist-cms/packages/documents/document-types/repository/manifests.d.ts +3 -2
  11. package/dist-cms/packages/documents/document-types/repository/manifests.js +9 -1
  12. package/dist-cms/packages/documents/document-types/repository/sources/document-type-item.server.data.d.ts +25 -0
  13. package/dist-cms/packages/documents/document-types/repository/sources/document-type-item.server.data.js +32 -0
  14. package/dist-cms/packages/documents/document-types/repository/sources/document-type.server.data.js +1 -12
  15. package/dist-cms/packages/documents/document-types/workspace/document-type-workspace.context.js +27 -27
  16. package/dist-cms/packages/documents/document-types/workspace/views/design/document-type-workspace-view-edit.element.js +8 -4
  17. package/dist-cms/packages/settings/dashboards/performance-profiling/dashboard-performance-profiling.element.d.ts +3 -1
  18. package/dist-cms/packages/settings/dashboards/performance-profiling/dashboard-performance-profiling.element.js +26 -40
  19. package/dist-cms/tsconfig.build.tsbuildinfo +1 -1
  20. package/dist-cms/vscode-html-custom-data.json +1 -1
  21. package/package.json +1 -1
@@ -1,5 +1,6 @@
1
- import { ManifestRepository, ManifestStore, ManifestTreeStore } from '../../../core/extension-registry/index.js';
1
+ import { ManifestItemStore, ManifestRepository, ManifestStore, ManifestTreeStore } from '../../../core/extension-registry/index.js';
2
2
  export declare const DOCUMENT_TYPE_REPOSITORY_ALIAS = "Umb.Repository.DocumentType";
3
3
  export declare const DOCUMENT_TYPE_STORE_ALIAS = "Umb.Store.DocumentType";
4
4
  export declare const DOCUMENT_TYPE_TREE_STORE_ALIAS = "Umb.Store.DocumentTypeTree";
5
- export declare const manifests: (ManifestRepository | ManifestStore | ManifestTreeStore)[];
5
+ export declare const DOCUMENT_TYPE_ITEM_STORE_ALIAS = "Umb.Store.DocumentTypeItem";
6
+ export declare const manifests: (ManifestItemStore | ManifestRepository | ManifestStore | ManifestTreeStore)[];
@@ -1,3 +1,4 @@
1
+ import { UmbDocumentTypeItemStore } from './document-type-item.store.js';
1
2
  import { UmbDocumentTypeRepository } from './document-type.repository.js';
2
3
  import { UmbDocumentTypeStore } from './document-type.store.js';
3
4
  import { UmbDocumentTypeTreeStore } from './document-type.tree.store.js';
@@ -10,6 +11,7 @@ const repository = {
10
11
  };
11
12
  export const DOCUMENT_TYPE_STORE_ALIAS = 'Umb.Store.DocumentType';
12
13
  export const DOCUMENT_TYPE_TREE_STORE_ALIAS = 'Umb.Store.DocumentTypeTree';
14
+ export const DOCUMENT_TYPE_ITEM_STORE_ALIAS = 'Umb.Store.DocumentTypeItem';
13
15
  const store = {
14
16
  type: 'store',
15
17
  alias: DOCUMENT_TYPE_STORE_ALIAS,
@@ -22,4 +24,10 @@ const treeStore = {
22
24
  name: 'Document Type Tree Store',
23
25
  class: UmbDocumentTypeTreeStore,
24
26
  };
25
- export const manifests = [repository, store, treeStore];
27
+ const itemStore = {
28
+ type: 'itemStore',
29
+ alias: DOCUMENT_TYPE_ITEM_STORE_ALIAS,
30
+ name: 'Document Type Item Store',
31
+ class: UmbDocumentTypeItemStore,
32
+ };
33
+ export const manifests = [repository, store, treeStore, itemStore];
@@ -0,0 +1,25 @@
1
+ import type { UmbItemDataSource } from '../../../../../shared/repository/index.js';
2
+ import { DocumentTypeItemResponseModel } from '../../../../../external/backend-api/index.js';
3
+ import { UmbControllerHostElement } from '../../../../../libs/controller-api/index.js';
4
+ /**
5
+ * A data source for Document Type items that fetches data from the server
6
+ * @export
7
+ * @class UmbDocumentTypeItemServerDataSource
8
+ * @implements {UmbItemDataSource}
9
+ */
10
+ export declare class UmbDocumentTypeItemServerDataSource implements UmbItemDataSource<DocumentTypeItemResponseModel> {
11
+ #private;
12
+ /**
13
+ * Creates an instance of UmbDocumentTypeItemServerDataSource.
14
+ * @param {UmbControllerHostElement} host
15
+ * @memberof UmbDocumentTypeItemServerDataSource
16
+ */
17
+ constructor(host: UmbControllerHostElement);
18
+ /**
19
+ * Fetches the items for the given ids from the server
20
+ * @param {Array<string>} ids
21
+ * @return {*}
22
+ * @memberof UmbDocumentTypeItemServerDataSource
23
+ */
24
+ getItems(ids: Array<string>): Promise<import("../../../../../shared/repository/index.js").DataSourceResponse<DocumentTypeItemResponseModel[]>>;
25
+ }
@@ -0,0 +1,32 @@
1
+ import { DocumentTypeResource } from '../../../../../external/backend-api/index.js';
2
+ import { tryExecuteAndNotify } from '../../../../../shared/resources/index.js';
3
+ /**
4
+ * A data source for Document Type items that fetches data from the server
5
+ * @export
6
+ * @class UmbDocumentTypeItemServerDataSource
7
+ * @implements {UmbItemDataSource}
8
+ */
9
+ export class UmbDocumentTypeItemServerDataSource {
10
+ #host;
11
+ /**
12
+ * Creates an instance of UmbDocumentTypeItemServerDataSource.
13
+ * @param {UmbControllerHostElement} host
14
+ * @memberof UmbDocumentTypeItemServerDataSource
15
+ */
16
+ constructor(host) {
17
+ this.#host = host;
18
+ }
19
+ /**
20
+ * Fetches the items for the given ids from the server
21
+ * @param {Array<string>} ids
22
+ * @return {*}
23
+ * @memberof UmbDocumentTypeItemServerDataSource
24
+ */
25
+ async getItems(ids) {
26
+ if (!ids)
27
+ throw new Error('Ids are missing');
28
+ return tryExecuteAndNotify(this.#host, DocumentTypeResource.getDocumentTypeItem({
29
+ id: ids,
30
+ }));
31
+ }
32
+ }
@@ -72,18 +72,7 @@ export class UmbDocumentTypeServerDataSource {
72
72
  */
73
73
  async insert(documentType) {
74
74
  if (!documentType)
75
- throw new Error('Document is missing');
76
- //if (!document.id) throw new Error('ID is missing');
77
- documentType = { ...documentType };
78
- // TODO: Hack to remove some props that ruins the document-type post end-point.
79
- documentType.id = undefined;
80
- // TODO: Investigate if this matters (should go away anyway when we have the end-point accepts us defining the ids.)
81
- documentType.properties = documentType.properties?.map((prop) => {
82
- return {
83
- ...prop,
84
- id: undefined,
85
- };
86
- });
75
+ throw new Error('Document Type is missing');
87
76
  return tryExecuteAndNotify(this.#host, DocumentTypeResource.postDocumentType({
88
77
  requestBody: documentType,
89
78
  }));
@@ -7,24 +7,24 @@ export class UmbDocumentTypeWorkspaceContext extends UmbWorkspaceContext {
7
7
  super(host, 'Umb.Workspace.DocumentType', new UmbDocumentTypeRepository(host));
8
8
  this.structure = new UmbContentTypePropertyStructureManager(this.host, this.repository);
9
9
  // General for content types:
10
- this.data = this.structure.ownerDocumentType;
11
- this.name = this.structure.ownerDocumentTypeObservablePart((data) => data?.name);
12
- this.alias = this.structure.ownerDocumentTypeObservablePart((data) => data?.alias);
13
- this.description = this.structure.ownerDocumentTypeObservablePart((data) => data?.description);
14
- this.icon = this.structure.ownerDocumentTypeObservablePart((data) => data?.icon);
15
- this.allowedAsRoot = this.structure.ownerDocumentTypeObservablePart((data) => data?.allowedAsRoot);
16
- this.variesByCulture = this.structure.ownerDocumentTypeObservablePart((data) => data?.variesByCulture);
17
- this.variesBySegment = this.structure.ownerDocumentTypeObservablePart((data) => data?.variesBySegment);
18
- this.isElement = this.structure.ownerDocumentTypeObservablePart((data) => data?.isElement);
19
- this.allowedContentTypes = this.structure.ownerDocumentTypeObservablePart((data) => data?.allowedContentTypes);
20
- this.compositions = this.structure.ownerDocumentTypeObservablePart((data) => data?.compositions);
10
+ this.data = this.structure.ownerContentType;
11
+ this.name = this.structure.ownerContentTypeObservablePart((data) => data?.name);
12
+ this.alias = this.structure.ownerContentTypeObservablePart((data) => data?.alias);
13
+ this.description = this.structure.ownerContentTypeObservablePart((data) => data?.description);
14
+ this.icon = this.structure.ownerContentTypeObservablePart((data) => data?.icon);
15
+ this.allowedAsRoot = this.structure.ownerContentTypeObservablePart((data) => data?.allowedAsRoot);
16
+ this.variesByCulture = this.structure.ownerContentTypeObservablePart((data) => data?.variesByCulture);
17
+ this.variesBySegment = this.structure.ownerContentTypeObservablePart((data) => data?.variesBySegment);
18
+ this.isElement = this.structure.ownerContentTypeObservablePart((data) => data?.isElement);
19
+ this.allowedContentTypes = this.structure.ownerContentTypeObservablePart((data) => data?.allowedContentTypes);
20
+ this.compositions = this.structure.ownerContentTypeObservablePart((data) => data?.compositions);
21
21
  // Document type specific:
22
- this.allowedTemplateIds = this.structure.ownerDocumentTypeObservablePart((data) => data?.allowedTemplateIds);
23
- this.defaultTemplateId = this.structure.ownerDocumentTypeObservablePart((data) => data?.defaultTemplateId);
24
- this.cleanup = this.structure.ownerDocumentTypeObservablePart((data) => data?.defaultTemplateId);
22
+ this.allowedTemplateIds = this.structure.ownerContentTypeObservablePart((data) => data?.allowedTemplateIds);
23
+ this.defaultTemplateId = this.structure.ownerContentTypeObservablePart((data) => data?.defaultTemplateId);
24
+ this.cleanup = this.structure.ownerContentTypeObservablePart((data) => data?.defaultTemplateId);
25
25
  }
26
26
  getData() {
27
- return this.structure.getOwnerDocumentType() || {};
27
+ return this.structure.getOwnerContentType() || {};
28
28
  }
29
29
  getEntityId() {
30
30
  return this.getData().id;
@@ -33,42 +33,42 @@ export class UmbDocumentTypeWorkspaceContext extends UmbWorkspaceContext {
33
33
  return 'document-type';
34
34
  }
35
35
  setName(name) {
36
- this.structure.updateOwnerDocumentType({ name });
36
+ this.structure.updateOwnerContentType({ name });
37
37
  }
38
38
  setAlias(alias) {
39
- this.structure.updateOwnerDocumentType({ alias });
39
+ this.structure.updateOwnerContentType({ alias });
40
40
  }
41
41
  setDescription(description) {
42
- this.structure.updateOwnerDocumentType({ description });
42
+ this.structure.updateOwnerContentType({ description });
43
43
  }
44
44
  // TODO: manage setting icon color alias?
45
45
  setIcon(icon) {
46
- this.structure.updateOwnerDocumentType({ icon });
46
+ this.structure.updateOwnerContentType({ icon });
47
47
  }
48
48
  setAllowedAsRoot(allowedAsRoot) {
49
- this.structure.updateOwnerDocumentType({ allowedAsRoot });
49
+ this.structure.updateOwnerContentType({ allowedAsRoot });
50
50
  }
51
51
  setVariesByCulture(variesByCulture) {
52
- this.structure.updateOwnerDocumentType({ variesByCulture });
52
+ this.structure.updateOwnerContentType({ variesByCulture });
53
53
  }
54
54
  setVariesBySegment(variesBySegment) {
55
- this.structure.updateOwnerDocumentType({ variesBySegment });
55
+ this.structure.updateOwnerContentType({ variesBySegment });
56
56
  }
57
57
  setIsElement(isElement) {
58
- this.structure.updateOwnerDocumentType({ isElement });
58
+ this.structure.updateOwnerContentType({ isElement });
59
59
  }
60
60
  setAllowedContentTypes(allowedContentTypes) {
61
- this.structure.updateOwnerDocumentType({ allowedContentTypes });
61
+ this.structure.updateOwnerContentType({ allowedContentTypes });
62
62
  }
63
63
  setCompositions(compositions) {
64
- this.structure.updateOwnerDocumentType({ compositions });
64
+ this.structure.updateOwnerContentType({ compositions });
65
65
  }
66
66
  // Document type specific:
67
67
  setAllowedTemplateIds(allowedTemplateIds) {
68
- this.structure.updateOwnerDocumentType({ allowedTemplateIds });
68
+ this.structure.updateOwnerContentType({ allowedTemplateIds });
69
69
  }
70
70
  setDefaultTemplateId(defaultTemplateId) {
71
- this.structure.updateOwnerDocumentType({ defaultTemplateId });
71
+ this.structure.updateOwnerContentType({ defaultTemplateId });
72
72
  }
73
73
  async create(parentId) {
74
74
  const { data } = await this.structure.createScaffold(parentId);
@@ -88,9 +88,13 @@ export let UmbDocumentTypeWorkspaceViewEditElement = class UmbDocumentTypeWorksp
88
88
  #requestRemoveTab(tab) {
89
89
  const Message = {
90
90
  headline: 'Delete tab',
91
- content: html `<umb-localize key="contentTypeEditor_confirmDeleteTabMessage" .args=${[tab?.name ?? tab?.id]}>Are you sure you want to delete the tab <strong>${tab?.name ?? tab?.id}</strong></umb-localize>
91
+ content: html `<umb-localize key="contentTypeEditor_confirmDeleteTabMessage" .args=${[tab?.name ?? tab?.id]}
92
+ >Are you sure you want to delete the tab <strong>${tab?.name ?? tab?.id}</strong></umb-localize
93
+ >
92
94
  <div style="color:var(--uui-color-danger-emphasis)">
93
- <umb-localize key="contentTypeEditor_confirmDeleteTabNotice">This will delete all items that doesn't belong to a composition.</umb-localize>
95
+ <umb-localize key="contentTypeEditor_confirmDeleteTabNotice"
96
+ >This will delete all items that doesn't belong to a composition.</umb-localize
97
+ >
94
98
  </div>`,
95
99
  confirmLabel: this.localize.term('actions_delete'),
96
100
  color: 'danger',
@@ -135,7 +139,7 @@ export let UmbDocumentTypeWorkspaceViewEditElement = class UmbDocumentTypeWorksp
135
139
  newName = 'Unnamed';
136
140
  event.target.value = 'Unnamed';
137
141
  }
138
- const changedName = this._workspaceContext?.structure.makeContainerNameUniqueForOwnerDocument(newName, 'Tab', tab.id);
142
+ const changedName = this._workspaceContext?.structure.makeContainerNameUniqueForOwnerContentType(newName, 'Tab', tab.id);
139
143
  // Check if it collides with another tab name of this same document-type, if so adjust name:
140
144
  if (changedName) {
141
145
  newName = changedName;
@@ -220,7 +224,7 @@ export let UmbDocumentTypeWorkspaceViewEditElement = class UmbDocumentTypeWorksp
220
224
  </uui-button>
221
225
  <uui-button label=${this.localize.term('general_reorder')} compact>
222
226
  <uui-icon name="umb:navigation"></uui-icon>
223
- <umb-localize key="general_reorder">Reorder</umb-localize>
227
+ <umb-localize key="general_reorder">Reorder</umb-localize>
224
228
  </uui-button>
225
229
  </div>`;
226
230
  }
@@ -1,7 +1,9 @@
1
1
  import { UmbLitElement } from '../../../../shared/lit-element/index.js';
2
2
  export declare class UmbDashboardPerformanceProfilingElement extends UmbLitElement {
3
- private _profilingStatus?;
3
+ #private;
4
+ private _profilingStatus;
4
5
  private _isDebugMode;
6
+ private _toggle;
5
7
  firstUpdated(): void;
6
8
  private _getProfilingStatus;
7
9
  private _changeProfilingStatus;
@@ -4,78 +4,61 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { UmbTextStyles } from "../../../../shared/style/index.js";
8
- import { css, html, customElement, state } from '../../../../external/lit/index.js';
7
+ import { UmbTextStyles } from '../../../../shared/style/index.js';
8
+ import { css, html, customElement, state, query, unsafeHTML } from '../../../../external/lit/index.js';
9
9
  import { UmbLitElement } from '../../../../shared/lit-element/index.js';
10
10
  import { ProfilingResource } from '../../../../external/backend-api/index.js';
11
11
  import { tryExecuteAndNotify } from '../../../../shared/resources/index.js';
12
12
  export let UmbDashboardPerformanceProfilingElement = class UmbDashboardPerformanceProfilingElement extends UmbLitElement {
13
13
  constructor() {
14
14
  super(...arguments);
15
+ this._profilingStatus = true;
15
16
  // TODO: Get this from the management api configuration when available
16
17
  this._isDebugMode = true;
17
18
  }
19
+ #setToggle(value) {
20
+ this._toggle.checked = value;
21
+ this._profilingStatus = value;
22
+ }
18
23
  firstUpdated() {
19
24
  this._getProfilingStatus();
20
25
  }
21
26
  async _getProfilingStatus() {
22
27
  const { data } = await tryExecuteAndNotify(this, ProfilingResource.getProfilingStatus());
23
- if (data) {
24
- this._profilingStatus = data.enabled;
25
- }
28
+ if (!data || !data.enabled)
29
+ return;
30
+ this._profilingStatus = data.enabled;
26
31
  }
27
32
  async _changeProfilingStatus() {
28
33
  const { error } = await tryExecuteAndNotify(this, ProfilingResource.putProfilingStatus({ requestBody: { enabled: !this._profilingStatus } }));
29
- if (!error) {
30
- this._profilingStatus = !this._profilingStatus;
34
+ if (error) {
35
+ this.#setToggle(this._profilingStatus);
36
+ }
37
+ else {
38
+ this.#setToggle(!this._profilingStatus);
31
39
  }
32
40
  }
33
41
  renderProfilingStatus() {
34
42
  return this._isDebugMode
35
43
  ? html `
36
- <p>
37
- Umbraco is running in debug mode. This means you can use the built-in performance profiler to assess
38
- performance when rendering pages.
39
- </p>
40
- <p>
41
- If you want to activate the profiler for a specific page rendering, simply add
42
- <strong>umbDebug=true</strong> to the querystring when requesting the page.
43
- </p>
44
-
45
- <p>
46
- If you want the profiler to be activated by default for all page renderings, you can use the toggle below.
47
- It will set a cookie in your browser, which then activates the profiler automatically. In other words, the
48
- profiler will only be active by default in your browser - not everyone else's.
49
- </p>
44
+ ${unsafeHTML(this.localize.term('profiling_performanceProfilingDescription'))}
50
45
 
51
46
  <uui-toggle
47
+ id="toggle"
52
48
  label="Activate the profiler by default"
53
49
  label-position="left"
54
- .checked="${this._profilingStatus}"
50
+ ?checked="${this._profilingStatus}"
55
51
  @change="${this._changeProfilingStatus}"></uui-toggle>
56
52
 
57
- <h4>Friendly reminder</h4>
58
- <p>
59
- You should never let a production site run in debug mode. Debug mode is turned off by setting
60
- <strong>Umbraco:CMS:Hosting:Debug</strong> to <strong>false</strong> in appsettings.json,
61
- appsettings.{Environment}.json or via an environment variable.
62
- </p>
53
+ <h4>${this.localize.term('profiling_reminder')}</h4>
54
+
55
+ ${unsafeHTML(this.localize.term('profiling_reminderDescription'))}
63
56
  `
64
- : html `
65
- <p>
66
- Umbraco is not running in debug mode, so you can't use the built-in profiler. This is how it should be for a
67
- production site.
68
- </p>
69
- <p>
70
- Debug mode is turned on by setting <strong>Umbraco:CMS:Hosting:Debug</strong> to <strong>true</strong> in
71
- appsettings.json, appsettings.{Environment}.json or via an environment variable.
72
- </p>
73
- `;
57
+ : html ` ${unsafeHTML(this.localize.term('profiling_profilerEnabledDescription'))} `;
74
58
  }
75
59
  render() {
76
60
  return html `
77
- <uui-box>
78
- <h1>Performance Profiling</h1>
61
+ <uui-box headline=${this.localize.term('profiling_performanceProfiling')}>
79
62
  ${typeof this._profilingStatus === 'undefined' ? html `<uui-loader></uui-loader>` : this.renderProfilingStatus()}
80
63
  </uui-box>
81
64
  `;
@@ -108,6 +91,9 @@ __decorate([
108
91
  __decorate([
109
92
  state()
110
93
  ], UmbDashboardPerformanceProfilingElement.prototype, "_isDebugMode", void 0);
94
+ __decorate([
95
+ query('#toggle')
96
+ ], UmbDashboardPerformanceProfilingElement.prototype, "_toggle", void 0);
111
97
  UmbDashboardPerformanceProfilingElement = __decorate([
112
98
  customElement('umb-dashboard-performance-profiling')
113
99
  ], UmbDashboardPerformanceProfilingElement);