@webiny/app-scheduler 6.6.0-alpha.0 → 6.6.0-alpha.2
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/index.d.ts +1 -1
- package/index.js +2 -1
- package/index.js.map +1 -1
- package/package.json +16 -16
- package/presentation/components/Cells/CellScheduledOn/CellScheduledOn.js +3 -1
- package/presentation/components/Cells/CellScheduledOn/CellScheduledOn.js.map +1 -1
- package/presentation/hooks/useCancelSchedulerItem.js.map +1 -1
- package/presentation/scheduleDialog/ScheduleDialogPresenter.d.ts +4 -1
- package/presentation/scheduleDialog/ScheduleDialogPresenter.js +18 -3
- package/presentation/scheduleDialog/ScheduleDialogPresenter.js.map +1 -1
- package/presentation/scheduleDialog/abstractions.d.ts +5 -0
- package/presentation/scheduleDialog/abstractions.js.map +1 -1
- package/presentation/scheduleDialog/components/CancelButtonComponent.d.ts +10 -0
- package/presentation/scheduleDialog/components/CancelButtonComponent.js +20 -0
- package/presentation/scheduleDialog/components/CancelButtonComponent.js.map +1 -0
- package/presentation/scheduleDialog/components/FormComponent.d.ts +9 -0
- package/presentation/scheduleDialog/components/FormComponent.js +32 -0
- package/presentation/scheduleDialog/components/FormComponent.js.map +1 -0
- package/presentation/scheduleDialog/components/ReschedulingAlert.d.ts +7 -0
- package/presentation/scheduleDialog/components/ReschedulingAlert.js +14 -0
- package/presentation/scheduleDialog/components/ReschedulingAlert.js.map +1 -0
- package/presentation/scheduleDialog/components/SchedulerDialogFormComponentDateTimeInput.d.ts +24 -0
- package/presentation/scheduleDialog/components/SchedulerDialogFormComponentDateTimeInput.js +15 -0
- package/presentation/scheduleDialog/components/SchedulerDialogFormComponentDateTimeInput.js.map +1 -0
- package/presentation/scheduleDialog/createMinDateValidator.d.ts +7 -0
- package/presentation/scheduleDialog/createMinDateValidator.js +14 -0
- package/presentation/scheduleDialog/createMinDateValidator.js.map +1 -0
- package/presentation/scheduleDialog/useScheduleDialog.d.ts +5 -24
- package/presentation/scheduleDialog/useScheduleDialog.js +7 -74
- package/presentation/scheduleDialog/useScheduleDialog.js.map +1 -1
- package/presentation/schedulerList/components/BottomInfoBar.d.ts +2 -2
- package/presentation/schedulerList/components/Empty.d.ts +2 -2
- package/presentation/schedulerList/components/SchedulerOverlay.d.ts +2 -2
- package/presentation/schedulerList/components/SchedulerTable.d.ts +2 -2
- package/presentation/schedulerList/components/SearchInput.d.ts +2 -2
package/index.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ export type { IUseScheduleDialogProps } from "./presentation/scheduleDialog/useS
|
|
|
5
5
|
export { Scheduler } from "./presentation/schedulerList/Scheduler.js";
|
|
6
6
|
export type { SchedulerProps } from "./presentation/schedulerList/Scheduler.js";
|
|
7
7
|
export { SchedulerConfigs } from "./presentation/SchedulerConfigs/SchedulerConfigs.js";
|
|
8
|
-
export { SchedulerDialogFormComponentDateTimeInput } from "./presentation/scheduleDialog/
|
|
8
|
+
export { SchedulerDialogFormComponentDateTimeInput } from "./presentation/scheduleDialog/components/SchedulerDialogFormComponentDateTimeInput.js";
|
|
9
9
|
export { CellScheduledOn } from "./presentation/components/Cells/CellScheduledOn/index.js";
|
package/index.js
CHANGED
|
@@ -8,8 +8,9 @@ const SchedulerModule = ()=>/*#__PURE__*/ react.createElement(react.Fragment, nu
|
|
|
8
8
|
}), /*#__PURE__*/ react.createElement(RegisterFeature, {
|
|
9
9
|
feature: ScheduleDialogPresenterFeature
|
|
10
10
|
}), /*#__PURE__*/ react.createElement(SchedulerConfigs, null));
|
|
11
|
-
export {
|
|
11
|
+
export { useScheduleDialog } from "./presentation/scheduleDialog/useScheduleDialog.js";
|
|
12
12
|
export { Scheduler } from "./presentation/schedulerList/Scheduler.js";
|
|
13
|
+
export { SchedulerDialogFormComponentDateTimeInput } from "./presentation/scheduleDialog/components/SchedulerDialogFormComponentDateTimeInput.js";
|
|
13
14
|
export { CellScheduledOn } from "./presentation/components/Cells/CellScheduledOn/index.js";
|
|
14
15
|
export { SchedulerConfigs, SchedulerModule };
|
|
15
16
|
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.tsx"],"sourcesContent":["import React from \"react\";\nimport { RegisterFeature } from \"@webiny/app-admin\";\nimport { SchedulerFeature } from \"./features/feature.js\";\nimport { ScheduleDialogPresenterFeature } from \"./presentation/scheduleDialog/feature.js\";\nimport { SchedulerConfigs } from \"./presentation/SchedulerConfigs/SchedulerConfigs.js\";\n\nexport const SchedulerModule = () => {\n return (\n <>\n <RegisterFeature feature={SchedulerFeature} />\n <RegisterFeature feature={ScheduleDialogPresenterFeature} />\n <SchedulerConfigs />\n </>\n );\n};\n\nexport { useScheduleDialog } from \"./presentation/scheduleDialog/useScheduleDialog.js\";\nexport type { IUseScheduleDialogProps } from \"./presentation/scheduleDialog/useScheduleDialog.js\";\nexport { Scheduler } from \"./presentation/schedulerList/Scheduler.js\";\nexport type { SchedulerProps } from \"./presentation/schedulerList/Scheduler.js\";\nexport { SchedulerConfigs } from \"./presentation/SchedulerConfigs/SchedulerConfigs.js\";\nexport { SchedulerDialogFormComponentDateTimeInput } from \"./presentation/scheduleDialog/
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.tsx"],"sourcesContent":["import React from \"react\";\nimport { RegisterFeature } from \"@webiny/app-admin\";\nimport { SchedulerFeature } from \"./features/feature.js\";\nimport { ScheduleDialogPresenterFeature } from \"./presentation/scheduleDialog/feature.js\";\nimport { SchedulerConfigs } from \"./presentation/SchedulerConfigs/SchedulerConfigs.js\";\n\nexport const SchedulerModule = () => {\n return (\n <>\n <RegisterFeature feature={SchedulerFeature} />\n <RegisterFeature feature={ScheduleDialogPresenterFeature} />\n <SchedulerConfigs />\n </>\n );\n};\n\nexport { useScheduleDialog } from \"./presentation/scheduleDialog/useScheduleDialog.js\";\nexport type { IUseScheduleDialogProps } from \"./presentation/scheduleDialog/useScheduleDialog.js\";\nexport { Scheduler } from \"./presentation/schedulerList/Scheduler.js\";\nexport type { SchedulerProps } from \"./presentation/schedulerList/Scheduler.js\";\nexport { SchedulerConfigs } from \"./presentation/SchedulerConfigs/SchedulerConfigs.js\";\nexport { SchedulerDialogFormComponentDateTimeInput } from \"./presentation/scheduleDialog/components/SchedulerDialogFormComponentDateTimeInput.js\";\nexport { CellScheduledOn } from \"./presentation/components/Cells/CellScheduledOn/index.js\";\n"],"names":["SchedulerModule","RegisterFeature","SchedulerFeature","ScheduleDialogPresenterFeature","SchedulerConfigs"],"mappings":";;;;;AAMO,MAAMA,kBAAkB,IACpB,WAAP,GACI,wDACI,oBAACC,iBAAeA;QAAC,SAASC;sBAC1B,oBAACD,iBAAeA;QAAC,SAASE;sBAC1B,oBAACC,kBAAgBA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/app-scheduler",
|
|
3
|
-
"version": "6.6.0-alpha.
|
|
3
|
+
"version": "6.6.0-alpha.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -16,28 +16,28 @@
|
|
|
16
16
|
"@emotion/react": "11.14.0",
|
|
17
17
|
"@emotion/styled": "11.14.1",
|
|
18
18
|
"@material-design-icons/svg": "0.14.15",
|
|
19
|
-
"@webiny/admin-ui": "6.6.0-alpha.
|
|
20
|
-
"@webiny/app": "6.6.0-alpha.
|
|
21
|
-
"@webiny/app-aco": "6.6.0-alpha.
|
|
22
|
-
"@webiny/app-admin": "6.6.0-alpha.
|
|
23
|
-
"@webiny/app-headless-cms-common": "6.6.0-alpha.
|
|
24
|
-
"@webiny/feature": "6.6.0-alpha.
|
|
25
|
-
"@webiny/form": "6.6.0-alpha.
|
|
26
|
-
"@webiny/icons": "6.6.0-alpha.
|
|
27
|
-
"@webiny/react-composition": "6.6.0-alpha.
|
|
28
|
-
"@webiny/react-properties": "6.6.0-alpha.
|
|
29
|
-
"@webiny/utils": "6.6.0-alpha.
|
|
30
|
-
"@webiny/validation": "6.6.0-alpha.
|
|
19
|
+
"@webiny/admin-ui": "6.6.0-alpha.2",
|
|
20
|
+
"@webiny/app": "6.6.0-alpha.2",
|
|
21
|
+
"@webiny/app-aco": "6.6.0-alpha.2",
|
|
22
|
+
"@webiny/app-admin": "6.6.0-alpha.2",
|
|
23
|
+
"@webiny/app-headless-cms-common": "6.6.0-alpha.2",
|
|
24
|
+
"@webiny/feature": "6.6.0-alpha.2",
|
|
25
|
+
"@webiny/form": "6.6.0-alpha.2",
|
|
26
|
+
"@webiny/icons": "6.6.0-alpha.2",
|
|
27
|
+
"@webiny/react-composition": "6.6.0-alpha.2",
|
|
28
|
+
"@webiny/react-properties": "6.6.0-alpha.2",
|
|
29
|
+
"@webiny/utils": "6.6.0-alpha.2",
|
|
30
|
+
"@webiny/validation": "6.6.0-alpha.2",
|
|
31
31
|
"lodash": "4.18.1",
|
|
32
|
-
"mobx": "
|
|
33
|
-
"mobx-react-lite": "
|
|
32
|
+
"mobx": "7.0.3",
|
|
33
|
+
"mobx-react-lite": "5.0.3",
|
|
34
34
|
"react": "18.3.1",
|
|
35
35
|
"react-dom": "18.3.1",
|
|
36
36
|
"zod": "4.4.3"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/react": "18.3.31",
|
|
40
|
-
"@webiny/build-tools": "6.6.0-alpha.
|
|
40
|
+
"@webiny/build-tools": "6.6.0-alpha.2",
|
|
41
41
|
"rimraf": "6.1.3",
|
|
42
42
|
"typescript": "7.0.2"
|
|
43
43
|
},
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import react from "react";
|
|
2
2
|
import { SchedulerListConfig } from "../../../configs/index.js";
|
|
3
3
|
import { makeDecoratable } from "@webiny/react-composition";
|
|
4
|
+
import { useDateFormatter } from "@webiny/app-admin";
|
|
4
5
|
const CellScheduledOnLabel = makeDecoratable("Scheduler.CellScheduledOnLabel", ({ dateTime })=>{
|
|
6
|
+
const dateFormatter = useDateFormatter();
|
|
5
7
|
if (!dateTime) return /*#__PURE__*/ react.createElement(react.Fragment, null, "Missing publish or unpublish date.");
|
|
6
|
-
return /*#__PURE__*/ react.createElement(react.Fragment, null,
|
|
8
|
+
return /*#__PURE__*/ react.createElement(react.Fragment, null, dateFormatter.format(dateTime));
|
|
7
9
|
});
|
|
8
10
|
const CellScheduledOn = ()=>{
|
|
9
11
|
const { useTableRow } = SchedulerListConfig.Browser.Table.Column;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentation/components/Cells/CellScheduledOn/CellScheduledOn.js","sources":["../../../../../src/presentation/components/Cells/CellScheduledOn/CellScheduledOn.tsx"],"sourcesContent":["import React from \"react\";\nimport { SchedulerListConfig } from \"~/presentation/configs/index.js\";\nimport { makeDecoratable } from \"@webiny/react-composition\";\n\nexport interface ICellScheduledOnLabelProps {\n dateTime: Date | undefined;\n}\n\nexport const CellScheduledOnLabel = makeDecoratable(\n \"Scheduler.CellScheduledOnLabel\",\n ({ dateTime }: ICellScheduledOnLabelProps) => {\n if (!dateTime) {\n return <>Missing publish or unpublish date.</>;\n }\n\n return <>{
|
|
1
|
+
{"version":3,"file":"presentation/components/Cells/CellScheduledOn/CellScheduledOn.js","sources":["../../../../../src/presentation/components/Cells/CellScheduledOn/CellScheduledOn.tsx"],"sourcesContent":["import React from \"react\";\nimport { SchedulerListConfig } from \"~/presentation/configs/index.js\";\nimport { makeDecoratable } from \"@webiny/react-composition\";\nimport { useDateFormatter } from \"@webiny/app-admin\";\n\nexport interface ICellScheduledOnLabelProps {\n dateTime: Date | undefined;\n}\n\nexport const CellScheduledOnLabel = makeDecoratable(\n \"Scheduler.CellScheduledOnLabel\",\n ({ dateTime }: ICellScheduledOnLabelProps) => {\n const dateFormatter = useDateFormatter();\n if (!dateTime) {\n return <>Missing publish or unpublish date.</>;\n }\n\n return <>{dateFormatter.format(dateTime)}</>;\n }\n);\n\nexport const CellScheduledOn = () => {\n const { useTableRow } = SchedulerListConfig.Browser.Table.Column;\n const { row } = useTableRow();\n\n return <CellScheduledOnLabel dateTime={row.data.publishOn || row.data.unpublishOn} />;\n};\n"],"names":["CellScheduledOnLabel","makeDecoratable","dateTime","dateFormatter","useDateFormatter","CellScheduledOn","useTableRow","SchedulerListConfig","row"],"mappings":";;;;AASO,MAAMA,uBAAuBC,gBAChC,kCACA,CAAC,EAAEC,QAAQ,EAA8B;IACrC,MAAMC,gBAAgBC;IACtB,IAAI,CAACF,UACD,OAAO,WAAP,GAAO,0CAAE;IAGb,OAAO,WAAP,GAAO,0CAAGC,cAAc,MAAM,CAACD;AACnC;AAGG,MAAMG,kBAAkB;IAC3B,MAAM,EAAEC,WAAW,EAAE,GAAGC,oBAAoB,OAAO,CAAC,KAAK,CAAC,MAAM;IAChE,MAAM,EAAEC,GAAG,EAAE,GAAGF;IAEhB,OAAO,WAAP,GAAO,oBAACN,sBAAoBA;QAAC,UAAUQ,IAAI,IAAI,CAAC,SAAS,IAAIA,IAAI,IAAI,CAAC,WAAW;;AACrF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentation/hooks/useCancelSchedulerItem.js","sources":["../../../src/presentation/hooks/useCancelSchedulerItem.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport { useConfirmationDialog } from \"@webiny/app-admin\";\nimport type { SchedulerEntry } from \"~/types.js\";\nimport { useSchedulerListPresenter } from \"~/presentation/schedulerList/useSchedulerListPresenter.js\";\nimport { useToast } from \"@webiny/admin-ui\";\n\ninterface UseCancelScheduleItemParams {\n item: Pick<SchedulerEntry, \"id\" | \"title\" | \"actionType\">;\n}\n\nexport const useCancelSchedulerItem = ({ item }: UseCancelScheduleItemParams) => {\n const presenter = useSchedulerListPresenter();\n const toast = useToast();\n\n const { showConfirmation } = useConfirmationDialog({\n title: \"Cancel scheduled action?\",\n message: (\n <p>\n You are about to cancel scheduled action for this item!\n <br />\n Are you sure you want to cancel scheduled <strong
|
|
1
|
+
{"version":3,"file":"presentation/hooks/useCancelSchedulerItem.js","sources":["../../../src/presentation/hooks/useCancelSchedulerItem.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport { useConfirmationDialog } from \"@webiny/app-admin\";\nimport type { SchedulerEntry } from \"~/types.js\";\nimport { useSchedulerListPresenter } from \"~/presentation/schedulerList/useSchedulerListPresenter.js\";\nimport { useToast } from \"@webiny/admin-ui\";\n\ninterface UseCancelScheduleItemParams {\n item: Pick<SchedulerEntry, \"id\" | \"title\" | \"actionType\">;\n}\n\nexport const useCancelSchedulerItem = ({ item }: UseCancelScheduleItemParams) => {\n const presenter = useSchedulerListPresenter();\n const toast = useToast();\n\n const { showConfirmation } = useConfirmationDialog({\n title: \"Cancel scheduled action?\",\n message: (\n <p>\n You are about to cancel scheduled action for this item!\n <br />\n Are you sure you want to cancel scheduled <strong>\n {item.actionType}\n </strong> for{\" \"}\n <strong>{item.title}</strong>?\n </p>\n )\n });\n\n const openDialogCancelSchedulerItem = useCallback(\n () =>\n showConfirmation(async () => {\n try {\n await presenter.cancelItem(item.id);\n toast.showSuccessToast({\n title: `Action on item \"${item.title}\" was canceled successfully!`\n });\n } catch (ex) {\n toast.showWarningToast({\n title: ex.message || `Error while canceling action for \"${item.title}\".`\n });\n }\n }),\n [item]\n );\n\n return { openDialogCancelSchedulerItem };\n};\n"],"names":["useCancelSchedulerItem","item","presenter","useSchedulerListPresenter","toast","useToast","showConfirmation","useConfirmationDialog","openDialogCancelSchedulerItem","useCallback","ex"],"mappings":";;;;AAUO,MAAMA,yBAAyB,CAAC,EAAEC,IAAI,EAA+B;IACxE,MAAMC,YAAYC;IAClB,MAAMC,QAAQC;IAEd,MAAM,EAAEC,gBAAgB,EAAE,GAAGC,sBAAsB;QAC/C,OAAO;QACP,SAAS,WAAT,GACI,oBAAC,WAAE,yEAEC,oBAAC,aAAK,4DACoC,oBAAC,gBACtCN,KAAK,UAAU,GACX,QAAK,mBACd,oBAAC,gBAAQA,KAAK,KAAK,GAAU;IAGzC;IAEA,MAAMO,gCAAgCC,YAClC,IACIH,iBAAiB;YACb,IAAI;gBACA,MAAMJ,UAAU,UAAU,CAACD,KAAK,EAAE;gBAClCG,MAAM,gBAAgB,CAAC;oBACnB,OAAO,CAAC,gBAAgB,EAAEH,KAAK,KAAK,CAAC,4BAA4B,CAAC;gBACtE;YACJ,EAAE,OAAOS,IAAI;gBACTN,MAAM,gBAAgB,CAAC;oBACnB,OAAOM,GAAG,OAAO,IAAI,CAAC,kCAAkC,EAAET,KAAK,KAAK,CAAC,EAAE,CAAC;gBAC5E;YACJ;QACJ,IACJ;QAACA;KAAK;IAGV,OAAO;QAAEO;IAA8B;AAC3C"}
|
|
@@ -2,16 +2,19 @@ import { GetScheduledActionGateway } from "../../features/getScheduledAction/abs
|
|
|
2
2
|
import { CancelScheduledActionGateway } from "../../features/cancelScheduledAction/abstractions.js";
|
|
3
3
|
import { SchedulePublishActionGateway } from "../../features/schedulePublishAction/abstractions.js";
|
|
4
4
|
import { ScheduleUnpublishActionGateway } from "../../features/scheduleUnpublishAction/abstractions.js";
|
|
5
|
+
import { DateFormatter } from "@webiny/app-admin";
|
|
5
6
|
import { type IScheduleDialogPresenter, type IScheduleDialogPresenterViewModel, type IScheduleDialogPresenterLoadParams, type IScheduleDialogPresenterScheduleParams, type IScheduleDialogPresenterCancelParams } from "./abstractions.js";
|
|
6
7
|
declare class ScheduleDialogPresenterImpl implements IScheduleDialogPresenter {
|
|
7
8
|
private readonly getGateway;
|
|
8
9
|
private readonly cancelGateway;
|
|
9
10
|
private readonly publishGateway;
|
|
10
11
|
private readonly unpublishGateway;
|
|
12
|
+
private readonly dateFormatter;
|
|
11
13
|
private loading;
|
|
12
14
|
private entry;
|
|
13
|
-
constructor(getGateway: GetScheduledActionGateway.Interface, cancelGateway: CancelScheduledActionGateway.Interface, publishGateway: SchedulePublishActionGateway.Interface, unpublishGateway: ScheduleUnpublishActionGateway.Interface);
|
|
15
|
+
constructor(getGateway: GetScheduledActionGateway.Interface, cancelGateway: CancelScheduledActionGateway.Interface, publishGateway: SchedulePublishActionGateway.Interface, unpublishGateway: ScheduleUnpublishActionGateway.Interface, dateFormatter: DateFormatter.Interface);
|
|
14
16
|
get vm(): IScheduleDialogPresenterViewModel;
|
|
17
|
+
private getRescheduling;
|
|
15
18
|
load(params: IScheduleDialogPresenterLoadParams): Promise<void>;
|
|
16
19
|
schedule(params: IScheduleDialogPresenterScheduleParams): Promise<void>;
|
|
17
20
|
cancel(params: IScheduleDialogPresenterCancelParams): Promise<void>;
|
|
@@ -4,13 +4,15 @@ import { CancelScheduledActionGateway } from "../../features/cancelScheduledActi
|
|
|
4
4
|
import { SchedulePublishActionGateway } from "../../features/schedulePublishAction/abstractions.js";
|
|
5
5
|
import { ScheduleUnpublishActionGateway } from "../../features/scheduleUnpublishAction/abstractions.js";
|
|
6
6
|
import { ScheduleActionType } from "../../types.js";
|
|
7
|
+
import { DateFormatter } from "@webiny/app-admin";
|
|
7
8
|
import { ScheduleDialogPresenter } from "./abstractions.js";
|
|
8
9
|
class ScheduleDialogPresenterImpl {
|
|
9
|
-
constructor(getGateway, cancelGateway, publishGateway, unpublishGateway){
|
|
10
|
+
constructor(getGateway, cancelGateway, publishGateway, unpublishGateway, dateFormatter){
|
|
10
11
|
this.getGateway = getGateway;
|
|
11
12
|
this.cancelGateway = cancelGateway;
|
|
12
13
|
this.publishGateway = publishGateway;
|
|
13
14
|
this.unpublishGateway = unpublishGateway;
|
|
15
|
+
this.dateFormatter = dateFormatter;
|
|
14
16
|
this.loading = false;
|
|
15
17
|
this.entry = null;
|
|
16
18
|
makeAutoObservable(this);
|
|
@@ -18,7 +20,19 @@ class ScheduleDialogPresenterImpl {
|
|
|
18
20
|
get vm() {
|
|
19
21
|
return {
|
|
20
22
|
loading: this.loading,
|
|
21
|
-
entry: this.entry
|
|
23
|
+
entry: this.entry,
|
|
24
|
+
rescheduling: this.getRescheduling()
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
getRescheduling() {
|
|
28
|
+
const entry = this.entry;
|
|
29
|
+
if (!entry) return null;
|
|
30
|
+
const scheduleOn = entry.publishOn || entry.unpublishOn;
|
|
31
|
+
if (!scheduleOn) return null;
|
|
32
|
+
const actionName = entry.actionType === ScheduleActionType.publish ? "publish" : "unpublish";
|
|
33
|
+
return {
|
|
34
|
+
actionName,
|
|
35
|
+
scheduleOn: this.dateFormatter.format(scheduleOn)
|
|
22
36
|
};
|
|
23
37
|
}
|
|
24
38
|
async load(params) {
|
|
@@ -92,7 +106,8 @@ const ScheduleDialogPresenter_ScheduleDialogPresenter = ScheduleDialogPresenter.
|
|
|
92
106
|
GetScheduledActionGateway,
|
|
93
107
|
CancelScheduledActionGateway,
|
|
94
108
|
SchedulePublishActionGateway,
|
|
95
|
-
ScheduleUnpublishActionGateway
|
|
109
|
+
ScheduleUnpublishActionGateway,
|
|
110
|
+
DateFormatter
|
|
96
111
|
]
|
|
97
112
|
});
|
|
98
113
|
export { ScheduleDialogPresenter_ScheduleDialogPresenter as ScheduleDialogPresenter };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentation/scheduleDialog/ScheduleDialogPresenter.js","sources":["../../../src/presentation/scheduleDialog/ScheduleDialogPresenter.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from \"mobx\";\nimport { GetScheduledActionGateway } from \"~/features/getScheduledAction/abstractions.js\";\nimport { CancelScheduledActionGateway } from \"~/features/cancelScheduledAction/abstractions.js\";\nimport { SchedulePublishActionGateway } from \"~/features/schedulePublishAction/abstractions.js\";\nimport { ScheduleUnpublishActionGateway } from \"~/features/scheduleUnpublishAction/abstractions.js\";\nimport { ScheduleActionType } from \"~/types.js\";\nimport type { SchedulerEntry } from \"~/types.js\";\nimport {\n ScheduleDialogPresenter as Abstraction,\n type IScheduleDialogPresenter,\n type IScheduleDialogPresenterViewModel,\n type IScheduleDialogPresenterLoadParams,\n type IScheduleDialogPresenterScheduleParams,\n type IScheduleDialogPresenterCancelParams\n} from \"./abstractions.js\";\n\nclass ScheduleDialogPresenterImpl implements IScheduleDialogPresenter {\n private loading = false;\n private entry: SchedulerEntry | null = null;\n\n constructor(\n private readonly getGateway: GetScheduledActionGateway.Interface,\n private readonly cancelGateway: CancelScheduledActionGateway.Interface,\n private readonly publishGateway: SchedulePublishActionGateway.Interface,\n private readonly unpublishGateway: ScheduleUnpublishActionGateway.Interface\n ) {\n makeAutoObservable(this);\n }\n\n get vm(): IScheduleDialogPresenterViewModel {\n return {\n loading: this.loading,\n entry: this.entry\n };\n }\n\n async load(params: IScheduleDialogPresenterLoadParams): Promise<void> {\n this.loading = true;\n\n try {\n const entry = await this.getGateway.execute(params);\n runInAction(() => {\n this.entry = entry;\n this.loading = false;\n });\n } catch {\n runInAction(() => {\n this.loading = false;\n });\n }\n }\n\n async schedule(params: IScheduleDialogPresenterScheduleParams): Promise<void> {\n const { targetId, namespace, scheduleOn, actionType } = params;\n this.loading = true;\n\n try {\n switch (actionType) {\n case ScheduleActionType.publish:\n await this.publishGateway.execute({ namespace, targetId, scheduleOn });\n break;\n case ScheduleActionType.unpublish:\n await this.unpublishGateway.execute({ namespace, targetId, scheduleOn });\n break;\n default:\n throw new Error(`Unsupported action type \"${actionType}\".`);\n }\n runInAction(() => {\n this.entry = null;\n this.loading = false;\n });\n } catch {\n runInAction(() => {\n this.loading = false;\n });\n }\n }\n\n async cancel(params: IScheduleDialogPresenterCancelParams): Promise<void> {\n this.loading = true;\n\n try {\n await this.cancelGateway.execute(params);\n runInAction(() => {\n this.entry = null;\n this.loading = false;\n });\n } catch {\n runInAction(() => {\n this.loading = false;\n });\n }\n }\n\n reset(): void {\n this.entry = null;\n this.loading = false;\n }\n}\n\nexport const ScheduleDialogPresenter = Abstraction.createImplementation({\n implementation: ScheduleDialogPresenterImpl,\n dependencies: [\n GetScheduledActionGateway,\n CancelScheduledActionGateway,\n SchedulePublishActionGateway,\n ScheduleUnpublishActionGateway\n ]\n});\n"],"names":["ScheduleDialogPresenterImpl","getGateway","cancelGateway","publishGateway","unpublishGateway","
|
|
1
|
+
{"version":3,"file":"presentation/scheduleDialog/ScheduleDialogPresenter.js","sources":["../../../src/presentation/scheduleDialog/ScheduleDialogPresenter.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from \"mobx\";\nimport { GetScheduledActionGateway } from \"~/features/getScheduledAction/abstractions.js\";\nimport { CancelScheduledActionGateway } from \"~/features/cancelScheduledAction/abstractions.js\";\nimport { SchedulePublishActionGateway } from \"~/features/schedulePublishAction/abstractions.js\";\nimport { ScheduleUnpublishActionGateway } from \"~/features/scheduleUnpublishAction/abstractions.js\";\nimport { ScheduleActionType } from \"~/types.js\";\nimport type { SchedulerEntry } from \"~/types.js\";\nimport { DateFormatter } from \"@webiny/app-admin\";\nimport {\n ScheduleDialogPresenter as Abstraction,\n type IScheduleDialogPresenter,\n type IScheduleDialogPresenterViewModel,\n type IScheduleDialogRescheduling,\n type IScheduleDialogPresenterLoadParams,\n type IScheduleDialogPresenterScheduleParams,\n type IScheduleDialogPresenterCancelParams\n} from \"./abstractions.js\";\n\nclass ScheduleDialogPresenterImpl implements IScheduleDialogPresenter {\n private loading = false;\n private entry: SchedulerEntry | null = null;\n\n constructor(\n private readonly getGateway: GetScheduledActionGateway.Interface,\n private readonly cancelGateway: CancelScheduledActionGateway.Interface,\n private readonly publishGateway: SchedulePublishActionGateway.Interface,\n private readonly unpublishGateway: ScheduleUnpublishActionGateway.Interface,\n private readonly dateFormatter: DateFormatter.Interface\n ) {\n makeAutoObservable(this);\n }\n\n get vm(): IScheduleDialogPresenterViewModel {\n return {\n loading: this.loading,\n entry: this.entry,\n rescheduling: this.getRescheduling()\n };\n }\n\n private getRescheduling(): IScheduleDialogRescheduling | null {\n const entry = this.entry;\n if (!entry) {\n return null;\n }\n const scheduleOn = entry.publishOn || entry.unpublishOn;\n if (!scheduleOn) {\n return null;\n }\n const actionName =\n entry.actionType === ScheduleActionType.publish ? \"publish\" : \"unpublish\";\n return { actionName, scheduleOn: this.dateFormatter.format(scheduleOn) };\n }\n\n async load(params: IScheduleDialogPresenterLoadParams): Promise<void> {\n this.loading = true;\n\n try {\n const entry = await this.getGateway.execute(params);\n runInAction(() => {\n this.entry = entry;\n this.loading = false;\n });\n } catch {\n runInAction(() => {\n this.loading = false;\n });\n }\n }\n\n async schedule(params: IScheduleDialogPresenterScheduleParams): Promise<void> {\n const { targetId, namespace, scheduleOn, actionType } = params;\n this.loading = true;\n\n try {\n switch (actionType) {\n case ScheduleActionType.publish:\n await this.publishGateway.execute({ namespace, targetId, scheduleOn });\n break;\n case ScheduleActionType.unpublish:\n await this.unpublishGateway.execute({ namespace, targetId, scheduleOn });\n break;\n default:\n throw new Error(`Unsupported action type \"${actionType}\".`);\n }\n runInAction(() => {\n this.entry = null;\n this.loading = false;\n });\n } catch {\n runInAction(() => {\n this.loading = false;\n });\n }\n }\n\n async cancel(params: IScheduleDialogPresenterCancelParams): Promise<void> {\n this.loading = true;\n\n try {\n await this.cancelGateway.execute(params);\n runInAction(() => {\n this.entry = null;\n this.loading = false;\n });\n } catch {\n runInAction(() => {\n this.loading = false;\n });\n }\n }\n\n reset(): void {\n this.entry = null;\n this.loading = false;\n }\n}\n\nexport const ScheduleDialogPresenter = Abstraction.createImplementation({\n implementation: ScheduleDialogPresenterImpl,\n dependencies: [\n GetScheduledActionGateway,\n CancelScheduledActionGateway,\n SchedulePublishActionGateway,\n ScheduleUnpublishActionGateway,\n DateFormatter\n ]\n});\n"],"names":["ScheduleDialogPresenterImpl","getGateway","cancelGateway","publishGateway","unpublishGateway","dateFormatter","makeAutoObservable","entry","scheduleOn","actionName","ScheduleActionType","params","runInAction","targetId","namespace","actionType","Error","ScheduleDialogPresenter","Abstraction","GetScheduledActionGateway","CancelScheduledActionGateway","SchedulePublishActionGateway","ScheduleUnpublishActionGateway","DateFormatter"],"mappings":";;;;;;;;AAkBA,MAAMA;IAIF,YACqBC,UAA+C,EAC/CC,aAAqD,EACrDC,cAAsD,EACtDC,gBAA0D,EAC1DC,aAAsC,CACzD;aALmBJ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AAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;wBAAEI;wBAAWD;wBAAUL;oBAAW;oBACtE;gBACJ;oBACI,MAAM,IAAIQ,MAAM,CAAC,yBAAyB,EAAED,WAAW,EAAE,CAAC;YAClE;YACAH,YAAY;gBACR,IAAI,CAAC,KAAK,GAAG;gBACb,IAAI,CAAC,OAAO,GAAG;YACnB;QACJ,EAAE,OAAM;YACJA,YAAY;gBACR,IAAI,CAAC,OAAO,GAAG;YACnB;QACJ;IACJ;IAEA,MAAM,OAAOD,MAA4C,EAAiB;QACtE,IAAI,CAAC,OAAO,GAAG;QAEf,IAAI;YACA,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAACA;YACjCC,YAAY;gBACR,IAAI,CAAC,KAAK,GAAG;gBACb,IAAI,CAAC,OAAO,GAAG;YACnB;QACJ,EAAE,OAAM;YACJA,YAAY;gBACR,IAAI,CAAC,OAAO,GAAG;YACnB;QACJ;IACJ;IAEA,QAAc;QACV,IAAI,CAAC,KAAK,GAAG;QACb,IAAI,CAAC,OAAO,GAAG;IACnB;AACJ;AAEO,MAAMK,kDAA0BC,wBAAAA,oBAAgC,CAAC;IACpE,gBAAgBlB;IAChB,cAAc;QACVmB;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { ScheduleActionType, SchedulerEntry } from "../../types.js";
|
|
2
|
+
export interface IScheduleDialogRescheduling {
|
|
3
|
+
actionName: string;
|
|
4
|
+
scheduleOn: string;
|
|
5
|
+
}
|
|
2
6
|
export interface IScheduleDialogPresenterViewModel {
|
|
3
7
|
loading: boolean;
|
|
4
8
|
entry: SchedulerEntry | null;
|
|
9
|
+
rescheduling: IScheduleDialogRescheduling | null;
|
|
5
10
|
}
|
|
6
11
|
export interface IScheduleDialogPresenterLoadParams {
|
|
7
12
|
namespace: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentation/scheduleDialog/abstractions.js","sources":["../../../src/presentation/scheduleDialog/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { ScheduleActionType, SchedulerEntry } from \"~/types.js\";\n\nexport interface IScheduleDialogPresenterViewModel {\n loading: boolean;\n entry: SchedulerEntry | null;\n}\n\nexport interface IScheduleDialogPresenterLoadParams {\n namespace: string;\n id: string;\n}\n\nexport interface IScheduleDialogPresenterScheduleParams {\n targetId: string;\n namespace: string;\n scheduleOn: Date;\n actionType: ScheduleActionType;\n}\n\nexport interface IScheduleDialogPresenterCancelParams {\n id: string;\n namespace: string;\n}\n\nexport interface IScheduleDialogPresenter {\n get vm(): IScheduleDialogPresenterViewModel;\n load(params: IScheduleDialogPresenterLoadParams): Promise<void>;\n schedule(params: IScheduleDialogPresenterScheduleParams): Promise<void>;\n cancel(params: IScheduleDialogPresenterCancelParams): Promise<void>;\n reset(): void;\n}\n\nexport const ScheduleDialogPresenter = createAbstraction<IScheduleDialogPresenter>(\n \"Scheduler/ScheduleDialogPresenter\"\n);\n\nexport namespace ScheduleDialogPresenter {\n export type Interface = IScheduleDialogPresenter;\n}\n"],"names":["ScheduleDialogPresenter","createAbstraction"],"mappings":";
|
|
1
|
+
{"version":3,"file":"presentation/scheduleDialog/abstractions.js","sources":["../../../src/presentation/scheduleDialog/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { ScheduleActionType, SchedulerEntry } from \"~/types.js\";\n\nexport interface IScheduleDialogRescheduling {\n actionName: string;\n scheduleOn: string;\n}\n\nexport interface IScheduleDialogPresenterViewModel {\n loading: boolean;\n entry: SchedulerEntry | null;\n rescheduling: IScheduleDialogRescheduling | null;\n}\n\nexport interface IScheduleDialogPresenterLoadParams {\n namespace: string;\n id: string;\n}\n\nexport interface IScheduleDialogPresenterScheduleParams {\n targetId: string;\n namespace: string;\n scheduleOn: Date;\n actionType: ScheduleActionType;\n}\n\nexport interface IScheduleDialogPresenterCancelParams {\n id: string;\n namespace: string;\n}\n\nexport interface IScheduleDialogPresenter {\n get vm(): IScheduleDialogPresenterViewModel;\n load(params: IScheduleDialogPresenterLoadParams): Promise<void>;\n schedule(params: IScheduleDialogPresenterScheduleParams): Promise<void>;\n cancel(params: IScheduleDialogPresenterCancelParams): Promise<void>;\n reset(): void;\n}\n\nexport const ScheduleDialogPresenter = createAbstraction<IScheduleDialogPresenter>(\n \"Scheduler/ScheduleDialogPresenter\"\n);\n\nexport namespace ScheduleDialogPresenter {\n export type Interface = IScheduleDialogPresenter;\n}\n"],"names":["ScheduleDialogPresenter","createAbstraction"],"mappings":";AAuCO,MAAMA,0BAA0BC,kBACnC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { IScheduleDialogPresenter } from "../abstractions.js";
|
|
3
|
+
interface ICancelButtonComponentProps {
|
|
4
|
+
presenter: IScheduleDialogPresenter;
|
|
5
|
+
onCancel: () => Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export declare const CancelButtonComponent: (({ presenter, onCancel }: ICancelButtonComponentProps) => React.JSX.Element | null) & React.NamedExoticComponent<ICancelButtonComponentProps> & {
|
|
8
|
+
readonly type: ({ presenter, onCancel }: ICancelButtonComponentProps) => React.JSX.Element | null;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { observer } from "mobx-react-lite";
|
|
3
|
+
import { Button } from "@webiny/admin-ui";
|
|
4
|
+
import { ReactComponent } from "@webiny/icons/delete.svg";
|
|
5
|
+
const CancelButtonComponent = observer(({ presenter, onCancel })=>{
|
|
6
|
+
const { entry } = presenter.vm;
|
|
7
|
+
const scheduleOn = entry?.publishOn || entry?.unpublishOn;
|
|
8
|
+
if (!scheduleOn) return null;
|
|
9
|
+
return /*#__PURE__*/ react.createElement(Button, {
|
|
10
|
+
variant: "ghost",
|
|
11
|
+
onClick: onCancel,
|
|
12
|
+
text: "Cancel Schedule",
|
|
13
|
+
size: "md",
|
|
14
|
+
icon: /*#__PURE__*/ react.createElement(ReactComponent, null),
|
|
15
|
+
iconPosition: "start"
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
export { CancelButtonComponent };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=CancelButtonComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentation/scheduleDialog/components/CancelButtonComponent.js","sources":["../../../../src/presentation/scheduleDialog/components/CancelButtonComponent.tsx"],"sourcesContent":["import React from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { Button } from \"@webiny/admin-ui\";\nimport { ReactComponent as DeleteIcon } from \"@webiny/icons/delete.svg\";\nimport type { IScheduleDialogPresenter } from \"../abstractions.js\";\n\ninterface ICancelButtonComponentProps {\n presenter: IScheduleDialogPresenter;\n onCancel: () => Promise<void>;\n}\n\nexport const CancelButtonComponent = observer(\n ({ presenter, onCancel }: ICancelButtonComponentProps) => {\n const { entry } = presenter.vm;\n const scheduleOn = entry?.publishOn || entry?.unpublishOn;\n\n if (!scheduleOn) {\n return null;\n }\n return (\n <Button\n variant=\"ghost\"\n onClick={onCancel}\n text={\"Cancel Schedule\"}\n size=\"md\"\n icon={<DeleteIcon />}\n iconPosition=\"start\"\n />\n );\n }\n);\n"],"names":["CancelButtonComponent","observer","presenter","onCancel","entry","scheduleOn","Button","DeleteIcon"],"mappings":";;;;AAWO,MAAMA,wBAAwBC,SACjC,CAAC,EAAEC,SAAS,EAAEC,QAAQ,EAA+B;IACjD,MAAM,EAAEC,KAAK,EAAE,GAAGF,UAAU,EAAE;IAC9B,MAAMG,aAAaD,OAAO,aAAaA,OAAO;IAE9C,IAAI,CAACC,YACD,OAAO;IAEX,OAAO,WAAP,GACI,oBAACC,QAAMA;QACH,SAAQ;QACR,SAASH;QACT,MAAM;QACN,MAAK;QACL,oBAAM,oBAACI,gBAAUA;QACjB,cAAa;;AAGzB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { IScheduleDialogPresenter } from "../abstractions.js";
|
|
3
|
+
interface FormComponentProps {
|
|
4
|
+
presenter: IScheduleDialogPresenter;
|
|
5
|
+
}
|
|
6
|
+
export declare const FormComponent: (({ presenter }: FormComponentProps) => React.JSX.Element) & React.NamedExoticComponent<FormComponentProps> & {
|
|
7
|
+
readonly type: ({ presenter }: FormComponentProps) => React.JSX.Element;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import react, { useMemo } from "react";
|
|
2
|
+
import { observer } from "mobx-react-lite";
|
|
3
|
+
import { Grid } from "@webiny/admin-ui";
|
|
4
|
+
import { Bind } from "@webiny/form";
|
|
5
|
+
import { validation } from "@webiny/validation";
|
|
6
|
+
import { createMinDateValidator } from "../createMinDateValidator.js";
|
|
7
|
+
import { useDateFormatter } from "@webiny/app-admin";
|
|
8
|
+
import { ReschedulingAlert } from "./ReschedulingAlert.js";
|
|
9
|
+
import { SchedulerDialogFormComponentDateTimeInput } from "./SchedulerDialogFormComponentDateTimeInput.js";
|
|
10
|
+
const FormComponent = observer(({ presenter })=>{
|
|
11
|
+
const { rescheduling } = presenter.vm;
|
|
12
|
+
const dateFormatter = useDateFormatter();
|
|
13
|
+
const minDateValidator = useMemo(()=>createMinDateValidator(dateFormatter), [
|
|
14
|
+
dateFormatter
|
|
15
|
+
]);
|
|
16
|
+
return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(ReschedulingAlert, {
|
|
17
|
+
rescheduling: rescheduling
|
|
18
|
+
}), /*#__PURE__*/ react.createElement(Grid, null, /*#__PURE__*/ react.createElement(Grid.Column, {
|
|
19
|
+
span: 12
|
|
20
|
+
}, /*#__PURE__*/ react.createElement(Bind, {
|
|
21
|
+
name: "scheduleOn",
|
|
22
|
+
validators: [
|
|
23
|
+
validation.create("required"),
|
|
24
|
+
minDateValidator
|
|
25
|
+
]
|
|
26
|
+
}, (bind)=>/*#__PURE__*/ react.createElement(SchedulerDialogFormComponentDateTimeInput, {
|
|
27
|
+
bind: bind
|
|
28
|
+
})))));
|
|
29
|
+
});
|
|
30
|
+
export { FormComponent };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=FormComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentation/scheduleDialog/components/FormComponent.js","sources":["../../../../src/presentation/scheduleDialog/components/FormComponent.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { Grid } from \"@webiny/admin-ui\";\nimport { Bind } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport type { IScheduleDialogPresenter } from \"../abstractions.js\";\nimport { createMinDateValidator } from \"../createMinDateValidator.js\";\nimport { useDateFormatter } from \"@webiny/app-admin\";\nimport { ReschedulingAlert } from \"./ReschedulingAlert.js\";\nimport { SchedulerDialogFormComponentDateTimeInput } from \"./SchedulerDialogFormComponentDateTimeInput.js\";\n\ninterface FormComponentProps {\n presenter: IScheduleDialogPresenter;\n}\n\nexport const FormComponent = observer(({ presenter }: FormComponentProps) => {\n const { rescheduling } = presenter.vm;\n const dateFormatter = useDateFormatter();\n const minDateValidator = useMemo(() => createMinDateValidator(dateFormatter), [dateFormatter]);\n\n return (\n <>\n <ReschedulingAlert rescheduling={rescheduling} />\n <Grid>\n <Grid.Column span={12}>\n <Bind\n name={\"scheduleOn\"}\n validators={[validation.create(\"required\"), minDateValidator]}\n >\n {bind => {\n return <SchedulerDialogFormComponentDateTimeInput bind={bind} />;\n }}\n </Bind>\n </Grid.Column>\n </Grid>\n </>\n );\n});\n"],"names":["FormComponent","observer","presenter","rescheduling","dateFormatter","useDateFormatter","minDateValidator","useMemo","createMinDateValidator","ReschedulingAlert","Grid","Bind","validation","bind","SchedulerDialogFormComponentDateTimeInput"],"mappings":";;;;;;;;;AAeO,MAAMA,gBAAgBC,SAAS,CAAC,EAAEC,SAAS,EAAsB;IACpE,MAAM,EAAEC,YAAY,EAAE,GAAGD,UAAU,EAAE;IACrC,MAAME,gBAAgBC;IACtB,MAAMC,mBAAmBC,QAAQ,IAAMC,uBAAuBJ,gBAAgB;QAACA;KAAc;IAE7F,OAAO,WAAP,GACI,wDACI,oBAACK,mBAAiBA;QAAC,cAAcN;sBACjC,oBAACO,MAAIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACC,MAAIA;QACD,MAAM;QACN,YAAY;YAACC,WAAW,MAAM,CAAC;YAAaN;SAAiB;OAE5DO,CAAAA,OACU,WAAP,GAAO,oBAACC,2CAAyCA;YAAC,MAAMD;;AAOpF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { IScheduleDialogRescheduling } from "../abstractions.js";
|
|
3
|
+
interface IReschedulingAlertProps {
|
|
4
|
+
rescheduling: IScheduleDialogRescheduling | null;
|
|
5
|
+
}
|
|
6
|
+
export declare const ReschedulingAlert: ({ rescheduling }: IReschedulingAlertProps) => React.JSX.Element | null;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { Alert } from "@webiny/admin-ui";
|
|
3
|
+
import { ReactComponent } from "@webiny/icons/access_time.svg";
|
|
4
|
+
const ReschedulingAlert = ({ rescheduling })=>{
|
|
5
|
+
if (!rescheduling) return null;
|
|
6
|
+
return /*#__PURE__*/ react.createElement(Alert, {
|
|
7
|
+
type: "warning",
|
|
8
|
+
variant: "subtle",
|
|
9
|
+
icon: /*#__PURE__*/ react.createElement(ReactComponent, null)
|
|
10
|
+
}, /*#__PURE__*/ react.createElement(react.Fragment, null, "A ", rescheduling.actionName, " is already scheduled at", /*#__PURE__*/ react.createElement("br", null), /*#__PURE__*/ react.createElement("strong", null, rescheduling.scheduleOn), "."));
|
|
11
|
+
};
|
|
12
|
+
export { ReschedulingAlert };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=ReschedulingAlert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentation/scheduleDialog/components/ReschedulingAlert.js","sources":["../../../../src/presentation/scheduleDialog/components/ReschedulingAlert.tsx"],"sourcesContent":["import React from \"react\";\nimport { Alert } from \"@webiny/admin-ui\";\nimport { ReactComponent as ScheduledIcon } from \"@webiny/icons/access_time.svg\";\nimport type { IScheduleDialogRescheduling } from \"../abstractions.js\";\n\ninterface IReschedulingAlertProps {\n rescheduling: IScheduleDialogRescheduling | null;\n}\n\nexport const ReschedulingAlert = ({ rescheduling }: IReschedulingAlertProps) => {\n if (!rescheduling) {\n return null;\n }\n return (\n <Alert type={\"warning\"} variant={\"subtle\"} icon={<ScheduledIcon />}>\n <>\n A {rescheduling.actionName} is already scheduled at\n <br />\n <strong>{rescheduling.scheduleOn}</strong>.\n </>\n </Alert>\n );\n};\n"],"names":["ReschedulingAlert","rescheduling","Alert","ScheduledIcon"],"mappings":";;;AASO,MAAMA,oBAAoB,CAAC,EAAEC,YAAY,EAA2B;IACvE,IAAI,CAACA,cACD,OAAO;IAEX,OAAO,WAAP,GACI,oBAACC,OAAKA;QAAC,MAAM;QAAW,SAAS;QAAU,oBAAM,oBAACC,gBAAaA;qBAC3D,0CAAE,MACKF,aAAa,UAAU,EAAC,0CAC3B,oBAAC,2BACD,oBAAC,gBAAQA,aAAa,UAAU,GAAU;AAI1D"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { BindComponentRenderProp } from "@webiny/form";
|
|
3
|
+
export interface ISchedulerDialogFormComponentDateTimeInputProps {
|
|
4
|
+
bind: BindComponentRenderProp<Date>;
|
|
5
|
+
}
|
|
6
|
+
export declare const SchedulerDialogFormComponentDateTimeInput: ((props: ISchedulerDialogFormComponentDateTimeInputProps) => React.JSX.Element) & {
|
|
7
|
+
original: (props: ISchedulerDialogFormComponentDateTimeInputProps) => React.JSX.Element;
|
|
8
|
+
originalName: string;
|
|
9
|
+
displayName: string;
|
|
10
|
+
} & {
|
|
11
|
+
original: ((props: ISchedulerDialogFormComponentDateTimeInputProps) => React.JSX.Element) & {
|
|
12
|
+
original: (props: ISchedulerDialogFormComponentDateTimeInputProps) => React.JSX.Element;
|
|
13
|
+
originalName: string;
|
|
14
|
+
displayName: string;
|
|
15
|
+
};
|
|
16
|
+
originalName: string;
|
|
17
|
+
displayName: string;
|
|
18
|
+
} & {
|
|
19
|
+
createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<((props: ISchedulerDialogFormComponentDateTimeInputProps) => React.JSX.Element) & {
|
|
20
|
+
original: (props: ISchedulerDialogFormComponentDateTimeInputProps) => React.JSX.Element;
|
|
21
|
+
originalName: string;
|
|
22
|
+
displayName: string;
|
|
23
|
+
}>) => (props: unknown) => React.JSX.Element;
|
|
24
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { DatePicker } from "@webiny/admin-ui";
|
|
3
|
+
import { makeDecoratable } from "@webiny/react-composition";
|
|
4
|
+
const SchedulerDialogFormComponentDateTimeInput = makeDecoratable("SchedulerDialogFormComponentDateTimeInput", (props)=>{
|
|
5
|
+
const { bind } = props;
|
|
6
|
+
return /*#__PURE__*/ react.createElement(DatePicker, {
|
|
7
|
+
...bind,
|
|
8
|
+
type: "dateTimeLocal",
|
|
9
|
+
label: "Schedule On",
|
|
10
|
+
size: "lg"
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
export { SchedulerDialogFormComponentDateTimeInput };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=SchedulerDialogFormComponentDateTimeInput.js.map
|
package/presentation/scheduleDialog/components/SchedulerDialogFormComponentDateTimeInput.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentation/scheduleDialog/components/SchedulerDialogFormComponentDateTimeInput.js","sources":["../../../../src/presentation/scheduleDialog/components/SchedulerDialogFormComponentDateTimeInput.tsx"],"sourcesContent":["import React from \"react\";\nimport { DatePicker } from \"@webiny/admin-ui\";\nimport { makeDecoratable } from \"@webiny/react-composition\";\nimport type { BindComponentRenderProp } from \"@webiny/form\";\n\nexport interface ISchedulerDialogFormComponentDateTimeInputProps {\n bind: BindComponentRenderProp<Date>;\n}\n\nexport const SchedulerDialogFormComponentDateTimeInput = makeDecoratable(\n \"SchedulerDialogFormComponentDateTimeInput\",\n (props: ISchedulerDialogFormComponentDateTimeInputProps) => {\n const { bind } = props;\n\n return <DatePicker {...bind} type={\"dateTimeLocal\"} label={\"Schedule On\"} size={\"lg\"} />;\n }\n);\n"],"names":["SchedulerDialogFormComponentDateTimeInput","makeDecoratable","props","bind","DatePicker"],"mappings":";;;AASO,MAAMA,4CAA4CC,gBACrD,6CACA,CAACC;IACG,MAAM,EAAEC,IAAI,EAAE,GAAGD;IAEjB,OAAO,WAAP,GAAO,oBAACE,YAAUA;QAAE,GAAGD,IAAI;QAAE,MAAM;QAAiB,OAAO;QAAe,MAAM;;AACpF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Validator } from "@webiny/validation/types.js";
|
|
2
|
+
import type { DateFormatter } from "@webiny/app-admin";
|
|
3
|
+
/**
|
|
4
|
+
* Builds a validator that requires the scheduled date to be at least 2 minutes in the future. The
|
|
5
|
+
* formatter is injected so the error message's date matches the format used everywhere else.
|
|
6
|
+
*/
|
|
7
|
+
export declare const createMinDateValidator: (dateFormatter: DateFormatter.Interface) => Validator;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import validationError from "@webiny/validation/validationError.js";
|
|
2
|
+
const createMinDateValidator = (dateFormatter)=>{
|
|
3
|
+
const minDateValidator = (input)=>{
|
|
4
|
+
const value = new Date(input);
|
|
5
|
+
const minDate = new Date(new Date().getTime() + 120000);
|
|
6
|
+
if (minDate < value) return;
|
|
7
|
+
throw new validationError(`The date must be at least 2 minutes in the future. Current minimum date is ${dateFormatter.format(minDate)}.`);
|
|
8
|
+
};
|
|
9
|
+
minDateValidator.validatorName = "minDateValidator";
|
|
10
|
+
return minDateValidator;
|
|
11
|
+
};
|
|
12
|
+
export { createMinDateValidator };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=createMinDateValidator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentation/scheduleDialog/createMinDateValidator.js","sources":["../../../src/presentation/scheduleDialog/createMinDateValidator.ts"],"sourcesContent":["import type { Validator } from \"@webiny/validation/types.js\";\nimport ValidationError from \"@webiny/validation/validationError.js\";\nimport type { DateFormatter } from \"@webiny/app-admin\";\n\n/**\n * Builds a validator that requires the scheduled date to be at least 2 minutes in the future. The\n * formatter is injected so the error message's date matches the format used everywhere else.\n */\nexport const createMinDateValidator = (dateFormatter: DateFormatter.Interface): Validator => {\n const minDateValidator: Validator = (input: string) => {\n const value = new Date(input);\n const minDate = new Date(new Date().getTime() + 120 * 1000);\n if (minDate < value) {\n return;\n }\n throw new ValidationError(\n `The date must be at least 2 minutes in the future. Current minimum date is ${dateFormatter.format(\n minDate\n )}.`\n );\n };\n\n minDateValidator.validatorName = \"minDateValidator\";\n\n return minDateValidator;\n};\n"],"names":["createMinDateValidator","dateFormatter","minDateValidator","input","value","Date","minDate","ValidationError"],"mappings":";AAQO,MAAMA,yBAAyB,CAACC;IACnC,MAAMC,mBAA8B,CAACC;QACjC,MAAMC,QAAQ,IAAIC,KAAKF;QACvB,MAAMG,UAAU,IAAID,KAAK,IAAIA,OAAO,OAAO,KAAK;QAChD,IAAIC,UAAUF,OACV;QAEJ,MAAM,IAAIG,gBACN,CAAC,2EAA2E,EAAEN,cAAc,MAAM,CAC9FK,SACF,CAAC,CAAC;IAEZ;IAEAJ,iBAAiB,aAAa,GAAG;IAEjC,OAAOA;AACX"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { type BindComponentRenderProp } from "@webiny/form";
|
|
3
1
|
export type ShowDialogParamsEntryStatus = "published" | "unpublished" | "draft" | string;
|
|
4
2
|
export interface IShowDialogParamsEntry {
|
|
5
3
|
id: string;
|
|
@@ -9,31 +7,14 @@ export interface IShowDialogParamsEntry {
|
|
|
9
7
|
interface UseShowScheduleDialogResponse {
|
|
10
8
|
showDialog: () => void;
|
|
11
9
|
}
|
|
12
|
-
export interface ISchedulerDialogFormComponentDateTimeInputProps {
|
|
13
|
-
bind: BindComponentRenderProp<Date>;
|
|
14
|
-
}
|
|
15
|
-
export declare const SchedulerDialogFormComponentDateTimeInput: ((props: ISchedulerDialogFormComponentDateTimeInputProps) => React.JSX.Element) & {
|
|
16
|
-
original: (props: ISchedulerDialogFormComponentDateTimeInputProps) => React.JSX.Element;
|
|
17
|
-
originalName: string;
|
|
18
|
-
displayName: string;
|
|
19
|
-
} & {
|
|
20
|
-
original: ((props: ISchedulerDialogFormComponentDateTimeInputProps) => React.JSX.Element) & {
|
|
21
|
-
original: (props: ISchedulerDialogFormComponentDateTimeInputProps) => React.JSX.Element;
|
|
22
|
-
originalName: string;
|
|
23
|
-
displayName: string;
|
|
24
|
-
};
|
|
25
|
-
originalName: string;
|
|
26
|
-
displayName: string;
|
|
27
|
-
} & {
|
|
28
|
-
createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<((props: ISchedulerDialogFormComponentDateTimeInputProps) => React.JSX.Element) & {
|
|
29
|
-
original: (props: ISchedulerDialogFormComponentDateTimeInputProps) => React.JSX.Element;
|
|
30
|
-
originalName: string;
|
|
31
|
-
displayName: string;
|
|
32
|
-
}>) => (props: unknown) => React.JSX.Element;
|
|
33
|
-
};
|
|
34
10
|
export interface IUseScheduleDialogProps {
|
|
35
11
|
namespace: string;
|
|
36
12
|
target: IShowDialogParamsEntry;
|
|
13
|
+
/**
|
|
14
|
+
* Called after a scheduled action is successfully created/updated or cancelled. Use it to
|
|
15
|
+
* refresh anything that displays the scheduled state (e.g. list cells, form banners).
|
|
16
|
+
*/
|
|
17
|
+
onCompleted?: () => void;
|
|
37
18
|
}
|
|
38
19
|
export declare const useScheduleDialog: (props: IUseScheduleDialogProps) => UseShowScheduleDialogResponse;
|
|
39
20
|
export {};
|
|
@@ -1,82 +1,13 @@
|
|
|
1
1
|
import react, { useCallback, useMemo, useRef } from "react";
|
|
2
|
-
import { observer } from "mobx-react-lite";
|
|
3
2
|
import { useContainer } from "@webiny/app";
|
|
4
|
-
import {
|
|
5
|
-
import { ReactComponent } from "@webiny/icons/delete.svg";
|
|
3
|
+
import { useToast } from "@webiny/admin-ui";
|
|
6
4
|
import { useDialogs } from "@webiny/app-admin";
|
|
7
|
-
import { Bind } from "@webiny/form";
|
|
8
|
-
import { validation } from "@webiny/validation";
|
|
9
|
-
import validationError from "@webiny/validation/validationError.js";
|
|
10
|
-
import { makeDecoratable } from "@webiny/react-composition";
|
|
11
5
|
import { ScheduleActionType } from "../../types.js";
|
|
12
6
|
import { ScheduleDialogPresenter } from "./abstractions.js";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
month: "2-digit",
|
|
16
|
-
day: "2-digit",
|
|
17
|
-
hour: "2-digit",
|
|
18
|
-
minute: "2-digit",
|
|
19
|
-
second: void 0,
|
|
20
|
-
hour12: false
|
|
21
|
-
});
|
|
22
|
-
const ReschedulingAlert = ({ scheduleOn, actionType })=>{
|
|
23
|
-
if (!scheduleOn || !actionType) return null;
|
|
24
|
-
const actionName = actionType === ScheduleActionType.publish ? "publish" : "unpublish";
|
|
25
|
-
return /*#__PURE__*/ react.createElement(Alert, {
|
|
26
|
-
type: "danger"
|
|
27
|
-
}, /*#__PURE__*/ react.createElement(react.Fragment, null, "A ", actionName, " is already scheduled at", /*#__PURE__*/ react.createElement("br", null), /*#__PURE__*/ react.createElement("strong", null, dateToLocaleStringFormatter.format(scheduleOn)), "."));
|
|
28
|
-
};
|
|
29
|
-
const minDateValidator = (input)=>{
|
|
30
|
-
const value = new Date(input);
|
|
31
|
-
const minDate = new Date(new Date().getTime() + 120000);
|
|
32
|
-
if (minDate < value) return;
|
|
33
|
-
throw new validationError(`The date must be at least 2 minutes in the future. Current minimum date is ${dateToLocaleStringFormatter.format(minDate)}.`);
|
|
34
|
-
};
|
|
35
|
-
minDateValidator.validatorName = "minDateValidator";
|
|
36
|
-
const CancelButtonComponent = observer(({ presenter, onCancel })=>{
|
|
37
|
-
const { entry } = presenter.vm;
|
|
38
|
-
const scheduleOn = entry?.publishOn || entry?.unpublishOn;
|
|
39
|
-
const enabled = !!scheduleOn;
|
|
40
|
-
if (!enabled) return null;
|
|
41
|
-
return /*#__PURE__*/ react.createElement(Button, {
|
|
42
|
-
variant: "ghost",
|
|
43
|
-
onClick: onCancel,
|
|
44
|
-
text: "Cancel Schedule",
|
|
45
|
-
size: "md",
|
|
46
|
-
icon: /*#__PURE__*/ react.createElement(ReactComponent, null),
|
|
47
|
-
iconPosition: "start"
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
const SchedulerDialogFormComponentDateTimeInput = makeDecoratable("SchedulerDialogFormComponentDateTimeInput", (props)=>{
|
|
51
|
-
const { bind } = props;
|
|
52
|
-
return /*#__PURE__*/ react.createElement(DatePicker, {
|
|
53
|
-
...bind,
|
|
54
|
-
type: "dateTimeLocal",
|
|
55
|
-
label: "Schedule On",
|
|
56
|
-
size: "lg"
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
const FormComponent = observer(({ presenter })=>{
|
|
60
|
-
const { entry } = presenter.vm;
|
|
61
|
-
const scheduleOn = entry?.publishOn || entry?.unpublishOn;
|
|
62
|
-
const actionType = entry?.actionType;
|
|
63
|
-
return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(ReschedulingAlert, {
|
|
64
|
-
actionType: actionType,
|
|
65
|
-
scheduleOn: scheduleOn
|
|
66
|
-
}), /*#__PURE__*/ react.createElement(Grid, null, /*#__PURE__*/ react.createElement(Grid.Column, {
|
|
67
|
-
span: 12
|
|
68
|
-
}, /*#__PURE__*/ react.createElement(Bind, {
|
|
69
|
-
name: "scheduleOn",
|
|
70
|
-
validators: [
|
|
71
|
-
validation.create("required"),
|
|
72
|
-
minDateValidator
|
|
73
|
-
]
|
|
74
|
-
}, (bind)=>/*#__PURE__*/ react.createElement(SchedulerDialogFormComponentDateTimeInput, {
|
|
75
|
-
bind: bind
|
|
76
|
-
})))));
|
|
77
|
-
});
|
|
7
|
+
import { FormComponent } from "./components/FormComponent.js";
|
|
8
|
+
import { CancelButtonComponent } from "./components/CancelButtonComponent.js";
|
|
78
9
|
const useScheduleDialog = (props)=>{
|
|
79
|
-
const { target, namespace } = props;
|
|
10
|
+
const { target, namespace, onCompleted } = props;
|
|
80
11
|
const container = useContainer();
|
|
81
12
|
const dialog = useDialogs();
|
|
82
13
|
const toast = useToast();
|
|
@@ -96,6 +27,7 @@ const useScheduleDialog = (props)=>{
|
|
|
96
27
|
toast.showSuccessToast({
|
|
97
28
|
title: `Scheduled ${actionType} action for "${target.title}"!`
|
|
98
29
|
});
|
|
30
|
+
onCompleted?.();
|
|
99
31
|
} catch (error) {
|
|
100
32
|
toast.showWarningToast({
|
|
101
33
|
title: error.message
|
|
@@ -129,6 +61,7 @@ const useScheduleDialog = (props)=>{
|
|
|
129
61
|
toast.showSuccessToast({
|
|
130
62
|
title: `Canceled scheduled ${entry.actionType} on "${entry.title}"!`
|
|
131
63
|
});
|
|
64
|
+
onCompleted?.();
|
|
132
65
|
} catch (error) {
|
|
133
66
|
toast.showWarningToast({
|
|
134
67
|
title: error.message
|
|
@@ -190,6 +123,6 @@ const useScheduleDialog = (props)=>{
|
|
|
190
123
|
showDialog
|
|
191
124
|
};
|
|
192
125
|
};
|
|
193
|
-
export {
|
|
126
|
+
export { useScheduleDialog };
|
|
194
127
|
|
|
195
128
|
//# sourceMappingURL=useScheduleDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentation/scheduleDialog/useScheduleDialog.js","sources":["../../../src/presentation/scheduleDialog/useScheduleDialog.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useRef } from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { useContainer } from \"@webiny/app\";\nimport { useToast } from \"@webiny/admin-ui\";\nimport { Alert, Button, Grid, DatePicker } from \"@webiny/admin-ui\";\nimport { ReactComponent as DeleteIcon } from \"@webiny/icons/delete.svg\";\nimport { useDialogs } from \"@webiny/app-admin\";\nimport { Bind, type BindComponentRenderProp } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport type { Validator } from \"@webiny/validation/types.js\";\nimport ValidationError from \"@webiny/validation/validationError.js\";\nimport { makeDecoratable } from \"@webiny/react-composition\";\nimport { ScheduleActionType } from \"~/types.js\";\nimport { ScheduleDialogPresenter } from \"./abstractions.js\";\nimport type { IScheduleDialogPresenter } from \"./abstractions.js\";\n\nexport type ShowDialogParamsEntryStatus = \"published\" | \"unpublished\" | \"draft\" | string;\n\nexport interface IShowDialogParamsEntry {\n id: string;\n status: ShowDialogParamsEntryStatus;\n title: string;\n}\n\ninterface UseShowScheduleDialogResponse {\n showDialog: () => void;\n}\n\ninterface FormComponentProps {\n presenter: IScheduleDialogPresenter;\n}\n\nconst dateToLocaleStringFormatter = new Intl.DateTimeFormat(undefined, {\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: undefined,\n hour12: false\n});\n\ninterface IReschedulingAlertProps {\n scheduleOn: Date | undefined;\n actionType: ScheduleActionType | undefined;\n}\n\nconst ReschedulingAlert = ({ scheduleOn, actionType }: IReschedulingAlertProps) => {\n if (!scheduleOn || !actionType) {\n return null;\n }\n const actionName = actionType === ScheduleActionType.publish ? \"publish\" : \"unpublish\";\n return (\n <Alert type={\"danger\"}>\n <>\n A {actionName} is already scheduled at\n <br />\n <strong>{dateToLocaleStringFormatter.format(scheduleOn)}</strong>.\n </>\n </Alert>\n );\n};\n\nconst minDateValidator: Validator = (input: string) => {\n const value = new Date(input);\n const minDate = new Date(new Date().getTime() + 120 * 1000);\n if (minDate < value) {\n return;\n }\n throw new ValidationError(\n `The date must be at least 2 minutes in the future. Current minimum date is ${dateToLocaleStringFormatter.format(\n minDate\n )}.`\n );\n};\n\nminDateValidator.validatorName = \"minDateValidator\";\n\nexport interface ISchedulerDialogFormComponentDateTimeInputProps {\n bind: BindComponentRenderProp<Date>;\n}\n\ninterface ICancelButtonComponentProps {\n presenter: IScheduleDialogPresenter;\n onCancel: OnCancelCallable;\n}\nconst CancelButtonComponent = observer(({ presenter, onCancel }: ICancelButtonComponentProps) => {\n const { entry } = presenter.vm;\n const scheduleOn = entry?.publishOn || entry?.unpublishOn;\n const enabled = !!scheduleOn;\n\n if (!enabled) {\n return null;\n }\n return (\n <Button\n variant=\"ghost\"\n onClick={onCancel}\n text={\"Cancel Schedule\"}\n size=\"md\"\n icon={<DeleteIcon />}\n iconPosition=\"start\"\n />\n );\n});\n\nexport const SchedulerDialogFormComponentDateTimeInput = makeDecoratable(\n \"SchedulerDialogFormComponentDateTimeInput\",\n (props: ISchedulerDialogFormComponentDateTimeInputProps) => {\n const { bind } = props;\n\n return <DatePicker {...bind} type={\"dateTimeLocal\"} label={\"Schedule On\"} size={\"lg\"} />;\n }\n);\n\nconst FormComponent = observer(({ presenter }: FormComponentProps) => {\n const { entry } = presenter.vm;\n const scheduleOn = entry?.publishOn || entry?.unpublishOn;\n const actionType = entry?.actionType;\n\n return (\n <>\n {<ReschedulingAlert actionType={actionType} scheduleOn={scheduleOn} />}\n <Grid>\n <Grid.Column span={12}>\n <Bind\n name={\"scheduleOn\"}\n validators={[validation.create(\"required\"), minDateValidator]}\n >\n {bind => {\n return <SchedulerDialogFormComponentDateTimeInput bind={bind} />;\n }}\n </Bind>\n </Grid.Column>\n </Grid>\n </>\n );\n});\n\ninterface ScheduleFormData {\n scheduleOn?: string;\n}\n\ninterface IOnAcceptParams {\n scheduleOn: Date;\n actionType: ScheduleActionType;\n}\n\ninterface OnCancelCallable {\n (): Promise<void>;\n}\n\nexport interface IUseScheduleDialogProps {\n namespace: string;\n target: IShowDialogParamsEntry;\n}\n\nexport const useScheduleDialog = (\n props: IUseScheduleDialogProps\n): UseShowScheduleDialogResponse => {\n const { target, namespace } = props;\n const container = useContainer();\n const dialog = useDialogs();\n const toast = useToast();\n\n const presenter = useMemo(() => {\n return container.resolve(ScheduleDialogPresenter);\n }, [container]);\n\n const dialogClose = useRef<null | (() => void)>(() => {\n return;\n });\n\n const onAccept = useCallback(\n async (params: IOnAcceptParams) => {\n const { scheduleOn, actionType } = params;\n\n try {\n await presenter.schedule({\n targetId: target.id,\n namespace,\n scheduleOn,\n actionType\n });\n toast.showSuccessToast({\n title: `Scheduled ${actionType} action for \"${target.title}\"!`\n });\n } catch (error) {\n toast.showWarningToast({ title: error.message });\n console.error(error);\n }\n },\n [presenter.vm]\n );\n\n const onCancel = useCallback(async () => {\n const entry = presenter.vm.entry;\n if (!entry) {\n toast.showWarningToast({ title: `No scheduled action found for \"${target.title}\"!` });\n if (dialogClose.current) {\n dialogClose.current();\n dialogClose.current = null;\n }\n return;\n }\n\n if (dialogClose.current) {\n dialogClose.current();\n dialogClose.current = null;\n }\n\n try {\n await presenter.cancel({\n id: entry.id,\n namespace: entry.namespace\n });\n toast.showSuccessToast({\n title: `Canceled scheduled ${entry.actionType} on \"${entry.title}\"!`\n });\n } catch (error) {\n toast.showWarningToast({ title: error.message });\n }\n }, [presenter.vm]);\n\n const showDialog = async () => {\n const isPublished = target.status === \"published\";\n\n dialogClose.current = dialog.showDialog({\n title: `Schedule \"${target.title}\"`,\n content: <FormComponent presenter={presenter} />,\n formData: async () => {\n await presenter.load({ namespace, id: target.id });\n\n const entry = presenter.vm.entry;\n const scheduleOn = entry?.publishOn || entry?.unpublishOn;\n\n return { scheduleOn };\n },\n acceptLabel: isPublished ? \"Schedule Unpublish\" : \"Schedule Publish\",\n cancelLabel: \"Discard\",\n loadingLabel: \"Scheduling...\",\n dataLoadingLabel: \"Checking schedule...\",\n info: <CancelButtonComponent presenter={presenter} onCancel={onCancel} />,\n dismissible: false,\n onAccept: (data: Partial<ScheduleFormData>) => {\n if (!data.scheduleOn) {\n toast.showWarningToast({ title: `Missing \"Schedule On\" date!` });\n return;\n }\n let scheduleOn: Date;\n try {\n scheduleOn = new Date(data.scheduleOn);\n } catch (ex) {\n toast.showWarningToast({ title: `Invalid \"Schedule On\" date!` });\n console.error(ex);\n return;\n }\n\n const actionType = isPublished\n ? ScheduleActionType.unpublish\n : ScheduleActionType.publish;\n\n return onAccept({\n scheduleOn,\n actionType\n });\n }\n });\n };\n\n return {\n showDialog\n };\n};\n"],"names":["dateToLocaleStringFormatter","Intl","undefined","ReschedulingAlert","scheduleOn","actionType","actionName","ScheduleActionType","Alert","minDateValidator","input","value","Date","minDate","ValidationError","CancelButtonComponent","observer","presenter","onCancel","entry","enabled","Button","DeleteIcon","SchedulerDialogFormComponentDateTimeInput","makeDecoratable","props","bind","DatePicker","FormComponent","Grid","Bind","validation","useScheduleDialog","target","namespace","container","useContainer","dialog","useDialogs","toast","useToast","useMemo","ScheduleDialogPresenter","dialogClose","useRef","onAccept","useCallback","params","error","console","showDialog","isPublished","data","ex"],"mappings":";;;;;;;;;;;;AAgCA,MAAMA,8BAA8B,IAAIC,KAAK,cAAc,CAACC,QAAW;IACnE,MAAM;IACN,OAAO;IACP,KAAK;IACL,MAAM;IACN,QAAQ;IACR,QAAQA;IACR,QAAQ;AACZ;AAOA,MAAMC,oBAAoB,CAAC,EAAEC,UAAU,EAAEC,UAAU,EAA2B;IAC1E,IAAI,CAACD,cAAc,CAACC,YAChB,OAAO;IAEX,MAAMC,aAAaD,eAAeE,mBAAmB,OAAO,GAAG,YAAY;IAC3E,OAAO,WAAP,GACI,oBAACC,OAAKA;QAAC,MAAM;qBACT,0CAAE,MACKF,YAAW,0CACd,oBAAC,2BACD,oBAAC,gBAAQN,4BAA4B,MAAM,CAACI,cAAqB;AAIjF;AAEA,MAAMK,mBAA8B,CAACC;IACjC,MAAMC,QAAQ,IAAIC,KAAKF;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,OAAO;QACH6C;IACJ;AACJ"}
|
|
1
|
+
{"version":3,"file":"presentation/scheduleDialog/useScheduleDialog.js","sources":["../../../src/presentation/scheduleDialog/useScheduleDialog.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useRef } from \"react\";\nimport { useContainer } from \"@webiny/app\";\nimport { useToast } from \"@webiny/admin-ui\";\nimport { useDialogs } from \"@webiny/app-admin\";\nimport { ScheduleActionType } from \"~/types.js\";\nimport { ScheduleDialogPresenter } from \"./abstractions.js\";\nimport { FormComponent } from \"./components/FormComponent.js\";\nimport { CancelButtonComponent } from \"./components/CancelButtonComponent.js\";\n\nexport type ShowDialogParamsEntryStatus = \"published\" | \"unpublished\" | \"draft\" | string;\n\nexport interface IShowDialogParamsEntry {\n id: string;\n status: ShowDialogParamsEntryStatus;\n title: string;\n}\n\ninterface UseShowScheduleDialogResponse {\n showDialog: () => void;\n}\n\ninterface ScheduleFormData {\n scheduleOn?: string;\n}\n\ninterface IOnAcceptParams {\n scheduleOn: Date;\n actionType: ScheduleActionType;\n}\n\nexport interface IUseScheduleDialogProps {\n namespace: string;\n target: IShowDialogParamsEntry;\n /**\n * Called after a scheduled action is successfully created/updated or cancelled. Use it to\n * refresh anything that displays the scheduled state (e.g. list cells, form banners).\n */\n onCompleted?: () => void;\n}\n\nexport const useScheduleDialog = (\n props: IUseScheduleDialogProps\n): UseShowScheduleDialogResponse => {\n const { target, namespace, onCompleted } = props;\n const container = useContainer();\n const dialog = useDialogs();\n const toast = useToast();\n\n const presenter = useMemo(() => {\n return container.resolve(ScheduleDialogPresenter);\n }, [container]);\n\n const dialogClose = useRef<null | (() => void)>(() => {\n return;\n });\n\n const onAccept = useCallback(\n async (params: IOnAcceptParams) => {\n const { scheduleOn, actionType } = params;\n\n try {\n await presenter.schedule({\n targetId: target.id,\n namespace,\n scheduleOn,\n actionType\n });\n toast.showSuccessToast({\n title: `Scheduled ${actionType} action for \"${target.title}\"!`\n });\n onCompleted?.();\n } catch (error) {\n toast.showWarningToast({ title: error.message });\n console.error(error);\n }\n },\n [presenter.vm]\n );\n\n const onCancel = useCallback(async () => {\n const entry = presenter.vm.entry;\n if (!entry) {\n toast.showWarningToast({ title: `No scheduled action found for \"${target.title}\"!` });\n if (dialogClose.current) {\n dialogClose.current();\n dialogClose.current = null;\n }\n return;\n }\n\n if (dialogClose.current) {\n dialogClose.current();\n dialogClose.current = null;\n }\n\n try {\n await presenter.cancel({\n id: entry.id,\n namespace: entry.namespace\n });\n toast.showSuccessToast({\n title: `Canceled scheduled ${entry.actionType} on \"${entry.title}\"!`\n });\n onCompleted?.();\n } catch (error) {\n toast.showWarningToast({ title: error.message });\n }\n }, [presenter.vm]);\n\n const showDialog = async () => {\n const isPublished = target.status === \"published\";\n\n dialogClose.current = dialog.showDialog({\n title: `Schedule \"${target.title}\"`,\n content: <FormComponent presenter={presenter} />,\n formData: async () => {\n await presenter.load({ namespace, id: target.id });\n\n const entry = presenter.vm.entry;\n const scheduleOn = entry?.publishOn || entry?.unpublishOn;\n\n return { scheduleOn };\n },\n acceptLabel: isPublished ? \"Schedule Unpublish\" : \"Schedule Publish\",\n cancelLabel: \"Discard\",\n loadingLabel: \"Scheduling...\",\n dataLoadingLabel: \"Checking schedule...\",\n info: <CancelButtonComponent presenter={presenter} onCancel={onCancel} />,\n dismissible: false,\n onAccept: (data: Partial<ScheduleFormData>) => {\n if (!data.scheduleOn) {\n toast.showWarningToast({ title: `Missing \"Schedule On\" date!` });\n return;\n }\n let scheduleOn: Date;\n try {\n scheduleOn = new Date(data.scheduleOn);\n } catch (ex) {\n toast.showWarningToast({ title: `Invalid \"Schedule On\" date!` });\n console.error(ex);\n return;\n }\n\n const actionType = isPublished\n ? ScheduleActionType.unpublish\n : ScheduleActionType.publish;\n\n return onAccept({\n scheduleOn,\n actionType\n });\n }\n });\n };\n\n return {\n showDialog\n };\n};\n"],"names":["useScheduleDialog","props","target","namespace","onCompleted","container","useContainer","dialog","useDialogs","toast","useToast","presenter","useMemo","ScheduleDialogPresenter","dialogClose","useRef","onAccept","useCallback","params","scheduleOn","actionType","error","console","onCancel","entry","showDialog","isPublished","FormComponent","CancelButtonComponent","data","Date","ex","ScheduleActionType"],"mappings":";;;;;;;;AAwCO,MAAMA,oBAAoB,CAC7BC;IAEA,MAAM,EAAEC,MAAM,EAAEC,SAAS,EAAEC,WAAW,EAAE,GAAGH;IAC3C,MAAMI,YAAYC;IAClB,MAAMC,SAASC;IACf,MAAMC,QAAQC;IAEd,MAAMC,YAAYC,QAAQ,IACfP,UAAU,OAAO,CAACQ,0BAC1B;QAACR;KAAU;IAEd,MAAMS,cAAcC,OAA4B,KAEhD;IAEA,MAAMC,WAAWC,YACb,OAAOC;QACH,MAAM,EAAEC,UAAU,EAAEC,UAAU,EAAE,GAAGF;QAEnC,IAAI;YACA,MAAMP,UAAU,QAAQ,CAAC;gBACrB,UAAUT,OAAO,EAAE;gBACnBC;gBACAgB;gBACAC;YACJ;YACAX,MAAM,gBAAgB,CAAC;gBACnB,OAAO,CAAC,UAAU,EAAEW,WAAW,aAAa,EAAElB,OAAO,KAAK,CAAC,EAAE,CAAC;YAClE;YACAE;QACJ,EAAE,OAAOiB,OAAO;YACZZ,MAAM,gBAAgB,CAAC;gBAAE,OAAOY,MAAM,OAAO;YAAC;YAC9CC,QAAQ,KAAK,CAACD;QAClB;IACJ,GACA;QAACV,UAAU,EAAE;KAAC;IAGlB,MAAMY,WAAWN,YAAY;QACzB,MAAMO,QAAQb,UAAU,EAAE,CAAC,KAAK;QAChC,IAAI,CAACa,OAAO;YACRf,MAAM,gBAAgB,CAAC;gBAAE,OAAO,CAAC,+BAA+B,EAAEP,OAAO,KAAK,CAAC,EAAE,CAAC;YAAC;YACnF,IAAIY,YAAY,OAAO,EAAE;gBACrBA,YAAY,OAAO;gBACnBA,YAAY,OAAO,GAAG;YAC1B;YACA;QACJ;QAEA,IAAIA,YAAY,OAAO,EAAE;YACrBA,YAAY,OAAO;YACnBA,YAAY,OAAO,GAAG;QAC1B;QAEA,I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;gBACJ;gBAEA,MAAMX,aAAaM,cACbM,mBAAmB,SAAS,GAC5BA,mBAAmB,OAAO;gBAEhC,OAAOhB,SAAS;oBACZG;oBACAC;gBACJ;YACJ;QACJ;IACJ;IAEA,OAAO;QACHK;IACJ;AACJ"}
|
|
@@ -3,7 +3,7 @@ import type { ISchedulerListPresenter } from "../abstractions.js";
|
|
|
3
3
|
interface BottomInfoBarProps {
|
|
4
4
|
presenter: ISchedulerListPresenter;
|
|
5
5
|
}
|
|
6
|
-
export declare const BottomInfoBar: (({ presenter }: BottomInfoBarProps) => React.JSX.Element) & {
|
|
7
|
-
|
|
6
|
+
export declare const BottomInfoBar: (({ presenter }: BottomInfoBarProps) => React.JSX.Element) & React.NamedExoticComponent<BottomInfoBarProps> & {
|
|
7
|
+
readonly type: ({ presenter }: BottomInfoBarProps) => React.JSX.Element;
|
|
8
8
|
};
|
|
9
9
|
export {};
|
|
@@ -3,7 +3,7 @@ import type { ISchedulerListPresenter } from "../abstractions.js";
|
|
|
3
3
|
interface EmptyProps {
|
|
4
4
|
presenter: ISchedulerListPresenter;
|
|
5
5
|
}
|
|
6
|
-
export declare const Empty: (({ presenter }: EmptyProps) => React.JSX.Element) & {
|
|
7
|
-
|
|
6
|
+
export declare const Empty: (({ presenter }: EmptyProps) => React.JSX.Element) & React.NamedExoticComponent<EmptyProps> & {
|
|
7
|
+
readonly type: ({ presenter }: EmptyProps) => React.JSX.Element;
|
|
8
8
|
};
|
|
9
9
|
export {};
|
|
@@ -5,7 +5,7 @@ interface SchedulerOverlayProps {
|
|
|
5
5
|
title: string;
|
|
6
6
|
onExited: () => void;
|
|
7
7
|
}
|
|
8
|
-
export declare const SchedulerOverlay: (({ presenter, title, onExited }: SchedulerOverlayProps) => React.JSX.Element) & {
|
|
9
|
-
|
|
8
|
+
export declare const SchedulerOverlay: (({ presenter, title, onExited }: SchedulerOverlayProps) => React.JSX.Element) & React.NamedExoticComponent<SchedulerOverlayProps> & {
|
|
9
|
+
readonly type: ({ presenter, title, onExited }: SchedulerOverlayProps) => React.JSX.Element;
|
|
10
10
|
};
|
|
11
11
|
export {};
|
|
@@ -3,7 +3,7 @@ import type { ISchedulerListPresenter } from "../abstractions.js";
|
|
|
3
3
|
interface SchedulerTableProps {
|
|
4
4
|
presenter: ISchedulerListPresenter;
|
|
5
5
|
}
|
|
6
|
-
export declare const SchedulerTable: (({ presenter }: SchedulerTableProps) => React.JSX.Element) & {
|
|
7
|
-
|
|
6
|
+
export declare const SchedulerTable: (({ presenter }: SchedulerTableProps) => React.JSX.Element) & React.NamedExoticComponent<SchedulerTableProps> & {
|
|
7
|
+
readonly type: ({ presenter }: SchedulerTableProps) => React.JSX.Element;
|
|
8
8
|
};
|
|
9
9
|
export {};
|
|
@@ -3,7 +3,7 @@ import type { ISchedulerListPresenter } from "../abstractions.js";
|
|
|
3
3
|
interface SearchInputProps {
|
|
4
4
|
presenter: ISchedulerListPresenter;
|
|
5
5
|
}
|
|
6
|
-
export declare const SearchInput: (({ presenter }: SearchInputProps) => React.JSX.Element) & {
|
|
7
|
-
|
|
6
|
+
export declare const SearchInput: (({ presenter }: SearchInputProps) => React.JSX.Element) & React.NamedExoticComponent<SearchInputProps> & {
|
|
7
|
+
readonly type: ({ presenter }: SearchInputProps) => React.JSX.Element;
|
|
8
8
|
};
|
|
9
9
|
export {};
|