@cundi/refine-xaf 1.0.5 → 1.0.7
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/index.d.mts +118 -1
- package/dist/index.d.ts +118 -1
- package/dist/index.js +472 -20
- package/dist/index.mjs +479 -20
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -7,13 +7,13 @@ var TOKEN_KEY = "refine-auth";
|
|
|
7
7
|
var MAX_RETRIES = 3;
|
|
8
8
|
var BASE_RETRY_DELAY = 1e3;
|
|
9
9
|
var HttpError = class _HttpError extends Error {
|
|
10
|
-
constructor(statusCode,
|
|
11
|
-
super(
|
|
10
|
+
constructor(statusCode, message3, body) {
|
|
11
|
+
super(message3);
|
|
12
12
|
__publicField(this, "statusCode");
|
|
13
13
|
__publicField(this, "message");
|
|
14
14
|
__publicField(this, "body");
|
|
15
15
|
this.statusCode = statusCode;
|
|
16
|
-
this.message =
|
|
16
|
+
this.message = message3;
|
|
17
17
|
this.body = body;
|
|
18
18
|
Object.setPrototypeOf(this, _HttpError.prototype);
|
|
19
19
|
}
|
|
@@ -552,7 +552,7 @@ var parseFilter = (filter) => {
|
|
|
552
552
|
// src/dataProvider.ts
|
|
553
553
|
var dataProvider = (apiUrl) => ({
|
|
554
554
|
getList: async ({ resource, pagination, sorters, filters }) => {
|
|
555
|
-
const url = new URL(`${apiUrl}/${resource}
|
|
555
|
+
const url = new URL(`${apiUrl}/${resource}`, window.location.origin);
|
|
556
556
|
if (pagination) {
|
|
557
557
|
const { current, pageSize } = pagination;
|
|
558
558
|
if (current && pageSize) {
|
|
@@ -580,7 +580,7 @@ var dataProvider = (apiUrl) => ({
|
|
|
580
580
|
};
|
|
581
581
|
},
|
|
582
582
|
getOne: async ({ resource, id, meta }) => {
|
|
583
|
-
const url = new URL(`${apiUrl}/${resource}(${id})
|
|
583
|
+
const url = new URL(`${apiUrl}/${resource}(${id})`, window.location.origin);
|
|
584
584
|
if (meta?.expand) {
|
|
585
585
|
const expand = meta.expand.map((item) => item.field ?? item).join(",");
|
|
586
586
|
if (expand) {
|
|
@@ -593,7 +593,8 @@ var dataProvider = (apiUrl) => ({
|
|
|
593
593
|
return { data: { ...data, id: data.Oid } };
|
|
594
594
|
},
|
|
595
595
|
create: async ({ resource, variables }) => {
|
|
596
|
-
const
|
|
596
|
+
const url = new URL(`${apiUrl}/${resource}`, window.location.origin);
|
|
597
|
+
const response = await httpClient(url.toString(), {
|
|
597
598
|
method: "POST",
|
|
598
599
|
body: JSON.stringify(variables)
|
|
599
600
|
});
|
|
@@ -602,7 +603,8 @@ var dataProvider = (apiUrl) => ({
|
|
|
602
603
|
return { data };
|
|
603
604
|
},
|
|
604
605
|
update: async ({ resource, id, variables }) => {
|
|
605
|
-
const
|
|
606
|
+
const url = new URL(`${apiUrl}/${resource}(${id})`, window.location.origin);
|
|
607
|
+
const response = await httpClient(url.toString(), {
|
|
606
608
|
method: "PATCH",
|
|
607
609
|
body: JSON.stringify(variables)
|
|
608
610
|
});
|
|
@@ -613,14 +615,15 @@ var dataProvider = (apiUrl) => ({
|
|
|
613
615
|
return { data };
|
|
614
616
|
},
|
|
615
617
|
deleteOne: async ({ resource, id }) => {
|
|
616
|
-
|
|
618
|
+
const url = new URL(`${apiUrl}/${resource}(${id})`, window.location.origin);
|
|
619
|
+
await httpClient(url.toString(), {
|
|
617
620
|
method: "DELETE"
|
|
618
621
|
});
|
|
619
622
|
return { data: { id } };
|
|
620
623
|
},
|
|
621
624
|
getApiUrl: () => apiUrl,
|
|
622
625
|
getMany: async ({ resource, ids }) => {
|
|
623
|
-
const url = new URL(`${apiUrl}/${resource}
|
|
626
|
+
const url = new URL(`${apiUrl}/${resource}`, window.location.origin);
|
|
624
627
|
const filter = ids.map((id) => {
|
|
625
628
|
const isGuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(id.toString());
|
|
626
629
|
return `Oid eq ${isGuid ? id : `'${id}'`}`;
|
|
@@ -645,7 +648,10 @@ var dataProvider = (apiUrl) => ({
|
|
|
645
648
|
throw new Error("Not implemented");
|
|
646
649
|
},
|
|
647
650
|
custom: async ({ url, method, filters, sorters, payload, query, headers }) => {
|
|
648
|
-
let requestUrl = new URL(
|
|
651
|
+
let requestUrl = new URL(
|
|
652
|
+
url.startsWith("http") ? url : `${apiUrl}${url}`,
|
|
653
|
+
window.location.origin
|
|
654
|
+
);
|
|
649
655
|
if (filters) {
|
|
650
656
|
const filterString = generateFilterString(filters);
|
|
651
657
|
if (filterString) {
|
|
@@ -816,7 +822,58 @@ var en = {
|
|
|
816
822
|
drawioExamples: "Drawio Examples",
|
|
817
823
|
users: "Users",
|
|
818
824
|
roles: "Roles",
|
|
819
|
-
settings: "Settings"
|
|
825
|
+
settings: "Settings",
|
|
826
|
+
backgroundJobs: "Background Jobs"
|
|
827
|
+
},
|
|
828
|
+
backgroundJobs: {
|
|
829
|
+
title: "Background Jobs",
|
|
830
|
+
tabs: {
|
|
831
|
+
recurring: "Recurring",
|
|
832
|
+
succeeded: "Succeeded",
|
|
833
|
+
failed: "Failed",
|
|
834
|
+
processing: "Processing"
|
|
835
|
+
},
|
|
836
|
+
columns: {
|
|
837
|
+
id: "ID",
|
|
838
|
+
jobId: "Job ID",
|
|
839
|
+
jobName: "Job Name",
|
|
840
|
+
cron: "Cron",
|
|
841
|
+
queue: "Queue",
|
|
842
|
+
nextExecution: "Next Execution",
|
|
843
|
+
lastState: "Last State",
|
|
844
|
+
succeededAt: "Succeeded At",
|
|
845
|
+
failedAt: "Failed At",
|
|
846
|
+
startedAt: "Started At",
|
|
847
|
+
duration: "Duration (ms)",
|
|
848
|
+
exception: "Exception",
|
|
849
|
+
serverId: "Server ID",
|
|
850
|
+
actions: "Actions"
|
|
851
|
+
},
|
|
852
|
+
status: {
|
|
853
|
+
succeeded: "Succeeded",
|
|
854
|
+
failed: "Failed",
|
|
855
|
+
processing: "Processing",
|
|
856
|
+
scheduled: "Scheduled",
|
|
857
|
+
unknown: "Unknown"
|
|
858
|
+
},
|
|
859
|
+
actions: {
|
|
860
|
+
trigger: "Trigger Now",
|
|
861
|
+
delete: "Delete",
|
|
862
|
+
triggerSuccess: "Job triggered successfully",
|
|
863
|
+
deleteSuccess: "Job deleted successfully",
|
|
864
|
+
triggerError: "Failed to trigger job",
|
|
865
|
+
deleteError: "Failed to delete job"
|
|
866
|
+
},
|
|
867
|
+
drawer: {
|
|
868
|
+
title: "Job Details",
|
|
869
|
+
jobName: "Job Name",
|
|
870
|
+
createdAt: "Created At",
|
|
871
|
+
history: "History",
|
|
872
|
+
state: "State",
|
|
873
|
+
reason: "Reason",
|
|
874
|
+
data: "Data",
|
|
875
|
+
noData: "No Data"
|
|
876
|
+
}
|
|
820
877
|
}
|
|
821
878
|
};
|
|
822
879
|
var zhTW = {
|
|
@@ -915,7 +972,58 @@ var zhTW = {
|
|
|
915
972
|
drawioExamples: "Drawio \u7BC4\u4F8B",
|
|
916
973
|
users: "\u4F7F\u7528\u8005",
|
|
917
974
|
roles: "\u89D2\u8272",
|
|
918
|
-
settings: "\u8A2D\u5B9A"
|
|
975
|
+
settings: "\u8A2D\u5B9A",
|
|
976
|
+
backgroundJobs: "\u80CC\u666F\u6392\u7A0B"
|
|
977
|
+
},
|
|
978
|
+
backgroundJobs: {
|
|
979
|
+
title: "\u80CC\u666F\u6392\u7A0B",
|
|
980
|
+
tabs: {
|
|
981
|
+
recurring: "\u9031\u671F\u6027\u4EFB\u52D9",
|
|
982
|
+
succeeded: "\u6210\u529F",
|
|
983
|
+
failed: "\u5931\u6557",
|
|
984
|
+
processing: "\u57F7\u884C\u4E2D"
|
|
985
|
+
},
|
|
986
|
+
columns: {
|
|
987
|
+
id: "ID",
|
|
988
|
+
jobId: "\u4EFB\u52D9 ID",
|
|
989
|
+
jobName: "\u4EFB\u52D9\u540D\u7A31",
|
|
990
|
+
cron: "\u6392\u7A0B\u8868\u9054\u5F0F",
|
|
991
|
+
queue: "\u4F47\u5217",
|
|
992
|
+
nextExecution: "\u4E0B\u6B21\u57F7\u884C",
|
|
993
|
+
lastState: "\u6700\u5F8C\u72C0\u614B",
|
|
994
|
+
succeededAt: "\u6210\u529F\u6642\u9593",
|
|
995
|
+
failedAt: "\u5931\u6557\u6642\u9593",
|
|
996
|
+
startedAt: "\u958B\u59CB\u6642\u9593",
|
|
997
|
+
duration: "\u8017\u6642 (\u6BEB\u79D2)",
|
|
998
|
+
exception: "\u4F8B\u5916",
|
|
999
|
+
serverId: "\u4F3A\u670D\u5668 ID",
|
|
1000
|
+
actions: "\u64CD\u4F5C"
|
|
1001
|
+
},
|
|
1002
|
+
status: {
|
|
1003
|
+
succeeded: "\u6210\u529F",
|
|
1004
|
+
failed: "\u5931\u6557",
|
|
1005
|
+
processing: "\u57F7\u884C\u4E2D",
|
|
1006
|
+
scheduled: "\u5DF2\u6392\u7A0B",
|
|
1007
|
+
unknown: "\u672A\u77E5"
|
|
1008
|
+
},
|
|
1009
|
+
actions: {
|
|
1010
|
+
trigger: "\u7ACB\u5373\u57F7\u884C",
|
|
1011
|
+
delete: "\u522A\u9664",
|
|
1012
|
+
triggerSuccess: "\u4EFB\u52D9\u5DF2\u6210\u529F\u89F8\u767C",
|
|
1013
|
+
deleteSuccess: "\u4EFB\u52D9\u5DF2\u6210\u529F\u522A\u9664",
|
|
1014
|
+
triggerError: "\u89F8\u767C\u4EFB\u52D9\u5931\u6557",
|
|
1015
|
+
deleteError: "\u522A\u9664\u4EFB\u52D9\u5931\u6557"
|
|
1016
|
+
},
|
|
1017
|
+
drawer: {
|
|
1018
|
+
title: "\u4EFB\u52D9\u8A73\u60C5",
|
|
1019
|
+
jobName: "\u4EFB\u52D9\u540D\u7A31",
|
|
1020
|
+
createdAt: "\u5EFA\u7ACB\u6642\u9593",
|
|
1021
|
+
history: "\u6B77\u53F2\u7D00\u9304",
|
|
1022
|
+
state: "\u72C0\u614B",
|
|
1023
|
+
reason: "\u539F\u56E0",
|
|
1024
|
+
data: "\u8CC7\u6599",
|
|
1025
|
+
noData: "\u7121\u8CC7\u6599"
|
|
1026
|
+
}
|
|
919
1027
|
}
|
|
920
1028
|
};
|
|
921
1029
|
var refineXafTranslations = {
|
|
@@ -5181,8 +5289,8 @@ var StepResult = class _StepResult {
|
|
|
5181
5289
|
/**
|
|
5182
5290
|
Create a failed step result.
|
|
5183
5291
|
*/
|
|
5184
|
-
static fail(
|
|
5185
|
-
return new _StepResult(null,
|
|
5292
|
+
static fail(message3) {
|
|
5293
|
+
return new _StepResult(null, message3);
|
|
5186
5294
|
}
|
|
5187
5295
|
/**
|
|
5188
5296
|
Call [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) with the given
|
|
@@ -6394,8 +6502,8 @@ var DocAttrStep = class _DocAttrStep extends Step {
|
|
|
6394
6502
|
Step.jsonID("docAttr", DocAttrStep);
|
|
6395
6503
|
var TransformError = class extends Error {
|
|
6396
6504
|
};
|
|
6397
|
-
TransformError = function TransformError2(
|
|
6398
|
-
let err = Error.call(this,
|
|
6505
|
+
TransformError = function TransformError2(message3) {
|
|
6506
|
+
let err = Error.call(this, message3);
|
|
6399
6507
|
err.__proto__ = TransformError2.prototype;
|
|
6400
6508
|
return err;
|
|
6401
6509
|
};
|
|
@@ -19711,7 +19819,7 @@ import React13 from "react";
|
|
|
19711
19819
|
import { Edit, useForm as useForm2, useSelect } from "@refinedev/antd";
|
|
19712
19820
|
import { Form as Form7, Input as Input7, Checkbox as Checkbox5, Select, App } from "antd/lib";
|
|
19713
19821
|
var ApplicationUserEdit = () => {
|
|
19714
|
-
const { message:
|
|
19822
|
+
const { message: message3 } = App.useApp();
|
|
19715
19823
|
const { formProps, saveButtonProps, id, form } = useForm2({
|
|
19716
19824
|
meta: {
|
|
19717
19825
|
expand: ["Roles"]
|
|
@@ -19732,12 +19840,12 @@ var ApplicationUserEdit = () => {
|
|
|
19732
19840
|
})
|
|
19733
19841
|
});
|
|
19734
19842
|
if (response.ok) {
|
|
19735
|
-
|
|
19843
|
+
message3.success("Roles updated successfully");
|
|
19736
19844
|
} else {
|
|
19737
|
-
|
|
19845
|
+
message3.error("Failed to update roles");
|
|
19738
19846
|
}
|
|
19739
19847
|
} catch (e) {
|
|
19740
|
-
|
|
19848
|
+
message3.error("Error updating roles");
|
|
19741
19849
|
}
|
|
19742
19850
|
}
|
|
19743
19851
|
});
|
|
@@ -20083,11 +20191,362 @@ var RoleEdit = () => {
|
|
|
20083
20191
|
)
|
|
20084
20192
|
));
|
|
20085
20193
|
};
|
|
20194
|
+
|
|
20195
|
+
// src/pages/background-jobs/list.tsx
|
|
20196
|
+
import React18, { useState as useState7, useEffect as useEffect6, useCallback } from "react";
|
|
20197
|
+
import { useApiUrl, useTranslate as useTranslate3 } from "@refinedev/core";
|
|
20198
|
+
import { List as List3 } from "@refinedev/antd";
|
|
20199
|
+
import { Table as Table7, Button as Button8, Space as Space8, Tag, Card as Card3, Statistic, Row, Col, message as message2, Tooltip as Tooltip2, Tabs, Drawer, Descriptions, Timeline, Skeleton, theme as theme7 } from "antd";
|
|
20200
|
+
import {
|
|
20201
|
+
ReloadOutlined as ReloadOutlined2,
|
|
20202
|
+
PlayCircleOutlined,
|
|
20203
|
+
DeleteOutlined as DeleteOutlined2,
|
|
20204
|
+
CheckCircleOutlined,
|
|
20205
|
+
CloseCircleOutlined,
|
|
20206
|
+
SyncOutlined,
|
|
20207
|
+
ClockCircleOutlined
|
|
20208
|
+
} from "@ant-design/icons";
|
|
20209
|
+
var BackgroundJobList = ({
|
|
20210
|
+
title,
|
|
20211
|
+
apiUrl: customApiUrl
|
|
20212
|
+
}) => {
|
|
20213
|
+
const t = useTranslate3();
|
|
20214
|
+
const defaultApiUrl = useApiUrl();
|
|
20215
|
+
const apiUrl = customApiUrl || defaultApiUrl?.replace("/odata", "");
|
|
20216
|
+
const { token } = theme7.useToken();
|
|
20217
|
+
const [refreshKey, setRefreshKey] = useState7(0);
|
|
20218
|
+
const [activeTab, setActiveTab] = useState7("recurring");
|
|
20219
|
+
const [loading, setLoading] = useState7(false);
|
|
20220
|
+
const [recurringJobs, setRecurringJobs] = useState7([]);
|
|
20221
|
+
const [succeededResult, setSucceededResult] = useState7(null);
|
|
20222
|
+
const [failedResult, setFailedResult] = useState7(null);
|
|
20223
|
+
const [processingResult, setProcessingResult] = useState7(null);
|
|
20224
|
+
const [drawerVisible, setDrawerVisible] = useState7(false);
|
|
20225
|
+
const [jobDetails, setJobDetails] = useState7(null);
|
|
20226
|
+
const [detailLoading, setDetailLoading] = useState7(false);
|
|
20227
|
+
const fetchData = useCallback(async () => {
|
|
20228
|
+
setLoading(true);
|
|
20229
|
+
const token2 = localStorage.getItem("refine-auth") || localStorage.getItem("access_token");
|
|
20230
|
+
const headers = token2 ? { "Authorization": `Bearer ${token2}` } : {};
|
|
20231
|
+
try {
|
|
20232
|
+
const [recurringRes, succeededRes, failedRes, processingRes] = await Promise.all([
|
|
20233
|
+
fetch(`${apiUrl}/hangfire/recurring`, { headers }),
|
|
20234
|
+
fetch(`${apiUrl}/hangfire/jobs/succeeded`, { headers }),
|
|
20235
|
+
fetch(`${apiUrl}/hangfire/jobs/failed`, { headers }),
|
|
20236
|
+
fetch(`${apiUrl}/hangfire/jobs/processing`, { headers })
|
|
20237
|
+
]);
|
|
20238
|
+
if (recurringRes.ok) {
|
|
20239
|
+
const data = await recurringRes.json();
|
|
20240
|
+
setRecurringJobs(data.value || data || []);
|
|
20241
|
+
}
|
|
20242
|
+
if (succeededRes.ok) {
|
|
20243
|
+
setSucceededResult(await succeededRes.json());
|
|
20244
|
+
}
|
|
20245
|
+
if (failedRes.ok) {
|
|
20246
|
+
setFailedResult(await failedRes.json());
|
|
20247
|
+
}
|
|
20248
|
+
if (processingRes.ok) {
|
|
20249
|
+
setProcessingResult(await processingRes.json());
|
|
20250
|
+
}
|
|
20251
|
+
} catch (error) {
|
|
20252
|
+
console.error("Failed to fetch Hangfire data:", error);
|
|
20253
|
+
} finally {
|
|
20254
|
+
setLoading(false);
|
|
20255
|
+
}
|
|
20256
|
+
}, [apiUrl]);
|
|
20257
|
+
useEffect6(() => {
|
|
20258
|
+
fetchData();
|
|
20259
|
+
}, [fetchData, refreshKey]);
|
|
20260
|
+
const handleRefresh = () => {
|
|
20261
|
+
setRefreshKey((prev) => prev + 1);
|
|
20262
|
+
};
|
|
20263
|
+
const handleTrigger = async (jobId) => {
|
|
20264
|
+
try {
|
|
20265
|
+
const token2 = localStorage.getItem("refine-auth") || localStorage.getItem("access_token");
|
|
20266
|
+
const headers = token2 ? { "Authorization": `Bearer ${token2}` } : {};
|
|
20267
|
+
const response = await fetch(`${apiUrl}/hangfire/trigger/${jobId}`, {
|
|
20268
|
+
method: "POST",
|
|
20269
|
+
headers
|
|
20270
|
+
});
|
|
20271
|
+
if (response.ok) {
|
|
20272
|
+
message2.success(t("backgroundJobs.actions.triggerSuccess"));
|
|
20273
|
+
handleRefresh();
|
|
20274
|
+
} else {
|
|
20275
|
+
message2.error(t("backgroundJobs.actions.triggerError"));
|
|
20276
|
+
}
|
|
20277
|
+
} catch {
|
|
20278
|
+
message2.error(t("backgroundJobs.actions.triggerError"));
|
|
20279
|
+
}
|
|
20280
|
+
};
|
|
20281
|
+
const handleDelete = async (jobId) => {
|
|
20282
|
+
try {
|
|
20283
|
+
const token2 = localStorage.getItem("refine-auth") || localStorage.getItem("access_token");
|
|
20284
|
+
const headers = token2 ? { "Authorization": `Bearer ${token2}` } : {};
|
|
20285
|
+
const response = await fetch(`${apiUrl}/hangfire/recurring/${jobId}`, {
|
|
20286
|
+
method: "DELETE",
|
|
20287
|
+
headers
|
|
20288
|
+
});
|
|
20289
|
+
if (response.ok) {
|
|
20290
|
+
message2.success(t("backgroundJobs.actions.deleteSuccess"));
|
|
20291
|
+
handleRefresh();
|
|
20292
|
+
} else {
|
|
20293
|
+
message2.error(t("backgroundJobs.actions.deleteError"));
|
|
20294
|
+
}
|
|
20295
|
+
} catch {
|
|
20296
|
+
message2.error(t("backgroundJobs.actions.deleteError"));
|
|
20297
|
+
}
|
|
20298
|
+
};
|
|
20299
|
+
const showDetails = async (jobId) => {
|
|
20300
|
+
setDrawerVisible(true);
|
|
20301
|
+
setDetailLoading(true);
|
|
20302
|
+
setJobDetails(null);
|
|
20303
|
+
try {
|
|
20304
|
+
const token2 = localStorage.getItem("refine-auth") || localStorage.getItem("access_token");
|
|
20305
|
+
const headers = token2 ? { "Authorization": `Bearer ${token2}` } : {};
|
|
20306
|
+
const res = await fetch(`${apiUrl}/hangfire/jobs/${jobId}`, { headers });
|
|
20307
|
+
if (res.ok) {
|
|
20308
|
+
const data = await res.json();
|
|
20309
|
+
setJobDetails(data);
|
|
20310
|
+
} else {
|
|
20311
|
+
message2.error("Failed to load details");
|
|
20312
|
+
}
|
|
20313
|
+
} catch {
|
|
20314
|
+
message2.error("Failed to load details");
|
|
20315
|
+
} finally {
|
|
20316
|
+
setDetailLoading(false);
|
|
20317
|
+
}
|
|
20318
|
+
};
|
|
20319
|
+
const closeDrawer = () => {
|
|
20320
|
+
setDrawerVisible(false);
|
|
20321
|
+
setJobDetails(null);
|
|
20322
|
+
};
|
|
20323
|
+
const getStateTag = (state) => {
|
|
20324
|
+
if (!state) return /* @__PURE__ */ React18.createElement(Tag, null, t("backgroundJobs.status.unknown"));
|
|
20325
|
+
switch (state.toLowerCase()) {
|
|
20326
|
+
case "succeeded":
|
|
20327
|
+
return /* @__PURE__ */ React18.createElement(Tag, { icon: /* @__PURE__ */ React18.createElement(CheckCircleOutlined, null), color: "success" }, t("backgroundJobs.status.succeeded"));
|
|
20328
|
+
case "failed":
|
|
20329
|
+
return /* @__PURE__ */ React18.createElement(Tag, { icon: /* @__PURE__ */ React18.createElement(CloseCircleOutlined, null), color: "error" }, t("backgroundJobs.status.failed"));
|
|
20330
|
+
case "processing":
|
|
20331
|
+
return /* @__PURE__ */ React18.createElement(Tag, { icon: /* @__PURE__ */ React18.createElement(SyncOutlined, { spin: true }), color: "processing" }, t("backgroundJobs.status.processing"));
|
|
20332
|
+
case "scheduled":
|
|
20333
|
+
return /* @__PURE__ */ React18.createElement(Tag, { icon: /* @__PURE__ */ React18.createElement(ClockCircleOutlined, null), color: "warning" }, t("backgroundJobs.status.scheduled"));
|
|
20334
|
+
default:
|
|
20335
|
+
return /* @__PURE__ */ React18.createElement(Tag, null, state);
|
|
20336
|
+
}
|
|
20337
|
+
};
|
|
20338
|
+
const recurringColumns = [
|
|
20339
|
+
{ title: t("backgroundJobs.columns.id"), dataIndex: "Id", key: "Id" },
|
|
20340
|
+
{
|
|
20341
|
+
title: t("backgroundJobs.columns.cron"),
|
|
20342
|
+
dataIndex: "Cron",
|
|
20343
|
+
key: "Cron",
|
|
20344
|
+
render: (cron) => /* @__PURE__ */ React18.createElement(Tag, { color: "blue" }, cron)
|
|
20345
|
+
},
|
|
20346
|
+
{ title: t("backgroundJobs.columns.queue"), dataIndex: "Queue", key: "Queue" },
|
|
20347
|
+
{
|
|
20348
|
+
title: t("backgroundJobs.columns.nextExecution"),
|
|
20349
|
+
dataIndex: "NextExecution",
|
|
20350
|
+
key: "NextExecution",
|
|
20351
|
+
render: (date) => date ? new Date(date).toLocaleString() : "-"
|
|
20352
|
+
},
|
|
20353
|
+
{
|
|
20354
|
+
title: t("backgroundJobs.columns.lastState"),
|
|
20355
|
+
dataIndex: "LastJobState",
|
|
20356
|
+
key: "LastJobState",
|
|
20357
|
+
render: (state) => getStateTag(state)
|
|
20358
|
+
},
|
|
20359
|
+
{
|
|
20360
|
+
title: t("backgroundJobs.columns.actions"),
|
|
20361
|
+
key: "actions",
|
|
20362
|
+
render: (_, record) => /* @__PURE__ */ React18.createElement(Space8, null, /* @__PURE__ */ React18.createElement(Tooltip2, { title: t("backgroundJobs.actions.trigger") }, /* @__PURE__ */ React18.createElement(
|
|
20363
|
+
Button8,
|
|
20364
|
+
{
|
|
20365
|
+
type: "primary",
|
|
20366
|
+
icon: /* @__PURE__ */ React18.createElement(PlayCircleOutlined, null),
|
|
20367
|
+
size: "small",
|
|
20368
|
+
onClick: () => handleTrigger(record.Id)
|
|
20369
|
+
}
|
|
20370
|
+
)), /* @__PURE__ */ React18.createElement(Tooltip2, { title: t("backgroundJobs.actions.delete") }, /* @__PURE__ */ React18.createElement(
|
|
20371
|
+
Button8,
|
|
20372
|
+
{
|
|
20373
|
+
danger: true,
|
|
20374
|
+
icon: /* @__PURE__ */ React18.createElement(DeleteOutlined2, null),
|
|
20375
|
+
size: "small",
|
|
20376
|
+
onClick: () => handleDelete(record.Id)
|
|
20377
|
+
}
|
|
20378
|
+
)))
|
|
20379
|
+
}
|
|
20380
|
+
];
|
|
20381
|
+
const succeededColumns = [
|
|
20382
|
+
{
|
|
20383
|
+
title: t("backgroundJobs.columns.jobId"),
|
|
20384
|
+
dataIndex: "JobId",
|
|
20385
|
+
key: "JobId",
|
|
20386
|
+
render: (text) => /* @__PURE__ */ React18.createElement("a", { onClick: () => showDetails(text) }, text)
|
|
20387
|
+
},
|
|
20388
|
+
{ title: t("backgroundJobs.columns.jobName"), dataIndex: "JobName", key: "JobName" },
|
|
20389
|
+
{
|
|
20390
|
+
title: t("backgroundJobs.columns.succeededAt"),
|
|
20391
|
+
dataIndex: "SucceededAt",
|
|
20392
|
+
key: "SucceededAt",
|
|
20393
|
+
render: (date) => date ? new Date(date).toLocaleString() : "-"
|
|
20394
|
+
},
|
|
20395
|
+
{ title: t("backgroundJobs.columns.duration"), dataIndex: "TotalDuration", key: "TotalDuration" }
|
|
20396
|
+
];
|
|
20397
|
+
const failedColumns = [
|
|
20398
|
+
{
|
|
20399
|
+
title: t("backgroundJobs.columns.jobId"),
|
|
20400
|
+
dataIndex: "JobId",
|
|
20401
|
+
key: "JobId",
|
|
20402
|
+
render: (text) => /* @__PURE__ */ React18.createElement("a", { onClick: () => showDetails(text) }, text)
|
|
20403
|
+
},
|
|
20404
|
+
{ title: t("backgroundJobs.columns.jobName"), dataIndex: "JobName", key: "JobName" },
|
|
20405
|
+
{
|
|
20406
|
+
title: t("backgroundJobs.columns.failedAt"),
|
|
20407
|
+
dataIndex: "FailedAt",
|
|
20408
|
+
key: "FailedAt",
|
|
20409
|
+
render: (date) => date ? new Date(date).toLocaleString() : "-"
|
|
20410
|
+
},
|
|
20411
|
+
{
|
|
20412
|
+
title: t("backgroundJobs.columns.exception"),
|
|
20413
|
+
dataIndex: "ExceptionMessage",
|
|
20414
|
+
key: "ExceptionMessage",
|
|
20415
|
+
render: (msg) => /* @__PURE__ */ React18.createElement(Tooltip2, { title: msg }, /* @__PURE__ */ React18.createElement("span", null, msg?.substring(0, 50), msg && msg.length > 50 ? "..." : ""))
|
|
20416
|
+
}
|
|
20417
|
+
];
|
|
20418
|
+
const processingColumns = [
|
|
20419
|
+
{
|
|
20420
|
+
title: t("backgroundJobs.columns.jobId"),
|
|
20421
|
+
dataIndex: "JobId",
|
|
20422
|
+
key: "JobId",
|
|
20423
|
+
render: (text) => /* @__PURE__ */ React18.createElement("a", { onClick: () => showDetails(text) }, text)
|
|
20424
|
+
},
|
|
20425
|
+
{ title: t("backgroundJobs.columns.jobName"), dataIndex: "JobName", key: "JobName" },
|
|
20426
|
+
{
|
|
20427
|
+
title: t("backgroundJobs.columns.startedAt"),
|
|
20428
|
+
dataIndex: "StartedAt",
|
|
20429
|
+
key: "StartedAt",
|
|
20430
|
+
render: (date) => date ? new Date(date).toLocaleString() : "-"
|
|
20431
|
+
},
|
|
20432
|
+
{ title: t("backgroundJobs.columns.serverId"), dataIndex: "ServerId", key: "ServerId" }
|
|
20433
|
+
];
|
|
20434
|
+
const items = [
|
|
20435
|
+
{
|
|
20436
|
+
key: "recurring",
|
|
20437
|
+
label: `${t("backgroundJobs.tabs.recurring")} (${recurringJobs.length})`,
|
|
20438
|
+
children: /* @__PURE__ */ React18.createElement(
|
|
20439
|
+
Table7,
|
|
20440
|
+
{
|
|
20441
|
+
dataSource: recurringJobs,
|
|
20442
|
+
columns: recurringColumns,
|
|
20443
|
+
rowKey: "Id",
|
|
20444
|
+
loading,
|
|
20445
|
+
pagination: false
|
|
20446
|
+
}
|
|
20447
|
+
)
|
|
20448
|
+
},
|
|
20449
|
+
{
|
|
20450
|
+
key: "succeeded",
|
|
20451
|
+
label: /* @__PURE__ */ React18.createElement("span", null, /* @__PURE__ */ React18.createElement(CheckCircleOutlined, { style: { color: "#52c41a" } }), " ", t("backgroundJobs.tabs.succeeded"), " (", succeededResult?.Total || 0, ")"),
|
|
20452
|
+
children: /* @__PURE__ */ React18.createElement(
|
|
20453
|
+
Table7,
|
|
20454
|
+
{
|
|
20455
|
+
dataSource: succeededResult?.Jobs || [],
|
|
20456
|
+
columns: succeededColumns,
|
|
20457
|
+
rowKey: "JobId",
|
|
20458
|
+
loading,
|
|
20459
|
+
pagination: { pageSize: 10 }
|
|
20460
|
+
}
|
|
20461
|
+
)
|
|
20462
|
+
},
|
|
20463
|
+
{
|
|
20464
|
+
key: "failed",
|
|
20465
|
+
label: /* @__PURE__ */ React18.createElement("span", null, /* @__PURE__ */ React18.createElement(CloseCircleOutlined, { style: { color: "#ff4d4f" } }), " ", t("backgroundJobs.tabs.failed"), " (", failedResult?.Total || 0, ")"),
|
|
20466
|
+
children: /* @__PURE__ */ React18.createElement(
|
|
20467
|
+
Table7,
|
|
20468
|
+
{
|
|
20469
|
+
dataSource: failedResult?.Jobs || [],
|
|
20470
|
+
columns: failedColumns,
|
|
20471
|
+
rowKey: "JobId",
|
|
20472
|
+
loading,
|
|
20473
|
+
pagination: { pageSize: 10 }
|
|
20474
|
+
}
|
|
20475
|
+
)
|
|
20476
|
+
},
|
|
20477
|
+
{
|
|
20478
|
+
key: "processing",
|
|
20479
|
+
label: /* @__PURE__ */ React18.createElement("span", null, /* @__PURE__ */ React18.createElement(SyncOutlined, { spin: true, style: { color: "#1890ff" } }), " ", t("backgroundJobs.tabs.processing"), " (", processingResult?.Total || 0, ")"),
|
|
20480
|
+
children: /* @__PURE__ */ React18.createElement(
|
|
20481
|
+
Table7,
|
|
20482
|
+
{
|
|
20483
|
+
dataSource: processingResult?.Jobs || [],
|
|
20484
|
+
columns: processingColumns,
|
|
20485
|
+
rowKey: "JobId",
|
|
20486
|
+
loading,
|
|
20487
|
+
pagination: false
|
|
20488
|
+
}
|
|
20489
|
+
)
|
|
20490
|
+
}
|
|
20491
|
+
];
|
|
20492
|
+
return /* @__PURE__ */ React18.createElement(
|
|
20493
|
+
List3,
|
|
20494
|
+
{
|
|
20495
|
+
title: title || t("backgroundJobs.title"),
|
|
20496
|
+
headerButtons: /* @__PURE__ */ React18.createElement(Button8, { icon: /* @__PURE__ */ React18.createElement(ReloadOutlined2, null), onClick: handleRefresh, loading }, t("buttons.refresh"))
|
|
20497
|
+
},
|
|
20498
|
+
/* @__PURE__ */ React18.createElement(Row, { gutter: 16, style: { marginBottom: 16 } }, /* @__PURE__ */ React18.createElement(Col, { span: 6 }, /* @__PURE__ */ React18.createElement(Card3, null, /* @__PURE__ */ React18.createElement(
|
|
20499
|
+
Statistic,
|
|
20500
|
+
{
|
|
20501
|
+
title: t("backgroundJobs.tabs.recurring"),
|
|
20502
|
+
value: recurringJobs.length,
|
|
20503
|
+
prefix: /* @__PURE__ */ React18.createElement(ClockCircleOutlined, null)
|
|
20504
|
+
}
|
|
20505
|
+
))), /* @__PURE__ */ React18.createElement(Col, { span: 6 }, /* @__PURE__ */ React18.createElement(Card3, null, /* @__PURE__ */ React18.createElement(
|
|
20506
|
+
Statistic,
|
|
20507
|
+
{
|
|
20508
|
+
title: t("backgroundJobs.tabs.succeeded"),
|
|
20509
|
+
value: succeededResult?.Total || 0,
|
|
20510
|
+
valueStyle: { color: "#3f8600" },
|
|
20511
|
+
prefix: /* @__PURE__ */ React18.createElement(CheckCircleOutlined, null)
|
|
20512
|
+
}
|
|
20513
|
+
))), /* @__PURE__ */ React18.createElement(Col, { span: 6 }, /* @__PURE__ */ React18.createElement(Card3, null, /* @__PURE__ */ React18.createElement(
|
|
20514
|
+
Statistic,
|
|
20515
|
+
{
|
|
20516
|
+
title: t("backgroundJobs.tabs.failed"),
|
|
20517
|
+
value: failedResult?.Total || 0,
|
|
20518
|
+
valueStyle: { color: "#cf1322" },
|
|
20519
|
+
prefix: /* @__PURE__ */ React18.createElement(CloseCircleOutlined, null)
|
|
20520
|
+
}
|
|
20521
|
+
))), /* @__PURE__ */ React18.createElement(Col, { span: 6 }, /* @__PURE__ */ React18.createElement(Card3, null, /* @__PURE__ */ React18.createElement(
|
|
20522
|
+
Statistic,
|
|
20523
|
+
{
|
|
20524
|
+
title: t("backgroundJobs.tabs.processing"),
|
|
20525
|
+
value: processingResult?.Total || 0,
|
|
20526
|
+
valueStyle: { color: "#1890ff" },
|
|
20527
|
+
prefix: /* @__PURE__ */ React18.createElement(SyncOutlined, null)
|
|
20528
|
+
}
|
|
20529
|
+
)))),
|
|
20530
|
+
/* @__PURE__ */ React18.createElement(Tabs, { activeKey: activeTab, onChange: setActiveTab, items }),
|
|
20531
|
+
/* @__PURE__ */ React18.createElement(
|
|
20532
|
+
Drawer,
|
|
20533
|
+
{
|
|
20534
|
+
title: t("backgroundJobs.drawer.title"),
|
|
20535
|
+
placement: "right",
|
|
20536
|
+
onClose: closeDrawer,
|
|
20537
|
+
open: drawerVisible,
|
|
20538
|
+
width: 600
|
|
20539
|
+
},
|
|
20540
|
+
detailLoading ? /* @__PURE__ */ React18.createElement(Skeleton, { active: true }) : jobDetails ? /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(Descriptions, { column: 1, bordered: true, size: "small" }, /* @__PURE__ */ React18.createElement(Descriptions.Item, { label: t("backgroundJobs.drawer.jobName") }, jobDetails.JobName), /* @__PURE__ */ React18.createElement(Descriptions.Item, { label: t("backgroundJobs.drawer.createdAt") }, jobDetails.CreatedAt ? new Date(jobDetails.CreatedAt).toLocaleString() : "-")), /* @__PURE__ */ React18.createElement("div", { style: { marginTop: 24 } }, /* @__PURE__ */ React18.createElement("h3", null, t("backgroundJobs.drawer.history")), /* @__PURE__ */ React18.createElement(Timeline, { mode: "left" }, jobDetails.History.map((h, i) => /* @__PURE__ */ React18.createElement(Timeline.Item, { key: i, color: h.StateName === "Succeeded" ? "green" : h.StateName === "Failed" ? "red" : "blue" }, /* @__PURE__ */ React18.createElement("p", null, /* @__PURE__ */ React18.createElement("strong", null, h.StateName), " - ", new Date(h.CreatedAt).toLocaleString()), h.Reason && /* @__PURE__ */ React18.createElement("p", null, t("backgroundJobs.drawer.reason"), ": ", h.Reason), h.Data && Object.keys(h.Data).length > 0 && /* @__PURE__ */ React18.createElement("div", { style: { background: token.colorFillAlter, padding: 8, borderRadius: 4, overflowX: "auto", marginTop: 8 } }, /* @__PURE__ */ React18.createElement("pre", { style: { margin: 0, fontSize: 12, color: token.colorText } }, JSON.stringify(h.Data, null, 2)))))))) : /* @__PURE__ */ React18.createElement("div", null, t("backgroundJobs.drawer.noData"))
|
|
20541
|
+
)
|
|
20542
|
+
);
|
|
20543
|
+
};
|
|
20086
20544
|
export {
|
|
20087
20545
|
ApplicationUserCreate,
|
|
20088
20546
|
ApplicationUserEdit,
|
|
20089
20547
|
ApplicationUserList,
|
|
20090
20548
|
AuthCallback,
|
|
20549
|
+
BackgroundJobList,
|
|
20091
20550
|
Base64Upload,
|
|
20092
20551
|
ColorModeContext,
|
|
20093
20552
|
ColorModeContextProvider,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cundi/refine-xaf",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Integration SDK for XAF backend and Refine frontend",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "tsup",
|
|
10
10
|
"dev": "tsup --watch",
|
|
11
|
+
"pack": "npm run build && npm pack --pack-destination ../../output/npm",
|
|
11
12
|
"test": "jest",
|
|
12
13
|
"test:watch": "jest --watch",
|
|
13
14
|
"test:coverage": "jest --coverage",
|