register links and history as info apps

This commit is contained in:
Mads Rasmussen
2025-01-16 15:07:54 +01:00
parent 37343b24bb
commit 04f7da81ec
26 changed files with 69 additions and 37 deletions

View File

@@ -1,7 +1,8 @@
import type { UmbDocumentAuditLogModel } from '../../../audit-log/types.js';
import { UmbDocumentAuditLogRepository } from '../../../audit-log/index.js';
import { UMB_DOCUMENT_WORKSPACE_CONTEXT } from '../../document-workspace.context-token.js';
import { getDocumentHistoryTagStyleAndText, TimeOptions } from './utils.js';
import { UmbDocumentAuditLogRepository } from '../repository/index.js';
import { UMB_DOCUMENT_WORKSPACE_CONTEXT } from '../../workspace/constants.js';
import type { UmbDocumentAuditLogModel } from '../types.js';
import { TimeOptions } from '../../utils.js';
import { getDocumentHistoryTagStyleAndText } from './utils.js';
import { css, customElement, html, nothing, repeat, state, when } from '@umbraco-cms/backoffice/external/lit';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import { UmbPaginationManager } from '@umbraco-cms/backoffice/utils';
@@ -13,8 +14,8 @@ import type { ManifestEntityAction } from '@umbraco-cms/backoffice/entity-action
import type { UmbUserItemModel } from '@umbraco-cms/backoffice/user';
import type { UUIPaginationEvent } from '@umbraco-cms/backoffice/external/uui';
@customElement('umb-document-workspace-view-info-history')
export class UmbDocumentWorkspaceViewInfoHistoryElement extends UmbLitElement {
@customElement('umb-document-history-workspace-info-app')
export class UmbDocumentHistoryWorkspaceInfoAppElement extends UmbLitElement {
#allowedActions = new Set(['Umb.EntityAction.Document.Rollback']);
#auditLogRepository = new UmbDocumentAuditLogRepository(this);
@@ -183,10 +184,10 @@ export class UmbDocumentWorkspaceViewInfoHistoryElement extends UmbLitElement {
];
}
export default UmbDocumentWorkspaceViewInfoHistoryElement;
export default UmbDocumentHistoryWorkspaceInfoAppElement;
declare global {
interface HTMLElementTagNameMap {
'umb-document-workspace-view-info-history': UmbDocumentWorkspaceViewInfoHistoryElement;
'umb-document-history-workspace-info-app': UmbDocumentHistoryWorkspaceInfoAppElement;
}
}

View File

@@ -0,0 +1,9 @@
export const manifests: Array<UmbExtensionManifest> = [
{
type: 'workspaceInfoApp',
name: 'Document History Workspace Info App',
alias: 'Umb.WorkspaceInfoApp.Document.History',
element: () => import('./document-history-workspace-info-app.element.js'),
weight: 90,
},
];

View File

@@ -1,4 +1,4 @@
import { UmbDocumentAuditLog, type UmbDocumentAuditLogType } from '../../../audit-log/utils/index.js';
import { UmbDocumentAuditLog, type UmbDocumentAuditLogType } from '../utils/index.js';
interface HistoryStyleMap {
look: 'default' | 'primary' | 'secondary' | 'outline' | 'placeholder';
@@ -137,12 +137,3 @@ export function getDocumentHistoryTagStyleAndText(type: UmbDocumentAuditLogType)
};
}
}
export const TimeOptions: Intl.DateTimeFormatOptions = {
year: 'numeric',
month: 'long',
day: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
};

View File

@@ -0,0 +1,4 @@
import { manifests as infoAppManifests } from './info-app/manifests.js';
import type { UmbExtensionManifestKind } from '@umbraco-cms/backoffice/extension-registry';
export const manifests: Array<UmbExtensionManifest | UmbExtensionManifestKind> = [...infoAppManifests];

View File

@@ -12,5 +12,6 @@ export * from './reference/constants.js';
export * from './repository/constants.js';
export * from './rollback/constants.js';
export * from './search/constants.js';
export * from './url/constants.js';
export * from './user-permissions/constants.js';
export * from './workspace/constants.js';

View File

