Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: workspace info app extension #18014

Draft
wants to merge 15 commits into
base: v15/dev
Choose a base branch
from
Draft
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type * from './workspace-info-app.extension.js';
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { ManifestElement, ManifestWithDynamicConditions } from '@umbraco-cms/backoffice/extension-api';

export interface UmbWorkspaceInfoAppElement extends HTMLElement {
manifest?: ManifestWorkspaceInfoApp;
}

export interface ManifestWorkspaceInfoApp
extends ManifestElement<UmbWorkspaceInfoAppElement>,
ManifestWithDynamicConditions<UmbExtensionConditionConfig> {
type: 'workspaceInfoApp';
meta: MetaWorkspaceInfoApp;
}

export interface MetaWorkspaceInfoApp {
label: string;
}

declare global {
interface UmbExtensionManifestMap {
umbWorkspaceInfoApp: ManifestWorkspaceInfoApp;
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import type { UmbEntityUnique } from '@umbraco-cms/backoffice/entity';

export type * from './extensions/types.js';
export type * from './kinds/types.js';
export type * from './conditions/types.js';
export type * from './data-manager/types.js';
export type * from './workspace-context.interface.js';
export type * from './extensions/types.js';
export type * from './info/types.js';
export type * from './kinds/types.js';
export type * from './namable/types.js';
export type * from './workspace-context.interface.js';

/**
* @deprecated Use `UmbEntityUnique`instead.
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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);
Expand Down Expand Up @@ -98,19 +99,18 @@ export class UmbDocumentWorkspaceViewInfoHistoryElement extends UmbLitElement {

override render() {
return html`
<uui-box headline=${this.localize.term('general_history')}>
<umb-extension-with-api-slot
<umb-extension-with-api-slot
slot="header-actions"
type="entityAction"
.filter=${(manifest: ManifestEntityAction) => this.#allowedActions.has(manifest.alias)}></umb-extension-with-api-slot>
</uui-button>
.filter=${(manifest: ManifestEntityAction) =>
this.#allowedActions.has(manifest.alias)}></umb-extension-with-api-slot>

${when(
this._items,
() => this.#renderHistory(),
() => html`<div id="loader"><uui-loader></uui-loader></div>`,
)}
${this.#renderPagination()}
</uui-box>
`;
}

Expand Down Expand Up @@ -162,6 +162,11 @@ export class UmbDocumentWorkspaceViewInfoHistoryElement extends UmbLitElement {
static override styles = [
UmbTextStyles,
css`
:host {
display: block;
padding: var(--uui-size-space-4) var(--uui-size-space-5);
}

#loader {
display: flex;
justify-content: center;
Expand All @@ -183,10 +188,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;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { UMB_DOCUMENT_WORKSPACE_ALIAS } from '../../workspace/constants.js';
import { UMB_WORKSPACE_CONDITION_ALIAS } from '@umbraco-cms/backoffice/workspace';

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: 80,
meta: {
label: '#general_history',
},
conditions: [
{
alias: UMB_WORKSPACE_CONDITION_ALIAS,
match: UMB_DOCUMENT_WORKSPACE_ALIAS,
},
],
},
];
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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',
};
Original file line number Diff line number Diff line change
@@ -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];
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
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';
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';
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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,
Expand All @@ -34,6 +37,7 @@ export const manifests: Array<UmbExtensionManifest | UmbExtensionManifestKind> =
...searchProviderManifests,
...trackedReferenceManifests,
...treeManifests,
...urlManifests,
...userPermissionManifests,
...workspaceManifests,
];
Loading
Loading