request reload when item is saved
This commit is contained in:
@@ -22,6 +22,7 @@ import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registr
|
||||
import { UMB_PROPERTY_EDITOR_SCHEMA_ALIAS_DEFAULT } from '@umbraco-cms/backoffice/property-editor';
|
||||
import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action';
|
||||
import { UmbReloadTreeItemChildrenRequestEntityActionEvent } from '@umbraco-cms/backoffice/tree';
|
||||
import { UmbRequestReloadStructureForEntityEvent } from '@umbraco-cms/backoffice/event';
|
||||
|
||||
type EntityType = UmbDataTypeDetailModel;
|
||||
export class UmbDataTypeWorkspaceContext
|
||||
@@ -283,6 +284,14 @@ export class UmbDataTypeWorkspaceContext
|
||||
eventContext.dispatchEvent(event);
|
||||
} else {
|
||||
await this.repository.save(this.#currentData.value);
|
||||
|
||||
const actionEventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT);
|
||||
const event = new UmbRequestReloadStructureForEntityEvent({
|
||||
unique: this.getUnique()!,
|
||||
entityType: this.getEntityType(),
|
||||
});
|
||||
|
||||
actionEventContext.dispatchEvent(event);
|
||||
}
|
||||
|
||||
this.setIsNew(false);
|
||||
|
||||
@@ -9,6 +9,7 @@ import { UmbObjectState } from '@umbraco-cms/backoffice/observable-api';
|
||||
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
|
||||
import { UmbReloadTreeItemChildrenRequestEntityActionEvent } from '@umbraco-cms/backoffice/tree';
|
||||
import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action';
|
||||
import { UmbRequestReloadStructureForEntityEvent } from '@umbraco-cms/backoffice/event';
|
||||
|
||||
export class UmbDictionaryWorkspaceContext
|
||||
extends UmbEditableWorkspaceContextBase<UmbDictionaryDetailModel>
|
||||
@@ -111,6 +112,14 @@ export class UmbDictionaryWorkspaceContext
|
||||
this.setIsNew(false);
|
||||
} else {
|
||||
await this.detailRepository.save(this.#data.value);
|
||||
|
||||
const actionEventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT);
|
||||
const event = new UmbRequestReloadStructureForEntityEvent({
|
||||
unique: this.getUnique()!,
|
||||
entityType: this.getEntityType(),
|
||||
});
|
||||
|
||||
actionEventContext.dispatchEvent(event);
|
||||
}
|
||||
|
||||
const data = this.getData();
|
||||
|
||||
@@ -10,6 +10,7 @@ import type { UmbReferenceByUnique } from '@umbraco-cms/backoffice/models';
|
||||
import type { UmbSaveableWorkspaceContextInterface } from '@umbraco-cms/backoffice/workspace';
|
||||
import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action';
|
||||
import { UmbReloadTreeItemChildrenRequestEntityActionEvent } from '@umbraco-cms/backoffice/tree';
|
||||
import { UmbRequestReloadStructureForEntityEvent } from '@umbraco-cms/backoffice/event';
|
||||
|
||||
type EntityType = UmbDocumentTypeDetailModel;
|
||||
export class UmbDocumentTypeWorkspaceContext
|
||||
@@ -197,6 +198,14 @@ export class UmbDocumentTypeWorkspaceContext
|
||||
}
|
||||
} else {
|
||||
await this.structure.save();
|
||||
|
||||
const actionEventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT);
|
||||
const event = new UmbRequestReloadStructureForEntityEvent({
|
||||
unique: this.getUnique()!,
|
||||
entityType: this.getEntityType(),
|
||||
});
|
||||
|
||||
actionEventContext.dispatchEvent(event);
|
||||
}
|
||||
|
||||
this.setIsNew(false);
|
||||
|
||||
@@ -32,6 +32,7 @@ import { UmbLanguageCollectionRepository, type UmbLanguageDetailModel } from '@u
|
||||
import { firstValueFrom } from '@umbraco-cms/backoffice/external/rxjs';
|
||||
import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action';
|
||||
import { UmbReloadTreeItemChildrenRequestEntityActionEvent } from '@umbraco-cms/backoffice/tree';
|
||||
import { UmbRequestReloadStructureForEntityEvent } from '@umbraco-cms/backoffice/event';
|
||||
|
||||
type EntityType = UmbDocumentDetailModel;
|
||||
export class UmbDocumentWorkspaceContext
|
||||
@@ -458,6 +459,14 @@ export class UmbDocumentWorkspaceContext
|
||||
console.error('Error saving document', error);
|
||||
throw new Error('Error saving document');
|
||||
}
|
||||
|
||||
const actionEventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT);
|
||||
const event = new UmbRequestReloadStructureForEntityEvent({
|
||||
unique: this.getUnique()!,
|
||||
entityType: this.getEntityType(),
|
||||
});
|
||||
|
||||
actionEventContext.dispatchEvent(event);
|
||||
}
|
||||
|
||||
return selectedVariants;
|
||||
|
||||
@@ -11,6 +11,7 @@ import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import type { UmbReferenceByUnique } from '@umbraco-cms/backoffice/models';
|
||||
import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action';
|
||||
import { UmbReloadTreeItemChildrenRequestEntityActionEvent } from '@umbraco-cms/backoffice/tree';
|
||||
import { UmbRequestReloadStructureForEntityEvent } from '@umbraco-cms/backoffice/event';
|
||||
|
||||
type EntityType = UmbMediaTypeDetailModel;
|
||||
export class UmbMediaTypeWorkspaceContext
|
||||
@@ -161,6 +162,14 @@ export class UmbMediaTypeWorkspaceContext
|
||||
}
|
||||
} else {
|
||||
await this.structure.save();
|
||||
|
||||
const actionEventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT);
|
||||
const event = new UmbRequestReloadStructureForEntityEvent({
|
||||
unique: this.getUnique()!,
|
||||
entityType: this.getEntityType(),
|
||||
});
|
||||
|
||||
actionEventContext.dispatchEvent(event);
|
||||
}
|
||||
|
||||
this.setIsNew(false);
|
||||
|
||||
@@ -22,6 +22,7 @@ import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { UmbLanguageCollectionRepository, type UmbLanguageDetailModel } from '@umbraco-cms/backoffice/language';
|
||||
import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action';
|
||||
import { UmbReloadTreeItemChildrenRequestEntityActionEvent } from '@umbraco-cms/backoffice/tree';
|
||||
import { UmbRequestReloadStructureForEntityEvent } from '@umbraco-cms/backoffice/event';
|
||||
|
||||
type EntityType = UmbMediaDetailModel;
|
||||
export class UmbMediaWorkspaceContext
|
||||
@@ -339,6 +340,14 @@ export class UmbMediaWorkspaceContext
|
||||
}
|
||||
} else {
|
||||
await this.repository.save(this.#currentData.value);
|
||||
|
||||
const actionEventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT);
|
||||
const event = new UmbRequestReloadStructureForEntityEvent({
|
||||
unique: this.getUnique()!,
|
||||
entityType: this.getEntityType(),
|
||||
});
|
||||
|
||||
actionEventContext.dispatchEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import { UmbContentTypePropertyStructureManager } from '@umbraco-cms/backoffice/
|
||||
import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action';
|
||||
import { UmbReloadTreeItemChildrenRequestEntityActionEvent } from '@umbraco-cms/backoffice/tree';
|
||||
import { UmbBooleanState, UmbObjectState } from '@umbraco-cms/backoffice/observable-api';
|
||||
import { UmbRequestReloadStructureForEntityEvent } from '@umbraco-cms/backoffice/event';
|
||||
|
||||
type EntityType = UmbMemberTypeDetailModel;
|
||||
export class UmbMemberTypeWorkspaceContext
|
||||
@@ -109,6 +110,14 @@ export class UmbMemberTypeWorkspaceContext
|
||||
eventContext.dispatchEvent(event);
|
||||
} else {
|
||||
await this.structure.save();
|
||||
|
||||
const actionEventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT);
|
||||
const event = new UmbRequestReloadStructureForEntityEvent({
|
||||
unique: this.getUnique()!,
|
||||
entityType: this.getEntityType(),
|
||||
});
|
||||
|
||||
actionEventContext.dispatchEvent(event);
|
||||
}
|
||||
|
||||
this.setIsNew(false);
|
||||
|
||||
@@ -11,6 +11,7 @@ import { tryExecuteAndNotify } from '@umbraco-cms/backoffice/resources';
|
||||
import { PartialViewResource } from '@umbraco-cms/backoffice/external/backend-api';
|
||||
import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action';
|
||||
import { UmbReloadTreeItemChildrenRequestEntityActionEvent } from '@umbraco-cms/backoffice/tree';
|
||||
import { UmbRequestReloadStructureForEntityEvent } from '@umbraco-cms/backoffice/event';
|
||||
|
||||
export class UmbPartialViewWorkspaceContext
|
||||
extends UmbEditableWorkspaceContextBase<UmbPartialViewDetailModel>
|
||||
@@ -119,6 +120,14 @@ export class UmbPartialViewWorkspaceContext
|
||||
} else {
|
||||
const { data } = await this.repository.save(this.#data.value);
|
||||
newData = data;
|
||||
|
||||
const actionEventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT);
|
||||
const event = new UmbRequestReloadStructureForEntityEvent({
|
||||
unique: this.getUnique()!,
|
||||
entityType: this.getEntityType(),
|
||||
});
|
||||
|
||||
actionEventContext.dispatchEvent(event);
|
||||
}
|
||||
|
||||
if (newData) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import { UmbEditableWorkspaceContextBase } from '@umbraco-cms/backoffice/workspa
|
||||
import { loadCodeEditor } from '@umbraco-cms/backoffice/code-editor';
|
||||
import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action';
|
||||
import { UmbReloadTreeItemChildrenRequestEntityActionEvent } from '@umbraco-cms/backoffice/tree';
|
||||
import { UmbRequestReloadStructureForEntityEvent } from '@umbraco-cms/backoffice/event';
|
||||
|
||||
export class UmbScriptWorkspaceContext extends UmbEditableWorkspaceContextBase<UmbScriptDetailModel> {
|
||||
public readonly repository = new UmbScriptDetailRepository(this);
|
||||
@@ -104,6 +105,14 @@ export class UmbScriptWorkspaceContext extends UmbEditableWorkspaceContextBase<U
|
||||
} else {
|
||||
const { data } = await this.repository.save(this.#data.value);
|
||||
newData = data;
|
||||
|
||||
const actionEventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT);
|
||||
const event = new UmbRequestReloadStructureForEntityEvent({
|
||||
unique: this.getUnique()!,
|
||||
entityType: this.getEntityType(),
|
||||
});
|
||||
|
||||
actionEventContext.dispatchEvent(event);
|
||||
}
|
||||
|
||||
if (newData) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import { loadCodeEditor } from '@umbraco-cms/backoffice/code-editor';
|
||||
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
|
||||
import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action';
|
||||
import { UmbReloadTreeItemChildrenRequestEntityActionEvent } from '@umbraco-cms/backoffice/tree';
|
||||
import { UmbRequestReloadStructureForEntityEvent } from '@umbraco-cms/backoffice/event';
|
||||
|
||||
export class UmbStylesheetWorkspaceContext
|
||||
extends UmbEditableWorkspaceContextBase<UmbStylesheetDetailModel>
|
||||
@@ -112,6 +113,14 @@ export class UmbStylesheetWorkspaceContext
|
||||
} else {
|
||||
const { data } = await this.repository.save(this.#data.value);
|
||||
newData = data;
|
||||
|
||||
const actionEventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT);
|
||||
const event = new UmbRequestReloadStructureForEntityEvent({
|
||||
unique: this.getUnique()!,
|
||||
entityType: this.getEntityType(),
|
||||
});
|
||||
|
||||
actionEventContext.dispatchEvent(event);
|
||||
}
|
||||
|
||||
if (newData) {
|
||||
|
||||
@@ -10,6 +10,7 @@ import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
|
||||
import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action';
|
||||
import { UmbReloadTreeItemChildrenRequestEntityActionEvent } from '@umbraco-cms/backoffice/tree';
|
||||
import { UmbRequestReloadStructureForEntityEvent } from '@umbraco-cms/backoffice/event';
|
||||
|
||||
export class UmbTemplateWorkspaceContext
|
||||
extends UmbEditableWorkspaceContextBase<UmbTemplateDetailModel>
|
||||
@@ -171,6 +172,14 @@ ${currentContent}`;
|
||||
} else {
|
||||
const { data } = await this.detailRepository.save(this.#data.value);
|
||||
newData = data;
|
||||
|
||||
const actionEventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT);
|
||||
const event = new UmbRequestReloadStructureForEntityEvent({
|
||||
unique: this.getUnique()!,
|
||||
entityType: this.getEntityType(),
|
||||
});
|
||||
|
||||
actionEventContext.dispatchEvent(event);
|
||||
}
|
||||
|
||||
if (newData) {
|
||||
|
||||
Reference in New Issue
Block a user