pollination-react-io 1.62.6 → 1.63.1
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/build/hooks/usePollinationPanel.d.ts +1 -0
- package/build/index.esm.js +56 -22
- package/build/index.esm.js.map +1 -1
- package/build/index.js +56 -22
- package/build/index.js.map +1 -1
- package/package.json +1 -1
@@ -12,4 +12,5 @@ export declare const usePollinationPanel: () => {
|
|
12
12
|
fileExplorer: (root: string) => PanelMessageOut;
|
13
13
|
getPaginatedJob: (projectSlug: string, pageSize: number, curPage: number) => ProjectJobInfo[];
|
14
14
|
getJob: (projectSlug: string) => ProjectJobInfo[];
|
15
|
+
deleteJob: (projectSlug: string, path: string) => any;
|
15
16
|
};
|
package/build/index.esm.js
CHANGED
@@ -38120,6 +38120,25 @@ var usePollinationPanel = function () {
|
|
38120
38120
|
return undefined;
|
38121
38121
|
}
|
38122
38122
|
};
|
38123
|
+
/**
|
38124
|
+
* Delete job with the same input/ouput folder from DB
|
38125
|
+
* @param projectSlug Project slug
|
38126
|
+
* @param path Location where files are
|
38127
|
+
* @returns Message with number of deleted records
|
38128
|
+
*/
|
38129
|
+
var deleteJob = function (projectSlug, path) {
|
38130
|
+
if (!panel)
|
38131
|
+
return;
|
38132
|
+
try {
|
38133
|
+
var message = panel.DeleteJob(projectSlug, path);
|
38134
|
+
var count = JSON.parse(message.data);
|
38135
|
+
return count;
|
38136
|
+
}
|
38137
|
+
catch (error) {
|
38138
|
+
// Do nothing. It is written at the end
|
38139
|
+
return undefined;
|
38140
|
+
}
|
38141
|
+
};
|
38123
38142
|
return {
|
38124
38143
|
getFileBase64: getFileBase64,
|
38125
38144
|
saveFileBase64: saveFileBase64,
|
@@ -38130,7 +38149,8 @@ var usePollinationPanel = function () {
|
|
38130
38149
|
fetchLocalLog: fetchLocalLog,
|
38131
38150
|
fileExplorer: fileExplorer,
|
38132
38151
|
getPaginatedJob: getPaginatedJob,
|
38133
|
-
getJob: getJob
|
38152
|
+
getJob: getJob,
|
38153
|
+
deleteJob: deleteJob
|
38134
38154
|
};
|
38135
38155
|
};
|
38136
38156
|
|
@@ -48812,8 +48832,8 @@ var formatDuration = function (duration) {
|
|
48812
48832
|
var RunCard = function (_a) {
|
48813
48833
|
var _b;
|
48814
48834
|
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
48815
|
-
var projectName = _a.projectName, projectOwner = _a.projectOwner, _run = _a.run,
|
48816
|
-
var
|
48835
|
+
var projectName = _a.projectName, projectOwner = _a.projectOwner, _run = _a.run, authUser = _a.authUser, client = _a.client, _o = _a.enableClick, enableClick = _o === void 0 ? true : _o, _p = _a.style, style = _p === void 0 ? {} : _p, _q = _a.getTab, getTab = _q === void 0 ? function (tab) { return undefined; } : _q, _r = _a.defaultTab, defaultTab = _r === void 0 ? RunTabs.details : _r, _s = _a.getValue, getValue = _s === void 0 ? function (run) { return undefined; } : _s, _t = _a.interval, interval = _t === void 0 ? 5000 : _t, _u = _a.canWrite, canWrite = _u === void 0 ? false : _u, _v = _a.localRun, localRun = _v === void 0 ? false : _v, _w = _a.loaderNode, loaderNode = _w === void 0 ? undefined : _w;
|
48836
|
+
var _x = usePollinationPanel(), fetchLocalRun = _x.fetchLocalRun, fetchLocalJob = _x.fetchLocalJob, fileExplorer = _x.fileExplorer, deleteJob = _x.deleteJob;
|
48817
48837
|
var disabled = useMemo(function () {
|
48818
48838
|
if (!localRun)
|
48819
48839
|
return;
|
@@ -48823,16 +48843,16 @@ var RunCard = function (_a) {
|
|
48823
48843
|
* Fetch run
|
48824
48844
|
*/
|
48825
48845
|
var fetchJob = useJobs(client).fetchJob;
|
48826
|
-
var
|
48827
|
-
var
|
48828
|
-
var
|
48829
|
-
var
|
48830
|
-
var
|
48831
|
-
var
|
48846
|
+
var _y = useRuns(client), fetchRun = _y.fetchRun, statusMap = _y.statusMap, getDuration = _y.getDuration, cancelRun = _y.cancelRun;
|
48847
|
+
var _z = useWindowDimensions(), width = _z.width; _z.height;
|
48848
|
+
var _0 = useState(false), seeDescription = _0[0], setSeeDescription = _0[1];
|
48849
|
+
var _1 = useState(false), seeAction = _1[0], setSeeAction = _1[1];
|
48850
|
+
var _2 = useState(false), stopRefresh = _2[0], setStopRefresh = _2[1];
|
48851
|
+
var _3 = useState(false), isReady = _3[0], setIsReady = _3[1];
|
48832
48852
|
/*
|
48833
48853
|
* From run and stop when it is done
|
48834
48854
|
*/
|
48835
|
-
var
|
48855
|
+
var _4 = useSWR(authUser && _run ? (!localRun ? [projectOwner, projectName, _run.id] : [_run.id]) : undefined, localRun ? fetchLocalRun : fetchRun, {
|
48836
48856
|
revalidateOnFocus: false,
|
48837
48857
|
refreshInterval: stopRefresh ? undefined : interval,
|
48838
48858
|
fallbackData: localRun ? undefined : _run,
|
@@ -48847,7 +48867,7 @@ var RunCard = function (_a) {
|
|
48847
48867
|
setStopRefresh(true);
|
48848
48868
|
setIsReady(true);
|
48849
48869
|
},
|
48850
|
-
}), run =
|
48870
|
+
}), run = _4.data, error = _4.error;
|
48851
48871
|
var sendRun = useCallback(function (run) { return getValue(run); }, [run]);
|
48852
48872
|
/**
|
48853
48873
|
* Fetch job just one time
|
@@ -48871,9 +48891,9 @@ var RunCard = function (_a) {
|
|
48871
48891
|
return undefined;
|
48872
48892
|
return run.status.status;
|
48873
48893
|
}, [run]);
|
48874
|
-
var
|
48875
|
-
var
|
48876
|
-
var
|
48894
|
+
var _5 = useState(), study = _5[0], setStudy = _5[1];
|
48895
|
+
var _6 = useState(), localStudy = _6[0], setLocalStudy = _6[1];
|
48896
|
+
var _7 = useState(getDuration(run)), duration = _7[0], setDuration = _7[1];
|
48877
48897
|
useEffect(function () {
|
48878
48898
|
if (!run)
|
48879
48899
|
return undefined;
|
@@ -48904,7 +48924,7 @@ var RunCard = function (_a) {
|
|
48904
48924
|
info: false,
|
48905
48925
|
settings: false,
|
48906
48926
|
};
|
48907
|
-
var
|
48927
|
+
var _8 = useState(__assign(__assign({}, initialValues), (_b = {}, _b[defaultTab] = true, _b))), hover = _8[0], setHover = _8[1];
|
48908
48928
|
var toggleHover = useCallback(function (id, value) {
|
48909
48929
|
if (value === void 0) { value = false; }
|
48910
48930
|
setHover(function (prevHover) {
|
@@ -49115,21 +49135,35 @@ var RunCard = function (_a) {
|
|
49115
49135
|
localRun && localStudy && localStudy.description)),
|
49116
49136
|
seeAction && width && React__default.createElement(React__default.Fragment, null,
|
49117
49137
|
React__default.createElement("div", { className: 'item7' },
|
49118
|
-
React__default.createElement(Button, {
|
49138
|
+
!localRun && React__default.createElement(Button, { disabled: !run || (run.status.status === dist$1.RunStatusEnum.Failed ||
|
49119
49139
|
run.status.status === dist$1.RunStatusEnum.Succeeded ||
|
49120
49140
|
run.status.status === dist$1.RunStatusEnum.Cancelled ||
|
49121
49141
|
run.status.status === dist$1.RunStatusEnum.Unknown), onClick: function (e) {
|
49122
49142
|
e.stopPropagation();
|
49123
49143
|
if (!run)
|
49124
49144
|
return;
|
49125
|
-
|
49126
|
-
|
49127
|
-
|
49128
|
-
.catch(function (e) { return console.log(e); });
|
49129
|
-
}
|
49145
|
+
cancelRun(projectOwner, projectName, run.id)
|
49146
|
+
.then(function (d) { return console.log(d); })
|
49147
|
+
.catch(function (e) { return console.log(e); });
|
49130
49148
|
} },
|
49131
49149
|
React__default.createElement(XOctagon$1, { style: { display: 'inline', margin: '0 5px 0 0' } }),
|
49132
|
-
" Cancel")
|
49150
|
+
" Cancel"),
|
49151
|
+
localRun && React__default.createElement(Button, { disabled: !run || !run.status.finished_at, onClick: function (e) {
|
49152
|
+
e.stopPropagation();
|
49153
|
+
if (!run)
|
49154
|
+
return;
|
49155
|
+
var count = deleteJob("".concat(projectOwner, "/").concat(projectName), _run.id);
|
49156
|
+
if (count > 0) {
|
49157
|
+
if (window.location.href = "/".concat(projectOwner, "/projects/").concat(projectName, "/localStudies/").concat(localStudyURLname, "/?path=").concat(_run.id)) {
|
49158
|
+
window.history.back();
|
49159
|
+
}
|
49160
|
+
else {
|
49161
|
+
window.location.reload();
|
49162
|
+
}
|
49163
|
+
}
|
49164
|
+
} },
|
49165
|
+
React__default.createElement(Trash$1, { style: { display: 'inline', margin: '0 5px 0 0' } }),
|
49166
|
+
" Delete")))));
|
49133
49167
|
};
|
49134
49168
|
|
49135
49169
|
var css_248z$5 = "";
|