a bit of clean up
This commit is contained in:
@@ -1,16 +1,9 @@
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api';
|
||||
import { type UmbApi, UmbExtensionApiInitializer } from '@umbraco-cms/backoffice/extension-api';
|
||||
import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import type { UmbApi } from '@umbraco-cms/backoffice/extension-api';
|
||||
|
||||
export class UmbActionBase<RepositoryType> extends UmbControllerBase implements UmbApi {
|
||||
repository?: RepositoryType;
|
||||
|
||||
constructor(host: UmbControllerHost, repositoryAlias: string) {
|
||||
export abstract class UmbActionBase extends UmbControllerBase implements UmbApi {
|
||||
constructor(host: UmbControllerHost) {
|
||||
super(host);
|
||||
|
||||
new UmbExtensionApiInitializer(this, umbExtensionsRegistry, repositoryAlias, [this._host], (permitted, ctrl) => {
|
||||
this.repository = permitted ? (ctrl.api as RepositoryType) : undefined;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,12 @@
|
||||
import type { UmbAction } from '../action/index.js';
|
||||
import { UmbActionBase } from '../action/index.js';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
|
||||
/**
|
||||
* Interface for an entity action.
|
||||
* @export
|
||||
* @interface UmbEntityAction<RepositoryType>
|
||||
* @extends {UmbAction<RepositoryType>}
|
||||
* @template RepositoryType
|
||||
* @interface UmbEntityAction
|
||||
*/
|
||||
export interface UmbEntityAction<RepositoryType> extends UmbAction<RepositoryType> {
|
||||
/**
|
||||
* The unique identifier of the entity.
|
||||
* @type {string}
|
||||
*/
|
||||
unique: string;
|
||||
export interface UmbEntityAction<ArgsMetaType> {
|
||||
args: UmbEntityActionArgs<ArgsMetaType>;
|
||||
|
||||
/**
|
||||
* The href location, the action will act as a link.
|
||||
@@ -33,32 +25,18 @@ export interface UmbEntityAction<RepositoryType> extends UmbAction<RepositoryTyp
|
||||
* Base class for an entity action.
|
||||
* @export
|
||||
* @abstract
|
||||
* @class UmbEntityActionBase<RepositoryType>
|
||||
* @extends {UmbActionBase<RepositoryType>}
|
||||
* @implements {UmbEntityAction<RepositoryType>}
|
||||
* @class UmbEntityActionBase
|
||||
* @extends {UmbActionBase}
|
||||
* @implements {UmbEntityAction}
|
||||
* @template RepositoryType
|
||||
*/
|
||||
export abstract class UmbEntityActionBase<RepositoryType>
|
||||
extends UmbActionBase<RepositoryType>
|
||||
implements UmbEntityAction<RepositoryType>
|
||||
{
|
||||
entityType: string;
|
||||
unique: string;
|
||||
repositoryAlias: string;
|
||||
export abstract class UmbEntityActionBase<ArgsMetaType> implements UmbEntityAction<ArgsMetaType> {
|
||||
public args: UmbEntityActionArgs<ArgsMetaType>;
|
||||
protected _host: UmbControllerHost;
|
||||
|
||||
/**
|
||||
* Creates an instance of UmbEntityActionBase<RepositoryType>.
|
||||
* @param {UmbControllerHost} host
|
||||
* @param {string} repositoryAlias
|
||||
* @param {string} unique
|
||||
* @param {string} entityType
|
||||
* @memberof UmbEntityActionBase<RepositoryType>
|
||||
*/
|
||||
constructor(host: UmbControllerHost, repositoryAlias: string, unique: string, entityType: string) {
|
||||
super(host, repositoryAlias);
|
||||
this.entityType = entityType;
|
||||
this.unique = unique;
|
||||
this.repositoryAlias = repositoryAlias;
|
||||
constructor(host: UmbControllerHost, args: UmbEntityActionArgs<ArgsMetaType>) {
|
||||
this._host = host;
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,3 +3,4 @@ export * from './entity-action.element.js';
|
||||
export * from './entity-action.js';
|
||||
export * from './common/index.js';
|
||||
export * from './entity-action.event.js';
|
||||
export * from './types.js';
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
export interface UmbEntityActionArgs<MetaArgsType> {
|
||||
entityType: string;
|
||||
unique: string | null;
|
||||
meta: MetaArgsType;
|
||||
}
|
||||
Reference in New Issue
Block a user