Skip to content

Commit 7de49af

Browse files
committed
rc1 client fixes
1 parent 4564932 commit 7de49af

File tree

51 files changed

+254
-369
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+254
-369
lines changed

src/components/charts/content-reviews-chart.element.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type { ChartHeaderCard } from "./chart-base.element.js";
99
import { ChartBase } from "./chart-base.element.js";
1010
import { ChartBaseStyles } from "./chart-style.styles.js";
1111
import {
12-
ChartResource,
12+
ChartService,
1313
WorkflowStatusModel,
1414
type ChartResponseModel,
1515
} from "@umbraco-workflow/generated";
@@ -37,15 +37,17 @@ export class ContentReviewsChartElement extends ChartBase {
3737
status: k.value,
3838
label: k.key,
3939
value: this.numberFormat(
40-
(chartData?.additionalData ?? {})[`${lower}Count`] ?? 0,
40+
<number>(chartData?.additionalData ?? {})[`${lower}Count`] ?? 0,
4141
chartData?.currentUserLocale
4242
),
4343
});
4444
});
4545

4646
this.series = chartData?.series ?? [];
4747
this.drawChart(
48-
chartData?.additionalData?.expiringCount > 100 ? "logarithmic" : "linear"
48+
<number>chartData?.additionalData?.expiringCount > 100
49+
? "logarithmic"
50+
: "linear"
4951
);
5052
}
5153

