-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #945 from umbraco/improvement-simplify-workspace-c…
…ontext-interface
- Loading branch information
Showing
7 changed files
with
27 additions
and
58 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
src/packages/core/workspace/workspace-action/common/save/save.action.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 7 additions & 3 deletions
10
src/packages/core/workspace/workspace-context/saveable-workspace-context.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
import type { UmbWorkspaceContextInterface } from './workspace-context.interface.js'; | ||
import { Observable } from '@umbraco-cms/backoffice/external/rxjs'; | ||
|
||
export interface UmbSaveableWorkspaceContextInterface<EntityType = unknown> | ||
extends UmbWorkspaceContextInterface<EntityType> { | ||
//getData(): EntityType | undefined; | ||
export interface UmbSaveableWorkspaceContextInterface<Type = unknown> extends UmbWorkspaceContextInterface { | ||
isNew: Observable<boolean | undefined>; | ||
getIsNew(): boolean | undefined; | ||
setIsNew(value: boolean): void; | ||
save(): Promise<void>; | ||
setValidationErrors?(errorMap: any): void; // TODO: temp solution to bubble validation errors to the UI | ||
destroy(): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 3 additions & 15 deletions
18
src/packages/core/workspace/workspace-context/workspace-context.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,6 @@ | ||
import { Observable } from '@umbraco-cms/backoffice/external/rxjs'; | ||
|
||
export interface UmbWorkspaceContextInterface<DataType = unknown> { | ||
destroy(): void; | ||
workspaceAlias: string; | ||
|
||
save(): Promise<void>; | ||
// TODO: temp solution to bubble validation errors to the UI | ||
setValidationErrors?(errorMap: any): void; | ||
|
||
getEntityId(): string | undefined; // Consider if this should go away now that we have getUnique() | ||
export interface UmbWorkspaceContextInterface { | ||
readonly workspaceAlias: string; | ||
// TODO: should we consider another name than entity type. File system files are not entities but still have this type. | ||
getEntityType(): string; | ||
|
||
isNew: Observable<boolean | undefined>; | ||
getIsNew(): boolean | undefined; | ||
setIsNew(value: boolean): void; | ||
getEntityId(): string | undefined; // Consider if this should go away now that we have getUnique() | ||
} |
5 changes: 1 addition & 4 deletions
5
src/packages/core/workspace/workspace-context/workspace-context.token.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
import type { UmbWorkspaceContextInterface } from './workspace-context.interface.js'; | ||
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api'; | ||
import type { UmbEntityBase } from '@umbraco-cms/backoffice/models'; | ||
|
||
export const UMB_WORKSPACE_CONTEXT = new UmbContextToken<UmbWorkspaceContextInterface<UmbEntityBase>>( | ||
'UmbWorkspaceContext' | ||
); | ||
export const UMB_WORKSPACE_CONTEXT = new UmbContextToken<UmbWorkspaceContextInterface>('UmbWorkspaceContext'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters