Skip to content

Commit 8434e2f

Browse files
committed
fix block workspace route
1 parent 414eab4 commit 8434e2f

File tree

9 files changed

+39
-48
lines changed

9 files changed

+39
-48
lines changed

src/packages/block/block-grid/context/block-grid-entries.context.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
1919
import { UmbModalRouteRegistrationController } from '@umbraco-cms/backoffice/router';
2020
import { pathFolderName } from '@umbraco-cms/backoffice/utils';
2121
import type { UmbNumberRangeValueType } from '@umbraco-cms/backoffice/models';
22+
import { UMB_PROPERTY_DATASET_CONTEXT } from '@umbraco-cms/backoffice/property';
2223

2324
interface UmbBlockGridAreaTypeInvalidRuleType {
2425
groupKey?: string;
@@ -200,6 +201,12 @@ export class UmbBlockGridEntriesContext
200201
const newPath = routeBuilder({});
201202
this._workspacePath.setValue(newPath);
202203
});
204+
205+
this.consumeContext(UMB_PROPERTY_DATASET_CONTEXT, (dataset) => {
206+
const variantId = dataset.getVariantId();
207+
this.#catalogueModal.setUniquePathValue('variantId', variantId?.toString());
208+
this.#workspaceModal.setUniquePathValue('variantId', variantId?.toString());
209+
});
203210
}
204211

205212
protected _gotBlockManager() {
@@ -216,16 +223,6 @@ export class UmbBlockGridEntriesContext
216223
},
217224
'observePropertyAlias',
218225
);
219-
220-
this.observe(
221-
this._manager.variantId,
222-
(variantId) => {
223-
// TODO: This might not be the property variant ID, but the content variant ID. Check up on what makes most sense?
224-
this.#catalogueModal.setUniquePathValue('variantId', variantId?.toString());
225-
this.#workspaceModal.setUniquePathValue('variantId', variantId?.toString());
226-
},
227-
'observePropertyAlias',
228-
);
229226
}
230227

231228
#gotAreaKey() {

src/packages/block/block-list/context/block-list-entries.context.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { UMB_BLOCK_LIST_MANAGER_CONTEXT } from './block-list-manager.context-tok
77
import { UmbBooleanState } from '@umbraco-cms/backoffice/observable-api';
88
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
99
import { UmbModalRouteRegistrationController } from '@umbraco-cms/backoffice/router';
10+
import { UMB_PROPERTY_DATASET_CONTEXT } from '@umbraco-cms/backoffice/property';
1011

1112
export class UmbBlockListEntriesContext extends UmbBlockEntriesContext<
1213
typeof UMB_BLOCK_LIST_MANAGER_CONTEXT,
@@ -81,6 +82,12 @@ export class UmbBlockListEntriesContext extends UmbBlockEntriesContext<
8182
const newPath = routeBuilder({});
8283
this._workspacePath.setValue(newPath);
8384
});
85+
86+
this.consumeContext(UMB_PROPERTY_DATASET_CONTEXT, (dataset) => {
87+
const variantId = dataset.getVariantId();
88+
this.#catalogueModal.setUniquePathValue('variantId', variantId?.toString());
89+
this.#workspaceModal.setUniquePathValue('variantId', variantId?.toString());
90+
});
8491
}
8592

8693
protected _gotBlockManager() {
@@ -109,16 +116,6 @@ export class UmbBlockListEntriesContext extends UmbBlockEntriesContext<
109116
},
110117
'observePropertyAlias',
111118
);
112-
113-
this.observe(
114-
this._manager.variantId,
115-
(variantId) => {
116-
// TODO: This might not be the property variant ID, but the content variant ID. Check up on what makes most sense?
117-
this.#catalogueModal.setUniquePathValue('variantId', variantId?.toString());
118-
this.#workspaceModal.setUniquePathValue('variantId', variantId?.toString());
119-
},
120-
'observePropertyAlias',
121-
);
122119
}
123120

124121
getPathForCreateBlock(index: number) {

src/packages/block/block-rte/context/block-rte-entries.context.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { UMB_BLOCK_RTE_MANAGER_CONTEXT } from './block-rte-manager.context-token
99
import { UmbBooleanState } from '@umbraco-cms/backoffice/observable-api';
1010
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
1111
import { UmbModalRouteRegistrationController } from '@umbraco-cms/backoffice/router';
12+
import { UMB_PROPERTY_DATASET_CONTEXT } from '@umbraco-cms/backoffice/property';
1213

1314
export class UmbBlockRteEntriesContext extends UmbBlockEntriesContext<
1415
typeof UMB_BLOCK_RTE_MANAGER_CONTEXT,
@@ -78,6 +79,12 @@ export class UmbBlockRteEntriesContext extends UmbBlockEntriesContext<
7879
const newPath = routeBuilder({});
7980
this._workspacePath.setValue(newPath);
8081
});
82+
83+
this.consumeContext(UMB_PROPERTY_DATASET_CONTEXT, (dataset) => {
84+
const variantId = dataset.getVariantId();
85+
this.#catalogueModal.setUniquePathValue('variantId', variantId?.toString());
86+
this.#workspaceModal.setUniquePathValue('variantId', variantId?.toString());
87+
});
8188
}
8289

8390
protected _gotBlockManager() {
@@ -106,16 +113,6 @@ export class UmbBlockRteEntriesContext extends UmbBlockEntriesContext<
106113
},
107114
'observePropertyAlias',
108115
);
109-
110-
this.observe(
111-
this._manager.variantId,
112-
(variantId) => {
113-
// TODO: This might not be the property variant ID, but the content variant ID. Check up on what makes most sense?
114-
this.#catalogueModal.setUniquePathValue('variantId', variantId?.toString());
115-
this.#workspaceModal.setUniquePathValue('variantId', variantId?.toString());
116-
},
117-
'observePropertyAlias',
118-
);
119116
}
120117

121118
getPathForCreateBlock() {

src/packages/block/block/workspace/block-element-manager.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,8 @@ export class UmbBlockElementManager extends UmbControllerBase {
125125

126126
/**
127127
* Get the current value of the property with the given alias and variantId.
128-
* @param alias
129-
* @param variantId
130-
* @returns The value or undefined if not set or found.
128+
* @param {string} alias - The alias of the property
129+
* @returns {ReturnType} The value or undefined if not set or found.
131130
*/
132131
async getPropertyValue<ReturnType = unknown>(alias: string) {
133132
await this.#getDataPromise;
@@ -144,9 +143,8 @@ export class UmbBlockElementManager extends UmbControllerBase {
144143

145144
/**
146145
* @function setPropertyValue
147-
* @param {string} alias
146+
* @param {string} alias - The alias of the property
148147
* @param {unknown} value - value can be a promise resolving into the actual value or the raw value it self.
149-
* @param {UmbVariantId | undefined} variantId - Optional variantId to filter by.
150148
* @returns {Promise<void>}
151149
* @description Set the value of this property.
152150
*/

src/packages/block/block/workspace/block-workspace.context.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,6 @@ export class UmbBlockWorkspaceContext<LayoutDataType extends UmbBlockLayoutBaseM
284284
#observeBlockData(unique: string) {
285285
if (!this.#blockEntries) {
286286
throw new Error('Block Entries not found');
287-
return;
288287
}
289288
this.observe(
290289
this.#blockEntries.layoutOf(unique),

src/packages/block/block/workspace/views/edit/block-workspace-view-edit.element.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export class UmbBlockWorkspaceViewEditElement extends UmbLitElement implements U
9090
this._tabs?.forEach((tab) => {
9191
const tabName = tab.name ?? '';
9292
routes.push({
93-
path: `tab/${encodeFolderName(tabName).toString()}`,
93+
path: `tab/${encodeFolderName(tabName)}`,
9494
component: () => import('./block-workspace-view-edit-tab.element.js'),
9595
setup: (component) => {
9696
(component as UmbBlockWorkspaceViewEditTabElement).managerName = this.#managerName;
@@ -112,10 +112,12 @@ export class UmbBlockWorkspaceViewEditElement extends UmbLitElement implements U
112112
}
113113

114114
if (routes.length !== 0) {
115-
routes.push({
116-
path: '',
117-
redirectTo: routes[0]?.path,
118-
});
115+
if (!this._hasRootGroups) {
116+
routes.push({
117+
path: '',
118+
redirectTo: routes[0]?.path,
119+
});
120+
}
119121
routes.push({
120122
path: `**`,
121123
component: async () => (await import('@umbraco-cms/backoffice/router')).UmbRouteNotFoundElement,

src/packages/core/content/workspace/views/edit/content-editor.element.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export class UmbContentWorkspaceViewEditElement extends UmbLitElement implements
8282
this._tabs?.forEach((tab) => {
8383
const tabName = tab.name ?? '';
8484
routes.push({
85-
path: `tab/${encodeFolderName(tabName).toString()}`,
85+
path: `tab/${encodeFolderName(tabName)}`,
8686
component: () => import('./content-editor-tab.element.js'),
8787
setup: (component) => {
8888
(component as UmbContentWorkspaceViewEditTabElement).containerId = tab.id;
@@ -102,10 +102,12 @@ export class UmbContentWorkspaceViewEditElement extends UmbLitElement implements
102102
}
103103

104104
if (routes.length !== 0) {
105-
routes.push({
106-
path: '',
107-
redirectTo: routes[0]?.path,
108-
});
105+
if (!this._hasRootGroups) {
106+
routes.push({
107+
path: '',
108+
redirectTo: routes[0]?.path,
109+
});
110+
}
109111

110112
routes.push({
111113
path: `**`,

src/packages/core/tree/entity-actions/duplicate-to/duplicate-to.action.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class UmbDuplicateToEntityAction extends UmbEntityActionBase<MetaEntityAc
4141
this.#reloadMenu();
4242
}
4343
} catch (error) {
44-
console.log(error);
44+
console.error(error);
4545
}
4646
}
4747

src/packages/user/user-group/collection/user-group-collection-header.element.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ export class UmbUserGroupCollectionHeaderElement extends UmbLitElement {
2020
#onSearch(event: InputEvent) {
2121
const target = event.target as HTMLInputElement;
2222
const query = target.value || '';
23-
console.log(this.#collectionContext);
2423
this.#debouncedSearch(query);
2524
}
2625

0 commit comments

Comments
 (0)