@umbraco-cms/backoffice 14.0.0--preview004-8fc4facc → 14.0.0--preview004-64d63c8e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-cms/packages/core/variant/variant-id.class.d.ts +2 -0
- package/dist-cms/packages/core/variant/variant-id.class.js +6 -0
- package/dist-cms/packages/documents/documents/repository/document.repository.d.ts +0 -3
- package/dist-cms/packages/documents/documents/repository/document.repository.js +1 -16
- package/dist-cms/packages/documents/documents/repository/sources/document.server.data.d.ts +1 -1
- package/dist-cms/packages/documents/documents/repository/sources/document.server.data.js +4 -2
- package/dist-cms/packages/documents/documents/workspace/actions/save-and-publish.action.js +1 -1
- package/dist-cms/packages/documents/documents/workspace/document-workspace.context.d.ts +1 -1
- package/dist-cms/packages/documents/documents/workspace/document-workspace.context.js +14 -12
- package/dist-cms/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -14,6 +14,8 @@ export declare class UmbVariantId {
|
|
|
14
14
|
toString(): string;
|
|
15
15
|
toCultureString(): string;
|
|
16
16
|
toSegmentString(): string;
|
|
17
|
+
isCultureInvariant(): boolean;
|
|
18
|
+
isSegmentInvariant(): boolean;
|
|
17
19
|
isInvariant(): boolean;
|
|
18
20
|
toObject(): variantObject;
|
|
19
21
|
toDifferencesString(variantId: UmbVariantId): string;
|
|
@@ -27,6 +27,12 @@ export class UmbVariantId {
|
|
|
27
27
|
toSegmentString() {
|
|
28
28
|
return this.segment || '';
|
|
29
29
|
}
|
|
30
|
+
isCultureInvariant() {
|
|
31
|
+
return this.culture === null;
|
|
32
|
+
}
|
|
33
|
+
isSegmentInvariant() {
|
|
34
|
+
return this.segment === null;
|
|
35
|
+
}
|
|
30
36
|
isInvariant() {
|
|
31
37
|
return this.culture === null && this.segment === null;
|
|
32
38
|
}
|
|
@@ -46,9 +46,6 @@ export declare class UmbDocumentRepository extends UmbBaseController implements
|
|
|
46
46
|
trash(id: string): Promise<{
|
|
47
47
|
error: import("../../../../external/backend-api/index.js").ApiError | import("../../../../external/backend-api/index.js").CancelError | undefined;
|
|
48
48
|
}>;
|
|
49
|
-
saveAndPublish(id: string, item: UpdateDocumentRequestModel, variantIds: Array<UmbVariantId>): Promise<{
|
|
50
|
-
error: import("../../../../external/backend-api/index.js").ApiError | import("../../../../external/backend-api/index.js").CancelError | undefined;
|
|
51
|
-
}>;
|
|
52
49
|
publish(id: string, variantIds: Array<UmbVariantId>): Promise<{
|
|
53
50
|
error: import("../../../../external/backend-api/index.js").ApiError | import("../../../../external/backend-api/index.js").CancelError | undefined;
|
|
54
51
|
}>;
|
|
@@ -159,28 +159,13 @@ export class UmbDocumentRepository extends UmbBaseController {
|
|
|
159
159
|
}
|
|
160
160
|
return { error };
|
|
161
161
|
}
|
|
162
|
-
async saveAndPublish(id, item, variantIds) {
|
|
163
|
-
if (!id)
|
|
164
|
-
throw new Error('id is missing');
|
|
165
|
-
if (!variantIds)
|
|
166
|
-
throw new Error('variant IDs are missing');
|
|
167
|
-
//await this.#init;
|
|
168
|
-
await this.save(id, item);
|
|
169
|
-
const { error } = await this.#detailDataSource.saveAndPublish(id, variantIds);
|
|
170
|
-
if (!error) {
|
|
171
|
-
// TODO: Update other stores based on above effect.
|
|
172
|
-
const notification = { data: { message: `Document saved and published` } };
|
|
173
|
-
this.#notificationContext?.peek('positive', notification);
|
|
174
|
-
}
|
|
175
|
-
return { error };
|
|
176
|
-
}
|
|
177
162
|
async publish(id, variantIds) {
|
|
178
163
|
if (!id)
|
|
179
164
|
throw new Error('id is missing');
|
|
180
165
|
if (!variantIds)
|
|
181
166
|
throw new Error('variant IDs are missing');
|
|
182
167
|
await this.#init;
|
|
183
|
-
const { error } = await this.#detailDataSource.
|
|
168
|
+
const { error } = await this.#detailDataSource.publish(id, variantIds);
|
|
184
169
|
if (!error) {
|
|
185
170
|
// TODO: Update other stores based on above effect.
|
|
186
171
|
const notification = { data: { message: `Document published` } };
|
|
@@ -53,7 +53,7 @@ export declare class UmbDocumentServerDataSource implements UmbDataSource<Create
|
|
|
53
53
|
* @return {*}
|
|
54
54
|
* @memberof UmbDocumentServerDataSource
|
|
55
55
|
*/
|
|
56
|
-
|
|
56
|
+
publish(id: string, variantIds: Array<UmbVariantId>): Promise<import("../../../../core/repository/index.js").DataSourceResponse<any>>;
|
|
57
57
|
/**
|
|
58
58
|
* Unpublish one or more variants of a Document
|
|
59
59
|
* @param {string} id
|
|
@@ -100,12 +100,14 @@ export class UmbDocumentServerDataSource {
|
|
|
100
100
|
* @return {*}
|
|
101
101
|
* @memberof UmbDocumentServerDataSource
|
|
102
102
|
*/
|
|
103
|
-
async
|
|
103
|
+
async publish(id, variantIds) {
|
|
104
104
|
if (!id)
|
|
105
105
|
throw new Error('Id is missing');
|
|
106
106
|
// TODO: THIS DOES NOT TAKE SEGMENTS INTO ACCOUNT!!!!!!
|
|
107
107
|
const requestBody = {
|
|
108
|
-
cultures: variantIds
|
|
108
|
+
cultures: variantIds
|
|
109
|
+
.map((variant) => (variant.isCultureInvariant() ? null : variant.toCultureString()))
|
|
110
|
+
.filter((x) => x !== null),
|
|
109
111
|
};
|
|
110
112
|
return tryExecuteAndNotify(this.#host, DocumentResource.putDocumentByIdPublish({ id, requestBody }));
|
|
111
113
|
}
|
|
@@ -11,6 +11,6 @@ export class UmbDocumentSaveAndPublishWorkspaceAction extends UmbWorkspaceAction
|
|
|
11
11
|
//const document = this.workspaceContext.getData();
|
|
12
12
|
// TODO: handle errors
|
|
13
13
|
//if (!document) return;
|
|
14
|
-
this.workspaceContext.
|
|
14
|
+
this.workspaceContext.saveAndPublish();
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -41,8 +41,8 @@ export declare class UmbDocumentWorkspaceContext extends UmbEditableWorkspaceCon
|
|
|
41
41
|
setPropertyValue<PropertyValueType = unknown>(alias: string, value: PropertyValueType, variantId?: UmbVariantId): Promise<void>;
|
|
42
42
|
save(): Promise<void>;
|
|
43
43
|
delete(): Promise<void>;
|
|
44
|
-
publish(): Promise<void>;
|
|
45
44
|
saveAndPublish(): Promise<void>;
|
|
45
|
+
publish(): Promise<void>;
|
|
46
46
|
unpublish(): Promise<void>;
|
|
47
47
|
createVariantContext(host: UmbControllerHost, variantId: UmbVariantId): UmbDocumentVariantContext;
|
|
48
48
|
destroy(): void;
|
|
@@ -134,11 +134,9 @@ export class UmbDocumentWorkspaceContext extends UmbEditableWorkspaceContextBase
|
|
|
134
134
|
this.#currentData.update({ values });
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
async
|
|
138
|
-
if (!this.#currentData.value)
|
|
139
|
-
|
|
140
|
-
if (!this.#currentData.value.id)
|
|
141
|
-
return;
|
|
137
|
+
async #createOrSave() {
|
|
138
|
+
if (!this.#currentData.value?.id)
|
|
139
|
+
throw new Error('Id is missing');
|
|
142
140
|
if (this.getIsNew()) {
|
|
143
141
|
// TODO: typescript hack until we get the create type
|
|
144
142
|
const value = this.#currentData.value;
|
|
@@ -149,6 +147,9 @@ export class UmbDocumentWorkspaceContext extends UmbEditableWorkspaceContextBase
|
|
|
149
147
|
else {
|
|
150
148
|
await this.repository.save(this.#currentData.value.id, this.#currentData.value);
|
|
151
149
|
}
|
|
150
|
+
}
|
|
151
|
+
async save() {
|
|
152
|
+
await this.#createOrSave();
|
|
152
153
|
this.saveComplete(this.getData());
|
|
153
154
|
}
|
|
154
155
|
async delete() {
|
|
@@ -157,25 +158,26 @@ export class UmbDocumentWorkspaceContext extends UmbEditableWorkspaceContextBase
|
|
|
157
158
|
await this.repository.delete(id);
|
|
158
159
|
}
|
|
159
160
|
}
|
|
160
|
-
async
|
|
161
|
-
|
|
161
|
+
async saveAndPublish() {
|
|
162
|
+
await this.#createOrSave();
|
|
163
|
+
// TODO: This might be right to publish all, but we need a method that just saves and publishes a declared range of variants.
|
|
162
164
|
const currentData = this.#currentData.value;
|
|
163
165
|
if (currentData) {
|
|
164
166
|
const variantIds = currentData.variants?.map((x) => UmbVariantId.Create(x));
|
|
165
|
-
const id =
|
|
167
|
+
const id = currentData.id;
|
|
166
168
|
if (variantIds && id) {
|
|
167
169
|
await this.repository.publish(id, variantIds);
|
|
168
170
|
}
|
|
169
171
|
}
|
|
170
172
|
}
|
|
171
|
-
async
|
|
172
|
-
// TODO: This might be right to publish all, but we need a method that just
|
|
173
|
+
async publish() {
|
|
174
|
+
// TODO: This might be right to publish all, but we need a method that just publishes a declared range of variants.
|
|
173
175
|
const currentData = this.#currentData.value;
|
|
174
176
|
if (currentData) {
|
|
175
177
|
const variantIds = currentData.variants?.map((x) => UmbVariantId.Create(x));
|
|
176
|
-
const id =
|
|
178
|
+
const id = this.getEntityId();
|
|
177
179
|
if (variantIds && id) {
|
|
178
|
-
await this.repository.
|
|
180
|
+
await this.repository.publish(id, variantIds);
|
|
179
181
|
}
|
|
180
182
|
}
|
|
181
183
|
}
|