Skip to content

Commit 30c4408

Browse files
authored
Merge pull request #18014 from umbraco/v15/feature/workspace-info-app-extension
Feature: workspace info app extension
2 parents c448190 + dab3977 commit 30c4408

File tree

69 files changed

+562
-263
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+562
-263
lines changed
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
import './entity-detail/global-components/index.js';
2-
31
export * from './components/index.js';
42
export * from './conditions/const.js';
53
export * from './constants.js';
64
export * from './contexts/index.js';
75
export * from './controllers/index.js';
8-
export * from './entity-detail/global-components/index.js';
96
export * from './entity-detail/index.js';
107
export * from './entity/index.js';
8+
export * from './info-app/index.js';
119
export * from './modals/index.js';
1210
export * from './paths.js';
1311
export * from './submittable/index.js';
1412
export * from './utils/object-to-property-value-array.function.js';
1513
export * from './workspace-property-dataset/index.js';
1614
export * from './workspace.context-token.js';
1715
export * from './workspace.element.js';
16+
1817
export type * from './types.js';
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import './workspace-info-app-layout.element.js';
2+
3+
export * from './workspace-info-app-layout.element.js';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { css, customElement, html, ifDefined, property } from '@umbraco-cms/backoffice/external/lit';
2+
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
3+
4+
@customElement('umb-workspace-info-app-layout')
5+
export class UmbWorkspaceInfoAppLayoutElement extends UmbLitElement {
6+
@property({ type: String })
7+
headline?: string;
8+
9+
protected override render() {
10+
return html`
11+
<uui-box headline=${ifDefined(this.headline ? this.localize.string(this.headline) : undefined)}>
12+
<slot name="header-actions" slot="header-actions"></slot>
13+
<slot></slot>
14+
</uui-box>
15+
`;
16+
}
17+
18+
static override styles = [
19+
css`
20+
uui-box {
21+
--uui-box-default-padding: 0;
22+
}
23+
`,
24+
];
25+
}
26+
27+
declare global {
28+
interface HTMLElementTagNameMap {
29+
'umb-workspace-info-app-layout': UmbWorkspaceInfoAppLayoutElement;
30+
}
31+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import './global-components/index.js';
2+
3+
export * from './global-components/index.js';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export type * from './workspace-info-app.extension.js';
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import type { ManifestElement, ManifestWithDynamicConditions } from '@umbraco-cms/backoffice/extension-api';
2+
3+
export interface UmbWorkspaceInfoAppElement extends HTMLElement {
4+
manifest?: ManifestWorkspaceInfoApp;
5+
}
6+
7+
export interface ManifestWorkspaceInfoApp
8+
extends ManifestElement<UmbWorkspaceInfoAppElement>,
9+
ManifestWithDynamicConditions<UmbExtensionConditionConfig> {
10+
type: 'workspaceInfoApp';
11+
meta: MetaWorkspaceInfoApp;
12+
}
13+
14+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
15+
export interface MetaWorkspaceInfoApp {}
16+
17+
declare global {
18+
interface UmbExtensionManifestMap {
19+
umbWorkspaceInfoApp: ManifestWorkspaceInfoApp;
20+
}
21+
}

src/Umbraco.Web.UI.Client/src/packages/core/workspace/types.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import type { UmbEntityUnique } from '@umbraco-cms/backoffice/entity';
22

3-
export type * from './extensions/types.js';
4-
export type * from './kinds/types.js';
53
export type * from './conditions/types.js';
64
export type * from './data-manager/types.js';
7-
export type * from './workspace-context.interface.js';
5+
export type * from './extensions/types.js';
6+
export type * from './info-app/types.js';
7+
export type * from './kinds/types.js';
88
export type * from './namable/types.js';
9+
export type * from './workspace-context.interface.js';
910

1011
/**
1112
* @deprecated Use `UmbEntityUnique`instead.
Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import type { UmbDocumentAuditLogModel } from '../../../audit-log/types.js';
2-
import { UmbDocumentAuditLogRepository } from '../../../audit-log/index.js';
3-
import { UMB_DOCUMENT_WORKSPACE_CONTEXT } from '../../document-workspace.context-token.js';
4-
import { getDocumentHistoryTagStyleAndText, TimeOptions } from './utils.js';
1+
import { UmbDocumentAuditLogRepository } from '../repository/index.js';
2+
import { UMB_DOCUMENT_WORKSPACE_CONTEXT } from '../../workspace/constants.js';
3+
import type { UmbDocumentAuditLogModel } from '../types.js';
4+
import { TimeOptions } from '../../utils.js';
5+
import { getDocumentHistoryTagStyleAndText } from './utils.js';
56
import { css, customElement, html, nothing, repeat, state, when } from '@umbraco-cms/backoffice/external/lit';
67
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
78
import { UmbPaginationManager } from '@umbraco-cms/backoffice/utils';
@@ -13,8 +14,8 @@ import type { ManifestEntityAction } from '@umbraco-cms/backoffice/entity-action
1314
import type { UmbUserItemModel } from '@umbraco-cms/backoffice/user';
1415
import type { UUIPaginationEvent } from '@umbraco-cms/backoffice/external/uui';
1516

16-
@customElement('umb-document-workspace-view-info-history')
17-
export class UmbDocumentWorkspaceViewInfoHistoryElement extends UmbLitElement {
17+
@customElement('umb-document-history-workspace-info-app')
18+
export class UmbDocumentHistoryWorkspaceInfoAppElement extends UmbLitElement {
1819
#allowedActions = new Set(['Umb.EntityAction.Document.Rollback']);
1920

2021
#auditLogRepository = new UmbDocumentAuditLogRepository(this);
@@ -98,19 +99,22 @@ export class UmbDocumentWorkspaceViewInfoHistoryElement extends UmbLitElement {
9899

99100
override render() {
100101
return html`
101-
<uui-box headline=${this.localize.term('general_history')}>
102+
<umb-workspace-info-app-layout headline="#general_history">
102103
<umb-extension-with-api-slot
103-
slot="header-actions"
104-
type="entityAction"
105-
.filter=${(manifest: ManifestEntityAction) => this.#allowedActions.has(manifest.alias)}></umb-extension-with-api-slot>
106-
</uui-button>
107-
${when(
108-
this._items,
109-
() => this.#renderHistory(),
110-
() => html`<div id="loader"><uui-loader></uui-loader></div>`,
111-
)}
112-
${this.#renderPagination()}
113-
</uui-box>
104+
slot="header-actions"
105+
type="entityAction"
106+
.filter=${(manifest: ManifestEntityAction) =>
107+
this.#allowedActions.has(manifest.alias)}></umb-extension-with-api-slot>
108+
109+
<div id="content">
110+
${when(
111+
this._items,
112+
() => this.#renderHistory(),
113+
() => html`<div id="loader"><uui-loader></uui-loader></div>`,
114+
)}
115+
${this.#renderPagination()}
116+
</div>
117+
</umb-workspace-info-app-layout>
114118
`;
115119
}
116120

@@ -162,6 +166,11 @@ export class UmbDocumentWorkspaceViewInfoHistoryElement extends UmbLitElement {
162166
static override styles = [
163167
UmbTextStyles,
164168
css`
169+
#content {
170+
display: block;
171+
padding: var(--uui-size-space-4) var(--uui-size-space-5);
172+
}
173+
165174
#loader {
166175
display: flex;
167176
justify-content: center;
@@ -173,6 +182,12 @@ export class UmbDocumentWorkspaceViewInfoHistoryElement extends UmbLitElement {
173182
gap: var(--uui-size-layout-1);
174183
}
175184
185+
.log-type uui-tag {
186+
height: fit-content;
187+
margin-top: auto;
188+
margin-bottom: auto;
189+
}
190+
176191
uui-pagination {
177192
flex: 1;
178193
display: flex;
@@ -183,10 +198,10 @@ export class UmbDocumentWorkspaceViewInfoHistoryElement extends UmbLitElement {
183198
];
184199
}
185200

186-
export default UmbDocumentWorkspaceViewInfoHistoryElement;
201+
export default UmbDocumentHistoryWorkspaceInfoAppElement;
187202

188203
declare global {
189204
interface HTMLElementTagNameMap {
190-
'umb-document-workspace-view-info-history': UmbDocumentWorkspaceViewInfoHistoryElement;
205+
'umb-document-history-workspace-info-app': UmbDocumentHistoryWorkspaceInfoAppElement;
191206
}
192207
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { UMB_DOCUMENT_WORKSPACE_ALIAS } from '../../workspace/constants.js';
2+
import { UMB_WORKSPACE_CONDITION_ALIAS } from '@umbraco-cms/backoffice/workspace';
3+
4+
export const manifests: Array<UmbExtensionManifest> = [
5+
{
6+
type: 'workspaceInfoApp',
7+
name: 'Document History Workspace Info App',
8+
alias: 'Umb.WorkspaceInfoApp.Document.History',
9+
element: () => import('./document-history-workspace-info-app.element.js'),
10+
weight: 80,
11+
conditions: [
12+
{
13+
alias: UMB_WORKSPACE_CONDITION_ALIAS,
14+
match: UMB_DOCUMENT_WORKSPACE_ALIAS,
15+
},
16+
],
17+
},
18+
];

src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/views/info/utils.ts renamed to src/Umbraco.Web.UI.Client/src/packages/documents/documents/audit-log/info-app/utils.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { UmbDocumentAuditLog, type UmbDocumentAuditLogType } from '../../../audit-log/utils/index.js';
1+
import { UmbDocumentAuditLog, type UmbDocumentAuditLogType } from '../utils/index.js';
22

33
interface HistoryStyleMap {
44
look: 'default' | 'primary' | 'secondary' | 'outline' | 'placeholder';
@@ -137,12 +137,3 @@ export function getDocumentHistoryTagStyleAndText(type: UmbDocumentAuditLogType)
137137
};
138138
}
139139
}
140-
141-
export const TimeOptions: Intl.DateTimeFormatOptions = {
142-
year: 'numeric',
143-
month: 'long',
144-
day: 'numeric',
145-
hour: 'numeric',
146-
minute: 'numeric',
147-
second: 'numeric',
148-
};

0 commit comments

Comments
 (0)