@@ -56,7 +58,7 @@ export class ContentReviewsChartElement extends ChartBase {
5658

5759
const { data, error } = await tryExecuteAndNotify(
5860
this,
59-
ChartResource.getChartContentReviewChart({
61+
ChartService.getChartContentReviewChart({
6062
range: this.range,
6163
})
6264
);

src/components/charts/workflow-activity-chart.element.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { ChartBase } from "./chart-base.element.js";
1111
import type { ChartHeaderCard } from "./chart-base.element.js";
1212
import {
1313
type ChartResponseModel,
14-
ChartResource,
14+
ChartService,
1515
WorkflowStatusModel,
1616
} from "@umbraco-workflow/generated";
1717
import { WorkflowStatus } from "@umbraco-workflow/enums";
@@ -42,7 +42,6 @@ export class WorkflowActivityChartElement extends ChartBase {
4242

4343
// TODO => humanize
4444
humanize = (x: number) => x;
45-
//moment.duration(x, 'seconds').humanize();
4645

4746
buildChartSeries(chartData?: ChartResponseModel) {
4847
this.headerCards = [];
@@ -56,7 +55,7 @@ export class WorkflowActivityChartElement extends ChartBase {
5655
action: () => this.getActivity(s.key),
5756
label: s.key,
5857
value: this.numberFormat(
59-
(chartData?.additionalData ?? {})[`${lower}Count`] ?? 0,
58+
<number>(chartData?.additionalData ?? {})[`${lower}Count`] ?? 0,
6059
chartData?.currentUserLocale
6160
),
6261
});
@@ -65,10 +64,10 @@ export class WorkflowActivityChartElement extends ChartBase {
6564
this.showStatsBox = chartData?.additionalData?.averageSeconds !== 0 || true;
6665

6766
if (this.showStatsBox) {
68-
this.minSeconds = this.humanize(chartData?.additionalData?.minSeconds);
69-
this.maxSeconds = this.humanize(chartData?.additionalData?.maxSeconds);
67+
this.minSeconds = this.humanize(<number>chartData?.additionalData?.minSeconds ?? 0);
68+
this.maxSeconds = this.humanize(<number>chartData?.additionalData?.maxSeconds ?? 0);
7069
this.averageSeconds = this.humanize(
71-
chartData?.additionalData?.averageSeconds
70+
<number>chartData?.additionalData?.averageSeconds ?? 0
7271
);
7372
}
7473

@@ -83,7 +82,7 @@ export class WorkflowActivityChartElement extends ChartBase {
8382

8483
const { data, error } = await tryExecuteAndNotify(
8584
this,
86-
ChartResource.getChartWorkflowChart({
85+
ChartService.getChartWorkflowChart({
8786
range: this.range,
8887
groupId: this.groupId,
8988
})

src/components/daterange/daterange.element.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ import {
77
property,
88
state,
99
} from "@umbraco-cms/backoffice/external/lit";
10-
import { FormControlMixin } from "@umbraco-cms/backoffice/external/uui";
10+
import { UUIFormControlMixin } from "@umbraco-cms/backoffice/external/uui";
1111

1212
const elementName = "workflow-daterange";
1313

1414
@customElement(elementName)
15-
export class WorkflowDateRangeElement extends FormControlMixin(
16-
UmbElementMixin(LitElement)
15+
export class WorkflowDateRangeElement extends UUIFormControlMixin(
16+
UmbElementMixin(LitElement),
17+
undefined
1718
) {
1819
getFormElement() {
1920
return undefined;
@@ -40,8 +41,12 @@ export class WorkflowDateRangeElement extends FormControlMixin(
4041
this.maxDateFrom = new Date().toString();
4142
this.minDateTo = new Date().toString();
4243

43-
this.labelFrom = this.localize.term(this.labelKeys[0]).replace(/\b\w/g, s => s.toUpperCase());
44-
this.labelTo = this.localize.term(this.labelKeys[1]).replace(/\b\w/g, s => s.toUpperCase());
44+
this.labelFrom = this.localize
45+
.term(this.labelKeys[0])
46+
.replace(/\b\w/g, (s) => s.toUpperCase());
47+
this.labelTo = this.localize
48+
.term(this.labelKeys[1])
49+
.replace(/\b\w/g, (s) => s.toUpperCase());
4550

4651
this.addValidator(
4752
"badInput",
@@ -105,7 +110,7 @@ export class WorkflowDateRangeElement extends FormControlMixin(
105110
}
106111
107112
umb-property-layout {
108-
padding:0;
113+
padding: 0;
109114
}
110115
`,
111116
];

src/components/filter-picker/elements/document-filter.element.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export class WorkflowDocumentFilterElement extends WorkflowBaseFilterElement<str
1111

1212
#onSelectionChange(event: CustomEvent) {
1313
this.setValue(
14-
(event.target as UmbInputDocumentElement).selectedIds.join(",")
14+
(event.target as UmbInputDocumentElement).selection.join(",")
1515
);
1616
}
1717

src/components/filter-picker/elements/user-filter.element.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const elementName = "workflow-user-filter";
77
@customElement(elementName)
88
export class WorkflowUserFilterElement extends WorkflowBaseFilterElement<string> {
99
#onSelectionChange(event: CustomEvent) {
10-
this.setValue((event.target as UmbInputDocumentElement).selectedIds.join(","));
10+
this.setValue((event.target as UmbInputDocumentElement).selection.join(","));
1111
}
1212

1313
render() {

src/components/history-cleanup/history-cleanup.element.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,16 @@ import {
77
property,
88
} from "@umbraco-cms/backoffice/external/lit";
99
import { UMB_MODAL_MANAGER_CONTEXT } from "@umbraco-cms/backoffice/modal";
10-
import { UMB_DOCUMENT_WORKSPACE_CONTEXT } from "@umbraco-cms/backoffice/document";
1110
import { tryExecuteAndNotify } from "@umbraco-cms/backoffice/resources";
1211
import { UMB_NOTIFICATION_CONTEXT } from "@umbraco-cms/backoffice/notification";
13-
import { HistoryCleanupResource } from "@umbraco-workflow/generated";
12+
import { HistoryCleanupService } from "@umbraco-workflow/generated";
1413
import { WORKFLOW_HISTORY_CLEANUP_MODAL } from "@umbraco-workflow/modal";
1514

1615
const elementName = "workflow-history-cleanup";
1716

1817
@customElement(elementName)
1918
export class WorkflowHistoryCleanupElement extends UmbElementMixin(LitElement) {
2019
#modalManagerContext?: typeof UMB_MODAL_MANAGER_CONTEXT.TYPE;
21-
#workspaceContext?: typeof UMB_DOCUMENT_WORKSPACE_CONTEXT.TYPE;
2220
#notificationContext?: typeof UMB_NOTIFICATION_CONTEXT.TYPE;
2321

2422
@property()
@@ -32,11 +30,6 @@ export class WorkflowHistoryCleanupElement extends UmbElementMixin(LitElement) {
3230
this.#modalManagerContext = instance;
3331
});
3432

35-
this.consumeContext(UMB_DOCUMENT_WORKSPACE_CONTEXT, (instance) => {
36-
if (!instance) return;
37-
this.#workspaceContext = instance;
38-
});
39-
4033
this.consumeContext(UMB_NOTIFICATION_CONTEXT, (instance) => {
4134
if (!instance) return;
4235
this.#notificationContext = instance;
@@ -58,7 +51,7 @@ export class WorkflowHistoryCleanupElement extends UmbElementMixin(LitElement) {
5851

5952
const { error } = await tryExecuteAndNotify(
6053
this,
61-
HistoryCleanupResource.putHistoryCleanup({
54+
HistoryCleanupService.putHistoryCleanup({
6255
requestBody: Object.assign({}, result.nodeRules, result.docTypeRules),
6356
})
6457
);

src/context/workflow-action.repository.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
} from "@umbraco-cms/backoffice/class-api";
1212
import { UmbContextConsumerController } from "@umbraco-cms/backoffice/context-api";
1313
import {
14-
ActionResource,
14+
ActionService,
1515
WorkflowTypeModel,
1616
} from "@umbraco-workflow/generated";
1717
import type {
@@ -62,7 +62,7 @@ export class WorkflowActionRepository extends UmbControllerBase {
6262
// attachmentId should be a guid
6363
const { data, error } = await tryExecuteAndNotify(
6464
this.#host,
65-
ActionResource.postActionInitiate({
65+
ActionService.postActionInitiate({
6666
requestBody: {
6767
entityId: nodeUnique,
6868
comment,
@@ -144,13 +144,13 @@ export class WorkflowActionRepository extends UmbControllerBase {
144144
| undefined {
145145
switch (action) {
146146
case ValidActionDescriptor.APPROVE:
147-
return ActionResource.postActionApprove;
147+
return ActionService.postActionApprove;
148148
case ValidActionDescriptor.CANCEL:
149-
return ActionResource.postActionCancel;
149+
return ActionService.postActionCancel;
150150
case ValidActionDescriptor.REJECT:
151-
return ActionResource.postActionReject;
151+
return ActionService.postActionReject;
152152
case ValidActionDescriptor.RESUBMIT:
153-
return ActionResource.postActionResubmit;
153+
return ActionService.postActionResubmit;
154154
}
155155
}
156156
}

src/context/workflow-context.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ import type {
1515
WorkflowScaffoldResponseModel,
1616
} from "@umbraco-workflow/generated";
1717
import {
18-
GlobalVariablesResource,
19-
LicenseResource,
20-
ScaffoldResource,
18+
GlobalVariablesService,
19+
LicenseService,
20+
ScaffoldService,
2121
} from "@umbraco-workflow/generated";
2222

2323
/** TODO => how do we handle new nodes? Currently creating a node won't trigger the change detection
@@ -97,7 +97,7 @@ export class WorkflowContext extends UmbControllerBase {
9797
async scaffoldNode(nodeKey = this.#currentDocument) {
9898
const { data } = await tryExecuteAndNotify(
9999
this,
100-
ScaffoldResource.getScaffold({
100+
ScaffoldService.getScaffold({
101101
nodeKey,
102102
})
103103
);
@@ -109,7 +109,7 @@ export class WorkflowContext extends UmbControllerBase {
109109
async #getLicense() {
110110
const { data } = await tryExecuteAndNotify(
111111
this,
112-
LicenseResource.getLicense()
112+
LicenseService.getLicense()
113113
);
114114

115115
this.#license.setValue(data);
@@ -118,7 +118,7 @@ export class WorkflowContext extends UmbControllerBase {
118118
async #getGlobals() {
119119
const { data } = await tryExecuteAndNotify(
120120
this,
121-
GlobalVariablesResource.getGlobal()
121+
GlobalVariablesService.getGlobal()
122122
);
123123

124124
this.#globalVariables.setValue(data);

src/dashboards/advanced-search/advanced-search.dashboard.element.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import type {
2727
SelectableNameKeyPairModel,
2828
} from "@umbraco-workflow/generated";
2929
import {
30-
AdvancedSearchResource,
30+
AdvancedSearchService,
3131
AdvancedSearchTypeModel,
3232
WorkflowStatusModel,
3333
} from "@umbraco-workflow/generated";
@@ -71,7 +71,7 @@ export class AdvancedSearchDashboardElement extends UmbElementMixin(
7171

7272
@state()
7373
searchModel: TableQueryModel = {
74-
handler: AdvancedSearchResource.postAdvancedSearchSearch,
74+
handler: AdvancedSearchService.postAdvancedSearchSearch,
7575
meta: {
7676
fuzzy: false,
7777
},
@@ -170,7 +170,7 @@ export class AdvancedSearchDashboardElement extends UmbElementMixin(
170170
async #getData() {
171171
const { data } = await tryExecuteAndNotify(
172172
this,
173-
AdvancedSearchResource.getAdvancedSearchContentTypes()
173+
AdvancedSearchService.getAdvancedSearchContentTypes()
174174
);
175175

176176
data?.contentTypes!.forEach((x) => (x.selected = true));
@@ -399,7 +399,7 @@ export class AdvancedSearchDashboardElement extends UmbElementMixin(
399399
status: Record<string, any>
400400
) {
401401
status.selected = !status.selected;
402-
const value = !property.value?.length ? [] : property.value.split(",");
402+
const value = !(<any>property.value)?.length ? [] : (<string>property.value).split(",");
403403

404404
if (status.selected) {
405405
value.push(status.value);
@@ -824,7 +824,7 @@ export class AdvancedSearchDashboardElement extends UmbElementMixin(
824824
${when(
825825
prop.propertyEditorUiAlias === "checkboxlist",
826826
() =>
827-
html` ${prop.config?.items.map(
827+
html` ${(<any>prop.config)?.items.map(
828828
(status) => html`
829829
<uui-checkbox
830830
style="margin-right:var(--uui-size-5)"
@@ -845,7 +845,7 @@ export class AdvancedSearchDashboardElement extends UmbElementMixin(
845845
html`${when(
846846
prop.value,
847847
() => html`<uui-ref-list>
848-
<uui-ref-node-user .name=${prop.value?.name}
848+
<uui-ref-node-user .name=${(<any>prop.value)?.name}
849849
><uui-action-bar slot="actions">
850850
<uui-button
851851
label="Remove"

src/dashboards/advanced-search/basefield-query-generator.function.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export function BaseFieldQueryGenerator(props: Array<Partial<PropertyDetailModel
99
const v = ValueMap(x);
1010

1111
if (x.propertyEditorUiAlias === "userpicker" && x.value) {
12-
v[1] = x.value.id;
12+
v[1] = (<any>x.value).id;
1313
}
1414

1515
return v;

0 commit comments

Comments
 (0)