update naming

This commit is contained in:
Julia Gru
2023-09-06 13:04:43 +02:00
committed by Jacob Overgaard
parent b343f2d194
commit 863372a995
6 changed files with 32 additions and 32 deletions

View File

@@ -16,8 +16,8 @@ import { ManifestEntityAction } from '@umbraco-cms/backoffice/extension-registry
const scriptsViewActions: Array<ManifestEntityAction> = [
{
type: 'entityAction',
alias: 'Umb.EntityAction.PartialView.Delete',
name: 'Delete PartialView Entity Action',
alias: 'Umb.EntityAction.Scripts.Delete',
name: 'Delete Scripts Entity Action',
meta: {
icon: 'umb:trash',
label: 'Delete',
@@ -31,11 +31,11 @@ const scriptsViewActions: Array<ManifestEntityAction> = [
const scriptsFolderActions: Array<ManifestEntityAction> = [
{
type: 'entityAction',
alias: 'Umb.EntityAction.PartialViewFolder.Create.New',
name: 'Create PartialView Entity Under Directory Action',
alias: 'Umb.EntityAction.ScriptsFolder.Create.New',
name: 'Create Scripts Entity Under Directory Action',
meta: {
icon: 'umb:article',
label: 'New empty partial view',
label: 'New empty script',
api: UmbCreateScriptAction,
repositoryAlias: SCRIPTS_REPOSITORY_ALIAS,
entityTypes: [SCRIPTS_FOLDER_ENTITY_TYPE, SCRIPTS_ROOT_ENTITY_TYPE],
@@ -43,7 +43,7 @@ const scriptsFolderActions: Array<ManifestEntityAction> = [
},
{
type: 'entityAction',
alias: 'Umb.EntityAction.PartialViewFolder.DeleteFolder',
alias: 'Umb.EntityAction.ScriptsFolder.DeleteFolder',
name: 'Remove empty folder',
meta: {
icon: 'umb:trash',
@@ -55,7 +55,7 @@ const scriptsFolderActions: Array<ManifestEntityAction> = [
},
{
type: 'entityAction',
alias: 'Umb.EntityAction.PartialViewFolder.CreateFolder',
alias: 'Umb.EntityAction.ScriptsFolder.CreateFolder',
name: 'Create empty folder',
meta: {
icon: 'umb:add',

View File

@@ -7,21 +7,21 @@ import { ManifestRepository, ManifestStore, ManifestTreeStore } from '@umbraco-c
const repository: ManifestRepository = {
type: 'repository',
alias: SCRIPTS_REPOSITORY_ALIAS,
name: 'Partial Views Repository',
name: 'Scripts Repository',
class: UmbScriptsRepository,
};
const store: ManifestStore = {
type: 'store',
alias: SCRIPTS_STORE_ALIAS,
name: 'Partial Views Store',
name: 'Scripts Store',
class: UmbScriptsStore,
};
const treeStore: ManifestTreeStore = {
type: 'treeStore',
alias: SCRIPTS_TREE_STORE_ALIAS,
name: 'Partial Views Tree Store',
name: 'Scripts Tree Store',
class: UmbScriptsTreeStore,
};

View File

@@ -7,33 +7,33 @@ import { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api
/**
* @export
* @class UmbPartialViewsStore
* @class UmbScriptsStore
* @extends {UmbStoreBase}
* @description - Data Store for partial views
* @description - Data Store for scripts
*/
export class UmbScriptsStore extends UmbStoreBase {
/**
* Creates an instance of UmbPartialViewsStore.
* Creates an instance of UmbScriptsStore.
* @param {UmbControllerHostInterface} host
* @memberof UmbPartialViewsStore
* @memberof UmbScriptsStore
*/
constructor(host: UmbControllerHostElement) {
super(host, UMB_SCRIPTS_STORE_CONTEXT_TOKEN.toString(), new UmbArrayState<TemplateResponseModel>([], (x) => x.id));
}
/**
* Append a partial view to the store
* Append a script to the store
* @param {Template} template
* @memberof UmbPartialViewsStore
* @memberof UmbScriptsStore
*/
append(template: TemplateResponseModel) {
this._data.append([template]);
}
/**
* Removes partial views in the store with the given uniques
* Removes scripts in the store with the given uniques
* @param {string[]} uniques
* @memberof UmbPartialViewsStore
* @memberof UmbScriptsStore
*/
remove(uniques: string[]) {
this._data.remove(uniques);

View File

@@ -8,17 +8,17 @@ export const UMB_SCRIPTS_TREE_STORE_CONTEXT_TOKEN = new UmbContextToken<UmbScrip
);
/**
* Tree Store for partial views
* Tree Store for scripts
*
* @export
* @class UmbPartialViewsTreeStore
* @class
* @extends {UmbEntityTreeStore}
*/
export class UmbScriptsTreeStore extends UmbFileSystemTreeStore {
/**
* Creates an instance of UmbPartialViewsTreeStore.
* Creates an instance of UmbScriptsTreeStore.
* @param {UmbControllerHostInterface} host
* @memberof UmbPartialViewsTreeStore
* @memberof UmbScriptsTreeStore
*/
constructor(host: UmbControllerHostElement) {
super(host, UMB_SCRIPTS_TREE_STORE_CONTEXT_TOKEN.toString());

View File

@@ -26,7 +26,7 @@ export class UmbScriptsServerDataSource
}
/**
* Fetches a partial view with the given path from the server
* Fetches a script with the given path from the server
* @param {string} path
* @return {*}
* @memberof UmbScriptsDetailServerDataSource
@@ -36,7 +36,7 @@ export class UmbScriptsServerDataSource
return tryExecuteAndNotify(this.#host, ScriptResource.getScript({ path }));
}
/**
* Creates a new partial view
* Creates a new script
*
* @param {CreateScriptRequestModel} requestBody
* @return {*} {Promise<DataSourceResponse<string>>}
@@ -48,7 +48,7 @@ export class UmbScriptsServerDataSource
//TODO the parameters here are bit ugly, since unique is already in the request body parameter, but it has to be done to marry the UmbDataSource interface an backend API together... maybe come up with some nicer solution
/**
* Updates a partial view
* Updates a script
*
* @param {string} [unique='']
* @param {UpdateScriptRequestModel} requestBody
@@ -59,7 +59,7 @@ export class UmbScriptsServerDataSource
return tryExecuteAndNotify(this.#host, ScriptResource.putScript({ requestBody }));
}
/**
* Deletes a partial view
* Deletes a script
*
* @param {string} path
* @return {*} {Promise<DataSourceResponse>}

View File

@@ -4,7 +4,7 @@ import { createObservablePart, UmbBooleanState, UmbDeepState } from '@umbraco-cm
import { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
import { UmbWorkspaceContext } from '@umbraco-cms/backoffice/workspace';
import { loadCodeEditor } from '@umbraco-cms/backoffice/code-editor';
import { UpdatePartialViewRequestModel } from '@umbraco-cms/backoffice/backend-api';
import { UpdateScriptRequestModel } from '@umbraco-cms/backoffice/backend-api';
export class UmbScriptsWorkspaceContext extends UmbWorkspaceContext<UmbScriptsRepository, ScriptDetails> {
getEntityId(): string | undefined {
@@ -16,7 +16,7 @@ export class UmbScriptsWorkspaceContext extends UmbWorkspaceContext<UmbScriptsRe
save(): Promise<void> {
const script = this.getData();
if (!script) return Promise.reject('Something went wrong, there is no data for partial view you want to save...');
if (!script) return Promise.reject('Something went wrong, there is no data for script view you want to save...');
if (this.getIsNew()) {
const createRequestBody = {
name: script.name,
@@ -29,7 +29,7 @@ export class UmbScriptsWorkspaceContext extends UmbWorkspaceContext<UmbScriptsRe
return Promise.resolve();
}
if (!script.path) return Promise.reject('There is no path');
const updateRequestBody: UpdatePartialViewRequestModel = {
const updateRequestBody: UpdateScriptRequestModel = {
name: script.name,
existingPath: script.path,
content: script.content,
@@ -50,7 +50,7 @@ export class UmbScriptsWorkspaceContext extends UmbWorkspaceContext<UmbScriptsRe
isCodeEditorReady = this.#isCodeEditorReady.asObservable();
constructor(host: UmbControllerHostElement) {
super(host, 'Umb.Workspace.PartialViews', new UmbScriptsRepository(host));
super(host, 'Umb.Workspace.Script', new UmbScriptsRepository(host));
this.#loadCodeEditor();
}
@@ -85,13 +85,13 @@ export class UmbScriptsWorkspaceContext extends UmbWorkspaceContext<UmbScriptsRe
async create(parentKey: string | null, name = 'Empty') {
const { data } = await this.repository.createScaffold(parentKey, name);
const newPartial = {
const script = {
...data,
name: '',
path: parentKey ?? '',
};
if (!data) return;
this.setIsNew(true);
this.#data.next(newPartial);
this.#data.next(script);
}
}