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: Default Workspace Kind + Collection Workspace View Kind #2309

Merged
merged 37 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
7fe0ecc
register default workspace kind
madsrasmussen Sep 17, 2024
40b3545
register kind types
madsrasmussen Sep 17, 2024
a2b1e09
render headline
madsrasmussen Sep 17, 2024
5bf46da
add const
madsrasmussen Sep 17, 2024
fcdb7c0
rename element
madsrasmussen Sep 17, 2024
3e3fce8
use editor in default workspace
madsrasmussen Sep 17, 2024
ea7887e
provide entity context from workspace
madsrasmussen Sep 17, 2024
c2bf292
register workspace view
madsrasmussen Sep 17, 2024
8f382a0
use default workspace kind
madsrasmussen Sep 17, 2024
6f72215
rename collection workspace view kind to contentCollection
madsrasmussen Sep 18, 2024
39cd78f
register collection workspace view kind
madsrasmussen Sep 18, 2024
2771097
utilize collection kind for user root
madsrasmussen Sep 18, 2024
7105e94
use collection kind on member root
madsrasmussen Sep 18, 2024
c922bc6
use collection kind for member group root
madsrasmussen Sep 18, 2024
476cd64
use collection kind for extension insight workspace
madsrasmussen Sep 18, 2024
3fd0c79
use collection workspace view for webhook root
madsrasmussen Sep 18, 2024
60d0ebb
use collection workspace view for languages
madsrasmussen Sep 18, 2024
f3fd727
Merge branch 'main' into v15/feature/collection-kind-workspace-view
madsrasmussen Sep 18, 2024
2a08359
use collection kind for relations
madsrasmussen Sep 18, 2024
565df41
use collection kind for user group root
madsrasmussen Sep 18, 2024
717054c
revert
madsrasmussen Sep 18, 2024
1276f85
clean up
madsrasmussen Sep 18, 2024
e8f1037
Revert "revert"
madsrasmussen Sep 18, 2024
d70c0af
clean up
madsrasmussen Sep 18, 2024
ffb52c7
Update entity-actions-bundle.element.ts
madsrasmussen Sep 18, 2024
7e829e9
fix linting
madsrasmussen Sep 18, 2024
db04aed
Merge branch 'main' into v15/feature/collection-kind-workspace-view
madsrasmussen Sep 19, 2024
c095425
Merge branch 'main' into v15/feature/collection-kind-workspace-view
madsrasmussen Sep 20, 2024
2a6b42e
Merge branch 'main' into v15/feature/collection-kind-workspace-view
madsrasmussen Sep 21, 2024
fffc640
Merge branch 'main' into v15/feature/collection-kind-workspace-view
madsrasmussen Sep 23, 2024
7640c42
Merge branch 'main' into v15/feature/collection-kind-workspace-view
madsrasmussen Sep 24, 2024
bcd4b52
Merge branch 'main' into v15/feature/collection-kind-workspace-view
madsrasmussen Sep 24, 2024
da7416a
Merge branch 'main' into v15/feature/collection-kind-workspace-view
madsrasmussen Sep 24, 2024
8c25ddf
Merge branch 'main' into v15/feature/collection-kind-workspace-view
madsrasmussen Sep 24, 2024
83cb339
Merge branch 'v15/fix/extend-entity-detail-workspace-base' into v15/f…
madsrasmussen Sep 25, 2024
ba78d05
Merge branch 'main' into v15/feature/collection-kind-workspace-view
madsrasmussen Sep 26, 2024
308ab3e
Merge branch 'main' into v15/feature/collection-kind-workspace-view
nielslyngsoe Sep 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/packages/core/collection/manifests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import type { UmbExtensionManifestKind } from '../extension-registry/registry.js';
import { manifest as collectionAliasCondition } from './collection-alias.manifest.js';
import { manifest as collectionBulkActionPermissionCondition } from './collection-bulk-action-permission.manifest.js';
import { manifests as workspaceViewManifests } from './workspace-view/manifests.js';

