@cundi/refine-xaf 1.0.5 → 1.0.6
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 +471 -20
- package/dist/index.mjs +478 -20
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -36,6 +36,7 @@ __export(index_exports, {
|
|
|
36
36
|
ApplicationUserEdit: () => ApplicationUserEdit,
|
|
37
37
|
ApplicationUserList: () => ApplicationUserList,
|
|
38
38
|
AuthCallback: () => AuthCallback,
|
|
39
|
+
BackgroundJobList: () => BackgroundJobList,
|
|
39
40
|
Base64Upload: () => Base64Upload,
|
|
40
41
|
ColorModeContext: () => ColorModeContext,
|
|
41
42
|
ColorModeContextProvider: () => ColorModeContextProvider,
|
|
@@ -74,13 +75,13 @@ var TOKEN_KEY = "refine-auth";
|
|
|
74
75
|
var MAX_RETRIES = 3;
|
|
75
76
|
var BASE_RETRY_DELAY = 1e3;
|
|
76
77
|
var HttpError = class _HttpError extends Error {
|
|
77
|
-
constructor(statusCode,
|
|
78
|
-
super(
|
|
78
|
+
constructor(statusCode, message3, body) {
|
|
79
|
+
super(message3);
|
|
79
80
|
__publicField(this, "statusCode");
|
|
80
81
|
__publicField(this, "message");
|
|
81
82
|
__publicField(this, "body");
|
|
82
83
|
this.statusCode = statusCode;
|
|
83
|
-
this.message =
|
|
84
|
+
this.message = message3;
|
|
84
85
|
this.body = body;
|
|
85
86
|
Object.setPrototypeOf(this, _HttpError.prototype);
|
|
86
87
|
}
|
|
@@ -620,7 +621,7 @@ var parseFilter = (filter) => {
|
|
|
620
621
|
// src/dataProvider.ts
|
|
621
622
|
var dataProvider = (apiUrl) => ({
|
|
622
623
|
getList: async ({ resource, pagination, sorters, filters }) => {
|
|
623
|
-
const url = new URL(`${apiUrl}/${resource}
|
|
624
|
+
const url = new URL(`${apiUrl}/${resource}`, window.location.origin);
|
|
624
625
|
if (pagination) {
|
|
625
626
|
const { current, pageSize } = pagination;
|
|
626
627
|
if (current && pageSize) {
|
|
@@ -648,7 +649,7 @@ var dataProvider = (apiUrl) => ({
|
|
|
648
649
|
};
|
|
649
650
|
},
|
|
650
651
|
getOne: async ({ resource, id, meta }) => {
|
|
651
|
-
const url = new URL(`${apiUrl}/${resource}(${id})
|
|
652
|
+
const url = new URL(`${apiUrl}/${resource}(${id})`, window.location.origin);
|
|
652
653
|
if (meta?.expand) {
|
|
653
654
|
const expand = meta.expand.map((item) => item.field ?? item).join(",");
|
|
654
655
|
if (expand) {
|
|
@@ -661,7 +662,8 @@ var dataProvider = (apiUrl) => ({
|
|
|
661
662
|
return { data: { ...data, id: data.Oid } };
|
|
662
663
|
},
|
|
663
664
|
create: async ({ resource, variables }) => {
|
|
664
|
-
const
|
|
665
|
+
const url = new URL(`${apiUrl}/${resource}`, window.location.origin);
|
|
666
|
+
const response = await httpClient(url.toString(), {
|
|
665
667
|
method: "POST",
|
|
666
668
|
body: JSON.stringify(variables)
|
|
667
669
|
});
|
|
@@ -670,7 +672,8 @@ var dataProvider = (apiUrl) => ({
|
|
|
670
672
|
return { data };
|
|
671
673
|
},
|
|
672
674
|
update: async ({ resource, id, variables }) => {
|
|
673
|
-
const
|
|
675
|
+
const url = new URL(`${apiUrl}/${resource}(${id})`, window.location.origin);
|
|
676
|
+
const response = await httpClient(url.toString(), {
|
|
674
677
|
method: "PATCH",
|
|
675
678
|
body: JSON.stringify(variables)
|
|
676
679
|
});
|
|
@@ -681,14 +684,15 @@ var dataProvider = (apiUrl) => ({
|
|
|
681
684
|
return { data };
|
|
682
685
|
},
|
|
683
686
|
deleteOne: async ({ resource, id }) => {
|
|
684
|
-
|
|
687
|
+
const url = new URL(`${apiUrl}/${resource}(${id})`, window.location.origin);
|
|
688
|
+
await httpClient(url.toString(), {
|
|
685
689
|
method: "DELETE"
|
|
686
690
|
});
|
|
687
691
|
return { data: { id } };
|
|
688
692
|
},
|
|
689
693
|
getApiUrl: () => apiUrl,
|
|
690
694
|
getMany: async ({ resource, ids }) => {
|
|
691
|
-
const url = new URL(`${apiUrl}/${resource}
|
|
695
|
+
const url = new URL(`${apiUrl}/${resource}`, window.location.origin);
|
|
692
696
|
const filter = ids.map((id) => {
|
|
693
697
|
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());
|
|
694
698
|
return `Oid eq ${isGuid ? id : `'${id}'`}`;
|
|
@@ -713,7 +717,10 @@ var dataProvider = (apiUrl) => ({
|
|
|
713
717
|
throw new Error("Not implemented");
|
|
714
718
|
},
|
|
715
719
|
custom: async ({ url, method, filters, sorters, payload, query, headers }) => {
|
|
716
|
-
let requestUrl = new URL(
|
|
720
|
+
let requestUrl = new URL(
|
|
721
|
+
url.startsWith("http") ? url : `${apiUrl}${url}`,
|
|
722
|
+
window.location.origin
|
|
723
|
+
);
|
|
717
724
|
if (filters) {
|
|
718
725
|
const filterString = generateFilterString(filters);
|
|
719
726
|
if (filterString) {
|
|
@@ -884,7 +891,58 @@ var en = {
|
|
|
884
891
|
drawioExamples: "Drawio Examples",
|
|
885
892
|
users: "Users",
|
|
886
893
|
roles: "Roles",
|
|
887
|
-
settings: "Settings"
|
|
894
|
+
settings: "Settings",
|
|
895
|
+
backgroundJobs: "Background Jobs"
|
|
896
|
+
},
|
|
897
|
+
backgroundJobs: {
|
|
898
|
+
title: "Background Jobs",
|
|
899
|
+
tabs: {
|
|
900
|
+
recurring: "Recurring",
|
|
901
|
+
succeeded: "Succeeded",
|
|
902
|
+
failed: "Failed",
|
|
903
|
+
processing: "Processing"
|
|
904
|
+
},
|
|
905
|
+
columns: {
|
|
906
|
+
id: "ID",
|
|
907
|
+
jobId: "Job ID",
|
|
908
|
+
jobName: "Job Name",
|
|
909
|
+
cron: "Cron",
|
|
910
|
+
queue: "Queue",
|
|
911
|
+
nextExecution: "Next Execution",
|
|
912
|
+
lastState: "Last State",
|
|
913
|
+
succeededAt: "Succeeded At",
|
|
914
|
+
failedAt: "Failed At",
|
|
915
|
+
startedAt: "Started At",
|
|
916
|
+
duration: "Duration (ms)",
|
|
917
|
+
exception: "Exception",
|
|
918
|
+
serverId: "Server ID",
|
|
919
|
+
actions: "Actions"
|
|
920
|
+
},
|
|
921
|
+
status: {
|
|
922
|
+
succeeded: "Succeeded",
|
|
923
|
+
failed: "Failed",
|
|
924
|
+
processing: "Processing",
|
|
925
|
+
scheduled: "Scheduled",
|
|
926
|
+
unknown: "Unknown"
|
|
927
|
+
},
|
|
928
|
+
actions: {
|
|
929
|
+
trigger: "Trigger Now",
|
|
930
|
+
delete: "Delete",
|
|
931
|
+
triggerSuccess: "Job triggered successfully",
|
|
932
|
+
deleteSuccess: "Job deleted successfully",
|
|
933
|
+
triggerError: "Failed to trigger job",
|
|
934
|
+
deleteError: "Failed to delete job"
|
|
935
|
+
},
|
|
936
|
+
drawer: {
|
|
937
|
+
title: "Job Details",
|
|
938
|
+
jobName: "Job Name",
|
|
939
|
+
createdAt: "Created At",
|
|
940
|
+
history: "History",
|
|
941
|
+
state: "State",
|
|
942
|
+
reason: "Reason",
|
|
943
|
+
data: "Data",
|
|
944
|
+
noData: "No Data"
|
|
945
|
+
}
|
|
888
946
|
}
|
|
889
947
|
};
|
|
890
948
|
var zhTW = {
|
|
@@ -983,7 +1041,58 @@ var zhTW = {
|
|
|
983
1041
|
drawioExamples: "Drawio \u7BC4\u4F8B",
|
|
984
1042
|
users: "\u4F7F\u7528\u8005",
|
|
985
1043
|
roles: "\u89D2\u8272",
|
|
986
|
-
settings: "\u8A2D\u5B9A"
|
|
1044
|
+
settings: "\u8A2D\u5B9A",
|
|
1045
|
+
backgroundJobs: "\u80CC\u666F\u6392\u7A0B"
|
|
1046
|
+
},
|
|
1047
|
+
backgroundJobs: {
|
|
1048
|
+
title: "\u80CC\u666F\u6392\u7A0B",
|
|
1049
|
+
tabs: {
|
|
1050
|
+
recurring: "\u9031\u671F\u6027\u4EFB\u52D9",
|
|
1051
|
+
succeeded: "\u6210\u529F",
|
|
1052
|
+
failed: "\u5931\u6557",
|
|
1053
|
+
processing: "\u57F7\u884C\u4E2D"
|
|
1054
|
+
},
|
|
1055
|
+
columns: {
|
|
1056
|
+
id: "ID",
|
|
1057
|
+
jobId: "\u4EFB\u52D9 ID",
|
|
1058
|
+
jobName: "\u4EFB\u52D9\u540D\u7A31",
|
|
1059
|
+
cron: "\u6392\u7A0B\u8868\u9054\u5F0F",
|
|
1060
|
+
queue: "\u4F47\u5217",
|
|
1061
|
+
nextExecution: "\u4E0B\u6B21\u57F7\u884C",
|
|
1062
|
+
lastState: "\u6700\u5F8C\u72C0\u614B",
|
|
1063
|
+
succeededAt: "\u6210\u529F\u6642\u9593",
|
|
1064
|
+
failedAt: "\u5931\u6557\u6642\u9593",
|
|
1065
|
+
startedAt: "\u958B\u59CB\u6642\u9593",
|
|
1066
|
+
duration: "\u8017\u6642 (\u6BEB\u79D2)",
|
|
1067
|
+
exception: "\u4F8B\u5916",
|
|
1068
|
+
serverId: "\u4F3A\u670D\u5668 ID",
|
|
1069
|
+
actions: "\u64CD\u4F5C"
|
|
1070
|
+
},
|
|
1071
|
+
status: {
|
|
1072
|
+
succeeded: "\u6210\u529F",
|
|
1073
|
+
failed: "\u5931\u6557",
|
|
1074
|
+
processing: "\u57F7\u884C\u4E2D",
|
|
1075
|
+
scheduled: "\u5DF2\u6392\u7A0B",
|
|
1076
|
+
unknown: "\u672A\u77E5"
|
|
1077
|
+
},
|
|
1078
|
+
actions: {
|
|
1079
|
+
trigger: "\u7ACB\u5373\u57F7\u884C",
|
|
1080
|
+
delete: "\u522A\u9664",
|
|
1081
|
+
triggerSuccess: "\u4EFB\u52D9\u5DF2\u6210\u529F\u89F8\u767C",
|
|
1082
|
+
deleteSuccess: "\u4EFB\u52D9\u5DF2\u6210\u529F\u522A\u9664",
|
|
1083
|
+
triggerError: "\u89F8\u767C\u4EFB\u52D9\u5931\u6557",
|
|
1084
|
+
deleteError: "\u522A\u9664\u4EFB\u52D9\u5931\u6557"
|
|
1085
|
+
},
|
|
1086
|
+
drawer: {
|
|
1087
|
+
title: "\u4EFB\u52D9\u8A73\u60C5",
|
|
1088
|
+
jobName: "\u4EFB\u52D9\u540D\u7A31",
|
|
1089
|
+
createdAt: "\u5EFA\u7ACB\u6642\u9593",
|
|
1090
|
+
history: "\u6B77\u53F2\u7D00\u9304",
|
|
1091
|
+
state: "\u72C0\u614B",
|
|
1092
|
+
reason: "\u539F\u56E0",
|
|
1093
|
+
data: "\u8CC7\u6599",
|
|
1094
|
+
noData: "\u7121\u8CC7\u6599"
|
|
1095
|
+
}
|
|
987
1096
|
}
|
|
988
1097
|
};
|
|
989
1098
|
var refineXafTranslations = {
|
|
@@ -5242,8 +5351,8 @@ var StepResult = class _StepResult {
|
|
|
5242
5351
|
/**
|
|
5243
5352
|
Create a failed step result.
|
|
5244
5353
|
*/
|
|
5245
|
-
static fail(
|
|
5246
|
-
return new _StepResult(null,
|
|
5354
|
+
static fail(message3) {
|
|
5355
|
+
return new _StepResult(null, message3);
|
|
5247
5356
|
}
|
|
5248
5357
|
/**
|
|
5249
5358
|
Call [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) with the given
|
|
@@ -6455,8 +6564,8 @@ var DocAttrStep = class _DocAttrStep extends Step {
|
|
|
6455
6564
|
Step.jsonID("docAttr", DocAttrStep);
|
|
6456
6565
|
var TransformError = class extends Error {
|
|
6457
6566
|
};
|
|
6458
|
-
TransformError = function TransformError2(
|
|
6459
|
-
let err = Error.call(this,
|
|
6567
|
+
TransformError = function TransformError2(message3) {
|
|
6568
|
+
let err = Error.call(this, message3);
|
|
6460
6569
|
err.__proto__ = TransformError2.prototype;
|
|
6461
6570
|
return err;
|
|
6462
6571
|
};
|
|
@@ -19741,7 +19850,7 @@ var import_react14 = __toESM(require("react"));
|
|
|
19741
19850
|
var import_antd9 = require("@refinedev/antd");
|
|
19742
19851
|
var import_lib12 = require("antd/lib");
|
|
19743
19852
|
var ApplicationUserEdit = () => {
|
|
19744
|
-
const { message:
|
|
19853
|
+
const { message: message3 } = import_lib12.App.useApp();
|
|
19745
19854
|
const { formProps, saveButtonProps, id, form } = (0, import_antd9.useForm)({
|
|
19746
19855
|
meta: {
|
|
19747
19856
|
expand: ["Roles"]
|
|
@@ -19762,12 +19871,12 @@ var ApplicationUserEdit = () => {
|
|
|
19762
19871
|
})
|
|
19763
19872
|
});
|
|
19764
19873
|
if (response.ok) {
|
|
19765
|
-
|
|
19874
|
+
message3.success("Roles updated successfully");
|
|
19766
19875
|
} else {
|
|
19767
|
-
|
|
19876
|
+
message3.error("Failed to update roles");
|
|
19768
19877
|
}
|
|
19769
19878
|
} catch (e) {
|
|
19770
|
-
|
|
19879
|
+
message3.error("Error updating roles");
|
|
19771
19880
|
}
|
|
19772
19881
|
}
|
|
19773
19882
|
});
|
|
@@ -20113,12 +20222,354 @@ var RoleEdit = () => {
|
|
|
20113
20222
|
)
|
|
20114
20223
|
));
|
|
20115
20224
|
};
|
|
20225
|
+
|
|
20226
|
+
// src/pages/background-jobs/list.tsx
|
|
20227
|
+
var import_react19 = __toESM(require("react"));
|
|
20228
|
+
var import_core22 = require("@refinedev/core");
|
|
20229
|
+
var import_antd14 = require("@refinedev/antd");
|
|
20230
|
+
var import_antd15 = require("antd");
|
|
20231
|
+
var import_icons6 = require("@ant-design/icons");
|
|
20232
|
+
var BackgroundJobList = ({
|
|
20233
|
+
title,
|
|
20234
|
+
apiUrl: customApiUrl
|
|
20235
|
+
}) => {
|
|
20236
|
+
const t = (0, import_core22.useTranslate)();
|
|
20237
|
+
const defaultApiUrl = (0, import_core22.useApiUrl)();
|
|
20238
|
+
const apiUrl = customApiUrl || defaultApiUrl?.replace("/odata", "");
|
|
20239
|
+
const [refreshKey, setRefreshKey] = (0, import_react19.useState)(0);
|
|
20240
|
+
const [activeTab, setActiveTab] = (0, import_react19.useState)("recurring");
|
|
20241
|
+
const [loading, setLoading] = (0, import_react19.useState)(false);
|
|
20242
|
+
const [recurringJobs, setRecurringJobs] = (0, import_react19.useState)([]);
|
|
20243
|
+
const [succeededResult, setSucceededResult] = (0, import_react19.useState)(null);
|
|
20244
|
+
const [failedResult, setFailedResult] = (0, import_react19.useState)(null);
|
|
20245
|
+
const [processingResult, setProcessingResult] = (0, import_react19.useState)(null);
|
|
20246
|
+
const [drawerVisible, setDrawerVisible] = (0, import_react19.useState)(false);
|
|
20247
|
+
const [jobDetails, setJobDetails] = (0, import_react19.useState)(null);
|
|
20248
|
+
const [detailLoading, setDetailLoading] = (0, import_react19.useState)(false);
|
|
20249
|
+
const fetchData = (0, import_react19.useCallback)(async () => {
|
|
20250
|
+
setLoading(true);
|
|
20251
|
+
const token = localStorage.getItem("refine-auth") || localStorage.getItem("access_token");
|
|
20252
|
+
const headers = token ? { "Authorization": `Bearer ${token}` } : {};
|
|
20253
|
+
try {
|
|
20254
|
+
const [recurringRes, succeededRes, failedRes, processingRes] = await Promise.all([
|
|
20255
|
+
fetch(`${apiUrl}/hangfire/recurring`, { headers }),
|
|
20256
|
+
fetch(`${apiUrl}/hangfire/jobs/succeeded`, { headers }),
|
|
20257
|
+
fetch(`${apiUrl}/hangfire/jobs/failed`, { headers }),
|
|
20258
|
+
fetch(`${apiUrl}/hangfire/jobs/processing`, { headers })
|
|
20259
|
+
]);
|
|
20260
|
+
if (recurringRes.ok) {
|
|
20261
|
+
const data = await recurringRes.json();
|
|
20262
|
+
setRecurringJobs(data.value || data || []);
|
|
20263
|
+
}
|
|
20264
|
+
if (succeededRes.ok) {
|
|
20265
|
+
setSucceededResult(await succeededRes.json());
|
|
20266
|
+
}
|
|
20267
|
+
if (failedRes.ok) {
|
|
20268
|
+
setFailedResult(await failedRes.json());
|
|
20269
|
+
}
|
|
20270
|
+
if (processingRes.ok) {
|
|
20271
|
+
setProcessingResult(await processingRes.json());
|
|
20272
|
+
}
|
|
20273
|
+
} catch (error) {
|
|
20274
|
+
console.error("Failed to fetch Hangfire data:", error);
|
|
20275
|
+
} finally {
|
|
20276
|
+
setLoading(false);
|
|
20277
|
+
}
|
|
20278
|
+
}, [apiUrl]);
|
|
20279
|
+
(0, import_react19.useEffect)(() => {
|
|
20280
|
+
fetchData();
|
|
20281
|
+
}, [fetchData, refreshKey]);
|
|
20282
|
+
const handleRefresh = () => {
|
|
20283
|
+
setRefreshKey((prev) => prev + 1);
|
|
20284
|
+
};
|
|
20285
|
+
const handleTrigger = async (jobId) => {
|
|
20286
|
+
try {
|
|
20287
|
+
const token = localStorage.getItem("refine-auth") || localStorage.getItem("access_token");
|
|
20288
|
+
const headers = token ? { "Authorization": `Bearer ${token}` } : {};
|
|
20289
|
+
const response = await fetch(`${apiUrl}/hangfire/trigger/${jobId}`, {
|
|
20290
|
+
method: "POST",
|
|
20291
|
+
headers
|
|
20292
|
+
});
|
|
20293
|
+
if (response.ok) {
|
|
20294
|
+
import_antd15.message.success(t("backgroundJobs.actions.triggerSuccess"));
|
|
20295
|
+
handleRefresh();
|
|
20296
|
+
} else {
|
|
20297
|
+
import_antd15.message.error(t("backgroundJobs.actions.triggerError"));
|
|
20298
|
+
}
|
|
20299
|
+
} catch {
|
|
20300
|
+
import_antd15.message.error(t("backgroundJobs.actions.triggerError"));
|
|
20301
|
+
}
|
|
20302
|
+
};
|
|
20303
|
+
const handleDelete = async (jobId) => {
|
|
20304
|
+
try {
|
|
20305
|
+
const token = localStorage.getItem("refine-auth") || localStorage.getItem("access_token");
|
|
20306
|
+
const headers = token ? { "Authorization": `Bearer ${token}` } : {};
|
|
20307
|
+
const response = await fetch(`${apiUrl}/hangfire/recurring/${jobId}`, {
|
|
20308
|
+
method: "DELETE",
|
|
20309
|
+
headers
|
|
20310
|
+
});
|
|
20311
|
+
if (response.ok) {
|
|
20312
|
+
import_antd15.message.success(t("backgroundJobs.actions.deleteSuccess"));
|
|
20313
|
+
handleRefresh();
|
|
20314
|
+
} else {
|
|
20315
|
+
import_antd15.message.error(t("backgroundJobs.actions.deleteError"));
|
|
20316
|
+
}
|
|
20317
|
+
} catch {
|
|
20318
|
+
import_antd15.message.error(t("backgroundJobs.actions.deleteError"));
|
|
20319
|
+
}
|
|
20320
|
+
};
|
|
20321
|
+
const showDetails = async (jobId) => {
|
|
20322
|
+
setDrawerVisible(true);
|
|
20323
|
+
setDetailLoading(true);
|
|
20324
|
+
setJobDetails(null);
|
|
20325
|
+
try {
|
|
20326
|
+
const token = localStorage.getItem("refine-auth") || localStorage.getItem("access_token");
|
|
20327
|
+
const headers = token ? { "Authorization": `Bearer ${token}` } : {};
|
|
20328
|
+
const res = await fetch(`${apiUrl}/hangfire/jobs/${jobId}`, { headers });
|
|
20329
|
+
if (res.ok) {
|
|
20330
|
+
const data = await res.json();
|
|
20331
|
+
setJobDetails(data);
|
|
20332
|
+
} else {
|
|
20333
|
+
import_antd15.message.error("Failed to load details");
|
|
20334
|
+
}
|
|
20335
|
+
} catch {
|
|
20336
|
+
import_antd15.message.error("Failed to load details");
|
|
20337
|
+
} finally {
|
|
20338
|
+
setDetailLoading(false);
|
|
20339
|
+
}
|
|
20340
|
+
};
|
|
20341
|
+
const closeDrawer = () => {
|
|
20342
|
+
setDrawerVisible(false);
|
|
20343
|
+
setJobDetails(null);
|
|
20344
|
+
};
|
|
20345
|
+
const getStateTag = (state) => {
|
|
20346
|
+
if (!state) return /* @__PURE__ */ import_react19.default.createElement(import_antd15.Tag, null, t("backgroundJobs.status.unknown"));
|
|
20347
|
+
switch (state.toLowerCase()) {
|
|
20348
|
+
case "succeeded":
|
|
20349
|
+
return /* @__PURE__ */ import_react19.default.createElement(import_antd15.Tag, { icon: /* @__PURE__ */ import_react19.default.createElement(import_icons6.CheckCircleOutlined, null), color: "success" }, t("backgroundJobs.status.succeeded"));
|
|
20350
|
+
case "failed":
|
|
20351
|
+
return /* @__PURE__ */ import_react19.default.createElement(import_antd15.Tag, { icon: /* @__PURE__ */ import_react19.default.createElement(import_icons6.CloseCircleOutlined, null), color: "error" }, t("backgroundJobs.status.failed"));
|
|
20352
|
+
case "processing":
|
|
20353
|
+
return /* @__PURE__ */ import_react19.default.createElement(import_antd15.Tag, { icon: /* @__PURE__ */ import_react19.default.createElement(import_icons6.SyncOutlined, { spin: true }), color: "processing" }, t("backgroundJobs.status.processing"));
|
|
20354
|
+
case "scheduled":
|
|
20355
|
+
return /* @__PURE__ */ import_react19.default.createElement(import_antd15.Tag, { icon: /* @__PURE__ */ import_react19.default.createElement(import_icons6.ClockCircleOutlined, null), color: "warning" }, t("backgroundJobs.status.scheduled"));
|
|
20356
|
+
default:
|
|
20357
|
+
return /* @__PURE__ */ import_react19.default.createElement(import_antd15.Tag, null, state);
|
|
20358
|
+
}
|
|
20359
|
+
};
|
|
20360
|
+
const recurringColumns = [
|
|
20361
|
+
{ title: t("backgroundJobs.columns.id"), dataIndex: "Id", key: "Id" },
|
|
20362
|
+
{
|
|
20363
|
+
title: t("backgroundJobs.columns.cron"),
|
|
20364
|
+
dataIndex: "Cron",
|
|
20365
|
+
key: "Cron",
|
|
20366
|
+
render: (cron) => /* @__PURE__ */ import_react19.default.createElement(import_antd15.Tag, { color: "blue" }, cron)
|
|
20367
|
+
},
|
|
20368
|
+
{ title: t("backgroundJobs.columns.queue"), dataIndex: "Queue", key: "Queue" },
|
|
20369
|
+
{
|
|
20370
|
+
title: t("backgroundJobs.columns.nextExecution"),
|
|
20371
|
+
dataIndex: "NextExecution",
|
|
20372
|
+
key: "NextExecution",
|
|
20373
|
+
render: (date) => date ? new Date(date).toLocaleString() : "-"
|
|
20374
|
+
},
|
|
20375
|
+
{
|
|
20376
|
+
title: t("backgroundJobs.columns.lastState"),
|
|
20377
|
+
dataIndex: "LastJobState",
|
|
20378
|
+
key: "LastJobState",
|
|
20379
|
+
render: (state) => getStateTag(state)
|
|
20380
|
+
},
|
|
20381
|
+
{
|
|
20382
|
+
title: t("backgroundJobs.columns.actions"),
|
|
20383
|
+
key: "actions",
|
|
20384
|
+
render: (_, record) => /* @__PURE__ */ import_react19.default.createElement(import_antd15.Space, null, /* @__PURE__ */ import_react19.default.createElement(import_antd15.Tooltip, { title: t("backgroundJobs.actions.trigger") }, /* @__PURE__ */ import_react19.default.createElement(
|
|
20385
|
+
import_antd15.Button,
|
|
20386
|
+
{
|
|
20387
|
+
type: "primary",
|
|
20388
|
+
icon: /* @__PURE__ */ import_react19.default.createElement(import_icons6.PlayCircleOutlined, null),
|
|
20389
|
+
size: "small",
|
|
20390
|
+
onClick: () => handleTrigger(record.Id)
|
|
20391
|
+
}
|
|
20392
|
+
)), /* @__PURE__ */ import_react19.default.createElement(import_antd15.Tooltip, { title: t("backgroundJobs.actions.delete") }, /* @__PURE__ */ import_react19.default.createElement(
|
|
20393
|
+
import_antd15.Button,
|
|
20394
|
+
{
|
|
20395
|
+
danger: true,
|
|
20396
|
+
icon: /* @__PURE__ */ import_react19.default.createElement(import_icons6.DeleteOutlined, null),
|
|
20397
|
+
size: "small",
|
|
20398
|
+
onClick: () => handleDelete(record.Id)
|
|
20399
|
+
}
|
|
20400
|
+
)))
|
|
20401
|
+
}
|
|
20402
|
+
];
|
|
20403
|
+
const succeededColumns = [
|
|
20404
|
+
{
|
|
20405
|
+
title: t("backgroundJobs.columns.jobId"),
|
|
20406
|
+
dataIndex: "JobId",
|
|
20407
|
+
key: "JobId",
|
|
20408
|
+
render: (text) => /* @__PURE__ */ import_react19.default.createElement("a", { onClick: () => showDetails(text) }, text)
|
|
20409
|
+
},
|
|
20410
|
+
{ title: t("backgroundJobs.columns.jobName"), dataIndex: "JobName", key: "JobName" },
|
|
20411
|
+
{
|
|
20412
|
+
title: t("backgroundJobs.columns.succeededAt"),
|
|
20413
|
+
dataIndex: "SucceededAt",
|
|
20414
|
+
key: "SucceededAt",
|
|
20415
|
+
render: (date) => date ? new Date(date).toLocaleString() : "-"
|
|
20416
|
+
},
|
|
20417
|
+
{ title: t("backgroundJobs.columns.duration"), dataIndex: "TotalDuration", key: "TotalDuration" }
|
|
20418
|
+
];
|
|
20419
|
+
const failedColumns = [
|
|
20420
|
+
{
|
|
20421
|
+
title: t("backgroundJobs.columns.jobId"),
|
|
20422
|
+
dataIndex: "JobId",
|
|
20423
|
+
key: "JobId",
|
|
20424
|
+
render: (text) => /* @__PURE__ */ import_react19.default.createElement("a", { onClick: () => showDetails(text) }, text)
|
|
20425
|
+
},
|
|
20426
|
+
{ title: t("backgroundJobs.columns.jobName"), dataIndex: "JobName", key: "JobName" },
|
|
20427
|
+
{
|
|
20428
|
+
title: t("backgroundJobs.columns.failedAt"),
|
|
20429
|
+
dataIndex: "FailedAt",
|
|
20430
|
+
key: "FailedAt",
|
|
20431
|
+
render: (date) => date ? new Date(date).toLocaleString() : "-"
|
|
20432
|
+
},
|
|
20433
|
+
{
|
|
20434
|
+
title: t("backgroundJobs.columns.exception"),
|
|
20435
|
+
dataIndex: "ExceptionMessage",
|
|
20436
|
+
key: "ExceptionMessage",
|
|
20437
|
+
render: (msg) => /* @__PURE__ */ import_react19.default.createElement(import_antd15.Tooltip, { title: msg }, /* @__PURE__ */ import_react19.default.createElement("span", null, msg?.substring(0, 50), msg && msg.length > 50 ? "..." : ""))
|
|
20438
|
+
}
|
|
20439
|
+
];
|
|
20440
|
+
const processingColumns = [
|
|
20441
|
+
{
|
|
20442
|
+
title: t("backgroundJobs.columns.jobId"),
|
|
20443
|
+
dataIndex: "JobId",
|
|
20444
|
+
key: "JobId",
|
|
20445
|
+
render: (text) => /* @__PURE__ */ import_react19.default.createElement("a", { onClick: () => showDetails(text) }, text)
|
|
20446
|
+
},
|
|
20447
|
+
{ title: t("backgroundJobs.columns.jobName"), dataIndex: "JobName", key: "JobName" },
|
|
20448
|
+
{
|
|
20449
|
+
title: t("backgroundJobs.columns.startedAt"),
|
|
20450
|
+
dataIndex: "StartedAt",
|
|
20451
|
+
key: "StartedAt",
|
|
20452
|
+
render: (date) => date ? new Date(date).toLocaleString() : "-"
|
|
20453
|
+
},
|
|
20454
|
+
{ title: t("backgroundJobs.columns.serverId"), dataIndex: "ServerId", key: "ServerId" }
|
|
20455
|
+
];
|
|
20456
|
+
const items = [
|
|
20457
|
+
{
|
|
20458
|
+
key: "recurring",
|
|
20459
|
+
label: `${t("backgroundJobs.tabs.recurring")} (${recurringJobs.length})`,
|
|
20460
|
+
children: /* @__PURE__ */ import_react19.default.createElement(
|
|
20461
|
+
import_antd15.Table,
|
|
20462
|
+
{
|
|
20463
|
+
dataSource: recurringJobs,
|
|
20464
|
+
columns: recurringColumns,
|
|
20465
|
+
rowKey: "Id",
|
|
20466
|
+
loading,
|
|
20467
|
+
pagination: false
|
|
20468
|
+
}
|
|
20469
|
+
)
|
|
20470
|
+
},
|
|
20471
|
+
{
|
|
20472
|
+
key: "succeeded",
|
|
20473
|
+
label: /* @__PURE__ */ import_react19.default.createElement("span", null, /* @__PURE__ */ import_react19.default.createElement(import_icons6.CheckCircleOutlined, { style: { color: "#52c41a" } }), " ", t("backgroundJobs.tabs.succeeded"), " (", succeededResult?.Total || 0, ")"),
|
|
20474
|
+
children: /* @__PURE__ */ import_react19.default.createElement(
|
|
20475
|
+
import_antd15.Table,
|
|
20476
|
+
{
|
|
20477
|
+
dataSource: succeededResult?.Jobs || [],
|
|
20478
|
+
columns: succeededColumns,
|
|
20479
|
+
rowKey: "JobId",
|
|
20480
|
+
loading,
|
|
20481
|
+
pagination: { pageSize: 10 }
|
|
20482
|
+
}
|
|
20483
|
+
)
|
|
20484
|
+
},
|
|
20485
|
+
{
|
|
20486
|
+
key: "failed",
|
|
20487
|
+
label: /* @__PURE__ */ import_react19.default.createElement("span", null, /* @__PURE__ */ import_react19.default.createElement(import_icons6.CloseCircleOutlined, { style: { color: "#ff4d4f" } }), " ", t("backgroundJobs.tabs.failed"), " (", failedResult?.Total || 0, ")"),
|
|
20488
|
+
children: /* @__PURE__ */ import_react19.default.createElement(
|
|
20489
|
+
import_antd15.Table,
|
|
20490
|
+
{
|
|
20491
|
+
dataSource: failedResult?.Jobs || [],
|
|
20492
|
+
columns: failedColumns,
|
|
20493
|
+
rowKey: "JobId",
|
|
20494
|
+
loading,
|
|
20495
|
+
pagination: { pageSize: 10 }
|
|
20496
|
+
}
|
|
20497
|
+
)
|
|
20498
|
+
},
|
|
20499
|
+
{
|
|
20500
|
+
key: "processing",
|
|
20501
|
+
label: /* @__PURE__ */ import_react19.default.createElement("span", null, /* @__PURE__ */ import_react19.default.createElement(import_icons6.SyncOutlined, { spin: true, style: { color: "#1890ff" } }), " ", t("backgroundJobs.tabs.processing"), " (", processingResult?.Total || 0, ")"),
|
|
20502
|
+
children: /* @__PURE__ */ import_react19.default.createElement(
|
|
20503
|
+
import_antd15.Table,
|
|
20504
|
+
{
|
|
20505
|
+
dataSource: processingResult?.Jobs || [],
|
|
20506
|
+
columns: processingColumns,
|
|
20507
|
+
rowKey: "JobId",
|
|
20508
|
+
loading,
|
|
20509
|
+
pagination: false
|
|
20510
|
+
}
|
|
20511
|
+
)
|
|
20512
|
+
}
|
|
20513
|
+
];
|
|
20514
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
20515
|
+
import_antd14.List,
|
|
20516
|
+
{
|
|
20517
|
+
title: title || t("backgroundJobs.title"),
|
|
20518
|
+
headerButtons: /* @__PURE__ */ import_react19.default.createElement(import_antd15.Button, { icon: /* @__PURE__ */ import_react19.default.createElement(import_icons6.ReloadOutlined, null), onClick: handleRefresh, loading }, t("buttons.refresh"))
|
|
20519
|
+
},
|
|
20520
|
+
/* @__PURE__ */ import_react19.default.createElement(import_antd15.Row, { gutter: 16, style: { marginBottom: 16 } }, /* @__PURE__ */ import_react19.default.createElement(import_antd15.Col, { span: 6 }, /* @__PURE__ */ import_react19.default.createElement(import_antd15.Card, null, /* @__PURE__ */ import_react19.default.createElement(
|
|
20521
|
+
import_antd15.Statistic,
|
|
20522
|
+
{
|
|
20523
|
+
title: t("backgroundJobs.tabs.recurring"),
|
|
20524
|
+
value: recurringJobs.length,
|
|
20525
|
+
prefix: /* @__PURE__ */ import_react19.default.createElement(import_icons6.ClockCircleOutlined, null)
|
|
20526
|
+
}
|
|
20527
|
+
))), /* @__PURE__ */ import_react19.default.createElement(import_antd15.Col, { span: 6 }, /* @__PURE__ */ import_react19.default.createElement(import_antd15.Card, null, /* @__PURE__ */ import_react19.default.createElement(
|
|
20528
|
+
import_antd15.Statistic,
|
|
20529
|
+
{
|
|
20530
|
+
title: t("backgroundJobs.tabs.succeeded"),
|
|
20531
|
+
value: succeededResult?.Total || 0,
|
|
20532
|
+
valueStyle: { color: "#3f8600" },
|
|
20533
|
+
prefix: /* @__PURE__ */ import_react19.default.createElement(import_icons6.CheckCircleOutlined, null)
|
|
20534
|
+
}
|
|
20535
|
+
))), /* @__PURE__ */ import_react19.default.createElement(import_antd15.Col, { span: 6 }, /* @__PURE__ */ import_react19.default.createElement(import_antd15.Card, null, /* @__PURE__ */ import_react19.default.createElement(
|
|
20536
|
+
import_antd15.Statistic,
|
|
20537
|
+
{
|
|
20538
|
+
title: t("backgroundJobs.tabs.failed"),
|
|
20539
|
+
value: failedResult?.Total || 0,
|
|
20540
|
+
valueStyle: { color: "#cf1322" },
|
|
20541
|
+
prefix: /* @__PURE__ */ import_react19.default.createElement(import_icons6.CloseCircleOutlined, null)
|
|
20542
|
+
}
|
|
20543
|
+
))), /* @__PURE__ */ import_react19.default.createElement(import_antd15.Col, { span: 6 }, /* @__PURE__ */ import_react19.default.createElement(import_antd15.Card, null, /* @__PURE__ */ import_react19.default.createElement(
|
|
20544
|
+
import_antd15.Statistic,
|
|
20545
|
+
{
|
|
20546
|
+
title: t("backgroundJobs.tabs.processing"),
|
|
20547
|
+
value: processingResult?.Total || 0,
|
|
20548
|
+
valueStyle: { color: "#1890ff" },
|
|
20549
|
+
prefix: /* @__PURE__ */ import_react19.default.createElement(import_icons6.SyncOutlined, null)
|
|
20550
|
+
}
|
|
20551
|
+
)))),
|
|
20552
|
+
/* @__PURE__ */ import_react19.default.createElement(import_antd15.Tabs, { activeKey: activeTab, onChange: setActiveTab, items }),
|
|
20553
|
+
/* @__PURE__ */ import_react19.default.createElement(
|
|
20554
|
+
import_antd15.Drawer,
|
|
20555
|
+
{
|
|
20556
|
+
title: t("backgroundJobs.drawer.title"),
|
|
20557
|
+
placement: "right",
|
|
20558
|
+
onClose: closeDrawer,
|
|
20559
|
+
open: drawerVisible,
|
|
20560
|
+
width: 600
|
|
20561
|
+
},
|
|
20562
|
+
detailLoading ? /* @__PURE__ */ import_react19.default.createElement(import_antd15.Skeleton, { active: true }) : jobDetails ? /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, /* @__PURE__ */ import_react19.default.createElement(import_antd15.Descriptions, { column: 1, bordered: true, size: "small" }, /* @__PURE__ */ import_react19.default.createElement(import_antd15.Descriptions.Item, { label: t("backgroundJobs.drawer.jobName") }, jobDetails.JobName), /* @__PURE__ */ import_react19.default.createElement(import_antd15.Descriptions.Item, { label: t("backgroundJobs.drawer.createdAt") }, jobDetails.CreatedAt ? new Date(jobDetails.CreatedAt).toLocaleString() : "-")), /* @__PURE__ */ import_react19.default.createElement("div", { style: { marginTop: 24 } }, /* @__PURE__ */ import_react19.default.createElement("h3", null, t("backgroundJobs.drawer.history")), /* @__PURE__ */ import_react19.default.createElement(import_antd15.Timeline, { mode: "left" }, jobDetails.History.map((h, i) => /* @__PURE__ */ import_react19.default.createElement(import_antd15.Timeline.Item, { key: i, color: h.StateName === "Succeeded" ? "green" : h.StateName === "Failed" ? "red" : "blue" }, /* @__PURE__ */ import_react19.default.createElement("p", null, /* @__PURE__ */ import_react19.default.createElement("strong", null, h.StateName), " - ", new Date(h.CreatedAt).toLocaleString()), h.Reason && /* @__PURE__ */ import_react19.default.createElement("p", null, t("backgroundJobs.drawer.reason"), ": ", h.Reason), h.Data && Object.keys(h.Data).length > 0 && /* @__PURE__ */ import_react19.default.createElement("div", { style: { background: "#f5f5f5", padding: 8, borderRadius: 4, overflowX: "auto", marginTop: 8 } }, /* @__PURE__ */ import_react19.default.createElement("pre", { style: { margin: 0, fontSize: 12 } }, JSON.stringify(h.Data, null, 2)))))))) : /* @__PURE__ */ import_react19.default.createElement("div", null, t("backgroundJobs.drawer.noData"))
|
|
20563
|
+
)
|
|
20564
|
+
);
|
|
20565
|
+
};
|
|
20116
20566
|
// Annotate the CommonJS export names for ESM import in node:
|
|
20117
20567
|
0 && (module.exports = {
|
|
20118
20568
|
ApplicationUserCreate,
|
|
20119
20569
|
ApplicationUserEdit,
|
|
20120
20570
|
ApplicationUserList,
|
|
20121
20571
|
AuthCallback,
|
|
20572
|
+
BackgroundJobList,
|
|
20122
20573
|
Base64Upload,
|
|
20123
20574
|
ColorModeContext,
|
|
20124
20575
|
ColorModeContextProvider,
|