Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { UMB_CONTENT_ROLLBACK_MODAL } from '../modal/constants.js';
import type { MetaEntityActionContentRollbackKind } from './types.js';
import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action';
import { umbOpenModal } from '@umbraco-cms/backoffice/modal';
import { UMB_NOTIFICATION_CONTEXT } from '@umbraco-cms/backoffice/notification';
import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action';
import { UmbLocalizationController } from '@umbraco-cms/backoffice/localization-api';
import { UMB_NOTIFICATION_CONTEXT } from '@umbraco-cms/backoffice/notification';

export class UmbContentRollbackEntityAction extends UmbEntityActionBase<MetaEntityActionContentRollbackKind> {
#localize = new UmbLocalizationController(this);
Expand All @@ -16,15 +16,11 @@ export class UmbContentRollbackEntityAction extends UmbEntityActionBase<MetaEnti
},
}).catch(() => undefined);

if (!result) return;
const entityType = result?.entityType || 'document';
const message = this.#localize.termOrDefault(`rollback_${entityType}RolledBack`, 'Content has been rolled back');
Comment thread
leekelleher marked this conversation as resolved.
Outdated

const notificationContext = await this.getContext(UMB_NOTIFICATION_CONTEXT);
if (!notificationContext) {
throw new Error('Notification context not found');
}
notificationContext.peek('positive', {
data: { message: this.#localize.term('rollback_documentRolledBack') },
});
notificationContext?.peek('positive', { data: { message } });
Comment thread
leekelleher marked this conversation as resolved.
Outdated
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { ManifestEntityAction, MetaEntityActionDefaultKind } from '@umbraco-cms/backoffice/entity-action';

export interface ManifestEntityActionContentRollbackKind
extends ManifestEntityAction<MetaEntityActionContentRollbackKind> {
export interface ManifestEntityActionContentRollbackKind extends ManifestEntityAction<MetaEntityActionContentRollbackKind> {
type: 'entityAction';
kind: 'contentRollback';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export class UmbContentRollbackModalElement extends UmbModalBaseElement<
const entityUpdatedEvent = new UmbEntityUpdatedEvent({ unique, entityType });
actionEventContext.dispatchEvent(entityUpdatedEvent);

this.value = {};
this.value = { unique, entityType };

this.modalContext?.submit();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { UmbEntityModel } from '@umbraco-cms/backoffice/entity';

export interface UmbContentRollbackModalData {
rollbackRepositoryAlias: string;
detailRepositoryAlias: string;
}

// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface UmbContentRollbackModalValue {}
export interface UmbContentRollbackModalValue extends UmbEntityModel {}
Loading