@@ -1,9 +1,9 @@
import './components/index.js';
export { UmbDocumentAuditLogRepository } from './audit-log/index.js';
export * from './audit-log/index.js';
export * from './components/index.js';
export * from './entity-actions/index.js';
export * from './constants.js';
export * from './entity-actions/index.js';
export * from './global-contexts/index.js';
export * from './modals/index.js';
export * from './paths.js';
@@ -11,6 +11,7 @@ export * from './publishing/index.js';
export * from './recycle-bin/index.js';
export * from './reference/index.js';
export * from './repository/index.js';
export * from './url/index.js';
export * from './user-permissions/index.js';
export * from './tree/index.js';

View File

@@ -1,3 +1,4 @@
import { manifests as auditLogManifests } from './audit-log/manifests.js';
import { manifests as collectionManifests } from './collection/manifests.js';
import { manifests as entityActionManifests } from './entity-actions/manifests.js';
import { manifests as entityBulkActionManifests } from './entity-bulk-actions/manifests.js';
@@ -13,12 +14,14 @@ import { manifests as rollbackManifests } from './rollback/manifests.js';
import { manifests as searchProviderManifests } from './search/manifests.js';
import { manifests as trackedReferenceManifests } from './reference/manifests.js';
import { manifests as treeManifests } from './tree/manifests.js';
import { manifests as urlManifests } from './url/manifests.js';
import { manifests as userPermissionManifests } from './user-permissions/manifests.js';
import { manifests as workspaceManifests } from './workspace/manifests.js';
import type { UmbExtensionManifestKind } from '@umbraco-cms/backoffice/extension-registry';
export const manifests: Array<UmbExtensionManifest | UmbExtensionManifestKind> = [
...auditLogManifests,
...collectionManifests,
...entityActionManifests,
...entityBulkActionManifests,
@@ -34,6 +37,7 @@ export const manifests: Array<UmbExtensionManifest | UmbExtensionManifestKind> =
...searchProviderManifests,
...trackedReferenceManifests,
...treeManifests,
...urlManifests,
...userPermissionManifests,
...workspaceManifests,
];

View File

@@ -1,4 +1,3 @@
export * from './detail/constants.js';
export * from './item/constants.js';
export * from './url/constants.js';
export * from './validation/constants.js';

View File

@@ -1,6 +1,5 @@
export { UmbDocumentDetailRepository } from './detail/index.js';
export { UmbDocumentItemRepository } from './item/index.js';
export { UmbDocumentUrlRepository, UMB_DOCUMENT_URL_REPOSITORY_ALIAS } from './url/index.js';
export { UmbDocumentPreviewRepository } from './preview/index.js';
export * from './constants.js';

View File

@@ -1,5 +1,4 @@
import { manifests as detailManifests } from './detail/manifests.js';
import { manifests as itemManifests } from './item/manifests.js';
import { manifests as urlManifests } from './url/manifests.js';
export const manifests: Array<UmbExtensionManifest> = [...detailManifests, ...itemManifests, ...urlManifests];
export const manifests: Array<UmbExtensionManifest> = [...detailManifests, ...itemManifests];

View File

@@ -0,0 +1 @@
export * from './repository/constants.js';

View File

@@ -0,0 +1,3 @@
export { UmbDocumentUrlRepository, UMB_DOCUMENT_URL_REPOSITORY_ALIAS } from './repository/index.js';
export * from './constants.js';

View File

