usage of sections
This commit is contained in:
@@ -57,7 +57,7 @@ export class UmbBackofficeHeaderSectionsElement extends UmbLitElement {
|
||||
private _observeSections() {
|
||||
if (!this._backofficeContext) return;
|
||||
|
||||
this.observe(this._backofficeContext.getAllowedSections(), (allowedSections) => {
|
||||
this.observe(this._backofficeContext.allowedSections, (allowedSections) => {
|
||||
this._sections = allowedSections;
|
||||
this._visibleSections = this._sections;
|
||||
});
|
||||
|
||||
@@ -37,7 +37,7 @@ export class UmbBackofficeMainElement extends UmbLitElement {
|
||||
private async _observeBackoffice() {
|
||||
if (this._backofficeContext) {
|
||||
this.observe(
|
||||
this._backofficeContext.getAllowedSections(),
|
||||
this._backofficeContext.allowedSections,
|
||||
(sections) => {
|
||||
this._sections = sections;
|
||||
this._createRoutes();
|
||||
|
||||
@@ -5,15 +5,7 @@ import { UmbStringState } from '@umbraco-cms/backoffice/observable-api';
|
||||
export class UmbBackofficeContext {
|
||||
#activeSectionAlias = new UmbStringState(undefined);
|
||||
public readonly activeSectionAlias = this.#activeSectionAlias.asObservable();
|
||||
|
||||
public getAllowedSections() {
|
||||
// TODO: implemented allowed filtering based on user, maybe this will be a general need and solved else where so this might not be needed in the end.
|
||||
/*
|
||||
const { data } = await getUserSections({});
|
||||
this._allowedSection = data.sections;
|
||||
*/
|
||||
return umbExtensionsRegistry.extensionsOfType('section');
|
||||
}
|
||||
public readonly allowedSections = umbExtensionsRegistry.extensionsOfType('section');
|
||||
|
||||
public setActiveSectionAlias(alias: string) {
|
||||
this.#activeSectionAlias.next(alias);
|
||||
|
||||
@@ -21,7 +21,7 @@ export class UmbInputPickerSectionElement extends UmbInputListBaseElement {
|
||||
|
||||
private _observeSections() {
|
||||
if (this.value.length > 0) {
|
||||
umbExtensionsRegistry.extensionsOfType('section').subscribe((sections: Array<ManifestSection>) => {
|
||||
this.observe(umbExtensionsRegistry.extensionsOfType('section'), (sections: Array<ManifestSection>) => {
|
||||
this._sections = sections.filter((section) => this.value.includes(section.alias));
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -14,7 +14,7 @@ export class UmbSectionPickerModalElement extends UmbModalElementPickerBase<Mani
|
||||
|
||||
connectedCallback(): void {
|
||||
super.connectedCallback();
|
||||
umbExtensionsRegistry.extensionsOfType('section').subscribe((sections: Array<ManifestSection>) => {
|
||||
this.observe(umbExtensionsRegistry.extensionsOfType('section'), (sections: Array<ManifestSection>) => {
|
||||
this._sections = sections;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user