export const manifests: Array<UmbExtensionManifest> = [
export const manifests: Array<UmbExtensionManifest | UmbExtensionManifestKind> = [
...workspaceViewManifests,
collectionAliasCondition,
collectionBulkActionPermissionCondition,
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { ManifestWorkspaceViewCollectionKind } from './types.js';
import { html, customElement, property } from '@umbraco-cms/backoffice/external/lit';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';

const elementName = 'umb-collection-workspace-view';
@customElement(elementName)
export class UmbCollectionWorkspaceViewElement extends UmbLitElement {
@property({ type: Object, attribute: false })
manifest?: ManifestWorkspaceViewCollectionKind;

override render() {
if (!this.manifest) return html` <div>No Manifest</div>`;
if (!this.manifest.meta.collectionAlias) return html` <div>No Collection Alias in Manifest</div>`;
return html`<umb-collection alias=${this.manifest.meta.collectionAlias}></umb-collection>`;
}
}

export { UmbCollectionWorkspaceViewElement as element };

declare global {
interface HTMLElementTagNameMap {
[elementName]: UmbCollectionWorkspaceViewElement;
}
}
1 change: 1 addition & 0 deletions src/packages/core/collection/workspace-view/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './collection-workspace-view.element.js';
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { UmbExtensionManifestKind } from '@umbraco-cms/backoffice/extension-registry';

export const manifests: Array<UmbExtensionManifestKind> = [
export const manifests: Array<UmbExtensionManifest | UmbExtensionManifestKind> = [
{
type: 'kind',
alias: 'Umb.Kind.WorkspaceView.Collection',
Expand All @@ -9,12 +9,11 @@ export const manifests: Array<UmbExtensionManifestKind> = [
manifest: {
type: 'workspaceView',
kind: 'collection',
element: () => import('./workspace-view-collection.element.js'),
weight: 300,
element: () => import('./collection-workspace-view.element.js'),
meta: {
label: 'Collection',
pathname: 'collection',
icon: 'icon-grid',
icon: 'icon-layers',
},
},
},
Expand Down
17 changes: 17 additions & 0 deletions src/packages/core/collection/workspace-view/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { ManifestWorkspaceView, MetaWorkspaceView } from '@umbraco-cms/backoffice/workspace';

export interface ManifestWorkspaceViewCollectionKind extends ManifestWorkspaceView {
type: 'workspaceView';
kind: 'collection';
meta: MetaWorkspaceViewCollectionKind;
}

export interface MetaWorkspaceViewCollectionKind extends MetaWorkspaceView {
collectionAlias: string;
}

declare global {
interface UmbExtensionManifestMap {
umbManifestWorkspaceViewCollectionKind: ManifestWorkspaceViewCollectionKind;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class UmbEntityActionsBundleElement extends UmbLitElement {
protected override updated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void {
if (_changedProperties.has('entityType') && _changedProperties.has('unique')) {
this.#entityContext.setEntityType(this.entityType);
this.#entityContext.setUnique(this.unique);
this.#entityContext.setUnique(this.unique ?? null);
this.#observeEntityActions();
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { UmbEntityWorkspaceContext } from './entity-workspace-context.interface.js';
import type { Observable } from '@umbraco-cms/backoffice/external/rxjs';
import type { UmbContentTypeModel, UmbContentTypeStructureManager } from '@umbraco-cms/backoffice/content-type';
import type { UmbEntityWorkspaceContext } from '@umbraco-cms/backoffice/workspace';

export interface UmbCollectionWorkspaceContext<T extends UmbContentTypeModel> extends UmbEntityWorkspaceContext {
export interface UmbContentCollectionWorkspaceContext<T extends UmbContentTypeModel> extends UmbEntityWorkspaceContext {
contentTypeHasCollection: Observable<boolean>;
getCollectionAlias(): string;
structure: UmbContentTypeStructureManager<T>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import type { UmbCollectionBulkActionPermissions, UmbCollectionConfiguration } from '../../../collection/types.js';
import type { UmbCollectionBulkActionPermissions, UmbCollectionConfiguration } from '../../collection/types.js';
import { UMB_CONTENT_COLLECTION_WORKSPACE_CONTEXT } from './content-collection-workspace.context-token.js';
import { customElement, html, nothing, state } from '@umbraco-cms/backoffice/external/lit';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import { UmbDataTypeDetailRepository } from '@umbraco-cms/backoffice/data-type';
import { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor';
import { UMB_COLLECTION_WORKSPACE_CONTEXT } from '@umbraco-cms/backoffice/workspace';
import type { UmbDataTypeDetailModel } from '@umbraco-cms/backoffice/data-type';
import type { UmbWorkspaceViewElement } from '@umbraco-cms/backoffice/workspace';

@customElement('umb-workspace-view-collection')
export class UmbWorkspaceViewCollectionElement extends UmbLitElement implements UmbWorkspaceViewElement {
const elementName = 'umb-content-collection-workspace-view';
@customElement('umb-content-collection-workspace-view')
export class UmbContentCollectionWorkspaceViewElement extends UmbLitElement implements UmbWorkspaceViewElement {
@state()
private _loading = true;

Expand All @@ -29,7 +30,7 @@ export class UmbWorkspaceViewCollectionElement extends UmbLitElement implements
}

async #observeConfig() {
this.consumeContext(UMB_COLLECTION_WORKSPACE_CONTEXT, (workspaceContext) => {
this.consumeContext(UMB_CONTENT_COLLECTION_WORKSPACE_CONTEXT, (workspaceContext) => {
this._collectionAlias = workspaceContext.getCollectionAlias();
this._documentUnique = workspaceContext.getUnique() ?? '';

Expand Down Expand Up @@ -78,10 +79,10 @@ export class UmbWorkspaceViewCollectionElement extends UmbLitElement implements
}
}

export default UmbWorkspaceViewCollectionElement;
export { UmbContentCollectionWorkspaceViewElement as element };

declare global {
interface HTMLElementTagNameMap {
'umb-workspace-view-collection': UmbWorkspaceViewCollectionElement;
[elementName]: UmbContentCollectionWorkspaceViewElement;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { UmbContentCollectionWorkspaceContext } from './content-collection-workspace-context.interface.js';
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
import type { UmbContentTypeModel } from '@umbraco-cms/backoffice/content-type';
import type { UmbWorkspaceContext } from '@umbraco-cms/backoffice/workspace';

export const UMB_CONTENT_COLLECTION_WORKSPACE_CONTEXT = new UmbContextToken<
UmbWorkspaceContext,
UmbContentCollectionWorkspaceContext<UmbContentTypeModel>
>(
'UmbWorkspaceContext',
undefined,
(context): context is UmbContentCollectionWorkspaceContext<UmbContentTypeModel> =>
(context as UmbContentCollectionWorkspaceContext<UmbContentTypeModel>).contentTypeHasCollection !== undefined,
);
2 changes: 2 additions & 0 deletions src/packages/core/content/collection/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export type * from './content-collection-workspace-context.interface.js';
export * from './content-collection-workspace.context-token.js';
21 changes: 21 additions & 0 deletions src/packages/core/content/collection/manifests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { UmbExtensionManifestKind } from '@umbraco-cms/backoffice/extension-registry';

export const manifests: Array<UmbExtensionManifestKind> = [
{
type: 'kind',
alias: 'Umb.Kind.WorkspaceView.Content.Collection',
matchKind: 'contentCollection',
matchType: 'workspaceView',
manifest: {
type: 'workspaceView',
kind: 'contentCollection',
element: () => import('./content-collection-workspace-view.element.js'),
weight: 300,
meta: {
label: 'Collection',
pathname: 'collection',
icon: 'icon-grid',
},
},
},
];
12 changes: 12 additions & 0 deletions src/packages/core/content/collection/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { ManifestWorkspaceView, MetaWorkspaceView } from '@umbraco-cms/backoffice/workspace';

export interface ManifestWorkspaceViewContentCollectionKind extends ManifestWorkspaceView<MetaWorkspaceView> {
type: 'workspaceView';
kind: 'contentCollection';
}

declare global {
interface UmbExtensionManifestMap {
umbManifestWorkspaceViewContentCollectionKind: ManifestWorkspaceViewContentCollectionKind;
}
}
2 changes: 2 additions & 0 deletions src/packages/core/content/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export { UMB_CONTENT_PROPERTY_CONTEXT } from './content-property.context-token.js';
export { UmbContentPropertyContext } from './content-property.context.js';

export * from './property-dataset-context/content-property-dataset.context.js';
export * from './workspace/index.js';
export * from './collection/index.js';
9 changes: 5 additions & 4 deletions src/packages/core/entity/entity.context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { UMB_ENTITY_CONTEXT } from './entity.context-token.js';
import type { UmbEntityUnique } from './types.js';
import { UmbContextBase } from '@umbraco-cms/backoffice/class-api';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbStringState } from '@umbraco-cms/backoffice/observable-api';
Expand All @@ -12,7 +13,7 @@ export class UmbEntityContext extends UmbContextBase<UmbEntityContext> {
#entityType = new UmbStringState<string | undefined>(undefined);
public readonly entityType = this.#entityType.asObservable();

#unique = new UmbStringState<string | null | undefined>(undefined);
#unique = new UmbStringState<UmbEntityUnique>(null);
public readonly unique = this.#unique.asObservable();

/**
Expand Down Expand Up @@ -44,16 +45,16 @@ export class UmbEntityContext extends UmbContextBase<UmbEntityContext> {

/**
* Set the unique
* @param {string | null | undefined} unique
* @param {string | null} unique
* @memberof UmbEntityContext
*/
setUnique(unique: string | null | undefined) {
setUnique(unique: string | null) {
this.#unique.setValue(unique);
}

/**
* Get the unique
* @returns {string | null | undefined}
* @returns {string | null}
* @memberof UmbEntityContext
*/
getUnique() {
Expand Down
2 changes: 1 addition & 1 deletion src/packages/core/workspace/components/manifests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { manifests as workspaceActionManifests } from './workspace-action/manifests.js';
import { manifests as workspaceActionMenuItemManifests } from './workspace-action-menu-item/manifests.js';
import { manifests as workspaceBreadcrumbManifests } from './workspace-breadcrumb/manifests.js';
import { manifests as workspaceViewManifests } from './workspace-collection/manifests.js';
import { manifests as workspaceViewManifests } from '../../content/collection/manifests.js';
import type { UmbExtensionManifestKind } from '@umbraco-cms/backoffice/extension-registry';

export const manifests: Array<UmbExtensionManifest | UmbExtensionManifestKind> = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { UMB_WORKSPACE_CONTEXT, type UmbWorkspaceContext } from '../contexts/index.js';
import { UMB_WORKSPACE_CONTEXT } from '../workspace.context-token.js';
import type { UmbWorkspaceContext } from '../workspace-context.interface.js';
import type { WorkspaceAliasConditionConfig } from './types.js';
import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry';
import type {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UMB_WORKSPACE_CONTEXT } from '../contexts/index.js';
import { UMB_WORKSPACE_CONTEXT } from '../workspace.context-token.js';
import type { WorkspaceEntityTypeConditionConfig } from './types.js';
import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry';
import type {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UMB_COLLECTION_WORKSPACE_CONTEXT } from '../contexts/tokens/collection-workspace.context-token.js';
import { UMB_CONTENT_COLLECTION_WORKSPACE_CONTEXT } from '../../content/collection/content-collection-workspace.context-token.js';
import type { WorkspaceHasCollectionConditionConfig } from './types.js';
import { UMB_WORKSPACE_HAS_COLLECTION_CONDITION } from './const.js';
import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry';
Expand All @@ -18,7 +18,7 @@ export class UmbWorkspaceHasCollectionCondition
constructor(host: UmbControllerHost, args: UmbConditionControllerArguments<WorkspaceHasCollectionConditionConfig>) {
super(host, args);

this.consumeContext(UMB_COLLECTION_WORKSPACE_CONTEXT, (context) => {
this.consumeContext(UMB_CONTENT_COLLECTION_WORKSPACE_CONTEXT, (context) => {
this.observe(
context.contentTypeHasCollection,
(hasCollection) => {
Expand Down
31 changes: 0 additions & 31 deletions src/packages/core/workspace/contexts/default-workspace.context.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/packages/core/workspace/contexts/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from './default-workspace.context.js';
export * from './tokens/index.js';

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { UmbWorkspaceContext } from './workspace-context.interface.js';
import type { UmbWorkspaceContext } from '../../workspace-context.interface.js';
import type { UmbWorkspaceUniqueType } from './../../types.js';
import type { Observable } from '@umbraco-cms/backoffice/external/rxjs';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { UmbWorkspaceContext } from './workspace-context.interface.js';
import type { UmbWorkspaceContext } from '../../workspace-context.interface.js';
import type { UmbEntityWorkspaceContext } from './entity-workspace-context.interface.js';
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';

Expand Down
5 changes: 1 addition & 4 deletions src/packages/core/workspace/contexts/tokens/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
export * from './collection-workspace.context-token.js';
export * from './entity-workspace.context-token.js';
export * from './property-structure-workspace.context-token.js';
export * from './publishable-workspace.context-token.js';
export * from './routable-workspace.context-token.js';
export * from './submittable-workspace.context-token.js';
export * from './variant-workspace.context-token.js';
export * from './workspace.context-token.js';
export type * from './collection-workspace-context.interface.js';
export type * from './entity-workspace-context.interface.js';
export type * from './invariant-dataset-workspace-context.interface.js';
export type * from './property-structure-workspace-context.interface.js';
export type * from './publishable-workspace-context.interface.js';
export type * from './routable-workspace-context.interface.js';
export type * from './submittable-workspace-context.interface.js';
export type * from './variant-dataset-workspace-context.interface.js';
export type * from './workspace-context.interface.js';
export type * from '../../workspace-context.interface.js';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { UmbWorkspaceContext } from './workspace-context.interface.js';
import type { UmbWorkspaceContext } from '../../workspace-context.interface.js';
import type { UmbPropertyStructureWorkspaceContext } from './property-structure-workspace-context.interface.js';
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { UmbWorkspaceRouteManager } from '../../index.js';
import type { UmbWorkspaceContext } from './workspace-context.interface.js';
import type { UmbWorkspaceContext } from '../../workspace-context.interface.js';

export interface UmbRoutableWorkspaceContext extends UmbWorkspaceContext {
readonly routes: UmbWorkspaceRouteManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { UmbWorkspaceContext } from '../../workspace-context.interface.js';
import type { UmbRoutableWorkspaceContext } from './routable-workspace-context.interface.js';
import type { UmbWorkspaceContext } from './workspace-context.interface.js';
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';

export const UMB_ROUTABLE_WORKSPACE_CONTEXT = new UmbContextToken<UmbWorkspaceContext, UmbRoutableWorkspaceContext>(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { UmbWorkspaceContext } from './workspace-context.interface.js';
import type { UmbWorkspaceContext } from '../../workspace-context.interface.js';
import type { UmbVariantDatasetWorkspaceContext } from './variant-dataset-workspace-context.interface.js';
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';

Expand Down
Loading
Loading