diff --git a/src/Umbraco.Web.UI.Client/.storybook/preview.js b/src/Umbraco.Web.UI.Client/.storybook/preview.js index 484ccb2c7c..9eb279f45b 100644 --- a/src/Umbraco.Web.UI.Client/.storybook/preview.js +++ b/src/Umbraco.Web.UI.Client/.storybook/preview.js @@ -1,3 +1,6 @@ +import '../src/core/css/custom-properties.css'; +import '@umbraco-ui/uui-css/dist/uui-css.css'; + import '@umbraco-ui/uui'; import '@umbraco-ui/uui-modal'; import '@umbraco-ui/uui-modal-container'; @@ -9,7 +12,7 @@ import { initialize, mswDecorator } from 'msw-storybook-addon'; import { setCustomElements } from '@storybook/web-components'; import customElementManifests from '../custom-elements.json'; -import { UmbDataTypeStore } from '../src/backoffice/settings/data-types/data-type.store'; +import { STORE_ALIAS as dataTypeAlias, UmbDataTypeStore } from '../src/backoffice/settings/data-types/data-type.store'; import { UmbDocumentTypeStore } from '../src/backoffice/documents/document-types/document-type.store'; import { UmbIconStore } from '../src/core/stores/icon/icon.store'; import { onUnhandledRequest } from '../src/core/mocks/browser'; @@ -22,7 +25,6 @@ import { UmbModalService } from '../src/core/modal'; import { umbExtensionsRegistry } from '../src/core/extensions-registry'; import '../src/core/context-api/provide/context-provider.element'; -import '../src/core/css/custom-properties.css'; import '../src/backoffice/shared/components/backoffice-frame/backoffice-modal-container.element'; import '../src/backoffice/shared/components/code-block/code-block.element'; @@ -51,7 +53,7 @@ customElements.define('umb-storybook', UmbStoryBookElement); const storybookProvider = (story) => html` ${story()} `; const dataTypeStoreProvider = (story) => html` - ${story()} + ${story()} `; const documentTypeStoreProvider = (story) => html` diff --git a/src/Umbraco.Web.UI.Client/devops/plop/plop.js b/src/Umbraco.Web.UI.Client/devops/plop/plop.js index f6662b30b4..1345d25b26 100644 --- a/src/Umbraco.Web.UI.Client/devops/plop/plop.js +++ b/src/Umbraco.Web.UI.Client/devops/plop/plop.js @@ -1,5 +1,4 @@ -import lodash from 'lodash'; -const { kebabCase, camelCase, startCase } = lodash; +import { kebabCase, camelCase, startCase } from 'lodash-es'; const pascalCase = (str) => startCase(str).replace(/ /g, ''); const tagNamePrefix = 'umb-'; diff --git a/src/Umbraco.Web.UI.Client/package-lock.json b/src/Umbraco.Web.UI.Client/package-lock.json index 2a9a0b9d6c..714173e565 100644 --- a/src/Umbraco.Web.UI.Client/package-lock.json +++ b/src/Umbraco.Web.UI.Client/package-lock.json @@ -17,9 +17,9 @@ "@umbraco-ui/uui-modal-container": "file:umbraco-ui-uui-modal-container-0.0.0.tgz", "@umbraco-ui/uui-modal-dialog": "file:umbraco-ui-uui-modal-dialog-0.0.0.tgz", "@umbraco-ui/uui-modal-sidebar": "file:umbraco-ui-uui-modal-sidebar-0.0.0.tgz", - "element-internals-polyfill": "^1.1.18", + "element-internals-polyfill": "^1.1.19", "lit": "^2.6.1", - "lodash": "^4.17.21", + "lodash-es": "4.17.21", "router-slot": "^1.5.5", "rxjs": "^7.8.0", "uuid": "^9.0.0" @@ -47,7 +47,7 @@ "@web/test-runner": "^0.15.0", "@web/test-runner-playwright": "^0.9.0", "babel-loader": "^9.1.2", - "eslint": "^8.31.0", + "eslint": "^8.32.0", "eslint-config-prettier": "^8.6.0", "eslint-import-resolver-typescript": "^3.5.3", "eslint-plugin-import": "^2.27.4", @@ -58,11 +58,11 @@ "eslint-plugin-wc": "^1.4.0", "lit-html": "^2.6.1", "msw": "^0.49.2", - "msw-storybook-addon": "^1.6.3", + "msw-storybook-addon": "^1.7.0", "openapi-typescript-codegen": "^0.23.0", "playwright-msw": "^2.1.0", "plop": "^3.1.1", - "prettier": "2.8.2", + "prettier": "2.8.3", "tiny-glob": "^0.2.9", "typescript": "^4.9.4", "vite": "^4.0.4", @@ -12887,9 +12887,9 @@ "dev": true }, "node_modules/element-internals-polyfill": { - "version": "1.1.18", - "resolved": "https://registry.npmjs.org/element-internals-polyfill/-/element-internals-polyfill-1.1.18.tgz", - "integrity": "sha512-ULyzpzblTZfMPEt83NphWeREajgaKQBNSTXvNBcjTeriIy7GsuAHFUZ0CpHnlDIVdvPlWcewfu7n7vVfiifZlQ==" + "version": "1.1.19", + "resolved": "https://registry.npmjs.org/element-internals-polyfill/-/element-internals-polyfill-1.1.19.tgz", + "integrity": "sha512-deGDqTkxXtYAQl/VSH5xXWfCe4zEVCkWCYrVeNOPtg3F6W1i0JYRjqPU+MZO9mS1P2UxkkD2vPH+Mb6W/CDicA==" }, "node_modules/element-resize-detector": { "version": "1.2.4", @@ -13515,9 +13515,9 @@ } }, "node_modules/eslint": { - "version": "8.31.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.31.0.tgz", - "integrity": "sha512-0tQQEVdmPZ1UtUKXjX7EMm9BlgJ08G90IhWh0PKDCb3ZLsgAOHI8fYSIzYVZej92zsgq+ft0FGsxhJ3xo2tbuA==", + "version": "8.32.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.32.0.tgz", + "integrity": "sha512-nETVXpnthqKPFyuY2FNjz/bEd6nbosRgKbkgS/y1C7LJop96gYHWpiguLecMHQ2XCPxn77DS0P+68WzG6vkZSQ==", "dev": true, "dependencies": { "@eslint/eslintrc": "^1.4.1", @@ -18461,7 +18461,13 @@ "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "node_modules/lodash-es": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", + "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==" }, "node_modules/lodash.camelcase": { "version": "4.3.0", @@ -20444,9 +20450,9 @@ } }, "node_modules/msw-storybook-addon": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/msw-storybook-addon/-/msw-storybook-addon-1.6.3.tgz", - "integrity": "sha512-Ps80WdRmXsmenoTwfrgKMNpQD8INUUFyUFyZOecx8QjuqSlL++UYrLaGyACXN2goOn+/VS6rb0ZapbjrasPClg==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/msw-storybook-addon/-/msw-storybook-addon-1.7.0.tgz", + "integrity": "sha512-G/cYj7Z8NuyFbMsdVJRr17flWed8J7CmKTSPNXmuK65W6uILpqNDpXJC7KVRhOg7lUFR5Hmqwcq6z8Mow/wu5A==", "dev": true, "dependencies": { "@storybook/addons": "^6.0.0", @@ -22455,9 +22461,9 @@ } }, "node_modules/prettier": { - "version": "2.8.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.2.tgz", - "integrity": "sha512-BtRV9BcncDyI2tsuS19zzhzoxD8Dh8LiCx7j7tHzrkz8GFXAexeWFdi22mjE1d16dftH2qNaytVxqiRTGlMfpw==", + "version": "2.8.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.3.tgz", + "integrity": "sha512-tJ/oJ4amDihPoufT5sM0Z1SKEuKay8LfVAMlbbhnnkvt6BUserZylqo2PN+p9KeljLr0OHa2rXHU1T8reeoTrw==", "dev": true, "bin": { "prettier": "bin-prettier.js" @@ -39302,9 +39308,9 @@ "dev": true }, "element-internals-polyfill": { - "version": "1.1.18", - "resolved": "https://registry.npmjs.org/element-internals-polyfill/-/element-internals-polyfill-1.1.18.tgz", - "integrity": "sha512-ULyzpzblTZfMPEt83NphWeREajgaKQBNSTXvNBcjTeriIy7GsuAHFUZ0CpHnlDIVdvPlWcewfu7n7vVfiifZlQ==" + "version": "1.1.19", + "resolved": "https://registry.npmjs.org/element-internals-polyfill/-/element-internals-polyfill-1.1.19.tgz", + "integrity": "sha512-deGDqTkxXtYAQl/VSH5xXWfCe4zEVCkWCYrVeNOPtg3F6W1i0JYRjqPU+MZO9mS1P2UxkkD2vPH+Mb6W/CDicA==" }, "element-resize-detector": { "version": "1.2.4", @@ -39702,9 +39708,9 @@ "dev": true }, "eslint": { - "version": "8.31.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.31.0.tgz", - "integrity": "sha512-0tQQEVdmPZ1UtUKXjX7EMm9BlgJ08G90IhWh0PKDCb3ZLsgAOHI8fYSIzYVZej92zsgq+ft0FGsxhJ3xo2tbuA==", + "version": "8.32.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.32.0.tgz", + "integrity": "sha512-nETVXpnthqKPFyuY2FNjz/bEd6nbosRgKbkgS/y1C7LJop96gYHWpiguLecMHQ2XCPxn77DS0P+68WzG6vkZSQ==", "dev": true, "requires": { "@eslint/eslintrc": "^1.4.1", @@ -43494,7 +43500,13 @@ "lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "lodash-es": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", + "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==" }, "lodash.camelcase": { "version": "4.3.0", @@ -44983,9 +44995,9 @@ } }, "msw-storybook-addon": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/msw-storybook-addon/-/msw-storybook-addon-1.6.3.tgz", - "integrity": "sha512-Ps80WdRmXsmenoTwfrgKMNpQD8INUUFyUFyZOecx8QjuqSlL++UYrLaGyACXN2goOn+/VS6rb0ZapbjrasPClg==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/msw-storybook-addon/-/msw-storybook-addon-1.7.0.tgz", + "integrity": "sha512-G/cYj7Z8NuyFbMsdVJRr17flWed8J7CmKTSPNXmuK65W6uILpqNDpXJC7KVRhOg7lUFR5Hmqwcq6z8Mow/wu5A==", "dev": true, "requires": { "@storybook/addons": "^6.0.0", @@ -46464,9 +46476,9 @@ "dev": true }, "prettier": { - "version": "2.8.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.2.tgz", - "integrity": "sha512-BtRV9BcncDyI2tsuS19zzhzoxD8Dh8LiCx7j7tHzrkz8GFXAexeWFdi22mjE1d16dftH2qNaytVxqiRTGlMfpw==", + "version": "2.8.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.3.tgz", + "integrity": "sha512-tJ/oJ4amDihPoufT5sM0Z1SKEuKay8LfVAMlbbhnnkvt6BUserZylqo2PN+p9KeljLr0OHa2rXHU1T8reeoTrw==", "dev": true }, "pretty-error": { diff --git a/src/Umbraco.Web.UI.Client/package.json b/src/Umbraco.Web.UI.Client/package.json index 40e63e164e..4a11ab1255 100644 --- a/src/Umbraco.Web.UI.Client/package.json +++ b/src/Umbraco.Web.UI.Client/package.json @@ -63,9 +63,9 @@ "@umbraco-ui/uui-modal-container": "file:umbraco-ui-uui-modal-container-0.0.0.tgz", "@umbraco-ui/uui-modal-dialog": "file:umbraco-ui-uui-modal-dialog-0.0.0.tgz", "@umbraco-ui/uui-modal-sidebar": "file:umbraco-ui-uui-modal-sidebar-0.0.0.tgz", - "element-internals-polyfill": "^1.1.18", + "element-internals-polyfill": "^1.1.19", "lit": "^2.6.1", - "lodash": "^4.17.21", + "lodash-es": "4.17.21", "router-slot": "^1.5.5", "rxjs": "^7.8.0", "uuid": "^9.0.0" @@ -93,7 +93,7 @@ "@web/test-runner": "^0.15.0", "@web/test-runner-playwright": "^0.9.0", "babel-loader": "^9.1.2", - "eslint": "^8.31.0", + "eslint": "^8.32.0", "eslint-config-prettier": "^8.6.0", "eslint-import-resolver-typescript": "^3.5.3", "eslint-plugin-import": "^2.27.4", @@ -104,11 +104,11 @@ "eslint-plugin-wc": "^1.4.0", "lit-html": "^2.6.1", "msw": "^0.49.2", - "msw-storybook-addon": "^1.6.3", + "msw-storybook-addon": "^1.7.0", "openapi-typescript-codegen": "^0.23.0", "playwright-msw": "^2.1.0", "plop": "^3.1.1", - "prettier": "2.8.2", + "prettier": "2.8.3", "tiny-glob": "^0.2.9", "typescript": "^4.9.4", "vite": "^4.0.4", diff --git a/src/Umbraco.Web.UI.Client/src/app.ts b/src/Umbraco.Web.UI.Client/src/app.ts index deac04fcb6..8cbb6f7bb0 100644 --- a/src/Umbraco.Web.UI.Client/src/app.ts +++ b/src/Umbraco.Web.UI.Client/src/app.ts @@ -1,3 +1,4 @@ +import '@umbraco-ui/uui-css/dist/uui-css.css'; import './core/css/custom-properties.css'; // TODO: remove these imports when they are part of UUI diff --git a/src/Umbraco.Web.UI.Client/src/auth/components/input-user-group/input-user-group.element.ts b/src/Umbraco.Web.UI.Client/src/auth/components/input-user-group/input-user-group.element.ts index f1133821f4..4b602520de 100644 --- a/src/Umbraco.Web.UI.Client/src/auth/components/input-user-group/input-user-group.element.ts +++ b/src/Umbraco.Web.UI.Client/src/auth/components/input-user-group/input-user-group.element.ts @@ -3,7 +3,10 @@ import { css, html, nothing } from 'lit'; import { customElement, state } from 'lit/decorators.js'; import { UmbInputListBase } from '../../../backoffice/shared/components/input-list-base/input-list-base'; import type { UserGroupEntity } from '@umbraco-cms/models'; -import { UmbUserGroupStore } from 'src/backoffice/users/user-groups/user-group.store'; +import { + UmbUserGroupStore, + UMB_USER_GROUP_STORE_CONTEXT_TOKEN, +} from 'src/backoffice/users/user-groups/user-group.store'; @customElement('umb-input-user-group') export class UmbInputPickerUserGroupElement extends UmbInputListBase { @@ -44,7 +47,7 @@ export class UmbInputPickerUserGroupElement extends UmbInputListBase { connectedCallback(): void { super.connectedCallback(); this.pickerLayout = 'umb-picker-layout-user-group'; - this.consumeContext('umbUserGroupStore', (usersContext: UmbUserGroupStore) => { + this.consumeContext(UMB_USER_GROUP_STORE_CONTEXT_TOKEN, (usersContext) => { this._userGroupStore = usersContext; this._observeUserGroups(); }); @@ -52,10 +55,7 @@ export class UmbInputPickerUserGroupElement extends UmbInputListBase { private _observeUserGroups() { if (this.value.length > 0 && this._userGroupStore) { - this.observe( - this._userGroupStore.getByKeys(this.value), - (userGroups) => (this._userGroups = userGroups) - ); + this.observe(this._userGroupStore.getByKeys(this.value), (userGroups) => (this._userGroups = userGroups)); } else { this._userGroups = []; } diff --git a/src/Umbraco.Web.UI.Client/src/auth/components/input-user/input-user.element.ts b/src/Umbraco.Web.UI.Client/src/auth/components/input-user/input-user.element.ts index dd99d8520d..552be4346b 100644 --- a/src/Umbraco.Web.UI.Client/src/auth/components/input-user/input-user.element.ts +++ b/src/Umbraco.Web.UI.Client/src/auth/components/input-user/input-user.element.ts @@ -3,7 +3,7 @@ import { css, html, nothing, PropertyValueMap } from 'lit'; import { customElement, state } from 'lit/decorators.js'; import { UmbInputListBase } from '../../../backoffice/shared/components/input-list-base/input-list-base'; import type { UserEntity } from '@umbraco-cms/models'; -import { UmbUserStore } from 'src/backoffice/users/users/user.store'; +import { UmbUserStore, UMB_USER_STORE_CONTEXT_TOKEN } from 'src/backoffice/users/users/user.store'; @customElement('umb-input-user') export class UmbPickerUserElement extends UmbInputListBase { @@ -39,7 +39,7 @@ export class UmbPickerUserElement extends UmbInputListBase { connectedCallback(): void { super.connectedCallback(); this.pickerLayout = 'umb-picker-layout-user'; - this.consumeContext('umbUserStore', (userStore: UmbUserStore) => { + this.consumeContext(UMB_USER_STORE_CONTEXT_TOKEN, (userStore) => { this._userStore = userStore; this._observeUser(); }); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/backoffice.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/backoffice.element.ts index 8a56c75eb5..2712f528bc 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/backoffice.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/backoffice.element.ts @@ -2,24 +2,33 @@ import { defineElement } from '@umbraco-ui/uui-base/lib/registration'; import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import { css, html } from 'lit'; -import { UmbModalService } from '../core/modal'; -import { UmbNotificationService } from '../core/notification'; -import { UmbUserStore } from './users/users/user.store'; -import { UmbUserGroupStore } from './users/user-groups/user-group.store'; -import { UmbCurrentUserStore } from './users/current-user/current-user.store'; -import { UmbCurrentUserHistoryStore } from './users/current-user/current-user-history.store'; +import { UmbModalService, UMB_MODAL_SERVICE_CONTEXT_TOKEN } from '../core/modal'; +import { UmbNotificationService, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '../core/notification'; +import { UmbUserStore, UMB_USER_STORE_CONTEXT_TOKEN } from './users/users/user.store'; +import { UmbUserGroupStore, UMB_USER_GROUP_STORE_CONTEXT_TOKEN } from './users/user-groups/user-group.store'; +import { UmbCurrentUserStore, UMB_CURRENT_USER_STORE_CONTEXT_TOKEN } from './users/current-user/current-user.store'; +import { + UmbCurrentUserHistoryStore, + UMB_CURRENT_USER_HISTORY_STORE_CONTEXT_TOKEN, +} from './users/current-user/current-user-history.store'; -import { UmbDocumentTypeStore } from './documents/document-types/document-type.store'; -import { UmbMediaTypeStore } from './media/media-types/media-type.store'; -import { UmbMemberTypeStore } from './members/member-types/member-type.store'; -import { UmbDocumentStore } from './documents/documents/document.store'; -import { UmbMediaStore } from './media/media/media.store'; -import { UmbMemberGroupStore } from './members/member-groups/member-group.store'; -import { UmbDictionaryStore } from './translation/dictionary/dictionary.store'; -import { UmbDocumentBlueprintStore } from './documents/document-blueprints/document-blueprint.store'; +import { + UmbDocumentTypeStore, + UMB_DOCUMENT_TYPE_STORE_CONTEXT_TOKEN, +} from './documents/document-types/document-type.store'; +import { UmbMediaTypeStore, UMB_MEDIA_TYPE_STORE_CONTEXT_TOKEN } from './media/media-types/media-type.store'; +import { UmbMemberTypeStore, UMB_MEMBER_TYPE_STORE_CONTEXT_TOKEN } from './members/member-types/member-type.store'; +import { UmbDocumentStore, UMB_DOCUMENT_STORE_CONTEXT_TOKEN } from './documents/documents/document.store'; +import { UmbMediaStore, UMB_MEDIA_STORE_CONTEXT_TOKEN } from './media/media/media.store'; +import { UmbMemberGroupStore, UMB_MEMBER_GROUP_STORE_CONTEXT_TOKEN } from './members/member-groups/member-group.store'; +import { UmbDictionaryStore, UMB_DICTIONARY_STORE_CONTEXT_TOKEN } from './translation/dictionary/dictionary.store'; +import { + UmbDocumentBlueprintStore, + UMB_DOCUMENT_BLUEPRINT_STORE_CONTEXT_TOKEN, +} from './documents/document-blueprints/document-blueprint.store'; -import { UmbSectionStore } from './shared/components/section/section.store'; -import { UmbDataTypeStore } from './settings/data-types/data-type.store'; +import { UmbSectionStore, UMB_SECTION_STORE_CONTEXT_TOKEN } from './shared/components/section/section.store'; +import { UmbDataTypeStore, UMB_DATA_TYPE_STORE_CONTEXT_TOKEN } from './settings/data-types/data-type.store'; import { UmbLitElement } from '@umbraco-cms/element'; // Domains @@ -53,24 +62,24 @@ export class UmbBackofficeElement extends UmbLitElement { constructor() { super(); - this.provideContext('umbModalService', new UmbModalService()); - this.provideContext('umbNotificationService', new UmbNotificationService()); + this.provideContext(UMB_MODAL_SERVICE_CONTEXT_TOKEN, new UmbModalService()); + this.provideContext(UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN, new UmbNotificationService()); // TODO: find a way this is possible outside this element. It needs to be possible to register stores in extensions - this.provideContext('umbCurrentUserStore', new UmbCurrentUserStore()); - this.provideContext('umbDocumentStore', new UmbDocumentStore(this)); - this.provideContext('umbMediaStore', new UmbMediaStore(this)); - this.provideContext('umbDataTypeStore', new UmbDataTypeStore(this)); - this.provideContext('umbDocumentTypeStore', new UmbDocumentTypeStore(this)); - this.provideContext('umbMediaTypeStore', new UmbMediaTypeStore(this)); - this.provideContext('umbMemberTypeStore', new UmbMemberTypeStore(this)); - this.provideContext('umbUserStore', new UmbUserStore(this)); - this.provideContext('umbUserGroupStore', new UmbUserGroupStore(this)); - this.provideContext('umbMemberGroupStore', new UmbMemberGroupStore(this)); - this.provideContext('umbSectionStore', new UmbSectionStore()); - this.provideContext('umbCurrentUserHistoryStore', new UmbCurrentUserHistoryStore()); - this.provideContext('umbDictionaryStore', new UmbDictionaryStore(this)); - this.provideContext('umbDocumentBlueprintStore', new UmbDocumentBlueprintStore(this)); + this.provideContext(UMB_CURRENT_USER_STORE_CONTEXT_TOKEN, new UmbCurrentUserStore()); + this.provideContext(UMB_DOCUMENT_STORE_CONTEXT_TOKEN, new UmbDocumentStore(this)); + this.provideContext(UMB_MEDIA_STORE_CONTEXT_TOKEN, new UmbMediaStore(this)); + this.provideContext(UMB_DATA_TYPE_STORE_CONTEXT_TOKEN, new UmbDataTypeStore(this)); + this.provideContext(UMB_DOCUMENT_TYPE_STORE_CONTEXT_TOKEN, new UmbDocumentTypeStore(this)); + this.provideContext(UMB_MEDIA_TYPE_STORE_CONTEXT_TOKEN, new UmbMediaTypeStore(this)); + this.provideContext(UMB_MEMBER_TYPE_STORE_CONTEXT_TOKEN, new UmbMemberTypeStore(this)); + this.provideContext(UMB_USER_STORE_CONTEXT_TOKEN, new UmbUserStore(this)); + this.provideContext(UMB_USER_GROUP_STORE_CONTEXT_TOKEN, new UmbUserGroupStore(this)); + this.provideContext(UMB_MEMBER_GROUP_STORE_CONTEXT_TOKEN, new UmbMemberGroupStore(this)); + this.provideContext(UMB_SECTION_STORE_CONTEXT_TOKEN, new UmbSectionStore()); + this.provideContext(UMB_CURRENT_USER_HISTORY_STORE_CONTEXT_TOKEN, new UmbCurrentUserHistoryStore()); + this.provideContext(UMB_DICTIONARY_STORE_CONTEXT_TOKEN, new UmbDictionaryStore(this)); + this.provideContext(UMB_DOCUMENT_BLUEPRINT_STORE_CONTEXT_TOKEN, new UmbDocumentBlueprintStore(this)); } render() { diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-blueprints/document-blueprint.store.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-blueprints/document-blueprint.store.ts index ca12e0b964..66d2c6e907 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-blueprints/document-blueprint.store.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-blueprints/document-blueprint.store.ts @@ -2,9 +2,12 @@ import { map, Observable } from 'rxjs'; import { UmbNodeStoreBase } from '../../../core/stores/store'; import type { DocumentBlueprintDetails, DocumentDetails } from '@umbraco-cms/models'; import { DocumentBlueprintTreeItem } from '@umbraco-cms/backend-api'; +import { UmbContextToken } from '@umbraco-cms/context-api'; export type UmbDocumentStoreItemType = DocumentBlueprintDetails | DocumentBlueprintTreeItem; +export const STORE_ALIAS = 'UmbDocumentBlueprintStore'; + const isDocumentBlueprintDetails = ( documentBlueprint: DocumentBlueprintDetails | DocumentBlueprintTreeItem ): documentBlueprint is DocumentBlueprintDetails => { @@ -18,7 +21,7 @@ const isDocumentBlueprintDetails = ( * @description - Data Store for Documents */ export class UmbDocumentBlueprintStore extends UmbNodeStoreBase { - public readonly storeAlias = 'umbDocumentBlueprintStore'; + public readonly storeAlias = STORE_ALIAS; getByKey(key: string): Observable { // TODO: implement call to end point @@ -37,3 +40,5 @@ export class UmbDocumentBlueprintStore extends UmbNodeStoreBase(STORE_ALIAS); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/document-type.store.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/document-type.store.ts index 53f7d2a65a..f2d476129f 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/document-type.store.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/document-type.store.ts @@ -3,6 +3,7 @@ import { UmbDataStoreBase } from '../../../core/stores/store'; import { DocumentTypeResource, DocumentTypeTreeItem } from '@umbraco-cms/backend-api'; import type { DocumentTypeDetails } from '@umbraco-cms/models'; import { tryExecuteAndNotify } from '@umbraco-cms/resources'; +import { UmbContextToken } from '@umbraco-cms/context-api'; export const isDocumentTypeDetails = ( documentType: DocumentTypeDetails | DocumentTypeTreeItem @@ -12,6 +13,8 @@ export const isDocumentTypeDetails = ( export type UmbDocumentTypeStoreItemType = DocumentTypeDetails | DocumentTypeTreeItem; +export const STORE_ALIAS = 'UmbDocumentTypeStore'; + /** * @export * @class UmbDocumentTypeStore @@ -19,7 +22,7 @@ export type UmbDocumentTypeStoreItemType = DocumentTypeDetails | DocumentTypeTre * @description - Data Store for Document Types */ export class UmbDocumentTypeStore extends UmbDataStoreBase { - public readonly storeAlias = 'umbDocumentTypeStore'; + public readonly storeAlias = STORE_ALIAS; getByKey(key: string): Observable { // TODO: use Fetcher API. @@ -82,3 +85,5 @@ export class UmbDocumentTypeStore extends UmbDataStoreBase items.filter((item) => item.parentKey === key))); } } + +export const UMB_DOCUMENT_TYPE_STORE_CONTEXT_TOKEN = new UmbContextToken(STORE_ALIAS); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/tree/manifests.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/tree/manifests.ts index 576748172b..694de8a0bf 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/tree/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/tree/manifests.ts @@ -1,3 +1,4 @@ +import { STORE_ALIAS } from '../document-type.store'; import type { ManifestTree, ManifestTreeItemAction } from '@umbraco-cms/models'; const tree: ManifestTree = { @@ -5,7 +6,7 @@ const tree: ManifestTree = { alias: 'Umb.Tree.DocumentTypes', name: 'Document Types Tree', meta: { - storeAlias: 'umbDocumentTypeStore', + storeAlias: STORE_ALIAS, }, }; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/workspace/document-type-workspace.context.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/workspace/document-type-workspace.context.ts index 98c9dc073a..a60d48833d 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/workspace/document-type-workspace.context.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/workspace/document-type-workspace.context.ts @@ -2,6 +2,7 @@ import { UmbWorkspaceContentContext } from '../../../shared/components/workspace import { UmbDocumentTypeStore, UmbDocumentTypeStoreItemType, + UMB_DOCUMENT_TYPE_STORE_CONTEXT_TOKEN, } from 'src/backoffice/documents/document-types/document-type.store'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; @@ -21,11 +22,10 @@ export class UmbWorkspaceDocumentTypeContext extends UmbWorkspaceContentContext< UmbDocumentTypeStore > { constructor(host: UmbControllerHostInterface) { - super(host, DefaultDocumentTypeData, 'umbDocumentTypeStore', 'documentType'); + super(host, DefaultDocumentTypeData, UMB_DOCUMENT_TYPE_STORE_CONTEXT_TOKEN.toString(), 'documentType'); } - public setPropertyValue(alias: string, value: unknown) { - throw new Error("setPropertyValue is not implemented for UmbWorkspaceDocumentTypeContext") + throw new Error('setPropertyValue is not implemented for UmbWorkspaceDocumentTypeContext'); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/workspace/document-type-workspace.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/workspace/document-type-workspace.element.ts index 4ab87c39f5..3c799f13c7 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/workspace/document-type-workspace.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/workspace/document-type-workspace.element.ts @@ -5,7 +5,7 @@ import { customElement, property, state } from 'lit/decorators.js'; import { distinctUntilChanged } from 'rxjs'; import { UmbWorkspaceDocumentTypeContext } from './document-type-workspace.context'; import type { DocumentTypeDetails } from '@umbraco-cms/models'; -import { UmbModalService } from 'src/core/modal'; +import { UmbModalService, UMB_MODAL_SERVICE_CONTEXT_TOKEN } from 'src/core/modal'; import { UmbLitElement } from '@umbraco-cms/element'; import type { UmbWorkspaceEntityElement } from 'src/backoffice/shared/components/workspace/workspace-entity-element.interface'; @@ -73,13 +73,13 @@ export class UmbDocumentTypeWorkspaceElement extends UmbLitElement implements Um constructor() { super(); - this.consumeContext('umbModalService', (instance) => { + this.consumeContext(UMB_MODAL_SERVICE_CONTEXT_TOKEN, (instance) => { this._modalService = instance; }); this.observe(this._workspaceContext.data.pipe(distinctUntilChanged()), (data) => { // TODO: make method to identify if data is of type DocumentTypeDetails - this._documentType = (data as DocumentTypeDetails); + this._documentType = data as DocumentTypeDetails; }); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/workspace/views/design/workspace-view-document-type-design.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/workspace/views/design/workspace-view-document-type-design.element.ts index 18c2003e3f..146230903f 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/workspace/views/design/workspace-view-document-type-design.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/workspace/views/design/workspace-view-document-type-design.element.ts @@ -18,7 +18,8 @@ export class UmbWorkspaceViewDocumentTypeDesignElement extends UmbLitElement { constructor() { super(); - this.consumeContext('umbWorkspaceContext', (documentTypeContext) => { + // TODO: Figure out if this is the best way to consume the context or if it can be strongly typed with an UmbContextToken + this.consumeContext('umbWorkspaceContext', (documentTypeContext) => { this._workspaceContext = documentTypeContext; this._observeDocumentType(); }); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/document.store.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/document.store.ts index 52a62d2df4..223f49df54 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/document.store.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/document.store.ts @@ -3,6 +3,7 @@ import { UmbNodeStoreBase } from '../../../core/stores/store'; import type { DocumentDetails } from '@umbraco-cms/models'; import { DocumentResource, DocumentTreeItem, FolderTreeItem } from '@umbraco-cms/backend-api'; import { tryExecuteAndNotify } from '@umbraco-cms/resources'; +import { UmbContextToken } from '@umbraco-cms/context-api'; export const isDocumentDetails = (document: DocumentDetails | DocumentTreeItem): document is DocumentDetails => { return (document as DocumentDetails).data !== undefined; @@ -11,7 +12,7 @@ export const isDocumentDetails = (document: DocumentDetails | DocumentTreeItem): export type UmbDocumentStoreItemType = DocumentDetails | DocumentTreeItem; // TODO: research how we write names of global consts. -export const STORE_ALIAS = 'umbDocumentStore'; +export const STORE_ALIAS = 'UmbDocumentStore'; /** * @export @@ -129,3 +130,5 @@ export class UmbDocumentStore extends UmbNodeStoreBase return this.items.pipe(map((items) => items.filter((item) => keys.includes(item.key ?? '')))); } } + +export const UMB_DOCUMENT_STORE_CONTEXT_TOKEN = new UmbContextToken(STORE_ALIAS); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/tree/actions/action-document-delete.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/tree/actions/action-document-delete.element.ts index 59bbc856c6..9c635f9d6e 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/tree/actions/action-document-delete.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/tree/actions/action-document-delete.element.ts @@ -1,8 +1,8 @@ import { UUITextStyles } from '@umbraco-ui/uui-css'; import { css, html } from 'lit'; import { customElement } from 'lit/decorators.js'; -import { UmbModalService } from '../../../../../core/modal'; -import { UmbDocumentStore } from '../../document.store'; +import { UmbModalService, UMB_MODAL_SERVICE_CONTEXT_TOKEN } from '../../../../../core/modal'; +import { UmbDocumentStore, UMB_DOCUMENT_STORE_CONTEXT_TOKEN } from '../../document.store'; import UmbTreeItemActionElement from '../../../../shared/components/tree/action/tree-item-action.element'; @customElement('umb-tree-action-document-delete') @@ -15,11 +15,11 @@ export default class UmbTreeActionDocumentDeleteElement extends UmbTreeItemActio connectedCallback(): void { super.connectedCallback(); - this.consumeContext('umbModalService', (modalService: UmbModalService) => { + this.consumeContext(UMB_MODAL_SERVICE_CONTEXT_TOKEN, (modalService) => { this._modalService = modalService; }); - this.consumeContext('umbDocumentStore', (documentStore: UmbDocumentStore) => { + this.consumeContext(UMB_DOCUMENT_STORE_CONTEXT_TOKEN, (documentStore) => { this._documentStore = documentStore; }); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/tree/manifests.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/tree/manifests.ts index 1039c9dcc9..dd544de291 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/tree/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/tree/manifests.ts @@ -1,3 +1,4 @@ +import { STORE_ALIAS } from '../document.store'; import type { ManifestTree, ManifestTreeItemAction } from '@umbraco-cms/models'; const treeAlias = 'Umb.Tree.Documents'; @@ -7,7 +8,7 @@ const tree: ManifestTree = { alias: treeAlias, name: 'Documents Tree', meta: { - storeAlias: 'umbDocumentStore', + storeAlias: STORE_ALIAS, }, }; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/media/media-types/media-type.store.ts b/src/Umbraco.Web.UI.Client/src/backoffice/media/media-types/media-type.store.ts index ae263f61f6..4a5e21868e 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/media/media-types/media-type.store.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/media/media-types/media-type.store.ts @@ -3,8 +3,12 @@ import { UmbNodeStoreBase } from '../../../core/stores/store'; import { MediaTypeResource, FolderTreeItem } from '@umbraco-cms/backend-api'; import type { MediaTypeDetails } from '@umbraco-cms/models'; import { tryExecuteAndNotify } from '@umbraco-cms/resources'; +import { UmbContextToken } from '@umbraco-cms/context-api'; export type UmbMediaTypeStoreItemType = MediaTypeDetails | FolderTreeItem; + +export const STORE_ALIAS = 'UmbMediaTypeStore'; + /** * @export * @class UmbMediaTypeStore @@ -12,7 +16,7 @@ export type UmbMediaTypeStoreItemType = MediaTypeDetails | FolderTreeItem; * @description - Data Store for Media Types */ export class UmbMediaTypeStore extends UmbNodeStoreBase { - public readonly storeAlias = 'umbMediaTypeStore'; + public readonly storeAlias = STORE_ALIAS; /** * @description - Request a Data Type by key. The Data Type is added to the store and is returned as an Observable. @@ -85,3 +89,5 @@ export class UmbMediaTypeStore extends UmbNodeStoreBase items.filter((item) => item.parentKey === key))); } } + +export const UMB_MEDIA_TYPE_STORE_CONTEXT_TOKEN = new UmbContextToken(STORE_ALIAS); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/media/media-types/tree/manifests.ts b/src/Umbraco.Web.UI.Client/src/backoffice/media/media-types/tree/manifests.ts index dcb609513d..54a406aca4 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/media/media-types/tree/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/media/media-types/tree/manifests.ts @@ -1,3 +1,4 @@ +import { STORE_ALIAS } from '../media-type.store'; import type { ManifestTree, ManifestTreeItemAction } from '@umbraco-cms/models'; const tree: ManifestTree = { @@ -5,7 +6,7 @@ const tree: ManifestTree = { alias: 'Umb.Tree.MediaTypes', name: 'Media Types Tree', meta: { - storeAlias: 'umbMediaTypeStore', + storeAlias: STORE_ALIAS, }, }; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/media/media/media.store.ts b/src/Umbraco.Web.UI.Client/src/backoffice/media/media/media.store.ts index 95f77c02b6..fba7c229ae 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/media/media/media.store.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/media/media/media.store.ts @@ -3,6 +3,7 @@ import { UmbDataStoreBase } from '../../../core/stores/store'; import type { MediaDetails } from '@umbraco-cms/models'; import { ContentTreeItem, MediaResource } from '@umbraco-cms/backend-api'; import { tryExecuteAndNotify } from '@umbraco-cms/resources'; +import { UmbContextToken } from '@umbraco-cms/context-api'; const isMediaDetails = (media: UmbMediaStoreItemType): media is MediaDetails => { return (media as MediaDetails).data !== undefined; @@ -11,6 +12,8 @@ const isMediaDetails = (media: UmbMediaStoreItemType): media is MediaDetails => // TODO: stop using ContentTreeItem. export type UmbMediaStoreItemType = MediaDetails | ContentTreeItem; +export const STORE_ALIAS = 'UmbMediaStore'; + /** * @export * @class UmbMediaStore @@ -18,7 +21,7 @@ export type UmbMediaStoreItemType = MediaDetails | ContentTreeItem; * @description - Data Store for Media */ export class UmbMediaStore extends UmbDataStoreBase { - public readonly storeAlias = 'umbMediaStore'; + public readonly storeAlias = STORE_ALIAS; getByKey(key: string): Observable { // fetch from server and update store @@ -108,3 +111,5 @@ export class UmbMediaStore extends UmbDataStoreBase { return this.items.pipe(map((items) => items.filter((item) => item.parentKey === key && !item.isTrashed))); } } + +export const UMB_MEDIA_STORE_CONTEXT_TOKEN = new UmbContextToken(STORE_ALIAS); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/media/media/tree/manifests.ts b/src/Umbraco.Web.UI.Client/src/backoffice/media/media/tree/manifests.ts index 67c7b723a5..5160b0f9cf 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/media/media/tree/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/media/media/tree/manifests.ts @@ -1,3 +1,4 @@ +import { STORE_ALIAS } from '../media.store'; import type { ManifestTree, ManifestTreeItemAction } from '@umbraco-cms/models'; const treeAlias = 'Umb.Tree.Media'; @@ -7,7 +8,7 @@ const tree: ManifestTree = { alias: treeAlias, name: 'Media Tree', meta: { - storeAlias: 'umbMediaStore', + storeAlias: STORE_ALIAS, }, }; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/media/media/workspace/manifests.ts b/src/Umbraco.Web.UI.Client/src/backoffice/media/media/workspace/manifests.ts index 778371d49f..0814d0f8e9 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/media/media/workspace/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/media/media/workspace/manifests.ts @@ -4,6 +4,7 @@ import type { ManifestWorkspaceView, ManifestWorkspaceViewCollection, } from '@umbraco-cms/models'; +import { STORE_ALIAS } from '../media.store'; const workspace: ManifestWorkspace = { type: 'workspace', @@ -58,7 +59,7 @@ const workspaceViewCollections: Array = [ pathname: 'collection', icon: 'umb:grid', entityType: 'media', - storeAlias: 'umbMediaStore', + storeAlias: STORE_ALIAS, }, }, ]; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/media/media/workspace/media-workspace.context.ts b/src/Umbraco.Web.UI.Client/src/backoffice/media/media/workspace/media-workspace.context.ts index 6083fad6d0..490ad41680 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/media/media/workspace/media-workspace.context.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/media/media/workspace/media-workspace.context.ts @@ -1,5 +1,9 @@ import { UmbWorkspaceContentContext } from '../../../shared/components/workspace/workspace-content/workspace-content.context'; -import type { UmbMediaStore, UmbMediaStoreItemType } from 'src/backoffice/media/media/media.store'; +import { + UmbMediaStore, + UmbMediaStoreItemType, + UMB_MEDIA_STORE_CONTEXT_TOKEN, +} from 'src/backoffice/media/media/media.store'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; const DefaultMediaData = { @@ -33,10 +37,10 @@ const DefaultMediaData = { export class UmbWorkspaceMediaContext extends UmbWorkspaceContentContext { constructor(host: UmbControllerHostInterface) { - super(host, DefaultMediaData, 'umbMediaStore', 'media'); + super(host, DefaultMediaData, UMB_MEDIA_STORE_CONTEXT_TOKEN.toString(), 'media'); } public setPropertyValue(alias: string, value: unknown) { - throw new Error("setPropertyValue is not implemented for UmbWorkspaceMediaContext") + throw new Error('setPropertyValue is not implemented for UmbWorkspaceMediaContext'); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/media/section.manifests.ts b/src/Umbraco.Web.UI.Client/src/backoffice/media/section.manifests.ts index 46ccb96ac5..b6ae3a143c 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/media/section.manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/media/section.manifests.ts @@ -1,3 +1,4 @@ +import { STORE_ALIAS } from './media/media.store'; import type { ManifestDashboardCollection, ManifestSection } from '@umbraco-cms/models'; const sectionAlias = 'Umb.Section.Media'; @@ -24,7 +25,7 @@ const dashboards: Array = [ sections: [sectionAlias], pathname: 'media-management', entityType: 'media', - storeAlias: 'umbMediaStore', + storeAlias: STORE_ALIAS, }, }, ]; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/members/member-groups/member-group.store.ts b/src/Umbraco.Web.UI.Client/src/backoffice/members/member-groups/member-group.store.ts index 25d092a20e..9be7cc8a67 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/members/member-groups/member-group.store.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/members/member-groups/member-group.store.ts @@ -3,9 +3,12 @@ import { UmbNodeStoreBase } from '../../../core/stores/store'; import { EntityTreeItem, MemberGroupResource } from '@umbraco-cms/backend-api'; import type { MemberGroupDetails } from '@umbraco-cms/models'; import { tryExecuteAndNotify } from '@umbraco-cms/resources'; +import { UmbContextToken } from '@umbraco-cms/context-api'; export type UmbMemberGroupStoreItemType = MemberGroupDetails | EntityTreeItem; +export const STORE_ALIAS = 'UmbMemberGroupStore'; + /** * @export * @class UmbMemberGroupStore @@ -13,7 +16,7 @@ export type UmbMemberGroupStoreItemType = MemberGroupDetails | EntityTreeItem; * @description - Data Store for Member Groups */ export class UmbMemberGroupStore extends UmbNodeStoreBase { - public readonly storeAlias = 'umbMemberGroupStore'; + public readonly storeAlias = STORE_ALIAS; getByKey(key: string): Observable { return null as any; @@ -33,3 +36,5 @@ export class UmbMemberGroupStore extends UmbNodeStoreBase items.filter((item) => item.parentKey === null))); } } + +export const UMB_MEMBER_GROUP_STORE_CONTEXT_TOKEN = new UmbContextToken(STORE_ALIAS); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/members/member-groups/tree/manifests.ts b/src/Umbraco.Web.UI.Client/src/backoffice/members/member-groups/tree/manifests.ts index d6605f11ff..45b2878951 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/members/member-groups/tree/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/members/member-groups/tree/manifests.ts @@ -1,3 +1,4 @@ +import { STORE_ALIAS } from '../member-group.store'; import type { ManifestTree, ManifestTreeItemAction } from '@umbraco-cms/models'; const treeAlias = 'Umb.Tree.MemberGroups'; @@ -7,7 +8,7 @@ const tree: ManifestTree = { alias: treeAlias, name: 'Member Groups Tree', meta: { - storeAlias: 'umbMemberGroupStore', + storeAlias: STORE_ALIAS, }, }; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/members/member-types/member-type.store.ts b/src/Umbraco.Web.UI.Client/src/backoffice/members/member-types/member-type.store.ts index 5c54dedda7..954d28e266 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/members/member-types/member-type.store.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/members/member-types/member-type.store.ts @@ -3,9 +3,12 @@ import { UmbDataStoreBase } from '../../../core/stores/store'; import { MemberTypeResource, EntityTreeItem } from '@umbraco-cms/backend-api'; import type { MemberTypeDetails } from '@umbraco-cms/models'; import { tryExecuteAndNotify } from '@umbraco-cms/resources'; +import { UmbContextToken } from '@umbraco-cms/context-api'; export type UmbMemberTypeStoreItemType = MemberTypeDetails | EntityTreeItem; +export const STORE_ALIAS = 'UmbMemberTypeStore'; + /** * @export * @class UmbMemberTypeStore @@ -13,7 +16,7 @@ export type UmbMemberTypeStoreItemType = MemberTypeDetails | EntityTreeItem; * @description - Data Store for Member Types */ export class UmbMemberTypeStore extends UmbDataStoreBase { - public readonly storeAlias = 'umbMemberTypeStore'; + public readonly storeAlias = STORE_ALIAS; getByKey(key: string): Observable { return null as any; @@ -33,3 +36,5 @@ export class UmbMemberTypeStore extends UmbDataStoreBase items.filter((item) => item.parentKey === null))); } } + +export const UMB_MEMBER_TYPE_STORE_CONTEXT_TOKEN = new UmbContextToken(STORE_ALIAS); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/members/member-types/tree/manifests.ts b/src/Umbraco.Web.UI.Client/src/backoffice/members/member-types/tree/manifests.ts index 40285dc0f7..b6607ad3e4 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/members/member-types/tree/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/members/member-types/tree/manifests.ts @@ -1,3 +1,4 @@ +import { STORE_ALIAS } from '../member-type.store'; import type { ManifestTree, ManifestTreeItemAction } from '@umbraco-cms/models'; const treeAlias = 'Umb.Tree.MemberTypes'; @@ -7,7 +8,7 @@ const tree: ManifestTree = { alias: treeAlias, name: 'Member Types Tree', meta: { - storeAlias: 'umbMemberTypeStore', + storeAlias: STORE_ALIAS, }, }; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/packages/package-section/views/installed/packages-installed-item.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/packages/package-section/views/installed/packages-installed-item.element.ts index 05353b06cd..445c521893 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/packages/package-section/views/installed/packages-installed-item.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/packages/package-section/views/installed/packages-installed-item.element.ts @@ -2,7 +2,7 @@ import { html, nothing } from 'lit'; import { customElement, property, state } from 'lit/decorators.js'; import { firstValueFrom, map } from 'rxjs'; -import type { UmbModalService } from '../../../../../core/modal'; +import { UmbModalService, UMB_MODAL_SERVICE_CONTEXT_TOKEN } from '../../../../../core/modal'; import { createExtensionElement } from '@umbraco-cms/extensions-api'; import { umbExtensionsRegistry } from '@umbraco-cms/extensions-registry'; @@ -22,7 +22,7 @@ export class UmbPackagesInstalledItem extends UmbLitElement { constructor() { super(); - this.consumeContext('umbModalService', (modalService: UmbModalService) => { + this.consumeContext(UMB_MODAL_SERVICE_CONTEXT_TOKEN, (modalService) => { this._umbModalService = modalService; }); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/packages/package-section/views/market-place/packages-market-place-section-view.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/packages/package-section/views/market-place/packages-market-place-section-view.element.ts index 7b8b760c5a..fb4eb3af97 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/packages/package-section/views/market-place/packages-market-place-section-view.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/packages/package-section/views/market-place/packages-market-place-section-view.element.ts @@ -1,10 +1,39 @@ -import { html, LitElement } from 'lit'; -import { customElement } from 'lit/decorators.js'; +import { css, html, LitElement } from 'lit'; +import { customElement, property } from 'lit/decorators.js'; @customElement('umb-packages-market-place-section-view') export class UmbPackagesMarketPlaceSectionViewElement extends LitElement { + static styles = [css` + #container { + height: 100%; + display: flex; + align-items: stretch; + } + + + iframe { + width: 100%; + height: 100%; + overflow: hidden; + border: none; + } + `]; + + // TODO: This URL comes from the server + // Was previously found in 'Umbraco.Sys.ServerVariables.umbracoUrls.marketplaceUrl' + @property() + marketplaceUrl = 'https://marketplace.umbraco.com/?umbversion=11.1.0&style=backoffice'; + render() { - return html`
Render Marketplace
`; + return html` +
+ +
`; } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/examine-management/views/section-view-examine-indexers.ts b/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/examine-management/views/section-view-examine-indexers.ts index 9a48b508cb..e69109991a 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/examine-management/views/section-view-examine-indexers.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/examine-management/views/section-view-examine-indexers.ts @@ -4,11 +4,11 @@ import { customElement, property, state } from 'lit/decorators.js'; import { UUIButtonState } from '@umbraco-ui/uui-button'; -import { UmbModalService } from '../../../../../core/modal'; +import { UmbModalService, UMB_MODAL_SERVICE_CONTEXT_TOKEN } from '../../../../../core/modal'; import './section-view-examine-searchers'; -import { Index, IndexerResource } from '@umbraco-cms/backend-api'; +import { HealthStatus, Index, IndexerResource } from '@umbraco-cms/backend-api'; import { UmbLitElement } from '@umbraco-cms/element'; import { tryExecuteAndNotify } from '@umbraco-cms/resources'; @@ -97,9 +97,11 @@ export class UmbDashboardExamineIndexElement extends UmbLitElement { constructor() { super(); - this.consumeAllContexts(['umbModalService'], (instances) => { - this._modalService = instances['umbModalService']; + this.consumeContext(UMB_MODAL_SERVICE_CONTEXT_TOKEN, (_instance) => { + this._modalService = _instance; }); + + this._getIndexData(); } private async _getIndexData() { @@ -108,15 +110,13 @@ export class UmbDashboardExamineIndexElement extends UmbLitElement { IndexerResource.getIndexerByIndexName({ indexName: this.indexName }) ); this._indexData = data; - if (!this._indexData?.isHealthy) { + + // TODO: Add continuous polling to update the status + if (this._indexData?.healthStatus === HealthStatus.REBUILDING) { this._buttonState = 'waiting'; } - this._loading = false; - } - async connectedCallback() { - super.connectedCallback(); - await this._getIndexData(); + this._loading = false; } private async _onRebuildHandler() { @@ -161,9 +161,11 @@ export class UmbDashboardExamineIndexElement extends UmbLitElement {

- + ${ + this._indexData.healthStatus === HealthStatus.UNHEALTHY + ? html`` + : html`` + } ${this._indexData.healthStatus} @@ -174,8 +176,8 @@ export class UmbDashboardExamineIndexElement extends UmbLitElement { } private renderIndexSearch() { - if (!this._indexData || !this._indexData.isHealthy) return nothing; - return html``; + if (!this._indexData || this._indexData.healthStatus !== HealthStatus.HEALTHY) return nothing; + return html``; } private renderPropertyList() { diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/examine-management/views/section-view-examine-overview.ts b/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/examine-management/views/section-view-examine-overview.ts index 8b204624a5..483d0099ce 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/examine-management/views/section-view-examine-overview.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/examine-management/views/section-view-examine-overview.ts @@ -2,7 +2,7 @@ import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import { css, html, nothing } from 'lit'; import { customElement, state } from 'lit/decorators.js'; -import { Index, IndexerResource, Searcher, SearcherResource } from '@umbraco-cms/backend-api'; +import { HealthStatus, Index, IndexerResource, Searcher, SearcherResource } from '@umbraco-cms/backend-api'; import { UmbLitElement } from '@umbraco-cms/element'; import { tryExecuteAndNotify } from '@umbraco-cms/resources'; @@ -111,10 +111,11 @@ export class UmbDashboardExamineOverviewElement extends UmbLitElement { - + ${ + index.healthStatus === HealthStatus.UNHEALTHY + ? html`` + : html`` + } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/examine-management/views/section-view-examine-searchers.ts b/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/examine-management/views/section-view-examine-searchers.ts index 2a4f399099..05f27c3337 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/examine-management/views/section-view-examine-searchers.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/examine-management/views/section-view-examine-searchers.ts @@ -2,7 +2,7 @@ import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import { css, html, nothing } from 'lit'; import { customElement, state, query, property } from 'lit/decorators.js'; -import { UmbModalService } from '../../../../../core/modal'; +import { UmbModalService, UMB_MODAL_SERVICE_CONTEXT_TOKEN } from '../../../../../core/modal'; import { SearchResult, SearcherResource, Field } from '@umbraco-cms/backend-api'; import { UmbLitElement } from '@umbraco-cms/element'; @@ -120,13 +120,13 @@ export class UmbDashboardExamineSearcherElement extends UmbLitElement { constructor() { super(); - this.consumeContext('umbModalService', (instance) => { + this.consumeContext(UMB_MODAL_SERVICE_CONTEXT_TOKEN, (instance) => { this._modalService = instance; }); } private _onNameClick() { - // TODO: + // TODO: alert('TODO: Open workspace for ' + this.searcherName); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/published-status/dashboard-published-status.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/published-status/dashboard-published-status.element.ts index 5995c9aea8..c91b095df2 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/published-status/dashboard-published-status.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/published-status/dashboard-published-status.element.ts @@ -3,7 +3,7 @@ import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import { css, html } from 'lit'; import { customElement, state } from 'lit/decorators.js'; -import { UmbModalService } from '../../../../core/modal'; +import { UmbModalService, UMB_MODAL_SERVICE_CONTEXT_TOKEN } from '../../../../core/modal'; import { PublishedCacheResource } from '@umbraco-cms/backend-api'; import { tryExecuteAndNotify } from '@umbraco-cms/resources'; @@ -43,8 +43,8 @@ export class UmbDashboardPublishedStatusElement extends UmbLitElement { constructor() { super(); - this.consumeAllContexts(['umbModalService'], (instances) => { - this._modalService = instances['umbModalService']; + this.consumeContext(UMB_MODAL_SERVICE_CONTEXT_TOKEN, (_instance) => { + this._modalService = _instance; }); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/telemetry/dashboard-telemetry.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/telemetry/dashboard-telemetry.element.ts index 140e3b94f7..81f1eee017 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/telemetry/dashboard-telemetry.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/telemetry/dashboard-telemetry.element.ts @@ -32,11 +32,7 @@ export class UmbDashboardTelemetryElement extends UmbLitElement { constructor() { super(); - } - - async connectedCallback() { - super.connectedCallback(); - await this._setup(); + this._setup(); } private async _setup() { diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/data-type.store.ts b/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/data-type.store.ts index 78e5d881e6..7ffda6749a 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/data-type.store.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/data-type.store.ts @@ -3,6 +3,7 @@ import { UmbDataStoreBase } from '../../../core/stores/store'; import type { DataTypeDetails } from '@umbraco-cms/models'; import { DataTypeResource, FolderTreeItem } from '@umbraco-cms/backend-api'; import { tryExecuteAndNotify } from '@umbraco-cms/resources'; +import { UmbContextToken } from '@umbraco-cms/context-api'; const isDataTypeDetails = (dataType: DataTypeDetails | FolderTreeItem): dataType is DataTypeDetails => { return (dataType as DataTypeDetails).data !== undefined; @@ -13,7 +14,7 @@ const isDataTypeDetails = (dataType: DataTypeDetails | FolderTreeItem): dataType export type UmbDataTypeStoreItemType = DataTypeDetails | FolderTreeItem; // TODO: research how we write names of global consts. -export const STORE_ALIAS = 'umbDataTypeStore'; +export const STORE_ALIAS = 'UmbDataTypeStore'; /** * @export @@ -124,3 +125,5 @@ export class UmbDataTypeStore extends UmbDataStoreBase return this.items.pipe(map((items) => items.filter((item) => item.parentKey === key))); } } + +export const UMB_DATA_TYPE_STORE_CONTEXT_TOKEN = new UmbContextToken(STORE_ALIAS); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/tree/actions/delete/action-data-type-delete.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/tree/actions/delete/action-data-type-delete.element.ts index 7bd5b8270e..612ba06807 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/tree/actions/delete/action-data-type-delete.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/tree/actions/delete/action-data-type-delete.element.ts @@ -1,8 +1,8 @@ import { UUITextStyles } from '@umbraco-ui/uui-css'; import { css, html } from 'lit'; import { customElement } from 'lit/decorators.js'; -import { UmbModalService } from '../../../../../../core/modal'; -import { UmbDataTypeStore } from '../../../data-type.store'; +import { UmbModalService, UMB_MODAL_SERVICE_CONTEXT_TOKEN } from '../../../../../../core/modal'; +import { UmbDataTypeStore, UMB_DATA_TYPE_STORE_CONTEXT_TOKEN } from '../../../data-type.store'; import UmbTreeItemActionElement from '../../../../../shared/components/tree/action/tree-item-action.element'; @customElement('umb-tree-action-data-type-delete') @@ -15,11 +15,11 @@ export default class UmbTreeActionDataTypeDeleteElement extends UmbTreeItemActio connectedCallback(): void { super.connectedCallback(); - this.consumeContext('umbModalService', (modalService: UmbModalService) => { + this.consumeContext(UMB_MODAL_SERVICE_CONTEXT_TOKEN, (modalService) => { this._modalService = modalService; }); - this.consumeContext('umbDataTypeStore', (dataTypeStore: UmbDataTypeStore) => { + this.consumeContext(UMB_DATA_TYPE_STORE_CONTEXT_TOKEN, (dataTypeStore) => { this._dataTypeStore = dataTypeStore; }); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/tree/manifests.ts b/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/tree/manifests.ts index 373e3bf1e9..488465a362 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/tree/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/tree/manifests.ts @@ -1,3 +1,4 @@ +import { STORE_ALIAS } from '../data-type.store'; import type { ManifestTree, ManifestTreeItemAction } from '@umbraco-cms/models'; const tree: ManifestTree = { @@ -6,7 +7,7 @@ const tree: ManifestTree = { name: 'Data Types Tree', weight: 100, meta: { - storeAlias: 'umbDataTypeStore', + storeAlias: STORE_ALIAS, }, }; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/data-type-workspace.context.ts b/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/data-type-workspace.context.ts index 4cb8181c25..678d491b39 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/data-type-workspace.context.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/data-type-workspace.context.ts @@ -1,5 +1,9 @@ import { UmbWorkspaceContentContext } from '../../../shared/components/workspace/workspace-content/workspace-content.context'; -import type { UmbDataTypeStore, UmbDataTypeStoreItemType } from 'src/backoffice/settings/data-types/data-type.store'; +import { + UmbDataTypeStore, + UmbDataTypeStoreItemType, + UMB_DATA_TYPE_STORE_CONTEXT_TOKEN, +} from 'src/backoffice/settings/data-types/data-type.store'; import type { DataTypeDetails } from '@umbraco-cms/models'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; import { appendToFrozenArray } from '@umbraco-cms/observable-api'; @@ -21,16 +25,19 @@ export class UmbWorkspaceDataTypeContext extends UmbWorkspaceContentContext< UmbDataTypeStore > { constructor(host: UmbControllerHostInterface) { - super(host, DefaultDataTypeData, 'umbDataTypeStore', 'dataType'); + super(host, DefaultDataTypeData, UMB_DATA_TYPE_STORE_CONTEXT_TOKEN.toString(), 'dataType'); } public setPropertyValue(alias: string, value: unknown) { - // TODO: make sure to check that we have a details model? otherwise fail? 8This can be relevant if we use the same context for tree actions? - const entry = {alias: alias, value: value}; + const entry = { alias: alias, value: value }; - const newDataSet = appendToFrozenArray((this._data.getValue() as DataTypeDetails).data, entry, x => x.alias === alias); + const newDataSet = appendToFrozenArray( + (this._data.getValue() as DataTypeDetails).data, + entry, + (x) => x.alias === alias + ); - this.update({data: newDataSet}); + this.update({ data: newDataSet }); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/views/edit/data-type-workspace-view-edit.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/views/edit/data-type-workspace-view-edit.element.ts index c4eb4ee119..3ad679fa59 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/views/edit/data-type-workspace-view-edit.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/views/edit/data-type-workspace-view-edit.element.ts @@ -1,7 +1,7 @@ import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import { css, html, nothing } from 'lit'; import { customElement, state } from 'lit/decorators.js'; -import { UmbModalService } from '../../../../../../core/modal'; +import { UmbModalService, UMB_MODAL_SERVICE_CONTEXT_TOKEN } from '../../../../../../core/modal'; import { UmbWorkspaceDataTypeContext } from '../../data-type-workspace.context'; import { UmbLitElement } from '@umbraco-cms/element'; import type { DataTypeDetails } from '@umbraco-cms/models'; @@ -46,9 +46,13 @@ export class UmbDataTypeWorkspaceViewEditElement extends UmbLitElement { constructor() { super(); - this.consumeAllContexts(['umbWorkspaceContext', 'umbModalService'], (result) => { - this._workspaceContext = result['umbWorkspaceContext']; - this._modalService = result['umbModalService']; + this.consumeContext(UMB_MODAL_SERVICE_CONTEXT_TOKEN, (_instance) => { + this._modalService = _instance; + }); + + // TODO: Figure out if this is the best way to consume a context or if it could be strongly typed using UmbContextToken + this.consumeContext('umbWorkspaceContext', (_instance) => { + this._workspaceContext = _instance; this._observeDataType(); }); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/views/info/workspace-view-data-type-info.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/views/info/workspace-view-data-type-info.element.ts index 5180894c9a..fa4ecf1bf8 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/views/info/workspace-view-data-type-info.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/views/info/workspace-view-data-type-info.element.ts @@ -18,7 +18,8 @@ export class UmbWorkspaceViewDataTypeInfoElement extends UmbLitElement { constructor() { super(); - this.consumeContext('umbWorkspaceContext', (dataTypeContext) => { + // TODO: Figure out if this is the best way to consume the context or if it can be strongly typed with an UmbContextToken + this.consumeContext('umbWorkspaceContext', (dataTypeContext) => { this._workspaceContext = dataTypeContext; this._observeDataType(); }); @@ -28,11 +29,11 @@ export class UmbWorkspaceViewDataTypeInfoElement extends UmbLitElement { if (!this._workspaceContext) return; this.observe(this._workspaceContext.data.pipe(distinctUntilChanged()), (dataType) => { - if(!dataType) return; + if (!dataType) return; // TODO: handle if model is not of the type wanted. // TODO: Make method to identify wether data is of type DataTypeDetails - this._dataType = (dataType as DataTypeDetails); + this._dataType = dataType as DataTypeDetails; }); } @@ -46,13 +47,11 @@ export class UmbWorkspaceViewDataTypeInfoElement extends UmbLitElement {
${this._dataType?.key}
- +
${this._dataType?.propertyEditorModelAlias}
- +
${this._dataType?.propertyEditorUIAlias}
diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/settings/languages/workspace/language/language-workspace.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/settings/languages/workspace/language/language-workspace.element.ts index 06a4912dbb..0ffc2e1b27 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/settings/languages/workspace/language/language-workspace.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/settings/languages/workspace/language/language-workspace.element.ts @@ -1,8 +1,17 @@ -import { html, LitElement } from 'lit'; +import { html } from 'lit'; import { customElement } from 'lit/decorators.js'; +import { UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from 'src/core/notification'; + +import { UmbLitElement } from '@umbraco-cms/element'; @customElement('umb-language-workspace') -export class UmbLanguageWorkspaceElement extends LitElement { +export class UmbLanguageWorkspaceElement extends UmbLitElement { + constructor() { + super(); + this.consumeContext(UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN, (service) => { + service.peek('positive', { data: { message: 'Language Workspace' } }); + }); + } render() { return html`
Language Workspace
`; } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/bulk-actions/collection-bulk-action-media-delete.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/bulk-actions/collection-bulk-action-media-delete.element.ts index 6cf38a66e0..1001bfbbdd 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/bulk-actions/collection-bulk-action-media-delete.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/bulk-actions/collection-bulk-action-media-delete.element.ts @@ -2,7 +2,7 @@ import { UUITextStyles } from '@umbraco-ui/uui-css'; import { css, html } from 'lit'; import { customElement } from 'lit/decorators.js'; import { ifDefined } from 'lit/directives/if-defined.js'; -import type { UmbCollectionContext } from '../collection.context'; +import { UmbCollectionContext, UMB_COLLECTION_CONTEXT_TOKEN } from '../collection.context'; import type { ManifestCollectionBulkAction } from '@umbraco-cms/models'; import { UmbLitElement } from '@umbraco-cms/element'; @@ -18,7 +18,7 @@ export class UmbCollectionBulkActionDeleteElement extends UmbLitElement { constructor() { super(); - this.consumeContext('umbCollectionContext', (context) => { + this.consumeContext(UMB_COLLECTION_CONTEXT_TOKEN, (context) => { this._collectionContext = context; }); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/collection-selection-actions.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/collection-selection-actions.element.ts index 83121e2ee2..1d85b374b5 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/collection-selection-actions.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/collection-selection-actions.element.ts @@ -1,7 +1,7 @@ import { UUITextStyles } from '@umbraco-ui/uui-css'; import { css, html, nothing } from 'lit'; import { customElement, property, state } from 'lit/decorators.js'; -import type { UmbCollectionContext } from './collection.context'; +import { UmbCollectionContext, UMB_COLLECTION_CONTEXT_TOKEN } from './collection.context'; import type { MediaDetails } from '@umbraco-cms/models'; import { UmbLitElement } from '@umbraco-cms/element'; @@ -36,7 +36,7 @@ export class UmbCollectionSelectionActionsElement extends UmbLitElement { constructor() { super(); - this.consumeContext('umbCollectionContext', (instance) => { + this.consumeContext(UMB_COLLECTION_CONTEXT_TOKEN, (instance) => { this._collectionContext = instance; this._observeCollectionContext(); }); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/collection.context.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/collection.context.ts index a312ccadf0..8a23c626b1 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/collection.context.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/collection.context.ts @@ -1,13 +1,12 @@ import { ContentTreeItem } from '@umbraco-cms/backend-api'; import { UmbTreeDataStore } from '@umbraco-cms/stores/store'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -import { UmbContextConsumerController } from '@umbraco-cms/context-api'; +import { UmbContextToken, UmbContextConsumerController } from '@umbraco-cms/context-api'; import { UniqueBehaviorSubject, UmbObserverController } from '@umbraco-cms/observable-api'; export class UmbCollectionContext< DataType extends ContentTreeItem, StoreType extends UmbTreeDataStore = UmbTreeDataStore > { - private _host: UmbControllerHostInterface; private _entityKey: string | null; @@ -60,14 +59,18 @@ export class UmbCollectionContext< this._dataObserver?.destroy(); if (this._entityKey) { - this._dataObserver = new UmbObserverController(this._host, this._store.getTreeItemChildren(this._entityKey), (nodes) => { - if(nodes) { - this.#data.next(nodes); + this._dataObserver = new UmbObserverController( + this._host, + this._store.getTreeItemChildren(this._entityKey), + (nodes) => { + if (nodes) { + this.#data.next(nodes); + } } - }); + ); } else { this._dataObserver = new UmbObserverController(this._host, this._store.getTreeRoot(), (nodes) => { - if(nodes) { + if (nodes) { this.#data.next(nodes); } }); @@ -107,3 +110,7 @@ export class UmbCollectionContext< this.#data.unsubscribe(); } } + +export const UMB_COLLECTION_CONTEXT_TOKEN = new UmbContextToken>( + UmbCollectionContext.name +); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/collection.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/collection.element.ts index 20bf799c50..4812e18d3a 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/collection.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/collection.element.ts @@ -4,7 +4,7 @@ import { customElement, state, property } from 'lit/decorators.js'; import { map } from 'rxjs'; import './collection-selection-actions.element'; import './collection-toolbar.element'; -import type { UmbCollectionContext } from './collection.context'; +import { UmbCollectionContext, UMB_COLLECTION_CONTEXT_TOKEN } from './collection.context'; import { createExtensionElement } from '@umbraco-cms/extensions-api'; import type { ManifestCollectionView, MediaDetails } from '@umbraco-cms/models'; import { umbExtensionsRegistry } from '@umbraco-cms/extensions-registry'; @@ -53,7 +53,7 @@ export class UmbCollectionElement extends UmbLitElement { constructor() { super(); - this.consumeContext('umbCollectionContext', (instance) => { + this.consumeContext(UMB_COLLECTION_CONTEXT_TOKEN, (instance) => { this._collectionContext = instance; this._observeCollectionContext(); }); @@ -85,7 +85,7 @@ export class UmbCollectionElement extends UmbLitElement { private _createRoutes(views: ManifestCollectionView[] | null) { this._routes = []; - if(views) { + if (views) { this._routes = views.map((view) => { return { path: `${view.meta.pathName}`, diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/dashboards/dashboard-collection.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/dashboards/dashboard-collection.element.ts index 697fa88192..97719a81ea 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/dashboards/dashboard-collection.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/dashboards/dashboard-collection.element.ts @@ -4,7 +4,10 @@ import { customElement, state } from 'lit/decorators.js'; import '../collection.element'; import { ifDefined } from 'lit-html/directives/if-defined.js'; import { UmbMediaStore, UmbMediaStoreItemType } from 'src/backoffice/media/media/media.store'; -import { UmbCollectionContext } from 'src/backoffice/shared/collection/collection.context'; +import { + UmbCollectionContext, + UMB_COLLECTION_CONTEXT_TOKEN, +} from 'src/backoffice/shared/collection/collection.context'; import type { ManifestDashboardCollection } from '@umbraco-cms/models'; import { UmbLitElement } from '@umbraco-cms/element'; @@ -37,7 +40,7 @@ export class UmbDashboardCollectionElement extends UmbLitElement { const manifestMeta = this.manifest.meta as any; this._entityType = manifestMeta.entityType as string; this._collectionContext = new UmbCollectionContext(this, null, manifestMeta.storeAlias); - this.provideContext('umbCollectionContext', this._collectionContext); + this.provideContext(UMB_COLLECTION_CONTEXT_TOKEN, this._collectionContext); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/views/collection-view-media-grid.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/views/collection-view-media-grid.element.ts index 52d943758a..794cdb6f6a 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/views/collection-view-media-grid.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/views/collection-view-media-grid.element.ts @@ -2,7 +2,7 @@ import { UUITextStyles } from '@umbraco-ui/uui-css'; import { css, html } from 'lit'; import { customElement, state } from 'lit/decorators.js'; import { repeat } from 'lit/directives/repeat.js'; -import type { UmbCollectionContext } from '../collection.context'; +import { UmbCollectionContext, UMB_COLLECTION_CONTEXT_TOKEN } from '../collection.context'; import type { MediaDetails } from '@umbraco-cms/models'; import { UmbLitElement } from '@umbraco-cms/element'; @@ -77,8 +77,7 @@ export class UmbCollectionViewsMediaGridElement extends UmbLitElement { document.addEventListener('dragenter', this._handleDragEnter.bind(this)); document.addEventListener('dragleave', this._handleDragLeave.bind(this)); document.addEventListener('drop', this._handleDrop.bind(this)); - this.consumeContext('umbCollectionContext', (instance) => { - console.log('umbCollectionContext', instance); + this.consumeContext(UMB_COLLECTION_CONTEXT_TOKEN, (instance) => { this._collectionContext = instance; this._observeCollectionContext(); }); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/views/collection-view-media-table.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/views/collection-view-media-table.element.ts index 069e3c8c9e..258a0a7465 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/views/collection-view-media-table.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/views/collection-view-media-table.element.ts @@ -1,25 +1,66 @@ import { UUITextStyles } from '@umbraco-ui/uui-css'; import { css, html } from 'lit'; import { customElement, state } from 'lit/decorators.js'; -import type { UmbCollectionContext } from '../collection.context'; +import { UmbCollectionContext, UMB_COLLECTION_CONTEXT_TOKEN } from '../collection.context'; import type { MediaDetails } from '@umbraco-cms/models'; import { UmbLitElement } from '@umbraco-cms/element'; +import { + UmbTableColumn, + UmbTableConfig, + UmbTableDeselectedEvent, + UmbTableElement, + UmbTableItem, + UmbTableOrderedEvent, + UmbTableSelectedEvent, +} from '../../components/table'; @customElement('umb-collection-view-media-table') export class UmbCollectionViewMediaTableElement extends UmbLitElement { - static styles = [UUITextStyles, css``]; + static styles = [ + UUITextStyles, + css` + :host { + display: block; + box-sizing: border-box; + height: 100%; + width: 100%; + padding: var(--uui-size-space-3) var(--uui-size-space-6); + } + + /* TODO: Should we have embedded padding in the table component? */ + umb-table { + padding: 0; /* To fix the embedded padding in the table component. */ + } + `, + ]; @state() private _mediaItems?: Array; @state() - private _selection?: Array; + private _tableConfig: UmbTableConfig = { + allowSelection: true, + }; + + @state() + private _tableColumns: Array = [ + { + name: 'Name', + alias: 'mediaName', + }, + ]; + + @state() + private _tableItems: Array = []; + + @state() + private _selection: Array = []; private _collectionContext?: UmbCollectionContext; constructor() { super(); - this.consumeContext('umbCollectionContext', (instance) => { + this.consumeContext(UMB_COLLECTION_CONTEXT_TOKEN, (instance) => { this._collectionContext = instance; this._observeCollectionContext(); }); @@ -30,6 +71,7 @@ export class UmbCollectionViewMediaTableElement extends UmbLitElement { this.observe(this._collectionContext.data, (nodes) => { this._mediaItems = nodes; + this._createTableItems(this._mediaItems); }); this.observe(this._collectionContext.selection, (selection) => { @@ -37,17 +79,55 @@ export class UmbCollectionViewMediaTableElement extends UmbLitElement { }); } + private _createTableItems(mediaItems: Array) { + // TODO: this should use the MediaDetails type, but for now that results in type errors. + // TODO: I guess the type error will go away when we get an entity based MediaDetails model instead of tree based. + this._tableItems = mediaItems.map((item) => { + return { + key: item.key, + icon: item.icon, + data: [ + { + columnAlias: 'mediaName', + value: item.name || 'Untitled', + }, + ], + }; + }); + } + + private _handleSelect(event: UmbTableSelectedEvent) { + event.stopPropagation(); + const table = event.target as UmbTableElement; + const selection = table.selection; + this._collectionContext?.setSelection(selection); + } + + private _handleDeselect(event: UmbTableDeselectedEvent) { + event.stopPropagation(); + const table = event.target as UmbTableElement; + const selection = table.selection; + this._collectionContext?.setSelection(selection); + } + + private _handleOrdering(event: UmbTableOrderedEvent) { + const table = event.target as UmbTableElement; + const orderingColumn = table.orderingColumn; + const orderingDesc = table.orderingDesc; + console.log(`fetch media items, order column: ${orderingColumn}, desc: ${orderingDesc}`); + } + render() { - return html`

