From 735ca6247bf83ae4a23d78c62b8a3e4bba30db21 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Wed, 5 Oct 2022 09:44:59 +0200 Subject: [PATCH] add label to section manifest --- src/Umbraco.Web.UI.Client/schemas/api/api.yml | 3 ++ .../schemas/generated-schema.ts | 1 + .../backoffice-header-sections.element.ts | 4 +- .../shared/section-sidebar.element.ts | 6 +-- .../src/temp-internal-manifests.ts | 40 ++++++++++++------- .../temp-schema-generator/manifests.ts | 1 + 6 files changed, 35 insertions(+), 20 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/schemas/api/api.yml b/src/Umbraco.Web.UI.Client/schemas/api/api.yml index 2f2d17687e..db7fa64dd5 100644 --- a/src/Umbraco.Web.UI.Client/schemas/api/api.yml +++ b/src/Umbraco.Web.UI.Client/schemas/api/api.yml @@ -481,12 +481,15 @@ components: MetaSection: type: object properties: + label: + type: string pathname: type: string weight: type: number format: float required: + - label - pathname - weight IManifestSection: diff --git a/src/Umbraco.Web.UI.Client/schemas/generated-schema.ts b/src/Umbraco.Web.UI.Client/schemas/generated-schema.ts index af89e681f5..51e8815b2c 100644 --- a/src/Umbraco.Web.UI.Client/schemas/generated-schema.ts +++ b/src/Umbraco.Web.UI.Client/schemas/generated-schema.ts @@ -127,6 +127,7 @@ export interface components { database?: components["schemas"]["InstallSetupDatabaseConfiguration"]; }; MetaSection: { + label: string; pathname: string; /** Format: float */ weight: number; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/components/backoffice-header-sections.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/components/backoffice-header-sections.element.ts index eaaef3a9a0..30dad3fb31 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/components/backoffice-header-sections.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/components/backoffice-header-sections.element.ts @@ -120,7 +120,7 @@ export class UmbBackofficeHeaderSections extends UmbContextProviderMixin(UmbCont @click="${this._handleTabClick}" ?active="${this._currentSectionAlias === section.alias}" href="${`/section/${section.meta.pathname}`}" - label="${section.name}" + label="${section.meta.label || section.name}" data-alias="${section.alias}"> ` )} @@ -144,7 +144,7 @@ export class UmbBackofficeHeaderSections extends UmbContextProviderMixin(UmbCont (section) => html` ` )} diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/sections/shared/section-sidebar.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/sections/shared/section-sidebar.element.ts index 6ce95a2c3d..984a99eeda 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/sections/shared/section-sidebar.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/sections/shared/section-sidebar.element.ts @@ -28,7 +28,7 @@ export class UmbSectionSidebar extends UmbContextConsumerMixin(LitElement) { ]; @state() - private _sectionName = ''; + private _sectionLabel = ''; @state() private _sectionPathname = ''; @@ -49,7 +49,7 @@ export class UmbSectionSidebar extends UmbContextConsumerMixin(LitElement) { this._sectionContextSubscription?.unsubscribe(); this._sectionContextSubscription = this._sectionContext?.data.subscribe((section) => { - this._sectionName = section.name; + this._sectionLabel = section.meta.label || section.name; this._sectionPathname = section.meta.pathname; }); } @@ -64,7 +64,7 @@ export class UmbSectionSidebar extends UmbContextConsumerMixin(LitElement) { -

${this._sectionName}

+

${this._sectionLabel}

diff --git a/src/Umbraco.Web.UI.Client/src/temp-internal-manifests.ts b/src/Umbraco.Web.UI.Client/src/temp-internal-manifests.ts index 252ba481a9..e3e2cbb32d 100644 --- a/src/Umbraco.Web.UI.Client/src/temp-internal-manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/temp-internal-manifests.ts @@ -1,15 +1,15 @@ import type { ManifestTypes } from './core/models'; // TODO: consider moving weight from meta to the main part of the manifest. We need it for every extension. -// TODO: consider adding a label property as part of the meta. It might make sense to have an "extension" name label where one is needed. export const internalManifests: Array Promise }> = [ { type: 'section', alias: 'Umb.Section.Content', - name: 'Content', + name: 'Content Section', elementName: 'umb-content-section', loader: () => import('./backoffice/sections/content/content-section.element'), meta: { + label: 'Content', pathname: 'content', // TODO: how to we want to support pretty urls? weight: 50, }, @@ -17,10 +17,11 @@ export const internalManifests: Array Promise import('./backoffice/sections/media/media-section.element'), meta: { + label: 'Media', pathname: 'media', // TODO: how to we want to support pretty urls? weight: 50, }, @@ -28,10 +29,11 @@ export const internalManifests: Array Promise import('./backoffice/sections/members/section-members.element'), meta: { + label: 'Members', pathname: 'members', weight: 30, }, @@ -39,9 +41,10 @@ export const internalManifests: Array Promise import('./backoffice/sections/settings/settings-section.element'), meta: { + label: 'Settings', pathname: 'settings', // TODO: how to we want to support pretty urls? weight: 20, }, @@ -49,10 +52,11 @@ export const internalManifests: Array Promise import('./backoffice/sections/packages/packages-section.element'), meta: { + label: 'Packages', pathname: 'packages', weight: 20, }, @@ -60,10 +64,11 @@ export const internalManifests: Array Promise import('./backoffice/dashboards/welcome/dashboard-welcome.element'), meta: { + label: 'Welcome', sections: ['Umb.Section.Content'], pathname: 'welcome', // TODO: how to we want to support pretty urls? weight: 20, @@ -72,10 +77,11 @@ export const internalManifests: Array Promise import('./backoffice/dashboards/redirect-management/dashboard-redirect-management.element'), meta: { + label: 'Redirect Management', sections: ['Umb.Section.Content'], pathname: 'redirect-management', // TODO: how to we want to support pretty urls? weight: 10, @@ -84,7 +90,7 @@ export const internalManifests: Array Promise import('./backoffice/dashboards/settings-about/dashboard-settings-about.element'), meta: { @@ -97,10 +103,11 @@ export const internalManifests: Array Promise import('./backoffice/dashboards/examine-management/dashboard-examine-management.element'), meta: { + label: 'Examine Management', sections: ['Umb.Section.Settings'], pathname: 'examine-management', // TODO: how to we want to support pretty urls? weight: 10, @@ -109,10 +116,11 @@ export const internalManifests: Array Promise import('./backoffice/dashboards/models-builder/dashboard-models-builder.element'), meta: { + label: 'Models Builder', sections: ['Umb.Section.Settings'], pathname: 'models-builder', // TODO: how to we want to support pretty urls? weight: 10, @@ -121,10 +129,11 @@ export const internalManifests: Array Promise import('./backoffice/dashboards/published-status/dashboard-published-status.element'), meta: { + label: 'Published Status', sections: ['Umb.Section.Settings'], pathname: 'published-status', // TODO: how to we want to support pretty urls? weight: 9, @@ -133,10 +142,11 @@ export const internalManifests: Array Promise import('./backoffice/dashboards/media-management/dashboard-media-management.element'), meta: { + label: 'Media', sections: ['Umb.Section.Media'], pathname: 'media-management', // TODO: how to we want to support pretty urls? weight: 10, @@ -325,7 +335,7 @@ export const internalManifests: Array Promise import('./backoffice/property-actions/copy/property-action-copy.element'), meta: { @@ -335,7 +345,7 @@ export const internalManifests: Array Promise import('./backoffice/property-actions/clear/property-action-clear.element'), meta: { diff --git a/src/Umbraco.Web.UI.Client/temp-schema-generator/manifests.ts b/src/Umbraco.Web.UI.Client/temp-schema-generator/manifests.ts index 54e2bd1e38..8ec67f328e 100644 --- a/src/Umbraco.Web.UI.Client/temp-schema-generator/manifests.ts +++ b/src/Umbraco.Web.UI.Client/temp-schema-generator/manifests.ts @@ -80,6 +80,7 @@ export interface IManifest { } export interface MetaSection { + label: string; pathname: string; weight: number; }