@@ -1,7 +1,7 @@
import { UmbDocumentUrlRepository } from '../../../repository/url/document-url.repository.js';
import { UMB_DOCUMENT_WORKSPACE_CONTEXT } from '../../document-workspace.context-token.js';
import type { UmbDocumentVariantOptionModel } from '../../../types.js';
import type { UmbDocumentUrlModel } from '../../../repository/url/types.js';
import { UmbDocumentUrlRepository } from '../repository/index.js';
import type { UmbDocumentVariantOptionModel } from '../../types.js';
import { UMB_DOCUMENT_WORKSPACE_CONTEXT } from '../../workspace/constants.js';
import type { UmbDocumentUrlModel } from '../repository/types.js';
import { css, customElement, html, nothing, repeat, state, when } from '@umbraco-cms/backoffice/external/lit';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import type { UmbEntityActionEvent } from '@umbraco-cms/backoffice/entity-action';
@@ -18,8 +18,8 @@ interface UmbDocumentInfoViewLink {
state: DocumentVariantStateModel | null | undefined;
}
@customElement('umb-document-workspace-view-info-links')
export class UmbDocumentWorkspaceViewInfoLinksElement extends UmbLitElement {
@customElement('umb-document-links-workspace-info-app')
export class UmbDocumentLinksWorkspaceInfoAppElement extends UmbLitElement {
#documentUrlRepository = new UmbDocumentUrlRepository(this);
@state()
@@ -284,10 +284,10 @@ export class UmbDocumentWorkspaceViewInfoLinksElement extends UmbLitElement {
];
}
export default UmbDocumentWorkspaceViewInfoLinksElement;
export default UmbDocumentLinksWorkspaceInfoAppElement;
declare global {
interface HTMLElementTagNameMap {
'umb-document-workspace-view-info-links': UmbDocumentWorkspaceViewInfoLinksElement;
'umb-document-links-workspace-info-app': UmbDocumentLinksWorkspaceInfoAppElement;
}
}

View File

@@ -0,0 +1,9 @@
export const manifests: Array<UmbExtensionManifest> = [
{
type: 'workspaceInfoApp',
name: 'Document Links Workspace Info App',
alias: 'Umb.WorkspaceInfoApp.Document.Links',
element: () => import('./document-links-workspace-info-app.element.js'),
weight: 100,
},
];

View File

@@ -0,0 +1,4 @@
import { manifests as infoAppManifests } from './info-app/manifests.js';
import { manifests as repositoryManifests } from './repository/manifests.js';
export const manifests: Array<UmbExtensionManifest> = [...repositoryManifests, ...infoAppManifests];

View File

@@ -37,3 +37,12 @@ export const sortVariants = (a: VariantType, b: VariantType) => {
return compareDefault(a, b) || compareMandatory(a, b) || compareState(a, b) || compareName(a, b);
};
export const TimeOptions: Intl.DateTimeFormatOptions = {
year: 'numeric',
month: 'long',
day: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
};

View File

@@ -0,0 +1 @@
export * from './document-workspace.context-token.js';

View File

@@ -1,7 +1,7 @@
import { UMB_DOCUMENT_PROPERTY_DATASET_CONTEXT, UMB_DOCUMENT_WORKSPACE_CONTEXT } from '../../../constants.js';
import type { UmbDocumentVariantModel } from '../../../types.js';
import { UMB_DOCUMENT_PUBLISHING_WORKSPACE_CONTEXT } from '../../../publishing/index.js';
import { TimeOptions } from './utils.js';
import { TimeOptions } from '../../../utils.js';
import { css, customElement, html, ifDefined, nothing, state } from '@umbraco-cms/backoffice/external/lit';
import { DocumentVariantStateModel } from '@umbraco-cms/backoffice/external/backend-api';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
@@ -16,8 +16,6 @@ import { UMB_SECTION_USER_PERMISSION_CONDITION_ALIAS } from '@umbraco-cms/backof
import { UMB_SETTINGS_SECTION_ALIAS } from '@umbraco-cms/backoffice/settings';
// import of local components
import './document-workspace-view-info-links.element.js';
import './document-workspace-view-info-history.element.js';
import './document-workspace-view-info-reference.element.js';
@customElement('umb-document-workspace-view-info')
@@ -182,10 +180,9 @@ export class UmbDocumentWorkspaceViewInfoElement extends UmbLitElement {
override render() {
return html`
<div class="container">
<umb-document-workspace-view-info-links></umb-document-workspace-view-info-links>
<umb-extension-slot id="workspace-info-apps" type="workspaceInfoApp"></umb-extension-slot>
<umb-document-workspace-view-info-reference
.documentUnique=${this._documentUnique}></umb-document-workspace-view-info-reference>
<umb-document-workspace-view-info-history></umb-document-workspace-view-info-history>
</div>
<div class="container">
<uui-box headline=${this.localize.term('general_general')} id="general-section">