umb-collection-view-media-table

-
-

Selected Media Items:

-
    - ${this._selection?.map((key) => { - const mediaItem = this._mediaItems?.find((item) => item.key === key); - return html`
  • ${mediaItem?.name}
  • `; - })} -
-
`; + return html` + + `; } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/backoffice-frame/backoffice-header-sections.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/backoffice-frame/backoffice-header-sections.element.ts index 7cd6c21bed..ba01e94be6 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/backoffice-frame/backoffice-header-sections.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/backoffice-frame/backoffice-header-sections.element.ts @@ -2,7 +2,7 @@ import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import { css, CSSResultGroup, html } from 'lit'; import { customElement, state } from 'lit/decorators.js'; import { when } from 'lit/directives/when.js'; -import { UmbSectionStore } from '../section/section.store'; +import { UmbSectionStore, UMB_SECTION_STORE_CONTEXT_TOKEN } from '../section/section.store'; import type { ManifestSection } from '@umbraco-cms/models'; import { UmbLitElement } from '@umbraco-cms/element'; @@ -54,7 +54,7 @@ export class UmbBackofficeHeaderSections extends UmbLitElement { constructor() { super(); - this.consumeContext('umbSectionStore', (sectionStore: UmbSectionStore) => { + this.consumeContext(UMB_SECTION_STORE_CONTEXT_TOKEN, (sectionStore) => { this._sectionStore = sectionStore; this._observeSections(); this._observeCurrentSection(); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/backoffice-frame/backoffice-main.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/backoffice-frame/backoffice-main.element.ts index 820b6c6050..5782cf7c17 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/backoffice-frame/backoffice-main.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/backoffice-frame/backoffice-main.element.ts @@ -3,8 +3,8 @@ import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import { css, html } from 'lit'; import { state } from 'lit/decorators.js'; import { IRoutingInfo } from 'router-slot'; -import { UmbSectionStore } from '../section/section.store'; -import { UmbSectionContext } from '../section/section.context'; +import { UmbSectionStore, UMB_SECTION_STORE_CONTEXT_TOKEN } from '../section/section.store'; +import { UmbSectionContext, UMB_SECTION_CONTEXT_TOKEN } from '../section/section.context'; import { createExtensionElement } from '@umbraco-cms/extensions-api'; import type { ManifestSection } from '@umbraco-cms/models'; import { UmbSectionElement } from 'src/backoffice/shared/components/section/section.element'; @@ -41,7 +41,7 @@ export class UmbBackofficeMain extends UmbLitElement { constructor() { super(); - this.consumeContext('umbSectionStore', (_instance: UmbSectionStore) => { + this.consumeContext(UMB_SECTION_STORE_CONTEXT_TOKEN, (_instance) => { this._sectionStore = _instance; this._observeSections(); }); @@ -93,7 +93,7 @@ export class UmbBackofficeMain extends UmbLitElement { private _provideSectionContext(section: ManifestSection) { if (!this._sectionContext) { this._sectionContext = new UmbSectionContext(section); - this.provideContext('umbSectionContext', this._sectionContext); + this.provideContext(UMB_SECTION_CONTEXT_TOKEN, this._sectionContext); } else { this._sectionContext.setManifest(section); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/backoffice-frame/backoffice-modal-container.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/backoffice-frame/backoffice-modal-container.element.ts index a216a45f2d..49298c46ed 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/backoffice-frame/backoffice-modal-container.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/backoffice-frame/backoffice-modal-container.element.ts @@ -2,7 +2,7 @@ import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import { css, CSSResultGroup, html } from 'lit'; import { customElement, state } from 'lit/decorators.js'; import { repeat } from 'lit/directives/repeat.js'; -import { UmbModalHandler, UmbModalService } from '../../../../core/modal'; +import { UmbModalHandler, UmbModalService, UMB_MODAL_SERVICE_CONTEXT_TOKEN } from '../../../../core/modal'; import { UmbLitElement } from '@umbraco-cms/element'; @customElement('umb-backoffice-modal-container') @@ -24,7 +24,7 @@ export class UmbBackofficeModalContainer extends UmbLitElement { constructor() { super(); - this.consumeContext('umbModalService', (modalService: UmbModalService) => { + this.consumeContext(UMB_MODAL_SERVICE_CONTEXT_TOKEN, (modalService) => { this._modalService = modalService; this._observeModals(); }); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/backoffice-frame/backoffice-notification-container.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/backoffice-frame/backoffice-notification-container.element.ts index 7540e565bf..a66040d95f 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/backoffice-frame/backoffice-notification-container.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/backoffice-frame/backoffice-notification-container.element.ts @@ -2,7 +2,11 @@ import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import { css, CSSResultGroup, html } from 'lit'; import { customElement, state } from 'lit/decorators.js'; import { repeat } from 'lit/directives/repeat.js'; -import type { UmbNotificationHandler, UmbNotificationService } from '../../../../core/notification'; +import { + UmbNotificationHandler, + UmbNotificationService, + UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN, +} from '../../../../core/notification'; import { UmbLitElement } from '@umbraco-cms/element'; @customElement('umb-backoffice-notification-container') @@ -30,7 +34,7 @@ export class UmbBackofficeNotificationContainer extends UmbLitElement { constructor() { super(); - this.consumeContext('umbNotificationService', (notificationService: UmbNotificationService) => { + this.consumeContext(UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN, (notificationService) => { this._notificationService = notificationService; this._observeNotifications(); }); @@ -47,11 +51,13 @@ export class UmbBackofficeNotificationContainer extends UmbLitElement { render() { return html` - ${this._notifications ? repeat( - this._notifications, - (notification: UmbNotificationHandler) => notification.key, - (notification) => html`${notification.element}` - ) : ''} + ${this._notifications + ? repeat( + this._notifications, + (notification: UmbNotificationHandler) => notification.key, + (notification) => html`${notification.element}` + ) + : ''} `; } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/content-property/content-property.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/content-property/content-property.element.ts index 233e42ab64..7ade9d09a1 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/content-property/content-property.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/content-property/content-property.element.ts @@ -3,7 +3,7 @@ import { css, html } from 'lit'; import { ifDefined } from 'lit-html/directives/if-defined.js'; import { customElement, property, state } from 'lit/decorators.js'; -import { UmbDataTypeStore } from '../../../settings/data-types/data-type.store'; +import { UmbDataTypeStore, UMB_DATA_TYPE_STORE_CONTEXT_TOKEN } from '../../../settings/data-types/data-type.store'; import type { ContentProperty, DataTypeDetails } from '@umbraco-cms/models'; import '../workspace-property/workspace-property.element'; @@ -30,7 +30,7 @@ export class UmbContentPropertyElement extends UmbLitElement { public set property(value: ContentProperty | undefined) { const oldProperty = this._property; this._property = value; - if(this._property?.dataTypeKey !== oldProperty?.dataTypeKey) { + if (this._property?.dataTypeKey !== oldProperty?.dataTypeKey) { this._observeDataType(this._property?.dataTypeKey); } } @@ -50,7 +50,7 @@ export class UmbContentPropertyElement extends UmbLitElement { constructor() { super(); - this.consumeContext('umbDataTypeStore', (instance) => { + this.consumeContext(UMB_DATA_TYPE_STORE_CONTEXT_TOKEN, (instance) => { this._dataTypeStore = instance; this._observeDataType(this._property?.dataTypeKey); }); @@ -60,14 +60,11 @@ export class UmbContentPropertyElement extends UmbLitElement { if (!this._dataTypeStore) return; this._dataTypeObserver?.destroy(); - if(dataTypeKey) { - this._dataTypeObserver = this.observe( - this._dataTypeStore.getByKey(dataTypeKey), - (dataType) => { - this._dataTypeData = dataType?.data; - this._propertyEditorUIAlias = dataType?.propertyEditorUIAlias || undefined; - } - ); + if (dataTypeKey) { + this._dataTypeObserver = this.observe(this._dataTypeStore.getByKey(dataTypeKey), (dataType) => { + this._dataTypeData = dataType?.data; + this._propertyEditorUIAlias = dataType?.propertyEditorUIAlias || undefined; + }); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-document-picker/input-document-picker.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-document-picker/input-document-picker.element.ts index 47ae5ecaad..31432bdac6 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-document-picker/input-document-picker.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-document-picker/input-document-picker.element.ts @@ -3,11 +3,11 @@ import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import { customElement, property, state } from 'lit/decorators.js'; import { ifDefined } from 'lit-html/directives/if-defined.js'; import { FormControlMixin } from '@umbraco-ui/uui-base/lib/mixins'; -import type { UmbModalService } from 'src/core/modal'; +import { UmbModalService, UMB_MODAL_SERVICE_CONTEXT_TOKEN } from 'src/core/modal'; import type { FolderTreeItem } from '@umbraco-cms/backend-api'; import { UmbLitElement } from '@umbraco-cms/element'; import type { UmbObserverController } from '@umbraco-cms/observable-api'; -import type { UmbDocumentStore } from 'src/backoffice/documents/documents/document.store'; +import { UmbDocumentStore, UMB_DOCUMENT_STORE_CONTEXT_TOKEN } from 'src/backoffice/documents/documents/document.store'; @customElement('umb-input-document-picker') export class UmbInputDocumentPickerElement extends FormControlMixin(UmbLitElement) { @@ -94,11 +94,11 @@ export class UmbInputDocumentPickerElement extends FormControlMixin(UmbLitElemen () => !!this.max && this._selectedKeys.length > this.max ); - this.consumeContext('umbDocumentStore', (instance) => { + this.consumeContext(UMB_DOCUMENT_STORE_CONTEXT_TOKEN, (instance) => { this._documentStore = instance; this._observePickedDocuments(); }); - this.consumeContext('umbModalService', (instance) => { + this.consumeContext(UMB_MODAL_SERVICE_CONTEXT_TOKEN, (instance) => { this._modalService = instance; }); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-list-base/input-list-base.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-list-base/input-list-base.ts index 2ee8808dce..847b7b9155 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-list-base/input-list-base.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-list-base/input-list-base.ts @@ -2,7 +2,7 @@ import { html } from 'lit'; import { property } from 'lit/decorators.js'; import { UUIModalSidebarSize } from '@umbraco-ui/uui-modal-sidebar'; import { UmbPickerData } from '../../../../core/modal/layouts/modal-layout-picker-base'; -import { UmbModalService, UmbModalType } from '../../../../core/modal'; +import { UmbModalService, UmbModalType, UMB_MODAL_SERVICE_CONTEXT_TOKEN } from '../../../../core/modal'; //TODO: These should probably be imported dynamically. import '../../../../core/modal/layouts/picker-section/picker-layout-section.element'; @@ -12,7 +12,6 @@ import { UmbLitElement } from '@umbraco-cms/element'; /** TODO: Make use of UUI FORM Mixin, to make it easily take part of a form. */ export class UmbInputListBase extends UmbLitElement { - @property({ type: Array }) public value: Array = []; @@ -30,7 +29,7 @@ export class UmbInputListBase extends UmbLitElement { constructor() { super(); - this.consumeContext('umbModalService', (modalService: UmbModalService) => { + this.consumeContext(UMB_MODAL_SERVICE_CONTEXT_TOKEN, (modalService) => { this._modalService = modalService; }); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section-dashboards/section-dashboards.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section-dashboards/section-dashboards.element.ts index bc1bfa484f..ba493baa14 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section-dashboards/section-dashboards.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section-dashboards/section-dashboards.element.ts @@ -3,7 +3,7 @@ import { css, html, nothing } from 'lit'; import { customElement, state } from 'lit/decorators.js'; import { IRoutingInfo } from 'router-slot'; import { first, map } from 'rxjs'; -import { UmbSectionContext } from '../section.context'; +import { UmbSectionContext, UMB_SECTION_CONTEXT_TOKEN } from '../section.context'; import { createExtensionElement } from '@umbraco-cms/extensions-api'; import type { ManifestDashboard, @@ -41,6 +41,7 @@ export class UmbSectionDashboardsElement extends UmbLitElement { height: 100%; box-sizing: border-box; display: block; + padding:var(--uui-size-5); } `, ]; @@ -63,7 +64,7 @@ export class UmbSectionDashboardsElement extends UmbLitElement { constructor() { super(); - this.consumeContext('umbSectionContext', (context: UmbSectionContext) => { + this.consumeContext(UMB_SECTION_CONTEXT_TOKEN, (context) => { this._sectionContext = context; this._observeSectionContext(); }); @@ -73,7 +74,7 @@ export class UmbSectionDashboardsElement extends UmbLitElement { if (!this._sectionContext) return; this.observe(this._sectionContext.manifest.pipe(first()), (section) => { - if(section) { + if (section) { this._currentSectionAlias = section.alias; this._currentSectionPathname = section.meta.pathname; this._observeDashboards(); @@ -86,7 +87,7 @@ export class UmbSectionDashboardsElement extends UmbLitElement { this.observe( umbExtensionsRegistry - ?.extensionsOfTypes<(ManifestDashboard | ManifestDashboardCollection)>(['dashboard', 'dashboardCollection']) + ?.extensionsOfTypes(['dashboard', 'dashboardCollection']) .pipe( map((extensions) => extensions.filter((extension) => @@ -104,7 +105,7 @@ export class UmbSectionDashboardsElement extends UmbLitElement { private _createRoutes() { this._routes = []; - if(this._dashboards) { + if (this._dashboards) { this._routes = this._dashboards.map((dashboard) => { return { path: `${dashboard.meta.pathname}`, diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section-dashboards/section-dashboards.stories.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section-dashboards/section-dashboards.stories.ts index c54f0dbf59..28c3096f16 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section-dashboards/section-dashboards.stories.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section-dashboards/section-dashboards.stories.ts @@ -1,7 +1,7 @@ import { Meta, Story } from '@storybook/web-components'; import { html } from 'lit-html'; import { manifests } from '../../../../documents/section.manifests'; -import { UmbSectionContext } from '../section.context'; +import { UmbSectionContext, UMB_SECTION_CONTEXT_TOKEN } from '../section.context'; import type { UmbSectionDashboardsElement } from './section-dashboards.element'; import type { ManifestSection } from '@umbraco-cms/models'; import './section-dashboards.element'; @@ -14,7 +14,9 @@ export default { id: 'umb-section-dashboards', decorators: [ (story) => - html` + html` ${story()} `, ], diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section-sidebar-menu/section-sidebar-menu.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section-sidebar-menu/section-sidebar-menu.element.ts index 47977ede17..f46bc00785 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section-sidebar-menu/section-sidebar-menu.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section-sidebar-menu/section-sidebar-menu.element.ts @@ -1,7 +1,7 @@ import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import { html } from 'lit'; import { customElement, state } from 'lit/decorators.js'; -import { UmbSectionContext } from '../section.context'; +import { UmbSectionContext, UMB_SECTION_CONTEXT_TOKEN } from '../section.context'; import { ManifestSidebarMenuItem } from '@umbraco-cms/extensions-registry'; import { UmbLitElement } from '@umbraco-cms/element'; @@ -19,7 +19,7 @@ export class UmbSectionSidebarMenuElement extends UmbLitElement { constructor() { super(); - this.consumeContext('umbSectionContext', (instance) => { + this.consumeContext(UMB_SECTION_CONTEXT_TOKEN, (instance) => { this._sectionContext = instance; this._observeCurrentSection(); }); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section-sidebar/section-sidebar.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section-sidebar/section-sidebar.element.ts index b339344abd..7964674b21 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section-sidebar/section-sidebar.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section-sidebar/section-sidebar.element.ts @@ -1,7 +1,7 @@ import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import { css, html } from 'lit'; import { customElement, state } from 'lit/decorators.js'; -import { UmbSectionContext } from '../section.context'; +import { UmbSectionContext, UMB_SECTION_CONTEXT_TOKEN } from '../section.context'; import type { ManifestSection } from '@umbraco-cms/models'; import '../../tree/context-menu/tree-context-menu.service'; @@ -39,7 +39,7 @@ export class UmbSectionSidebarElement extends UmbLitElement { constructor() { super(); - this.consumeContext('umbSectionContext', (sectionContext: UmbSectionContext) => { + this.consumeContext(UMB_SECTION_CONTEXT_TOKEN, (sectionContext) => { this._sectionContext = sectionContext; this._observeSectionContext(); }); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section-views/section-views.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section-views/section-views.element.ts index 9773e7d1b7..c7d498e252 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section-views/section-views.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section-views/section-views.element.ts @@ -2,7 +2,7 @@ import { UUITextStyles } from '@umbraco-ui/uui-css'; import { css, html, nothing } from 'lit'; import { customElement, state } from 'lit/decorators.js'; import { EMPTY, map, of, Subscription, switchMap } from 'rxjs'; -import { UmbSectionContext } from '../section.context'; +import { UmbSectionContext, UMB_SECTION_CONTEXT_TOKEN } from '../section.context'; import type { ManifestSectionView } from '@umbraco-cms/models'; import { umbExtensionsRegistry } from '@umbraco-cms/extensions-registry'; import { UmbLitElement } from '@umbraco-cms/element'; @@ -44,7 +44,7 @@ export class UmbSectionViewsElement extends UmbLitElement { constructor() { super(); - this.consumeContext('umbSectionContext', (sectionContext: UmbSectionContext) => { + this.consumeContext(UMB_SECTION_CONTEXT_TOKEN, (sectionContext) => { this._sectionContext = sectionContext; this._observeViews(); this._observeActiveView(); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section.context.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section.context.ts index 8ce461f91a..a599227afe 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section.context.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section.context.ts @@ -1,10 +1,9 @@ import { BehaviorSubject } from 'rxjs'; import type { Entity, ManifestSection, ManifestSectionView, ManifestTree } from '@umbraco-cms/models'; import { UniqueBehaviorSubject } from '@umbraco-cms/observable-api'; +import { UmbContextToken } from '@umbraco-cms/context-api'; export class UmbSectionContext { - - #manifest; public readonly manifest; @@ -25,7 +24,6 @@ export class UmbSectionContext { this.manifest = this.#manifest.asObservable(); } - public setManifest(data: ManifestSection) { this.#manifest.next({ ...data }); } @@ -46,3 +44,5 @@ export class UmbSectionContext { this._activeView.next(view); } } + +export const UMB_SECTION_CONTEXT_TOKEN = new UmbContextToken(UmbSectionContext.name); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section.element.ts index e975845712..4b04b25ca2 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section.element.ts @@ -4,7 +4,7 @@ import { customElement, state } from 'lit/decorators.js'; import { map, switchMap, EMPTY, of } from 'rxjs'; import { IRoutingInfo } from 'router-slot'; import type { UmbWorkspaceEntityElement } from '../workspace/workspace-entity-element.interface'; -import { UmbSectionContext } from './section.context'; +import { UmbSectionContext, UMB_SECTION_CONTEXT_TOKEN } from './section.context'; import { createExtensionElement } from '@umbraco-cms/extensions-api'; import type { ManifestSectionView, ManifestWorkspace, ManifestSidebarMenuItem } from '@umbraco-cms/models'; import { umbExtensionsRegistry } from '@umbraco-cms/extensions-registry'; @@ -48,7 +48,7 @@ export class UmbSectionElement extends UmbLitElement { constructor() { super(); - this.consumeContext('umbSectionContext', (instance) => { + this.consumeContext(UMB_SECTION_CONTEXT_TOKEN, (instance) => { this._sectionContext = instance; // TODO: currently they don't corporate, as they overwrite each other... @@ -60,11 +60,9 @@ export class UmbSectionElement extends UmbLitElement { private _observeMenuItems() { if (!this._sectionContext) return; - this.observe(this._sectionContext?.manifest, - (section) => { - this._observeSidebarMenuItem(section?.alias); - } - ); + this.observe(this._sectionContext?.manifest, (section) => { + this._observeSidebarMenuItem(section?.alias); + }); this.observe(umbExtensionsRegistry.extensionsOfType('workspace'), (workspaceExtensions) => { this._workspaces = workspaceExtensions; @@ -72,14 +70,12 @@ export class UmbSectionElement extends UmbLitElement { }); } - private _observeSidebarMenuItem(sectionAlias?:string) { - if(sectionAlias) { + private _observeSidebarMenuItem(sectionAlias?: string) { + if (sectionAlias) { this.observe( umbExtensionsRegistry - ?.extensionsOfType('sidebarMenuItem') - .pipe( - map((manifests) => manifests.filter((manifest) => manifest.meta.sections.includes(sectionAlias))) - ), + ?.extensionsOfType('sidebarMenuItem') + .pipe(map((manifests) => manifests.filter((manifest) => manifest.meta.sections.includes(sectionAlias)))), (manifests) => { this._menuItems = manifests; this._createMenuRoutes(); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section.store.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section.store.ts index ac710a3a2e..5ef99b054d 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section.store.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/section/section.store.ts @@ -1,5 +1,6 @@ import { Observable, ReplaySubject } from 'rxjs'; import { umbExtensionsRegistry } from '@umbraco-cms/extensions-registry'; +import { UmbContextToken } from '@umbraco-cms/context-api'; // TODO: maybe this should be named something else than store? export class UmbSectionStore { @@ -20,3 +21,5 @@ export class UmbSectionStore { this._currentAlias.next(alias); } } + +export const UMB_SECTION_STORE_CONTEXT_TOKEN = new UmbContextToken(UmbSectionStore.name); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/table/table.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/table/table.element.ts index 2f3c4c15f1..722377a020 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/table/table.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/table/table.element.ts @@ -1,5 +1,7 @@ import { UUITextStyles } from '@umbraco-ui/uui-css'; -import { css, html, LitElement, nothing } from 'lit'; +import { css, html, LitElement } from 'lit'; +import { ifDefined } from 'lit-html/directives/if-defined.js'; +import { when } from 'lit-html/directives/when.js'; import { customElement, property, state } from 'lit/decorators.js'; import { repeat } from 'lit/directives/repeat.js'; @@ -22,6 +24,7 @@ export interface UmbTableColumn { export interface UmbTableConfig { allowSelection: boolean; + hideIcon?: boolean; } export class UmbTableSelectedEvent extends Event { @@ -77,16 +80,16 @@ export class UmbTableElement extends LitElement { display: none; } - uui-table-row:focus uui-icon, - uui-table-row:focus-within uui-icon, - uui-table-row:hover uui-icon, + uui-table-row[selectable]:focus uui-icon, + uui-table-row[selectable]:focus-within uui-icon, + uui-table-row[selectable]:hover uui-icon, uui-table-row[select-only] uui-icon { display: none; } - uui-table-row:focus uui-checkbox, - uui-table-row:focus-within uui-checkbox, - uui-table-row:hover uui-checkbox, + uui-table-row[selectable]:focus uui-checkbox, + uui-table-row[selectable]:focus-within uui-checkbox, + uui-table-row[selectable]:hover uui-checkbox, uui-table-row[select-only] uui-checkbox { display: inline-block; } @@ -137,6 +140,7 @@ export class UmbTableElement extends LitElement { @property({ type: Object, attribute: false }) public config: UmbTableConfig = { allowSelection: false, + hideIcon: false, }; /** @@ -201,18 +205,10 @@ export class UmbTableElement extends LitElement { } render() { - return html` + return html` - - - - - ${this.columns.map((column) => this._renderHeaderCell(column))} + ${this._renderHeaderCheckboxCell()} ${this.columns.map((column) => this._renderHeaderCell(column))} ${repeat(this.items, (item) => item.key, this._renderRow)} `; @@ -231,28 +227,52 @@ export class UmbTableElement extends LitElement { `; } + private _renderHeaderCheckboxCell() { + if (this.config.hideIcon && !this.config.allowSelection) return; + + return html` + ${when( + this.config.allowSelection, + () => html` + ` + )} + `; + } + private _renderRow = (item: UmbTableItem) => { return html` this._selectRow(item.key)} @unselected=${() => this._deselectRow(item.key)}> - - ${item.icon ? html`` : nothing} - this._renderRowCell(column, item))} + `; + }; + + private _renderRowCheckboxCell(item: UmbTableItem) { + if (this.config.hideIcon && !this.config.allowSelection) return; + + return html` + ${when(!this.config.hideIcon, () => html``)} + ${when( + this.config.allowSelection, + () => html` e.stopPropagation()} @change=${(event: Event) => this._handleRowCheckboxChange(event, item)} ?checked="${this._isSelected(item.key)}"> - - - ${this.columns.map((column) => this._renderRowCell(column, item))} -
`; - }; + ` + )} + `; + } private _renderRowCell(column: UmbTableColumn, item: UmbTableItem) { - return html`${this._renderCellContent(column, item)} `; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/table/table.stories.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/table/table.stories.ts index 329ae94aea..b26be13e10 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/table/table.stories.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/table/table.stories.ts @@ -72,6 +72,7 @@ const items: Array = [ const config: UmbTableConfig = { allowSelection: true, + hideIcon: false, }; export const AAAOverview: Story = () => diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/tree/action/tree-item-action.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/tree/action/tree-item-action.element.ts index 773916db86..a738d06b5f 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/tree/action/tree-item-action.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/tree/action/tree-item-action.element.ts @@ -1,7 +1,13 @@ import { customElement, property, state } from 'lit/decorators.js'; -import { UmbSectionContext } from '../../section/section.context'; -import { UmbTreeContextMenuPageService } from '../context-menu/tree-context-menu-page.service'; -import { UmbTreeContextMenuService } from '../context-menu/tree-context-menu.service'; +import { UmbSectionContext, UMB_SECTION_CONTEXT_TOKEN } from '../../section/section.context'; +import { + UmbTreeContextMenuPageService, + UMB_TREE_CONTEXT_MENU_PAGE_SERVICE_CONTEXT_TOKEN, +} from '../context-menu/tree-context-menu-page.service'; +import { + UmbTreeContextMenuService, + UMB_TREE_CONTEXT_MENU_SERVICE_CONTEXT_TOKEN, +} from '../context-menu/tree-context-menu.service'; import type { Entity, ManifestTreeItemAction, ManifestTree } from '@umbraco-cms/models'; import { UmbLitElement } from '@umbraco-cms/element'; @@ -28,17 +34,17 @@ export default class UmbTreeItemActionElement extends UmbLitElement { connectedCallback() { super.connectedCallback(); - this.consumeContext('umbSectionContext', (sectionContext) => { + this.consumeContext(UMB_SECTION_CONTEXT_TOKEN, (sectionContext) => { this._sectionContext = sectionContext; this._observeActiveTree(); this._observeActiveTreeItem(); }); - this.consumeContext('umbTreeContextMenuService', (treeContextMenuService: UmbTreeContextMenuService) => { + this.consumeContext(UMB_TREE_CONTEXT_MENU_SERVICE_CONTEXT_TOKEN, (treeContextMenuService) => { this._treeContextMenuService = treeContextMenuService; }); - this.consumeContext('umbTreeContextMenuPageService', (actionPageService: UmbTreeContextMenuPageService) => { + this.consumeContext(UMB_TREE_CONTEXT_MENU_PAGE_SERVICE_CONTEXT_TOKEN, (actionPageService) => { this._actionPageService = actionPageService; this._observeEntity(); }); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/tree/context-menu/tree-context-menu-page-action-list.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/tree/context-menu/tree-context-menu-page-action-list.element.ts index 59a5991fa4..9ef5edbae1 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/tree/context-menu/tree-context-menu-page-action-list.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/tree/context-menu/tree-context-menu-page-action-list.element.ts @@ -2,7 +2,7 @@ import { css, html } from 'lit'; import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import { customElement, state } from 'lit/decorators.js'; import { map } from 'rxjs'; -import { UmbSectionContext } from '../../section/section.context'; +import { UmbSectionContext, UMB_SECTION_CONTEXT_TOKEN } from '../../section/section.context'; import type { Entity, ManifestTreeItemAction, ManifestTree } from '@umbraco-cms/models'; import { umbExtensionsRegistry } from '@umbraco-cms/extensions-registry'; import { UmbLitElement } from '@umbraco-cms/element'; @@ -41,7 +41,7 @@ export class UmbTreeContextMenuPageActionListElement extends UmbLitElement { constructor() { super(); - this.consumeContext('umbSectionContext', (sectionContext) => { + this.consumeContext(UMB_SECTION_CONTEXT_TOKEN, (sectionContext) => { this._sectionContext = sectionContext; this._observeActiveTree(); this._observeActiveTreeItem(); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/tree/context-menu/tree-context-menu-page.service.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/tree/context-menu/tree-context-menu-page.service.ts index 5804c1b483..36bcd4bc21 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/tree/context-menu/tree-context-menu-page.service.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/tree/context-menu/tree-context-menu-page.service.ts @@ -2,8 +2,10 @@ import { UUITextStyles } from '@umbraco-ui/uui-css'; import { css, nothing, PropertyValueMap } from 'lit'; import { customElement, property, state } from 'lit/decorators.js'; import UmbTreeItemActionElement, { ActionPageEntity } from '../action/tree-item-action.element'; +import { UmbTreeContextMenuService } from './tree-context-menu.service'; import { UmbLitElement } from '@umbraco-cms/element'; import { UniqueBehaviorSubject } from '@umbraco-cms/observable-api'; +import { UmbContextToken } from '@umbraco-cms/context-api'; // TODO: Refactor this, its not a service and the data should be handled by a context api. @customElement('umb-tree-context-menu-page-service') @@ -21,7 +23,7 @@ export class UmbTreeContextMenuPageService extends UmbLitElement { connectedCallback() { super.connectedCallback(); - this.provideContext('umbTreeContextMenuPageService', this); + this.provideContext(UMB_TREE_CONTEXT_MENU_PAGE_SERVICE_CONTEXT_TOKEN, this); this.openFreshPage('umb-tree-context-menu-page-action-list'); } @@ -64,6 +66,10 @@ export class UmbTreeContextMenuPageService extends UmbLitElement { } } +export const UMB_TREE_CONTEXT_MENU_PAGE_SERVICE_CONTEXT_TOKEN = new UmbContextToken( + UmbTreeContextMenuService.name +); + declare global { interface HTMLElementTagNameMap { 'umb-tree-context-menu-page-service': UmbTreeContextMenuPageService; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/tree/context-menu/tree-context-menu.service.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/tree/context-menu/tree-context-menu.service.ts index f21f2d833a..5b6e322682 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/tree/context-menu/tree-context-menu.service.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/tree/context-menu/tree-context-menu.service.ts @@ -3,6 +3,7 @@ import { css, html, nothing } from 'lit'; import { customElement, state } from 'lit/decorators.js'; import { ActionPageEntity } from '../action/tree-item-action.element'; import { UmbLitElement } from '@umbraco-cms/element'; +import { UmbContextToken } from '@umbraco-cms/context-api'; @customElement('umb-tree-context-menu-service') export class UmbTreeContextMenuService extends UmbLitElement { @@ -56,7 +57,7 @@ export class UmbTreeContextMenuService extends UmbLitElement { connectedCallback() { super.connectedCallback(); - this.provideContext('umbTreeContextMenuService', this); + this.provideContext(UMB_TREE_CONTEXT_MENU_SERVICE_CONTEXT_TOKEN, this); } public open(entity: ActionPageEntity) { @@ -92,6 +93,10 @@ export class UmbTreeContextMenuService extends UmbLitElement { } } +export const UMB_TREE_CONTEXT_MENU_SERVICE_CONTEXT_TOKEN = new UmbContextToken( + UmbTreeContextMenuService.name +); + declare global { interface HTMLElementTagNameMap { 'umb-tree-context-menu-service': UmbTreeContextMenuService; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/tree/tree-item.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/tree/tree-item.element.ts index 8ec0dffd7e..83d7affd20 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/tree/tree-item.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/tree/tree-item.element.ts @@ -4,9 +4,12 @@ import { customElement, property, state } from 'lit/decorators.js'; import { ifDefined } from 'lit-html/directives/if-defined.js'; import { map, Observable } from 'rxjs'; import { repeat } from 'lit/directives/repeat.js'; -import { UmbSectionContext } from '../section/section.context'; +import { UmbSectionContext, UMB_SECTION_CONTEXT_TOKEN } from '../section/section.context'; import type { UmbTreeContextBase } from './tree.context'; -import { UmbTreeContextMenuService } from './context-menu/tree-context-menu.service'; +import { + UmbTreeContextMenuService, + UMB_TREE_CONTEXT_MENU_SERVICE_CONTEXT_TOKEN, +} from './context-menu/tree-context-menu.service'; import type { Entity } from '@umbraco-cms/models'; import { UmbTreeDataStore } from '@umbraco-cms/stores/store'; import { UmbLitElement } from '@umbraco-cms/element'; @@ -82,13 +85,13 @@ export class UmbTreeItem extends UmbLitElement { this._store = store; }); - this.consumeContext('umbSectionContext', (sectionContext: UmbSectionContext) => { + this.consumeContext(UMB_SECTION_CONTEXT_TOKEN, (sectionContext) => { this._sectionContext = sectionContext; this._observeSection(); this._observeActiveTreeItem(); }); - this.consumeContext('umbTreeContextMenuService', (treeContextMenuService: UmbTreeContextMenuService) => { + this.consumeContext(UMB_TREE_CONTEXT_MENU_SERVICE_CONTEXT_TOKEN, (treeContextMenuService) => { this._treeContextMenuService = treeContextMenuService; }); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/variant-selector/variant-selector.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/variant-selector/variant-selector.element.ts index 11a83671bf..dc605c8d92 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/variant-selector/variant-selector.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/variant-selector/variant-selector.element.ts @@ -54,10 +54,14 @@ export class UmbVariantSelectorElement extends UmbLitElement { constructor() { super(); - this.consumeContext('umbWorkspaceContext', (instance) => { - this._workspaceContext = instance; - this._observeWorkspace(); - }); + // TODO: Figure out how to get the magic string for the workspace context. + this.consumeContext>>( + 'umbWorkspaceContext', + (instance) => { + this._workspaceContext = instance; + this._observeWorkspace(); + } + ); } private async _observeWorkspace() { @@ -68,7 +72,6 @@ export class UmbVariantSelectorElement extends UmbLitElement { }); } - // TODO. find a way where we don't have to do this for all workspaces. private _handleInput(event: UUIInputEvent) { if (event instanceof UUIInputEvent) { @@ -95,31 +98,35 @@ export class UmbVariantSelectorElement extends UmbLitElement { return html` - ${this._content && this._content.variants?.length > 0 - ? html` -
- - English (United States) - - -
- ` - : nothing} + ${ + this._content && this._content.variants?.length > 0 + ? html` +
+ + English (United States) + + +
+ ` + : nothing + }
- ${this._content && this._content.variants?.length > 0 - ? html` - -
- -
    -
  • Implement variants
  • -
-
-
-
- ` - : nothing} + ${ + this._content && this._content.variants?.length > 0 + ? html` + +
+ +
    +
  • Implement variants
  • +
+
+
+
+ ` + : nothing + }
`; } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace-property/workspace-property.context.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace-property/workspace-property.context.ts index 37e20d25ff..4bf94b6d3c 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace-property/workspace-property.context.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace-property/workspace-property.context.ts @@ -1,19 +1,9 @@ -import { UmbWorkspaceContentContext } from "../workspace/workspace-content/workspace-content.context"; -import type { DataTypeDetails } from "@umbraco-cms/models"; -import { UmbControllerHostInterface } from "src/core/controller/controller-host.mixin"; -import { createObservablePart, UniqueBehaviorSubject } from "src/core/observable-api/unique-behavior-subject"; -import { UmbContextProviderController } from "src/core/context-api/provide/context-provider.controller"; -import { UmbContextConsumerController } from "src/core/context-api/consume/context-consumer.controller"; - - - - - - - - - - +import { UmbWorkspaceContentContext } from '../workspace/workspace-content/workspace-content.context'; +import type { DataTypeDetails } from '@umbraco-cms/models'; +import { UmbControllerHostInterface } from 'src/core/controller/controller-host.mixin'; +import { createObservablePart, UniqueBehaviorSubject } from 'src/core/observable-api/unique-behavior-subject'; +import { UmbContextProviderController } from 'src/core/context-api/provide/context-provider.controller'; +import { UmbContextConsumerController } from 'src/core/context-api/consume/context-consumer.controller'; // If we get this from the server then we can consider using TypeScripts Partial<> around the model from the Management-API. export type WorkspacePropertyData = { @@ -21,62 +11,56 @@ export type WorkspacePropertyData = { label?: string; description?: string; value?: ValueType | null; - config?: DataTypeDetails['data'];// This could potentially then come from hardcoded JS object and not the DataType store. + config?: DataTypeDetails['data']; // This could potentially then come from hardcoded JS object and not the DataType store. }; export class UmbWorkspacePropertyContext { - - private _providerController: UmbContextProviderController; private _data = new UniqueBehaviorSubject>({}); - public readonly alias = createObservablePart(this._data, data => data.alias); - public readonly label = createObservablePart(this._data, data => data.label); - public readonly description = createObservablePart(this._data, data => data.description); - public readonly value = createObservablePart(this._data, data => data.value); - public readonly config = createObservablePart(this._data, data => data.config); + public readonly alias = createObservablePart(this._data, (data) => data.alias); + public readonly label = createObservablePart(this._data, (data) => data.label); + public readonly description = createObservablePart(this._data, (data) => data.description); + public readonly value = createObservablePart(this._data, (data) => data.value); + public readonly config = createObservablePart(this._data, (data) => data.config); private _workspaceContext?: UmbWorkspaceContentContext; - - constructor(host:UmbControllerHostInterface) { - - new UmbContextConsumerController(host, 'umbWorkspaceContext', (workspaceContext) => { + constructor(host: UmbControllerHostInterface) { + // TODO: Figure out how to get the magic string in a better way. + new UmbContextConsumerController(host, 'umbWorkspaceContext', (workspaceContext) => { this._workspaceContext = workspaceContext; }); this._providerController = new UmbContextProviderController(host, 'umbPropertyContext', this); - - } public setAlias(alias: WorkspacePropertyData['alias']) { - this._data.update({alias: alias}); + this._data.update({ alias: alias }); } public setLabel(label: WorkspacePropertyData['label']) { - this._data.update({label: label}); + this._data.update({ label: label }); } public setDescription(description: WorkspacePropertyData['description']) { - this._data.update({description: description}); + this._data.update({ description: description }); } public setValue(value: WorkspacePropertyData['value']) { - // Note: Do not try to compare new / old value, as it can of any type. We trust the UniqueBehaviorSubject in doing such. - this._data.update({value: value}); + this._data.update({ value: value }); const alias = this._data.getValue().alias; - if(alias) { + if (alias) { this._workspaceContext?.setPropertyValue(alias, value); } } public setConfig(config: WorkspacePropertyData['config']) { - this._data.update({config: config}); + this._data.update({ config: config }); } public resetValue() { - this.setValue(null);// TODO: Consider if this can be configured/provided from Property Editor or DataType Configuration or even locally specified in DocumentType. + this.setValue(null); // TODO: Consider if this can be configured/provided from Property Editor or DataType Configuration or even locally specified in DocumentType. } // TODO: how can we make sure to call this. @@ -84,6 +68,4 @@ export class UmbWorkspacePropertyContext { this._data.unsubscribe(); this._providerController.destroy(); // This would also be handled by the controller host, but if someone wanted to replace/remove this context without the host being destroyed. Then we have clean up out selfs here. } - } - diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/actions/save/workspace-action-node-save.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/actions/save/workspace-action-node-save.element.ts index 2e22762721..733eb1d661 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/actions/save/workspace-action-node-save.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/actions/save/workspace-action-node-save.element.ts @@ -2,13 +2,12 @@ import { css, html } from 'lit'; import { customElement, state } from 'lit/decorators.js'; import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import type { UUIButtonState } from '@umbraco-ui/uui'; -import type { UmbWorkspaceContentContext } from '../../workspace-content/workspace-content.context'; +import { UmbWorkspaceContentContext } from '../../workspace-content/workspace-content.context'; import { UmbLitElement } from '@umbraco-cms/element'; import type { ManifestWorkspaceAction } from '@umbraco-cms/models'; @customElement('umb-workspace-action-node-save') export class UmbWorkspaceActionNodeSaveElement extends UmbLitElement { - static styles = [UUITextStyles, css``]; @state() @@ -21,21 +20,24 @@ export class UmbWorkspaceActionNodeSaveElement extends UmbLitElement { constructor() { super(); - this.consumeContext('umbWorkspaceContext', (instance) => { - this._workspaceContext = instance; - } - ); + // TODO: Figure out how to get the magic string for the workspace context. + this.consumeContext('umbWorkspaceContext', (instance) => { + this._workspaceContext = instance; + }); } private async _onSave() { if (!this._workspaceContext) return; this._saveButtonState = 'waiting'; - await this._workspaceContext.save().then(() => { - this._saveButtonState = 'success'; - }).catch(() => { - this._saveButtonState = 'failed'; - }) + await this._workspaceContext + .save() + .then(() => { + this._saveButtonState = 'success'; + }) + .catch(() => { + this._saveButtonState = 'failed'; + }); } render() { diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-content/views/collection/workspace-view-collection.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-content/views/collection/workspace-view-collection.element.ts index 3ea12bc01c..882dc1bdf9 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-content/views/collection/workspace-view-collection.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-content/views/collection/workspace-view-collection.element.ts @@ -2,8 +2,11 @@ import { css, html } from 'lit'; import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import { customElement } from 'lit/decorators.js'; import { ifDefined } from 'lit-html/directives/if-defined.js'; -import type { UmbWorkspaceContentContext } from '../../workspace-content.context'; -import { UmbCollectionContext } from 'src/backoffice/shared/collection/collection.context'; +import { UmbWorkspaceContentContext } from '../../workspace-content.context'; +import { + UmbCollectionContext, + UMB_COLLECTION_CONTEXT_TOKEN, +} from 'src/backoffice/shared/collection/collection.context'; import { UmbMediaStore, UmbMediaStoreItemType } from 'src/backoffice/media/media/media.store'; import '../../../../../../shared/components/content-property/content-property.element'; @@ -29,7 +32,8 @@ export class UmbWorkspaceViewCollectionElement extends UmbLitElement { constructor() { super(); - this.consumeContext('umbWorkspaceContext', (nodeContext) => { + // TODO: Figure out how to get the magic string for the workspace context. + this.consumeContext('umbWorkspaceContext', (nodeContext) => { this._workspaceContext = nodeContext; this._provideWorkspace(); }); @@ -42,7 +46,7 @@ export class UmbWorkspaceViewCollectionElement extends UmbLitElement { this._workspaceContext.entityKey, this._workspaceContext.getStore()?.storeAlias || '' // The store is available when the context is available. ); - this.provideContext('umbCollectionContext', this._collectionContext); + this.provideContext(UMB_COLLECTION_CONTEXT_TOKEN, this._collectionContext); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-content/views/edit/workspace-view-content-edit.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-content/views/edit/workspace-view-content-edit.element.ts index e004fa983a..d10cf56215 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-content/views/edit/workspace-view-content-edit.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-content/views/edit/workspace-view-content-edit.element.ts @@ -3,7 +3,7 @@ import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import { customElement, state } from 'lit/decorators.js'; import { distinctUntilChanged } from 'rxjs'; import { repeat } from 'lit/directives/repeat.js'; -import type { UmbWorkspaceContentContext } from '../../workspace-content.context'; +import { UmbWorkspaceContentContext } from '../../workspace-content.context'; import type { ContentProperty, ContentPropertyData, DocumentDetails, MediaDetails } from '@umbraco-cms/models'; import '../../../../content-property/content-property.element'; @@ -32,10 +32,14 @@ export class UmbWorkspaceViewContentEditElement extends UmbLitElement { constructor() { super(); - this.consumeContext('umbWorkspaceContext', (workspaceContext) => { - this._workspaceContext = workspaceContext; - this._observeContent(); - }); + // TODO: Figure out how to get the magic string for the workspace context. + this.consumeContext>( + 'umbWorkspaceContext', + (workspaceContext) => { + this._workspaceContext = workspaceContext; + this._observeContent(); + } + ); } private _observeContent() { @@ -43,22 +47,19 @@ export class UmbWorkspaceViewContentEditElement extends UmbLitElement { /* TODO: Property-Context: This observer gets all changes, We need to fix this. it should be simpler. - It should look at length and aliases? as long as they are identical nothing should change. + It should look at length and aliases? as long as they are identical nothing should change. As they would update them selfs? Should use a Observable for this._workspaceContext.properties */ - this.observe( - this._workspaceContext.data.pipe(distinctUntilChanged()), - (content) => { - this._properties = content.properties; - this._data = content.data; - /* + this.observe(this._workspaceContext.data.pipe(distinctUntilChanged()), (content) => { + this._properties = content.properties; + this._data = content.data; + /* Maybe we should not give the value, but the umb-content-property should get the context and observe its own data. This would become a more specific Observer therefor better performance?.. Note to self: Debate with Mads how he sees this perspective. */ - } - ); + }); } render() { @@ -67,11 +68,10 @@ export class UmbWorkspaceViewContentEditElement extends UmbLitElement { ${repeat( this._properties, (property) => property.alias, - (property) => + (property) => html` data.alias === property.alias)?.value}> - ` + .value=${this._data.find((data) => data.alias === property.alias)?.value}> ` )} `; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-content/views/info/workspace-view-content-info.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-content/views/info/workspace-view-content-info.element.ts index 56fd69160c..ae148d8937 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-content/views/info/workspace-view-content-info.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-content/views/info/workspace-view-content-info.element.ts @@ -11,10 +11,10 @@ export class UmbWorkspaceViewContentInfoElement extends UmbLitElement { UUITextStyles, css` :host { - display:block; + display: block; margin: var(--uui-size-layout-1); } - ` + `, ]; @state() @@ -25,13 +25,16 @@ export class UmbWorkspaceViewContentInfoElement extends UmbLitElement { constructor() { super(); - this.consumeContext('umbWorkspaceContext', (nodeContext) => { - this._workspaceContext = nodeContext; - this._observeContent(); - }); + // TODO: Figure out how to get the magic string for the workspace context. + this.consumeContext>( + 'umbWorkspaceContext', + (nodeContext) => { + this._workspaceContext = nodeContext; + this._observeContent(); + } + ); } - private _observeContent() { if (!this._workspaceContext) return; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-content/workspace-content.context.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-content/workspace-content.context.ts index 8acc609eb3..0cbcdd4ba4 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-content/workspace-content.context.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-content/workspace-content.context.ts @@ -1,5 +1,5 @@ import { v4 as uuidv4 } from 'uuid'; -import { UmbNotificationService } from '../../../../../core/notification'; +import { UmbNotificationService, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '../../../../../core/notification'; import { UmbNotificationDefaultData } from '../../../../../core/notification/layouts/default'; import { UmbNodeStoreBase } from '@umbraco-cms/stores/store'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; @@ -13,7 +13,6 @@ export abstract class UmbWorkspaceContentContext< ContentTypeType extends EntityTreeItem = EntityTreeItem, StoreType extends UmbNodeStoreBase = UmbNodeStoreBase > { - protected _host: UmbControllerHostInterface; // TODO: figure out how fine grained we want to make our observables. @@ -24,7 +23,7 @@ export abstract class UmbWorkspaceContentContext< protected _notificationService?: UmbNotificationService; - protected _store: StoreType|null = null; + protected _store: StoreType | null = null; protected _storeSubscription?: UmbObserverController; #isNew = true; @@ -32,29 +31,18 @@ export abstract class UmbWorkspaceContentContext< public entityKey?: string; public entityType: string; - constructor( - host: UmbControllerHostInterface, - defaultData: ContentTypeType, - storeAlias: string, - entityType: string - ) { - + constructor(host: UmbControllerHostInterface, defaultData: ContentTypeType, storeAlias: string, entityType: string) { this._host = host; this._data = new UniqueBehaviorSubject(defaultData); this.data = this._data.asObservable(); - this.name = createObservablePart(this._data, data => data.name); - + this.name = createObservablePart(this._data, (data) => data.name); this.entityType = entityType; - new UmbContextConsumerController( - host, - 'umbNotificationService', - (_instance: UmbNotificationService) => { - this._notificationService = _instance; - } - ); + new UmbContextConsumerController(host, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN, (_instance) => { + this._notificationService = _instance; + }); new UmbContextConsumerController(host, storeAlias, (_instance: StoreType) => { this._store = _instance; @@ -69,7 +57,6 @@ export abstract class UmbWorkspaceContentContext< }); } - public getData() { return this._data.getValue(); } @@ -86,21 +73,24 @@ export abstract class UmbWorkspaceContentContext< create(parentKey: string | null) { this.#isNew = true; this.entityKey = uuidv4(); - console.log("I'm new, and I will be created under ", parentKey) + console.log("I'm new, and I will be created under ", parentKey); } protected _observeStore(): void { - if(!this._store || !this.entityKey) { + if (!this._store || !this.entityKey) { return; } - if(!this.#isNew) { + if (!this.#isNew) { this._storeSubscription?.destroy(); - this._storeSubscription = new UmbObserverController(this._host, this._store.getByKey(this.entityKey), - (content) => { - if (!content) return; // TODO: Handle nicely if there is no content data. - this.update(content as any); - }); + this._storeSubscription = new UmbObserverController( + this._host, + this._store.getByKey(this.entityKey), + (content) => { + if (!content) return; // TODO: Handle nicely if there is no content data. + this.update(content as any); + } + ); } } @@ -108,17 +98,17 @@ export abstract class UmbWorkspaceContentContext< return this._store; } - abstract setPropertyValue(alias: string, value: unknown):void; - + abstract setPropertyValue(alias: string, value: unknown): void; // TODO: consider turning this into an abstract so each context implement this them selfs. public save(): Promise { - if(!this._store) { + if (!this._store) { // TODO: more beautiful error: - console.error("Could not save cause workspace context has no store."); + console.error('Could not save cause workspace context has no store.'); return Promise.resolve(); } - return this._store.save([this.getData()]) + return this._store + .save([this.getData()]) .then(() => { const data: UmbNotificationDefaultData = { message: 'Document Saved' }; this._notificationService?.peek('positive', { data }); @@ -129,8 +119,6 @@ export abstract class UmbWorkspaceContentContext< }); } - - // TODO: how can we make sure to call this. public destroy(): void { this._data.unsubscribe(); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-layout/workspace-layout.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-layout/workspace-layout.element.ts index 59ca7e8672..72917fb40d 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-layout/workspace-layout.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-layout/workspace-layout.element.ts @@ -46,6 +46,7 @@ export class UmbWorkspaceLayout extends UmbLitElement { } router-slot { height: 100%; + flex:0; } umb-extension-slot[slot='actions'] { diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-actions/copy/property-action-copy.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-actions/copy/property-action-copy.element.ts index 6182985fa7..4c0901e9bd 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-actions/copy/property-action-copy.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-actions/copy/property-action-copy.element.ts @@ -1,13 +1,12 @@ import { html } from 'lit'; import { customElement, property } from 'lit/decorators.js'; import type { UmbNotificationDefaultData } from '../../../../core/notification/layouts/default'; -import type { UmbNotificationService } from '../../../../core/notification'; +import { UmbNotificationService, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '../../../../core/notification'; import type { UmbPropertyAction } from '../shared/property-action/property-action.model'; import { UmbLitElement } from '@umbraco-cms/element'; @customElement('umb-property-action-copy') export class UmbPropertyActionCopyElement extends UmbLitElement implements UmbPropertyAction { - @property() value = ''; @@ -21,7 +20,7 @@ export class UmbPropertyActionCopyElement extends UmbLitElement implements UmbPr console.log('PROPERTY', property); }); - this.consumeContext('umbNotificationService', (notificationService: UmbNotificationService) => { + this.consumeContext(UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN, (notificationService) => { this._notificationService = notificationService; }); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/icon-picker/property-editor-ui-icon-picker.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/icon-picker/property-editor-ui-icon-picker.element.ts index 2fb03c08e8..32cc9d951d 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/icon-picker/property-editor-ui-icon-picker.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/icon-picker/property-editor-ui-icon-picker.element.ts @@ -1,7 +1,7 @@ import { html } from 'lit'; import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import { customElement, property } from 'lit/decorators.js'; -import type { UmbModalService } from 'src/core/modal'; +import { UmbModalService, UMB_MODAL_SERVICE_CONTEXT_TOKEN } from '../../../../../core/modal'; import { UmbLitElement } from '@umbraco-cms/element'; /** @@ -21,7 +21,7 @@ export class UmbPropertyEditorUIIconPickerElement extends UmbLitElement { constructor() { super(); - this.consumeContext('umbModalService', (modalService: UmbModalService) => { + this.consumeContext(UMB_MODAL_SERVICE_CONTEXT_TOKEN, (modalService) => { this._modalService = modalService; }); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/dictionary.store.ts b/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/dictionary.store.ts index 6b056b7c07..0fcf2c3fe5 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/dictionary.store.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/dictionary.store.ts @@ -2,6 +2,9 @@ import { map, Observable } from 'rxjs'; import { UmbDataStoreBase } from '../../../core/stores/store'; import { DictionaryResource, EntityTreeItem } from '@umbraco-cms/backend-api'; import { tryExecuteAndNotify } from '@umbraco-cms/resources'; +import { UmbContextToken } from '@umbraco-cms/context-api'; + +export const STORE_ALIAS = 'UmbDictionaryStore'; /** * @export @@ -10,7 +13,7 @@ import { tryExecuteAndNotify } from '@umbraco-cms/resources'; * @description - Data Store for Dictionary Items. */ export class UmbDictionaryStore extends UmbDataStoreBase { - public readonly storeAlias = 'umbDictionaryStore'; + public readonly storeAlias = STORE_ALIAS; /** * @description - Get the root of the tree. @@ -48,3 +51,5 @@ export class UmbDictionaryStore extends UmbDataStoreBase { return this.items.pipe(map((items) => items.filter((item) => item.parentKey === key))); } } + +export const UMB_DICTIONARY_STORE_CONTEXT_TOKEN = new UmbContextToken(STORE_ALIAS); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/tree/manifests.ts b/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/tree/manifests.ts index 398b5bb5b0..f399178b43 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/tree/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/tree/manifests.ts @@ -1,3 +1,4 @@ +import { STORE_ALIAS } from '../dictionary.store'; import type { ManifestTree, ManifestTreeItemAction } from '@umbraco-cms/models'; const treeAlias = 'Umb.Tree.Dictionary'; @@ -7,7 +8,7 @@ const tree: ManifestTree = { alias: treeAlias, name: 'Dictionary Tree', meta: { - storeAlias: 'umbDictionaryStore', + storeAlias: STORE_ALIAS, }, }; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/users/current-user/current-user-header-app.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/users/current-user/current-user-header-app.element.ts index 2cbc66df2c..66f587fe86 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/users/current-user/current-user-header-app.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/users/current-user/current-user-header-app.element.ts @@ -1,9 +1,9 @@ import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import { css, CSSResultGroup, html } from 'lit'; import { customElement, state } from 'lit/decorators.js'; -import { UmbCurrentUserStore } from './current-user.store'; +import { UmbCurrentUserStore, UMB_CURRENT_USER_STORE_CONTEXT_TOKEN } from './current-user.store'; import type { UserDetails } from '@umbraco-cms/models'; -import { UmbModalService } from 'src/core/modal'; +import { UmbModalService, UMB_MODAL_SERVICE_CONTEXT_TOKEN } from 'src/core/modal'; import { UmbLitElement } from '@umbraco-cms/element'; @customElement('umb-current-user-header-app') @@ -25,9 +25,13 @@ export class UmbCurrentUserHeaderApp extends UmbLitElement { constructor() { super(); - this.consumeAllContexts(['umbCurrentUserStore', 'umbModalService'], (instances) => { - this._currentUserStore = instances['umbCurrentUserStore']; - this._modalService = instances['umbModalService']; + + this.consumeContext(UMB_MODAL_SERVICE_CONTEXT_TOKEN, (_instance) => { + this._modalService = _instance; + }); + + this.consumeContext(UMB_CURRENT_USER_STORE_CONTEXT_TOKEN, (_instance) => { + this._currentUserStore = _instance; this._observeCurrentUser(); }); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/users/current-user/current-user-history.store.ts b/src/Umbraco.Web.UI.Client/src/backoffice/users/current-user/current-user-history.store.ts index 76f6651277..6044e059f1 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/users/current-user/current-user-history.store.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/users/current-user/current-user-history.store.ts @@ -1,3 +1,4 @@ +import { UmbContextToken } from '@umbraco-cms/context-api'; import { createObservablePart, UniqueBehaviorSubject } from '@umbraco-cms/observable-api'; export type UmbModelType = 'dialog' | 'sidebar'; @@ -9,14 +10,10 @@ export type UmbCurrentUserHistoryItem = { }; export class UmbCurrentUserHistoryStore { - - #history = new UniqueBehaviorSubject( - >[] - ); + #history = new UniqueBehaviorSubject(>[]); public readonly history = this.#history.asObservable(); - public readonly latestHistory = createObservablePart(this.#history, historyItems => historyItems.slice(-10)); - + public readonly latestHistory = createObservablePart(this.#history, (historyItems) => historyItems.slice(-10)); constructor() { if (!('navigation' in window)) return; @@ -52,3 +49,7 @@ export class UmbCurrentUserHistoryStore { this.#history.next([]); } } + +export const UMB_CURRENT_USER_HISTORY_STORE_CONTEXT_TOKEN = new UmbContextToken( + UmbCurrentUserHistoryStore.name +); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/users/current-user/current-user.store.ts b/src/Umbraco.Web.UI.Client/src/backoffice/users/current-user/current-user.store.ts index 8acd9daea9..d3d60997cd 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/users/current-user/current-user.store.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/users/current-user/current-user.store.ts @@ -2,6 +2,7 @@ import { BehaviorSubject, Observable } from 'rxjs'; import { umbUsersData } from '../../../core/mocks/data/users.data'; import type { UserDetails } from '@umbraco-cms/models'; import { umbracoPath } from '@umbraco-cms/utils'; +import { UmbContextToken } from '@umbraco-cms/context-api'; export class UmbCurrentUserStore { private _currentUser = new BehaviorSubject(umbUsersData.getAll()[0]); //TODO: Temp solution to set the first user as the current logged in user @@ -26,3 +27,5 @@ export class UmbCurrentUserStore { return this._currentUser.getValue()?.userGroups.includes(adminUserGroupKey); } } + +export const UMB_CURRENT_USER_STORE_CONTEXT_TOKEN = new UmbContextToken(UmbCurrentUserStore.name); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-groups/user-group.store.ts b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-groups/user-group.store.ts index 32eb707031..ebf7d6af87 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-groups/user-group.store.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-groups/user-group.store.ts @@ -1,10 +1,13 @@ import { map, Observable } from 'rxjs'; import { UmbDataStoreBase } from '../../../core/stores/store'; import type { UserGroupDetails, UserGroupEntity } from '@umbraco-cms/models'; +import { UmbContextToken } from '@umbraco-cms/context-api'; // TODO: get rid of this type addition & { ... }: export type UmbUserGroupStoreItemType = UserGroupDetails & { users?: Array }; +export const STORE_ALIAS = 'UmbUserGroupStore'; + /** * @export * @class UmbUserGroupStore @@ -12,7 +15,7 @@ export type UmbUserGroupStoreItemType = UserGroupDetails & { users?: Array { - public readonly storeAlias = 'umbUserGroupStore'; + public readonly storeAlias = STORE_ALIAS; getAll(): Observable> { // TODO: use Fetcher API. @@ -83,3 +86,5 @@ export class UmbUserGroupStore extends UmbDataStoreBase(STORE_ALIAS); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-groups/workspace/actions/workspace-action-user-group-save.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-groups/workspace/actions/workspace-action-user-group-save.element.ts index 6aa5d8f09a..3977037d08 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-groups/workspace/actions/workspace-action-user-group-save.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-groups/workspace/actions/workspace-action-user-group-save.element.ts @@ -2,7 +2,7 @@ import { css, html } from 'lit'; import { customElement, state } from 'lit/decorators.js'; import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import type { UUIButtonState } from '@umbraco-ui/uui'; -import type { UmbWorkspaceUserContext } from '../../../users/workspace/user-workspace.context'; +import { UmbWorkspaceUserContext } from '../../../users/workspace/user-workspace.context'; import { UmbLitElement } from '@umbraco-cms/element'; @customElement('umb-workspace-action-user-group-save') @@ -17,7 +17,8 @@ export class UmbWorkspaceActionUserGroupSaveElement extends UmbLitElement { constructor() { super(); - this.consumeContext('umbWorkspaceContext', (instance) => { + // TODO: Figure out how to get the magic string for the workspace context. + this.consumeContext('umbWorkspaceContext', (instance) => { this._workspaceContext = instance; }); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-groups/workspace/user-group-workspace.context.ts b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-groups/workspace/user-group-workspace.context.ts index 863df3b4ae..a7168973a9 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-groups/workspace/user-group-workspace.context.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-groups/workspace/user-group-workspace.context.ts @@ -1,4 +1,5 @@ import { UmbWorkspaceContentContext } from '../../../shared/components/workspace/workspace-content/workspace-content.context'; +import { UMB_USER_STORE_CONTEXT_TOKEN } from '../../users/user.store'; import type { UmbUserGroupStore, UmbUserGroupStoreItemType } from 'src/backoffice/users/user-groups/user-group.store'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; @@ -19,11 +20,10 @@ export class UmbWorkspaceUserGroupContext extends UmbWorkspaceContentContext< UmbUserGroupStore > { constructor(host: UmbControllerHostInterface) { - super(host, DefaultDataTypeData, 'umbUserStore', 'userGroup'); + super(host, DefaultDataTypeData, UMB_USER_STORE_CONTEXT_TOKEN.toString(), 'userGroup'); } - public setPropertyValue(alias: string, value: unknown) { - throw new Error("setPropertyValue is not implemented for UmbWorkspaceUserGroupContext") + throw new Error('setPropertyValue is not implemented for UmbWorkspaceUserGroupContext'); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-groups/workspace/user-group-workspace.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-groups/workspace/user-group-workspace.element.ts index 028738c485..0d3633cc10 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-groups/workspace/user-group-workspace.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-groups/workspace/user-group-workspace.element.ts @@ -7,7 +7,7 @@ import { distinctUntilChanged } from 'rxjs'; import { UmbWorkspaceUserGroupContext } from './user-group-workspace.context'; import type { ManifestWorkspaceAction, UserGroupDetails } from '@umbraco-cms/models'; import { umbExtensionsRegistry } from '@umbraco-cms/extensions-registry'; -import type { UmbUserStore } from 'src/backoffice/users/users/user.store'; +import { UmbUserStore, UMB_USER_STORE_CONTEXT_TOKEN } from 'src/backoffice/users/users/user.store'; import '../../../../auth/components/input-user/input-user.element'; import '../../../../backoffice/shared/components/input-section/input-section.element'; @@ -16,7 +16,6 @@ import { UmbWorkspaceEntityElement } from 'src/backoffice/shared/components/work @customElement('umb-user-group-workspace') export class UmbUserGroupWorkspaceElement extends UmbLitElement implements UmbWorkspaceEntityElement { - static styles = [ UUITextStyles, css` @@ -217,7 +216,7 @@ export class UmbUserGroupWorkspaceElement extends UmbLitElement implements UmbWo this._registerWorkspaceActions(); - this.consumeContext('umbUserStore', (instance) => { + this.consumeContext(UMB_USER_STORE_CONTEXT_TOKEN, (instance) => { this._userStore = instance; this._observeUsers(); }); @@ -233,8 +232,7 @@ export class UmbUserGroupWorkspaceElement extends UmbLitElement implements UmbWo type: 'workspaceAction', alias: 'Umb.WorkspaceAction.UserGroup.Save', name: 'Save User Group Workspace Action', - loader: () => - import('../../../shared/components/workspace/actions/save/workspace-action-node-save.element'), + loader: () => import('../../../shared/components/workspace/actions/save/workspace-action-node-save.element'), meta: { workspaces: ['Umb.Workspace.UserGroup'], look: 'primary', diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/user-groups/workspace-view-user-groups.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/user-groups/workspace-view-user-groups.element.ts index 7fc29ade07..9d3f8ac467 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/user-groups/workspace-view-user-groups.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/user-groups/workspace-view-user-groups.element.ts @@ -14,7 +14,10 @@ import type { UserGroupDetails } from '@umbraco-cms/models'; import './user-group-table-name-column-layout.element'; import './user-group-table-sections-column-layout.element'; -import { UmbUserGroupStore } from 'src/backoffice/users/user-groups/user-group.store'; +import { + UmbUserGroupStore, + UMB_USER_GROUP_STORE_CONTEXT_TOKEN, +} from 'src/backoffice/users/user-groups/user-group.store'; import { UmbLitElement } from '@umbraco-cms/element'; @customElement('umb-workspace-view-user-groups') @@ -71,7 +74,7 @@ export class UmbWorkspaceViewUserGroupsElement extends UmbLitElement { connectedCallback(): void { super.connectedCallback(); - this.consumeContext('umbUserGroupStore', (userGroupStore: UmbUserGroupStore) => { + this.consumeContext(UMB_USER_GROUP_STORE_CONTEXT_TOKEN, (userGroupStore) => { this._userGroupStore = userGroupStore; this._observeUserGroups(); }); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/list-view-layouts/grid/workspace-view-users-grid.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/list-view-layouts/grid/workspace-view-users-grid.element.ts index 3bbe72aadc..45f52c2d8b 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/list-view-layouts/grid/workspace-view-users-grid.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/list-view-layouts/grid/workspace-view-users-grid.element.ts @@ -5,8 +5,8 @@ import { repeat } from 'lit/directives/repeat.js'; import { ifDefined } from 'lit-html/directives/if-defined.js'; import type { UmbSectionViewUsersElement } from '../../section-view-users.element'; import { getTagLookAndColor } from '../../../../../../../auth/utils'; -import type { UserDetails, UserEntity, UserGroupDetails, UserGroupEntity } from '@umbraco-cms/models'; -import { UmbUserGroupStore } from 'src/backoffice/users/user-groups/user-group.store'; +import { UmbUserGroupStore, UMB_USER_GROUP_STORE_CONTEXT_TOKEN } from '../../../../../user-groups/user-group.store'; +import type { UserDetails, UserEntity, UserGroupEntity } from '@umbraco-cms/models'; import { UmbLitElement } from '@umbraco-cms/element'; @customElement('umb-workspace-view-users-grid') @@ -54,11 +54,14 @@ export class UmbWorkspaceViewUsersGridElement extends UmbLitElement { constructor() { super(); - this.consumeAllContexts(['umbUserGroupStore', 'umbUsersContext'], (instances) => { - this._userGroupStore = instances['umbUserGroupStore']; - this._usersContext = instances['umbUsersContext']; - this._observeUsers(); + this.consumeContext(UMB_USER_GROUP_STORE_CONTEXT_TOKEN, (instance) => { + this._userGroupStore = instance; this._observeUserGroups(); + }); + + this.consumeContext('umbUsersContext', (_instance) => { + this._usersContext = _instance; + this._observeUsers(); this._observeSelection(); }); } @@ -72,10 +75,7 @@ export class UmbWorkspaceViewUsersGridElement extends UmbLitElement { private _observeUserGroups() { if (!this._userGroupStore) return; - this.observe( - this._userGroupStore.getAll(), - (userGroups) => (this._userGroups = userGroups) - ); + this.observe(this._userGroupStore.getAll(), (userGroups) => (this._userGroups = userGroups)); } private _observeSelection() { diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/list-view-layouts/table/workspace-view-users-table.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/list-view-layouts/table/workspace-view-users-table.element.ts index b1529a7035..bcd3ae99fd 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/list-view-layouts/table/workspace-view-users-table.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/list-view-layouts/table/workspace-view-users-table.element.ts @@ -15,7 +15,10 @@ import type { UserDetails, UserGroupEntity } from '@umbraco-cms/models'; import './column-layouts/name/user-table-name-column-layout.element'; import './column-layouts/status/user-table-status-column-layout.element'; -import { UmbUserGroupStore } from 'src/backoffice/users/user-groups/user-group.store'; +import { + UmbUserGroupStore, + UMB_USER_GROUP_STORE_CONTEXT_TOKEN, +} from 'src/backoffice/users/user-groups/user-group.store'; import { UmbLitElement } from '@umbraco-cms/element'; @customElement('umb-workspace-view-users-table') @@ -76,11 +79,14 @@ export class UmbWorkspaceViewUsersTableElement extends UmbLitElement { constructor() { super(); - this.consumeAllContexts(['umbUserGroupStore', 'umbUsersContext'], (instances) => { - this._userGroupStore = instances['umbUserGroupStore']; - this._usersContext = instances['umbUsersContext']; - this._observeUsers(); + this.consumeContext(UMB_USER_GROUP_STORE_CONTEXT_TOKEN, (instance) => { + this._userGroupStore = instance; this._observeUserGroups(); + }); + + this.consumeContext('umbUsersContext', (_instance) => { + this._usersContext = _instance; + this._observeUsers(); this._observeSelection(); }); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/section-view-users.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/section-view-users.element.ts index 56b5bd1a62..01eaac240a 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/section-view-users.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/section-view-users.element.ts @@ -9,7 +9,7 @@ import './list-view-layouts/grid/workspace-view-users-grid.element'; import './workspace-view-users-selection.element'; import './workspace-view-users-invite.element'; import type { ManifestWorkspace, UserDetails } from '@umbraco-cms/models'; -import { UmbUserStore } from 'src/backoffice/users/users/user.store'; +import { UmbUserStore, UMB_USER_STORE_CONTEXT_TOKEN } from 'src/backoffice/users/users/user.store'; import { createExtensionElement } from '@umbraco-cms/extensions-api'; import { UmbLitElement } from '@umbraco-cms/element'; import { UniqueBehaviorSubject } from '@umbraco-cms/observable-api'; @@ -30,7 +30,6 @@ export class UmbSectionViewUsersElement extends UmbLitElement { private _workspaces: Array = []; - // TODO: This must be turned into context api: Maybe its a Collection View (SectionView Collection View)? private _userStore?: UmbUserStore; @@ -43,14 +42,14 @@ export class UmbSectionViewUsersElement extends UmbLitElement { #search = new UniqueBehaviorSubject(''); public readonly search = this.#search.asObservable(); - constructor() { super(); - this.consumeAllContexts(['umbUserStore', 'umbUserGroupStore', 'umbUsersContext'], (instances) => { - this._userStore = instances['umbUserStore']; + this.consumeContext(UMB_USER_STORE_CONTEXT_TOKEN, (_instance) => { + this._userStore = _instance; this._observeUsers(); }); + // TODO: consider this context name, is it to broad? // TODO: Stop using it self as a context api. this.provideContext('umbUsersContext', this); @@ -97,9 +96,7 @@ export class UmbSectionViewUsersElement extends UmbLitElement { if (!this._userStore) return; if (this.#search.getValue()) { - this.observe(this._userStore.getByName(this.#search.getValue()), (users) => - this.#users.next(users) - ); + this.observe(this._userStore.getByName(this.#search.getValue()), (users) => this.#users.next(users)); } else { this.observe(this._userStore.getAll(), (users) => this.#users.next(users)); } @@ -119,7 +116,7 @@ export class UmbSectionViewUsersElement extends UmbLitElement { public select(key: string) { const oldSelection = this.#selection.getValue(); - if(oldSelection.indexOf(key) !== -1) return; + if (oldSelection.indexOf(key) !== -1) return; this.#selection.next([...oldSelection, key]); this.requestUpdate('selection'); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/workspace-view-users-create.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/workspace-view-users-create.element.ts index 173df0fc7a..38917f60a7 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/workspace-view-users-create.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/workspace-view-users-create.element.ts @@ -4,10 +4,10 @@ import { customElement, query, state } from 'lit/decorators.js'; import { UUIInputPasswordElement } from '@umbraco-ui/uui'; import { UmbInputPickerUserGroupElement } from 'src/auth/components/input-user-group/input-user-group.element'; import type { UserDetails } from '@umbraco-cms/models'; -import { UmbNotificationService } from 'src/core/notification'; +import { UmbNotificationService, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from 'src/core/notification'; import { UmbNotificationDefaultData } from 'src/core/notification/layouts/default'; import { UmbModalLayoutElement } from 'src/core/modal'; -import { UmbUserStore } from 'src/backoffice/users/users/user.store'; +import { UmbUserStore, UMB_USER_STORE_CONTEXT_TOKEN } from 'src/backoffice/users/users/user.store'; export type UsersViewType = 'list' | 'grid'; @customElement('umb-workspace-view-users-create') @@ -63,9 +63,12 @@ export class UmbWorkspaceViewUsersCreateElement extends UmbModalLayoutElement { connectedCallback(): void { super.connectedCallback(); - this.consumeAllContexts(['umbUserStore', 'umbNotificationService'], (instances) => { - this._userStore = instances['umbUserStore']; - this._notificationService = instances['umbNotificationService']; + this.consumeContext(UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN, (_instance) => { + this._notificationService = _instance; + }); + + this.consumeContext(UMB_USER_STORE_CONTEXT_TOKEN, (_instance) => { + this._userStore = _instance; }); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/workspace-view-users-invite.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/workspace-view-users-invite.element.ts index 5c64294fec..4a7ac4465b 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/workspace-view-users-invite.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/workspace-view-users-invite.element.ts @@ -4,7 +4,7 @@ import { customElement, query, state } from 'lit/decorators.js'; import { UmbInputPickerUserGroupElement } from 'src/auth/components/input-user-group/input-user-group.element'; import type { UserDetails } from '@umbraco-cms/models'; import { UmbModalLayoutElement } from 'src/core/modal'; -import { UmbUserStore } from 'src/backoffice/users/users/user.store'; +import { UmbUserStore, UMB_USER_STORE_CONTEXT_TOKEN } from 'src/backoffice/users/users/user.store'; export type UsersViewType = 'list' | 'grid'; @customElement('umb-workspace-view-users-invite') @@ -58,7 +58,7 @@ export class UmbWorkspaceViewUsersInviteElement extends UmbModalLayoutElement { connectedCallback(): void { super.connectedCallback(); - this.consumeContext('umbUserStore', (usersContext: UmbUserStore) => { + this.consumeContext(UMB_USER_STORE_CONTEXT_TOKEN, (usersContext) => { this._userStore = usersContext; }); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/workspace-view-users-overview.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/workspace-view-users-overview.element.ts index cfc5518a70..1cf7e2456e 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/workspace-view-users-overview.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/workspace-view-users-overview.element.ts @@ -5,8 +5,8 @@ import { IRoute } from 'router-slot'; import { UUIPopoverElement } from '@umbraco-ui/uui'; import type { UmbSectionViewUsersElement } from './section-view-users.element'; -import { UmbLitElement } from '@umbraco-cms/element'; -import { UmbModalService } from 'src/core/modal'; +import { UmbLitElement } from '@umbraco-cms/element'; +import { UmbModalService, UMB_MODAL_SERVICE_CONTEXT_TOKEN } from 'src/core/modal'; import './list-view-layouts/table/workspace-view-users-table.element'; import './list-view-layouts/grid/workspace-view-users-grid.element'; @@ -114,7 +114,7 @@ export class UmbWorkspaceViewUsersOverviewElement extends UmbLitElement { this._observeSelection(); }); - this.consumeContext('umbModalService', (modalService: UmbModalService) => { + this.consumeContext(UMB_MODAL_SERVICE_CONTEXT_TOKEN, (modalService) => { this._modalService = modalService; }); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/workspace-view-users-selection.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/workspace-view-users-selection.element.ts index 3338fc6984..9de0d77569 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/workspace-view-users-selection.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/workspace-view-users-selection.element.ts @@ -2,7 +2,7 @@ import { css, html } from 'lit'; import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import { customElement, state } from 'lit/decorators.js'; import { UmbSectionViewUsersElement } from './section-view-users.element'; -import { UmbUserStore } from 'src/backoffice/users/users/user.store'; +import { UmbUserStore, UMB_USER_STORE_CONTEXT_TOKEN } from 'src/backoffice/users/users/user.store'; import { UmbLitElement } from '@umbraco-cms/element'; @customElement('umb-workspace-view-users-selection') @@ -39,7 +39,7 @@ export class UmbWorkspaceViewUsersSelectionElement extends UmbLitElement { this._observeSelection(); }); - this.consumeContext('umbUserStore', (userStore: UmbUserStore) => { + this.consumeContext(UMB_USER_STORE_CONTEXT_TOKEN, (userStore) => { this._userStore = userStore; this._observeTotalUsers(); }); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/users/users/user.store.ts b/src/Umbraco.Web.UI.Client/src/backoffice/users/users/user.store.ts index cc50de40fa..7399a86e63 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/users/users/user.store.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/users/users/user.store.ts @@ -2,9 +2,12 @@ import { map, Observable } from 'rxjs'; import { UmbDataStoreBase } from '../../../core/stores/store'; import type { UserDetails } from '@umbraco-cms/models'; import { UniqueBehaviorSubject } from '@umbraco-cms/observable-api'; +import { UmbContextToken } from '@umbraco-cms/context-api'; export type UmbUserStoreItemType = UserDetails; +export const STORE_ALIAS = 'UmbUserStore'; + /** * @export * @class UmbUserStore @@ -12,7 +15,7 @@ export type UmbUserStoreItemType = UserDetails; * @description - Data Store for Users */ export class UmbUserStore extends UmbDataStoreBase { - public readonly storeAlias = 'umbUserStore'; + public readonly storeAlias = STORE_ALIAS; #totalUsers = new UniqueBehaviorSubject(0); public readonly totalUsers = this.#totalUsers.asObservable(); @@ -276,3 +279,5 @@ export class UmbUserStore extends UmbDataStoreBase { // this.requestUpdate('users'); // } } + +export const UMB_USER_STORE_CONTEXT_TOKEN = new UmbContextToken(STORE_ALIAS); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/users/users/workspace/actions/workspace-action-user-save.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/users/users/workspace/actions/workspace-action-user-save.element.ts index 43370e5c02..000e11c34d 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/users/users/workspace/actions/workspace-action-user-save.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/users/users/workspace/actions/workspace-action-user-save.element.ts @@ -17,7 +17,8 @@ export class UmbWorkspaceActionUserSaveElement extends UmbLitElement { constructor() { super(); - this.consumeContext('umbWorkspaceContext', (instance) => { + // TODO: Figure out how to get the magic string for the workspace context. + this.consumeContext('umbWorkspaceContext', (instance) => { this._workspaceContext = instance; }); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/users/users/workspace/user-workspace.context.ts b/src/Umbraco.Web.UI.Client/src/backoffice/users/users/workspace/user-workspace.context.ts index bfaf92784c..772f88ed9c 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/users/users/workspace/user-workspace.context.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/users/users/workspace/user-workspace.context.ts @@ -1,5 +1,9 @@ import { UmbWorkspaceContentContext } from '../../../shared/components/workspace/workspace-content/workspace-content.context'; -import type { UmbUserStore, UmbUserStoreItemType } from 'src/backoffice/users/users/user.store'; +import { + UmbUserStore, + UmbUserStoreItemType, + UMB_USER_STORE_CONTEXT_TOKEN, +} from 'src/backoffice/users/users/user.store'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; const DefaultDataTypeData = { @@ -22,10 +26,10 @@ const DefaultDataTypeData = { export class UmbWorkspaceUserContext extends UmbWorkspaceContentContext { constructor(host: UmbControllerHostInterface) { - super(host, DefaultDataTypeData, 'umbUserStore', 'user'); + super(host, DefaultDataTypeData, UMB_USER_STORE_CONTEXT_TOKEN.toString(), 'user'); } public setPropertyValue(alias: string, value: unknown) { - throw new Error("setPropertyValue is not implemented for UmbWorkspaceUserContext") + throw new Error('setPropertyValue is not implemented for UmbWorkspaceUserContext'); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/users/users/workspace/user-workspace.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/users/users/workspace/user-workspace.element.ts index f1f670d8ca..ee0e0b5e14 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/users/users/workspace/user-workspace.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/users/users/workspace/user-workspace.element.ts @@ -8,7 +8,7 @@ import { repeat } from 'lit/directives/repeat.js'; import { distinctUntilChanged } from 'rxjs'; import { getTagLookAndColor } from '../../../../auth/utils'; -import { UmbCurrentUserStore } from '../../current-user/current-user.store'; +import { UmbCurrentUserStore, UMB_CURRENT_USER_STORE_CONTEXT_TOKEN } from '../../current-user/current-user.store'; import { UmbWorkspaceUserContext } from './user-workspace.context'; import type { UserDetails } from '@umbraco-cms/models'; @@ -117,7 +117,7 @@ export class UmbUserWorkspaceElement extends UmbLitElement implements UmbWorkspa constructor() { super(); - this.consumeContext('umbCurrentUserStore', (store) => { + this.consumeContext(UMB_CURRENT_USER_STORE_CONTEXT_TOKEN, (store) => { this._currentUserStore = store; this._observeCurrentUser(); }); diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/core/ApiError.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/core/ApiError.ts index 1dfee0af35..99d7929967 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/core/ApiError.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/core/ApiError.ts @@ -5,20 +5,20 @@ import type { ApiRequestOptions } from './ApiRequestOptions'; import type { ApiResult } from './ApiResult'; export class ApiError extends Error { - public readonly url: string; - public readonly status: number; - public readonly statusText: string; - public readonly body: any; - public readonly request: ApiRequestOptions; + public readonly url: string; + public readonly status: number; + public readonly statusText: string; + public readonly body: any; + public readonly request: ApiRequestOptions; - constructor(request: ApiRequestOptions, response: ApiResult, message: string) { - super(message); + constructor(request: ApiRequestOptions, response: ApiResult, message: string) { + super(message); - this.name = 'ApiError'; - this.url = response.url; - this.status = response.status; - this.statusText = response.statusText; - this.body = response.body; - this.request = request; - } + this.name = 'ApiError'; + this.url = response.url; + this.status = response.status; + this.statusText = response.statusText; + this.body = response.body; + this.request = request; + } } diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/index.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/index.ts index 6687aed063..7d1b97b143 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/index.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/index.ts @@ -26,6 +26,8 @@ export type { DatabaseSettings } from './models/DatabaseSettings'; export type { DataType } from './models/DataType'; export type { DataTypeCreateModel } from './models/DataTypeCreateModel'; export type { DataTypeProperty } from './models/DataTypeProperty'; +export type { DataTypePropertyReference } from './models/DataTypePropertyReference'; +export type { DataTypeReference } from './models/DataTypeReference'; export type { DataTypeUpdateModel } from './models/DataTypeUpdateModel'; export type { Dictionary } from './models/Dictionary'; export type { DictionaryImport } from './models/DictionaryImport'; @@ -44,7 +46,10 @@ export type { Field } from './models/Field'; export { FieldAttributes } from './models/FieldAttributes'; export type { FieldInfo } from './models/FieldInfo'; export type { FileSystemTreeItem } from './models/FileSystemTreeItem'; +export type { Folder } from './models/Folder'; +export type { FolderCreateModel } from './models/FolderCreateModel'; export type { FolderTreeItem } from './models/FolderTreeItem'; +export type { FolderUpdateModel } from './models/FolderUpdateModel'; export { GenericParameterAttributes } from './models/GenericParameterAttributes'; export type { HealthCheck } from './models/HealthCheck'; export type { HealthCheckAction } from './models/HealthCheckAction'; @@ -52,6 +57,7 @@ export type { HealthCheckGroup } from './models/HealthCheckGroup'; export type { HealthCheckGroupWithResult } from './models/HealthCheckGroupWithResult'; export type { HealthCheckResult } from './models/HealthCheckResult'; export type { HealthCheckWithResult } from './models/HealthCheckWithResult'; +export { HealthStatus } from './models/HealthStatus'; export type { HelpPage } from './models/HelpPage'; export type { ICustomAttributeProvider } from './models/ICustomAttributeProvider'; export type { Index } from './models/Index'; @@ -75,6 +81,7 @@ export type { ModuleHandle } from './models/ModuleHandle'; export type { NotFoundResult } from './models/NotFoundResult'; export { NotificationStyle } from './models/NotificationStyle'; export type { OkResult } from './models/OkResult'; +export { Operator } from './models/Operator'; export type { OutOfDateStatus } from './models/OutOfDateStatus'; export { OutOfDateType } from './models/OutOfDateType'; export type { PagedContentTreeItem } from './models/PagedContentTreeItem'; @@ -121,6 +128,19 @@ export { StatusResultType } from './models/StatusResultType'; export type { StructLayoutAttribute } from './models/StructLayoutAttribute'; export type { Telemetry } from './models/Telemetry'; export { TelemetryLevel } from './models/TelemetryLevel'; +export type { Template } from './models/Template'; +export type { TemplateCreateModel } from './models/TemplateCreateModel'; +export type { TemplateQueryExecuteFilterModel } from './models/TemplateQueryExecuteFilterModel'; +export type { TemplateQueryExecuteModel } from './models/TemplateQueryExecuteModel'; +export type { TemplateQueryExecuteSortModel } from './models/TemplateQueryExecuteSortModel'; +export type { TemplateQueryOperator } from './models/TemplateQueryOperator'; +export type { TemplateQueryProperty } from './models/TemplateQueryProperty'; +export { TemplateQueryPropertyType } from './models/TemplateQueryPropertyType'; +export type { TemplateQueryResult } from './models/TemplateQueryResult'; +export type { TemplateQueryResultItem } from './models/TemplateQueryResultItem'; +export type { TemplateQuerySettings } from './models/TemplateQuerySettings'; +export type { TemplateScaffold } from './models/TemplateScaffold'; +export type { TemplateUpdateModel } from './models/TemplateUpdateModel'; export type { Type } from './models/Type'; export { TypeAttributes } from './models/TypeAttributes'; export type { TypeInfo } from './models/TypeInfo'; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Assembly.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Assembly.ts index 13d126ea17..188ab7ecbe 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Assembly.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Assembly.ts @@ -10,27 +10,27 @@ import type { Type } from './Type'; import type { TypeInfo } from './TypeInfo'; export type Assembly = { - readonly definedTypes?: Array | null; - readonly exportedTypes?: Array | null; + readonly definedTypes?: Array; + readonly exportedTypes?: Array; /** * @deprecated */ readonly codeBase?: string | null; entryPoint?: MethodInfo; readonly fullName?: string | null; - readonly imageRuntimeVersion?: string | null; + readonly imageRuntimeVersion?: string; readonly isDynamic?: boolean; - readonly location?: string | null; + readonly location?: string; readonly reflectionOnly?: boolean; readonly isCollectible?: boolean; readonly isFullyTrusted?: boolean; - readonly customAttributes?: Array | null; + readonly customAttributes?: Array; /** * @deprecated */ - readonly escapedCodeBase?: string | null; + readonly escapedCodeBase?: string; manifestModule?: Module; - readonly modules?: Array | null; + readonly modules?: Array; /** * @deprecated */ diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/ConsentLevel.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/ConsentLevel.ts index 155a1b210e..d581eed573 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/ConsentLevel.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/ConsentLevel.ts @@ -6,6 +6,6 @@ import type { TelemetryLevel } from './TelemetryLevel'; export type ConsentLevel = { level?: TelemetryLevel; - description?: string | null; + description?: string; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/ConstructorInfo.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/ConstructorInfo.ts index d8fcf5ff11..bc87002c57 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/ConstructorInfo.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/ConstructorInfo.ts @@ -12,11 +12,11 @@ import type { RuntimeMethodHandle } from './RuntimeMethodHandle'; import type { Type } from './Type'; export type ConstructorInfo = { - readonly name?: string | null; + readonly name?: string; declaringType?: Type; reflectedType?: Type; module?: Module; - readonly customAttributes?: Array | null; + readonly customAttributes?: Array; readonly isCollectible?: boolean; readonly metadataToken?: number; attributes?: MethodAttributes; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/ContentTreeItem.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/ContentTreeItem.ts index 8cafbf1308..6f7ad5f2bf 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/ContentTreeItem.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/ContentTreeItem.ts @@ -3,13 +3,14 @@ /* eslint-disable */ export type ContentTreeItem = { - name?: string | null; - type?: string | null; - icon?: string | null; + name?: string; + type?: string; + icon?: string; hasChildren?: boolean; key?: string; isContainer?: boolean; parentKey?: string | null; noAccess?: boolean; + isTrashed?: boolean; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/CreatedResult.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/CreatedResult.ts index 8f0739f88f..0b19517af2 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/CreatedResult.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/CreatedResult.ts @@ -7,10 +7,10 @@ import type { Type } from './Type'; export type CreatedResult = { value?: any; - formatters?: Array | null; - contentTypes?: Array | null; + formatters?: Array; + contentTypes?: Array; declaredType?: Type; statusCode?: number | null; - location?: string | null; + location?: string; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Culture.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Culture.ts index f8b6bb184b..15f63f8740 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Culture.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Culture.ts @@ -3,7 +3,7 @@ /* eslint-disable */ export type Culture = { - name?: string | null; - englishName?: string | null; + name?: string; + englishName?: string; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/CustomAttributeData.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/CustomAttributeData.ts index c91d2b383d..c16e0f1c0a 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/CustomAttributeData.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/CustomAttributeData.ts @@ -10,7 +10,7 @@ import type { Type } from './Type'; export type CustomAttributeData = { attributeType?: Type; constructor?: ConstructorInfo; - readonly constructorArguments?: Array | null; - readonly namedArguments?: Array | null; + readonly constructorArguments?: Array; + readonly namedArguments?: Array; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/CustomAttributeNamedArgument.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/CustomAttributeNamedArgument.ts index 0985714283..cf176a6832 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/CustomAttributeNamedArgument.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/CustomAttributeNamedArgument.ts @@ -8,7 +8,7 @@ import type { MemberInfo } from './MemberInfo'; export type CustomAttributeNamedArgument = { memberInfo?: MemberInfo; typedValue?: CustomAttributeTypedArgument; - readonly memberName?: string | null; + readonly memberName?: string; readonly isField?: boolean; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DataType.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DataType.ts index 4476e50e7b..951f65e274 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DataType.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DataType.ts @@ -5,9 +5,10 @@ import type { DataTypeProperty } from './DataTypeProperty'; export type DataType = { - name?: string | null; - propertyEditorAlias?: string | null; - data?: Array | null; + name?: string; + propertyEditorAlias?: string; + propertyEditorUiAlias?: string | null; + data?: Array; key?: string; parentKey?: string | null; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DataTypeCreateModel.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DataTypeCreateModel.ts index 18592412d1..bdceaf80cb 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DataTypeCreateModel.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DataTypeCreateModel.ts @@ -5,9 +5,10 @@ import type { DataTypeProperty } from './DataTypeProperty'; export type DataTypeCreateModel = { - name?: string | null; - propertyEditorAlias?: string | null; - data?: Array | null; + name?: string; + propertyEditorAlias?: string; + propertyEditorUiAlias?: string | null; + data?: Array; parentKey?: string | null; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DataTypeProperty.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DataTypeProperty.ts index d069cab255..75031fa9af 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DataTypeProperty.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DataTypeProperty.ts @@ -3,7 +3,7 @@ /* eslint-disable */ export type DataTypeProperty = { - alias?: string | null; + alias?: string; value?: any; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DataTypePropertyReference.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DataTypePropertyReference.ts new file mode 100644 index 0000000000..07bf4500db --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DataTypePropertyReference.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type DataTypePropertyReference = { + name?: string; + alias?: string; +}; + diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DataTypeReference.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DataTypeReference.ts new file mode 100644 index 0000000000..b1c0c02770 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DataTypeReference.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { DataTypePropertyReference } from './DataTypePropertyReference'; + +export type DataTypeReference = { + key?: string; + type?: string; + properties?: Array; +}; + diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DataTypeUpdateModel.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DataTypeUpdateModel.ts index 95f65138f5..f264cdf90b 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DataTypeUpdateModel.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DataTypeUpdateModel.ts @@ -5,8 +5,9 @@ import type { DataTypeProperty } from './DataTypeProperty'; export type DataTypeUpdateModel = { - name?: string | null; - propertyEditorAlias?: string | null; - data?: Array | null; + name?: string; + propertyEditorAlias?: string; + propertyEditorUiAlias?: string | null; + data?: Array; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DatabaseSettings.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DatabaseSettings.ts index fa99b51d1f..ccaa1ff21c 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DatabaseSettings.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DatabaseSettings.ts @@ -5,12 +5,12 @@ export type DatabaseSettings = { id?: string; sortOrder?: number; - displayName?: string | null; - defaultDatabaseName?: string | null; - providerName?: string | null; + displayName?: string; + defaultDatabaseName?: string; + providerName?: string; isConfigured?: boolean; requiresServer?: boolean; - serverPlaceholder?: string | null; + serverPlaceholder?: string; requiresCredentials?: boolean; supportsIntegratedAuthentication?: boolean; requiresConnectionTest?: boolean; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Dictionary.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Dictionary.ts index 5464bde7b8..ae6139cb92 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Dictionary.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Dictionary.ts @@ -8,11 +8,11 @@ import type { DictionaryTranslation } from './DictionaryTranslation'; export type Dictionary = { parentId?: string | null; - translations?: Array | null; - contentApps?: Array | null; - readonly notifications?: Array | null; + translations?: Array; + contentApps?: Array; + readonly notifications?: Array; name: string; key?: string; - path?: string | null; + path?: string; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DictionaryImport.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DictionaryImport.ts index 9d4d282be0..400116fd57 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DictionaryImport.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DictionaryImport.ts @@ -5,7 +5,7 @@ import type { DictionaryItemsImport } from './DictionaryItemsImport'; export type DictionaryImport = { - dictionaryItems?: Array | null; + dictionaryItems?: Array; tempFileName?: string | null; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DictionaryOverview.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DictionaryOverview.ts index 438c2bbc78..42d0015a0e 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DictionaryOverview.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DictionaryOverview.ts @@ -8,6 +8,6 @@ export type DictionaryOverview = { name?: string | null; key?: string; level?: number; - readonly translations?: Array | null; + readonly translations?: Array; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DictionaryTranslation.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DictionaryTranslation.ts index 669e0a94cf..97f245a415 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DictionaryTranslation.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DictionaryTranslation.ts @@ -7,7 +7,7 @@ export type DictionaryTranslation = { key?: string; displayName?: string | null; isoCode?: string | null; - translation?: string | null; + translation?: string; languageId?: number; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DocumentBlueprintTreeItem.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DocumentBlueprintTreeItem.ts index ef120659bd..95af2225f0 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DocumentBlueprintTreeItem.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DocumentBlueprintTreeItem.ts @@ -3,15 +3,15 @@ /* eslint-disable */ export type DocumentBlueprintTreeItem = { - name?: string | null; - type?: string | null; - icon?: string | null; + name?: string; + type?: string; + icon?: string; hasChildren?: boolean; key?: string; isContainer?: boolean; parentKey?: string | null; documentTypeKey?: string; - documentTypeAlias?: string | null; + documentTypeAlias?: string; documentTypeName?: string | null; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DocumentTreeItem.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DocumentTreeItem.ts index 489cc15166..c3fda312be 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DocumentTreeItem.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DocumentTreeItem.ts @@ -3,14 +3,15 @@ /* eslint-disable */ export type DocumentTreeItem = { - name?: string | null; - type?: string | null; - icon?: string | null; + name?: string; + type?: string; + icon?: string; hasChildren?: boolean; key?: string; isContainer?: boolean; parentKey?: string | null; noAccess?: boolean; + isTrashed?: boolean; isProtected?: boolean; isPublished?: boolean; isEdited?: boolean; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DocumentTypeTreeItem.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DocumentTypeTreeItem.ts index 72bd8082d6..ffe110b4fc 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DocumentTypeTreeItem.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/DocumentTypeTreeItem.ts @@ -3,9 +3,9 @@ /* eslint-disable */ export type DocumentTypeTreeItem = { - name?: string | null; - type?: string | null; - icon?: string | null; + name?: string; + type?: string; + icon?: string; hasChildren?: boolean; key?: string; isContainer?: boolean; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/EntityTreeItem.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/EntityTreeItem.ts index 77a5b9cda9..47c461934d 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/EntityTreeItem.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/EntityTreeItem.ts @@ -3,9 +3,9 @@ /* eslint-disable */ export type EntityTreeItem = { - name?: string | null; - type?: string | null; - icon?: string | null; + name?: string; + type?: string; + icon?: string; hasChildren?: boolean; key?: string; isContainer?: boolean; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/EventInfo.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/EventInfo.ts index 4ec49e7f1b..1f85186081 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/EventInfo.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/EventInfo.ts @@ -10,11 +10,11 @@ import type { Module } from './Module'; import type { Type } from './Type'; export type EventInfo = { - readonly name?: string | null; + readonly name?: string; declaringType?: Type; reflectedType?: Type; module?: Module; - readonly customAttributes?: Array | null; + readonly customAttributes?: Array; readonly isCollectible?: boolean; readonly metadataToken?: number; memberType?: MemberTypes; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Field.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Field.ts index f03083b81d..7bc3138a69 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Field.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Field.ts @@ -3,7 +3,7 @@ /* eslint-disable */ export type Field = { - name?: string | null; - values?: Array | null; + name?: string; + values?: Array; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/FieldInfo.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/FieldInfo.ts index e54075e1a8..2a1bd213f0 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/FieldInfo.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/FieldInfo.ts @@ -10,11 +10,11 @@ import type { RuntimeFieldHandle } from './RuntimeFieldHandle'; import type { Type } from './Type'; export type FieldInfo = { - readonly name?: string | null; + readonly name?: string; declaringType?: Type; reflectedType?: Type; module?: Module; - readonly customAttributes?: Array | null; + readonly customAttributes?: Array; readonly isCollectible?: boolean; readonly metadataToken?: number; memberType?: MemberTypes; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/FileSystemTreeItem.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/FileSystemTreeItem.ts index 058f032a68..11fb5b5b07 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/FileSystemTreeItem.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/FileSystemTreeItem.ts @@ -3,11 +3,11 @@ /* eslint-disable */ export type FileSystemTreeItem = { - name?: string | null; - type?: string | null; - icon?: string | null; + name?: string; + type?: string; + icon?: string; hasChildren?: boolean; - path?: string | null; + path?: string; isFolder?: boolean; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Folder.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Folder.ts new file mode 100644 index 0000000000..95565e60d8 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Folder.ts @@ -0,0 +1,10 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type Folder = { + name?: string; + key?: string; + parentKey?: string | null; +}; + diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/FolderCreateModel.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/FolderCreateModel.ts new file mode 100644 index 0000000000..fc34bb2ce8 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/FolderCreateModel.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type FolderCreateModel = { + name?: string; + parentKey?: string | null; +}; + diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/FolderTreeItem.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/FolderTreeItem.ts index 8407711e91..f3ca6a12e5 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/FolderTreeItem.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/FolderTreeItem.ts @@ -3,9 +3,9 @@ /* eslint-disable */ export type FolderTreeItem = { - name?: string | null; - type?: string | null; - icon?: string | null; + name?: string; + type?: string; + icon?: string; hasChildren?: boolean; key?: string; isContainer?: boolean; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/FolderUpdateModel.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/FolderUpdateModel.ts new file mode 100644 index 0000000000..8cf803666d --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/FolderUpdateModel.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type FolderUpdateModel = { + name?: string; +}; + diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/HealthCheck.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/HealthCheck.ts index bbd5d72496..c3a55c8fe2 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/HealthCheck.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/HealthCheck.ts @@ -4,7 +4,7 @@ export type HealthCheck = { key?: string; - name?: string | null; + name?: string; description?: string | null; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/HealthCheckGroup.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/HealthCheckGroup.ts index f96bad143e..f9cec322a2 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/HealthCheckGroup.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/HealthCheckGroup.ts @@ -6,6 +6,6 @@ import type { HealthCheck } from './HealthCheck'; export type HealthCheckGroup = { name?: string | null; - checks?: Array | null; + checks?: Array; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/HealthCheckGroupWithResult.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/HealthCheckGroupWithResult.ts index 797b13c46e..da13fe5aea 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/HealthCheckGroupWithResult.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/HealthCheckGroupWithResult.ts @@ -6,6 +6,6 @@ import type { HealthCheckWithResult } from './HealthCheckWithResult'; export type HealthCheckGroupWithResult = { name?: string | null; - checks?: Array | null; + checks?: Array; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/HealthCheckResult.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/HealthCheckResult.ts index 332200c5c4..24542f559c 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/HealthCheckResult.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/HealthCheckResult.ts @@ -6,7 +6,7 @@ import type { HealthCheckAction } from './HealthCheckAction'; import type { StatusResultType } from './StatusResultType'; export type HealthCheckResult = { - message?: string | null; + message?: string; resultType?: StatusResultType; actions?: Array | null; readMoreLink?: string | null; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/HealthCheckWithResult.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/HealthCheckWithResult.ts index 8001e4b7a5..31cb5d56e1 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/HealthCheckWithResult.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/HealthCheckWithResult.ts @@ -6,7 +6,7 @@ import type { HealthCheckResult } from './HealthCheckResult'; export type HealthCheckWithResult = { key?: string; - name?: string | null; + name?: string; description?: string | null; results?: Array | null; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/HealthStatus.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/HealthStatus.ts new file mode 100644 index 0000000000..4c4307a292 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/HealthStatus.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export enum HealthStatus { + HEALTHY = 'Healthy', + UNHEALTHY = 'Unhealthy', + REBUILDING = 'Rebuilding', +} diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Index.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Index.ts index c34fc480b8..07f935b31e 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Index.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Index.ts @@ -2,12 +2,13 @@ /* tslint:disable */ /* eslint-disable */ +import type { HealthStatus } from './HealthStatus'; + export type Index = { name: string; - healthStatus?: string | null; - readonly isHealthy: boolean; + healthStatus?: HealthStatus; canRebuild: boolean; - searcherName?: string | null; + searcherName?: string; documentCount: number; fieldCount: number; providerProperties?: Record | null; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/InstallSettings.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/InstallSettings.ts index 746fa1728a..334bbcdefd 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/InstallSettings.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/InstallSettings.ts @@ -7,6 +7,6 @@ import type { UserSettings } from './UserSettings'; export type InstallSettings = { user?: UserSettings; - databases?: Array | null; + databases?: Array; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/JsonPatch.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/JsonPatch.ts index e18637fcee..fb9e0177ba 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/JsonPatch.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/JsonPatch.ts @@ -3,8 +3,8 @@ /* eslint-disable */ export type JsonPatch = { - op?: string | null; - path?: string | null; + op?: string; + path?: string; value?: any; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/MemberInfo.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/MemberInfo.ts index 3e3f9819c7..4b559a865e 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/MemberInfo.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/MemberInfo.ts @@ -9,11 +9,11 @@ import type { Type } from './Type'; export type MemberInfo = { memberType?: MemberTypes; - readonly name?: string | null; + readonly name?: string; declaringType?: Type; reflectedType?: Type; module?: Module; - readonly customAttributes?: Array | null; + readonly customAttributes?: Array; readonly isCollectible?: boolean; readonly metadataToken?: number; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/MethodBase.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/MethodBase.ts index 94cfa1b3cc..30167ffc4d 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/MethodBase.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/MethodBase.ts @@ -13,11 +13,11 @@ import type { Type } from './Type'; export type MethodBase = { memberType?: MemberTypes; - readonly name?: string | null; + readonly name?: string; declaringType?: Type; reflectedType?: Type; module?: Module; - readonly customAttributes?: Array | null; + readonly customAttributes?: Array; readonly isCollectible?: boolean; readonly metadataToken?: number; attributes?: MethodAttributes; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/MethodInfo.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/MethodInfo.ts index 382fb5adf5..c1a3d421cd 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/MethodInfo.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/MethodInfo.ts @@ -14,11 +14,11 @@ import type { RuntimeMethodHandle } from './RuntimeMethodHandle'; import type { Type } from './Type'; export type MethodInfo = { - readonly name?: string | null; + readonly name?: string; declaringType?: Type; reflectedType?: Type; module?: Module; - readonly customAttributes?: Array | null; + readonly customAttributes?: Array; readonly isCollectible?: boolean; readonly metadataToken?: number; attributes?: MethodAttributes; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Module.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Module.ts index 7843f8da04..87a07e860a 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Module.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Module.ts @@ -8,13 +8,13 @@ import type { ModuleHandle } from './ModuleHandle'; export type Module = { assembly?: Assembly; - readonly fullyQualifiedName?: string | null; - readonly name?: string | null; + readonly fullyQualifiedName?: string; + readonly name?: string; readonly mdStreamVersion?: number; readonly moduleVersionId?: string; - readonly scopeName?: string | null; + readonly scopeName?: string; moduleHandle?: ModuleHandle; - readonly customAttributes?: Array | null; + readonly customAttributes?: Array; readonly metadataToken?: number; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Operator.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Operator.ts new file mode 100644 index 0000000000..7d4e681831 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Operator.ts @@ -0,0 +1,14 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export enum Operator { + EQUALS = 'Equals', + NOT_EQUALS = 'NotEquals', + CONTAINS = 'Contains', + NOT_CONTAINS = 'NotContains', + LESS_THAN = 'LessThan', + LESS_THAN_EQUAL_TO = 'LessThanEqualTo', + GREATER_THAN = 'GreaterThan', + GREATER_THAN_EQUAL_TO = 'GreaterThanEqualTo', +} diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/ParameterInfo.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/ParameterInfo.ts index 15c13932a7..b83cfb909b 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/ParameterInfo.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/ParameterInfo.ts @@ -21,7 +21,7 @@ export type ParameterInfo = { readonly defaultValue?: any; readonly rawDefaultValue?: any; readonly hasDefaultValue?: boolean; - readonly customAttributes?: Array | null; + readonly customAttributes?: Array; readonly metadataToken?: number; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/PropertyInfo.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/PropertyInfo.ts index df98f1e0c1..cc2b6cbfb3 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/PropertyInfo.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/PropertyInfo.ts @@ -10,11 +10,11 @@ import type { PropertyAttributes } from './PropertyAttributes'; import type { Type } from './Type'; export type PropertyInfo = { - readonly name?: string | null; + readonly name?: string; declaringType?: Type; reflectedType?: Type; module?: Module; - readonly customAttributes?: Array | null; + readonly customAttributes?: Array; readonly isCollectible?: boolean; readonly metadataToken?: number; memberType?: MemberTypes; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/RecycleBinItem.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/RecycleBinItem.ts index 6e077b49fd..726cf81eec 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/RecycleBinItem.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/RecycleBinItem.ts @@ -4,9 +4,9 @@ export type RecycleBinItem = { key?: string; - name?: string | null; - type?: string | null; - icon?: string | null; + name?: string; + type?: string; + icon?: string; hasChildren?: boolean; isContainer?: boolean; parentKey?: string | null; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/RedirectUrl.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/RedirectUrl.ts index 7f7eaf0ddb..5c1fec3934 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/RedirectUrl.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/RedirectUrl.ts @@ -4,8 +4,8 @@ export type RedirectUrl = { key?: string; - originalUrl?: string | null; - destinationUrl?: string | null; + originalUrl?: string; + destinationUrl?: string; created?: string; contentKey?: string; culture?: string | null; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/SearchResult.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/SearchResult.ts index e468166035..d6dc140d8d 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/SearchResult.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/SearchResult.ts @@ -5,9 +5,9 @@ import type { Field } from './Field'; export type SearchResult = { - id?: string | null; + id?: string; score?: number; readonly fieldCount?: number; - fields?: Array | null; + fields?: Array; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Searcher.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Searcher.ts index bc89694c3a..1e55566aa3 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Searcher.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Searcher.ts @@ -3,6 +3,6 @@ /* eslint-disable */ export type Searcher = { - name?: string | null; + name?: string; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Template.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Template.ts new file mode 100644 index 0000000000..3055919ab5 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Template.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type Template = { + name?: string; + alias?: string; + content?: string | null; + key?: string; +}; + diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateCreateModel.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateCreateModel.ts new file mode 100644 index 0000000000..6a393e41ba --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateCreateModel.ts @@ -0,0 +1,10 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type TemplateCreateModel = { + name?: string; + alias?: string; + content?: string | null; +}; + diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateQueryExecuteFilterModel.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateQueryExecuteFilterModel.ts new file mode 100644 index 0000000000..d04281f02d --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateQueryExecuteFilterModel.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { Operator } from './Operator'; + +export type TemplateQueryExecuteFilterModel = { + propertyAlias?: string; + constraintValue?: string; + operator?: Operator; +}; + diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateQueryExecuteModel.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateQueryExecuteModel.ts new file mode 100644 index 0000000000..53481eabcf --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateQueryExecuteModel.ts @@ -0,0 +1,15 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { TemplateQueryExecuteFilterModel } from './TemplateQueryExecuteFilterModel'; +import type { TemplateQueryExecuteSortModel } from './TemplateQueryExecuteSortModel'; + +export type TemplateQueryExecuteModel = { + rootContentKey?: string | null; + contentTypeAlias?: string | null; + filters?: Array | null; + sort?: TemplateQueryExecuteSortModel; + take?: number; +}; + diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateQueryExecuteSortModel.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateQueryExecuteSortModel.ts new file mode 100644 index 0000000000..d3a1b6cf56 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateQueryExecuteSortModel.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type TemplateQueryExecuteSortModel = { + propertyAlias?: string; + direction?: string | null; +}; + diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateQueryOperator.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateQueryOperator.ts new file mode 100644 index 0000000000..f1e3cd66cb --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateQueryOperator.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { Operator } from './Operator'; +import type { TemplateQueryPropertyType } from './TemplateQueryPropertyType'; + +export type TemplateQueryOperator = { + operator?: Operator; + applicableTypes?: Array; +}; + diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateQueryProperty.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateQueryProperty.ts new file mode 100644 index 0000000000..2b8472d303 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateQueryProperty.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { TemplateQueryPropertyType } from './TemplateQueryPropertyType'; + +export type TemplateQueryProperty = { + alias?: string; + type?: TemplateQueryPropertyType; +}; + diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateQueryPropertyType.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateQueryPropertyType.ts new file mode 100644 index 0000000000..2ec073e349 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateQueryPropertyType.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export enum TemplateQueryPropertyType { + STRING = 'String', + DATE_TIME = 'DateTime', + INTEGER = 'Integer', +} diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateQueryResult.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateQueryResult.ts new file mode 100644 index 0000000000..92773aedb5 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateQueryResult.ts @@ -0,0 +1,13 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { TemplateQueryResultItem } from './TemplateQueryResultItem'; + +export type TemplateQueryResult = { + queryExpression?: string; + sampleResults?: Array; + resultCount?: number; + executionTime?: number; +}; + diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateQueryResultItem.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateQueryResultItem.ts new file mode 100644 index 0000000000..f04b8cbe5b --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateQueryResultItem.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type TemplateQueryResultItem = { + icon?: string; + name?: string; +}; + diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateQuerySettings.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateQuerySettings.ts new file mode 100644 index 0000000000..cc21151d6c --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateQuerySettings.ts @@ -0,0 +1,13 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { TemplateQueryOperator } from './TemplateQueryOperator'; +import type { TemplateQueryProperty } from './TemplateQueryProperty'; + +export type TemplateQuerySettings = { + contentTypeAliases?: Array; + properties?: Array; + operators?: Array; +}; + diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateScaffold.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateScaffold.ts new file mode 100644 index 0000000000..a6de02512b --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateScaffold.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type TemplateScaffold = { + content?: string; +}; + diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateUpdateModel.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateUpdateModel.ts new file mode 100644 index 0000000000..f33c895029 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TemplateUpdateModel.ts @@ -0,0 +1,10 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type TemplateUpdateModel = { + name?: string; + alias?: string; + content?: string | null; +}; + diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Type.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Type.ts index 5aa4d99801..3b3f03fe0d 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Type.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Type.ts @@ -14,8 +14,8 @@ import type { StructLayoutAttribute } from './StructLayoutAttribute'; import type { TypeAttributes } from './TypeAttributes'; export type Type = { - readonly name?: string | null; - readonly customAttributes?: Array | null; + readonly name?: string; + readonly customAttributes?: Array; readonly isCollectible?: boolean; readonly metadataToken?: number; readonly isInterface?: boolean; @@ -44,7 +44,7 @@ export type Type = { readonly isVariableBoundArray?: boolean; readonly isByRefLike?: boolean; readonly hasElementType?: boolean; - readonly genericTypeArguments?: Array | null; + readonly genericTypeArguments?: Array; readonly genericParameterPosition?: number; genericParameterAttributes?: GenericParameterAttributes; attributes?: TypeAttributes; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TypeInfo.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TypeInfo.ts index 1d5cfc6397..4010b30ea1 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TypeInfo.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/TypeInfo.ts @@ -20,8 +20,8 @@ import type { Type } from './Type'; import type { TypeAttributes } from './TypeAttributes'; export type TypeInfo = { - readonly name?: string | null; - readonly customAttributes?: Array | null; + readonly name?: string; + readonly customAttributes?: Array; readonly isCollectible?: boolean; readonly metadataToken?: number; readonly isInterface?: boolean; @@ -50,7 +50,7 @@ export type TypeInfo = { readonly isVariableBoundArray?: boolean; readonly isByRefLike?: boolean; readonly hasElementType?: boolean; - readonly genericTypeArguments?: Array | null; + readonly genericTypeArguments?: Array; readonly genericParameterPosition?: number; genericParameterAttributes?: GenericParameterAttributes; attributes?: TypeAttributes; @@ -91,14 +91,14 @@ export type TypeInfo = { readonly isSerializable?: boolean; readonly containsGenericParameters?: boolean; readonly isVisible?: boolean; - readonly genericTypeParameters?: Array | null; - readonly declaredConstructors?: Array | null; - readonly declaredEvents?: Array | null; - readonly declaredFields?: Array | null; - readonly declaredMembers?: Array | null; - readonly declaredMethods?: Array | null; - readonly declaredNestedTypes?: Array | null; - readonly declaredProperties?: Array | null; - readonly implementedInterfaces?: Array | null; + readonly genericTypeParameters?: Array; + readonly declaredConstructors?: Array; + readonly declaredEvents?: Array; + readonly declaredFields?: Array; + readonly declaredMembers?: Array; + readonly declaredMethods?: Array; + readonly declaredNestedTypes?: Array; + readonly declaredProperties?: Array; + readonly implementedInterfaces?: Array; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/UpgradeSettings.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/UpgradeSettings.ts index 88faaeecc7..f3b582ab1d 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/UpgradeSettings.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/UpgradeSettings.ts @@ -3,10 +3,10 @@ /* eslint-disable */ export type UpgradeSettings = { - currentState?: string | null; - newState?: string | null; - newVersion?: string | null; - oldVersion?: string | null; - readonly reportUrl?: string | null; + currentState?: string; + newState?: string; + newVersion?: string; + oldVersion?: string; + readonly reportUrl?: string; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/UserSettings.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/UserSettings.ts index 1b875f4d36..ddc42d069b 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/UserSettings.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/UserSettings.ts @@ -7,6 +7,6 @@ import type { ConsentLevel } from './ConsentLevel'; export type UserSettings = { minCharLength?: number; minNonAlphaNumericLength?: number; - consentLevels?: Array | null; + consentLevels?: Array; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Version.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Version.ts index 3ee6e570a7..35249a3fba 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Version.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/models/Version.ts @@ -3,6 +3,6 @@ /* eslint-disable */ export type Version = { - version?: string | null; + version?: string; }; diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/services/DataTypeResource.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/services/DataTypeResource.ts index 51a0f68819..fffdb6fb45 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/services/DataTypeResource.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/services/DataTypeResource.ts @@ -3,8 +3,12 @@ /* eslint-disable */ import type { DataType } from '../models/DataType'; import type { DataTypeCreateModel } from '../models/DataTypeCreateModel'; +import type { DataTypeReference } from '../models/DataTypeReference'; import type { DataTypeUpdateModel } from '../models/DataTypeUpdateModel'; +import type { Folder } from '../models/Folder'; +import type { FolderCreateModel } from '../models/FolderCreateModel'; import type { FolderTreeItem } from '../models/FolderTreeItem'; +import type { FolderUpdateModel } from '../models/FolderUpdateModel'; import type { PagedFolderTreeItem } from '../models/PagedFolderTreeItem'; import type { CancelablePromise } from '../core/CancelablePromise'; @@ -14,14 +18,14 @@ import { request as __request } from '../core/request'; export class DataTypeResource { /** - * @returns DataType Success + * @returns any Created * @throws ApiError */ public static postDataType({ requestBody, }: { requestBody?: DataTypeCreateModel, - }): CancelablePromise { + }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/umbraco/management/api/v1/data-type', @@ -55,7 +59,28 @@ export class DataTypeResource { } /** - * @returns DataType Success + * @returns any Success + * @throws ApiError + */ + public static deleteDataTypeByKey({ + key, + }: { + key: string, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'DELETE', + url: '/umbraco/management/api/v1/data-type/{key}', + path: { + 'key': key, + }, + errors: { + 404: `Not Found`, + }, + }); + } + + /** + * @returns any Success * @throws ApiError */ public static putDataTypeByKey({ @@ -64,7 +89,7 @@ export class DataTypeResource { }: { key: string, requestBody?: DataTypeUpdateModel, - }): CancelablePromise { + }): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/umbraco/management/api/v1/data-type/{key}', @@ -79,6 +104,111 @@ export class DataTypeResource { }); } + /** + * @returns DataTypeReference Success + * @throws ApiError + */ + public static getDataTypeByKeyReferences({ + key, + }: { + key: string, + }): CancelablePromise> { + return __request(OpenAPI, { + method: 'GET', + url: '/umbraco/management/api/v1/data-type/{key}/references', + path: { + 'key': key, + }, + errors: { + 404: `Not Found`, + }, + }); + } + + /** + * @returns any Created + * @throws ApiError + */ + public static postDataTypeFolder({ + requestBody, + }: { + requestBody?: FolderCreateModel, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/umbraco/management/api/v1/data-type/folder', + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * @returns Folder Success + * @throws ApiError + */ + public static getDataTypeFolderByKey({ + key, + }: { + key: string, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/umbraco/management/api/v1/data-type/folder/{key}', + path: { + 'key': key, + }, + errors: { + 404: `Not Found`, + }, + }); + } + + /** + * @returns any Success + * @throws ApiError + */ + public static deleteDataTypeFolderByKey({ + key, + }: { + key: string, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'DELETE', + url: '/umbraco/management/api/v1/data-type/folder/{key}', + path: { + 'key': key, + }, + errors: { + 404: `Not Found`, + }, + }); + } + + /** + * @returns any Success + * @throws ApiError + */ + public static putDataTypeFolderByKey({ + key, + requestBody, + }: { + key: string, + requestBody?: FolderUpdateModel, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'PUT', + url: '/umbraco/management/api/v1/data-type/folder/{key}', + path: { + 'key': key, + }, + body: requestBody, + mediaType: 'application/json', + errors: { + 404: `Not Found`, + }, + }); + } + /** * @returns PagedFolderTreeItem Success * @throws ApiError diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/services/TemplateResource.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/services/TemplateResource.ts index 5050c7314f..771d6ef5ef 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/services/TemplateResource.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/services/TemplateResource.ts @@ -3,6 +3,13 @@ /* eslint-disable */ import type { EntityTreeItem } from '../models/EntityTreeItem'; import type { PagedEntityTreeItem } from '../models/PagedEntityTreeItem'; +import type { Template } from '../models/Template'; +import type { TemplateCreateModel } from '../models/TemplateCreateModel'; +import type { TemplateQueryExecuteModel } from '../models/TemplateQueryExecuteModel'; +import type { TemplateQueryResult } from '../models/TemplateQueryResult'; +import type { TemplateQuerySettings } from '../models/TemplateQuerySettings'; +import type { TemplateScaffold } from '../models/TemplateScaffold'; +import type { TemplateUpdateModel } from '../models/TemplateUpdateModel'; import type { CancelablePromise } from '../core/CancelablePromise'; import { OpenAPI } from '../core/OpenAPI'; @@ -10,6 +17,142 @@ import { request as __request } from '../core/request'; export class TemplateResource { + /** + * @returns any Created + * @throws ApiError + */ + public static postTemplate({ + requestBody, + }: { + requestBody?: TemplateCreateModel, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/umbraco/management/api/v1/template', + body: requestBody, + mediaType: 'application/json', + errors: { + 404: `Not Found`, + }, + }); + } + + /** + * @returns Template Success + * @throws ApiError + */ + public static getTemplateByKey({ + key, + }: { + key: string, + }): CancelablePromise