diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/sections/settings/settings-section-tree.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/sections/settings/settings-section-tree.element.ts deleted file mode 100644 index 32200bf0f9..0000000000 --- a/src/Umbraco.Web.UI.Client/src/backoffice/sections/settings/settings-section-tree.element.ts +++ /dev/null @@ -1,139 +0,0 @@ -import { css, html, LitElement } from 'lit'; -import { customElement, state } from 'lit/decorators.js'; -import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; -import { UmbContextConsumerMixin } from '../../../core/context'; -import { UmbDataTypeStore } from '../../../core/stores/data-type.store'; -import { map, Subscription, first } from 'rxjs'; -import { UmbDocumentTypeStore } from '../../../core/stores/document-type.store'; -import { UmbExtensionRegistry } from '../../../core/extension'; -import '../../tree/shared/tree.element'; -import { UmbSectionContext } from '../section.context'; - -@customElement('umb-settings-section-tree') -class UmbSettingsSectionTree extends UmbContextConsumerMixin(LitElement) { - static styles = [UUITextStyles]; - - // TODO: implement dynamic tree data - @state() - _dataTypes: Array = []; - - @state() - _documentTypes: Array = []; - - @state() - private _trees: Array = []; - - @state() - private _currentSectionAlias?: string; - - private _dataTypeStore?: UmbDataTypeStore; - private _documentTypeStore?: UmbDocumentTypeStore; - - private _dataTypesSubscription?: Subscription; - private _documentTypesSubscription?: Subscription; - - private _extensionStore?: UmbExtensionRegistry; - private _treeSubscription?: Subscription; - - private _sectionContextSubscription?: Subscription; - private _sectionContext?: UmbSectionContext; - - constructor() { - super(); - - this.consumeContext('umbSectionContext', (context: UmbSectionContext) => { - this._sectionContext = context; - this._useSectionContext(); - }); - - // TODO: temp solution until we know where to get tree data from - this.consumeContext('umbDataTypeStore', (store) => { - this._dataTypeStore = store; - - this._dataTypesSubscription = this._dataTypeStore?.getAll().subscribe((dataTypes) => { - this._dataTypes = dataTypes; - }); - }); - - // TODO: temp solution until we know where to get tree data from - this.consumeContext('umbDocumentTypeStore', (store) => { - this._documentTypeStore = store; - - this._documentTypesSubscription = this._documentTypeStore?.getAll().subscribe((documentTypes) => { - this._documentTypes = documentTypes; - }); - }); - - this.consumeContext('umbExtensionRegistry', (store) => { - this._extensionStore = store; - this._useTrees(); - }); - } - - disconnectedCallback(): void { - super.disconnectedCallback(); - - this._dataTypesSubscription?.unsubscribe(); - this._documentTypesSubscription?.unsubscribe(); - } - - private _useSectionContext() { - this._sectionContextSubscription?.unsubscribe(); - - this._sectionContextSubscription = this._sectionContext?.data.pipe(first()).subscribe((section) => { - this._currentSectionAlias = section.alias; - }); - } - - private _useTrees() { - //TODO: Merge streams - if (this._extensionStore && this._currentSectionAlias) { - this._treeSubscription?.unsubscribe(); - - this._treeSubscription = this._extensionStore - ?.extensionsOfType('tree') - .pipe( - map((extensions) => - extensions - .filter((extension) => extension.meta.sections.includes(this._currentSectionAlias as string)) // TODO: Why do whe need "as string" here?? - .sort((a, b) => b.meta.weight - a.meta.weight) - ) - ) - .subscribe((treeExtensions) => { - this._trees = treeExtensions; - console.log('Wrosk', this._trees); - }); - } - } - - render() { - return html` - - - - ${this._dataTypes.map( - (dataType) => html` - - ` - )} - - - ${this._documentTypes.map( - (documentType) => html` - - ` - )} - - - ${this._trees.map((tree) => html``)} - `; - } -} - -declare global { - interface HTMLElementTagNameMap { - 'umb-settings-section-tree': UmbSettingsSectionTree; - } -} diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/sections/settings/settings-section.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/sections/settings/settings-section.element.ts index fdd66c9c6f..2295ae822a 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/sections/settings/settings-section.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/sections/settings/settings-section.element.ts @@ -1,7 +1,6 @@ import { html, LitElement } from 'lit'; import { customElement } from 'lit/decorators.js'; -import './settings-section-tree.element'; @customElement('umb-section-settings') export class UmbSectionSettingsElement extends LitElement { render() {