pollination-react-io 1.80.3 → 1.80.4
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/index.esm.js +44 -44
- package/build/index.esm.js.map +1 -1
- package/build/index.js +44 -44
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.esm.js
CHANGED
@@ -55124,22 +55124,22 @@ var formatDuration$1 = function (duration) {
|
|
55124
55124
|
};
|
55125
55125
|
var StudyCard = function (_a) {
|
55126
55126
|
var _b;
|
55127
|
-
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
55128
|
-
var projectName = _a.projectName, projectOwner = _a.projectOwner, _study = _a.study, style = _a.style, authUser = _a.authUser, client = _a.client, enableClick = _a.enableClick,
|
55127
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
55128
|
+
var projectName = _a.projectName, projectOwner = _a.projectOwner, _study = _a.study, style = _a.style, authUser = _a.authUser, client = _a.client, enableClick = _a.enableClick, _1 = _a.getTab, getTab = _1 === void 0 ? function (tab) { } : _1, _2 = _a.defaultTab, defaultTab = _2 === void 0 ? '' : _2, _3 = _a.enableLink, enableLink = _3 === void 0 ? false : _3, _4 = _a.canWrite, canWrite = _4 === void 0 ? false : _4, _5 = _a.getValue, getValue = _5 === void 0 ? function (job) { } : _5, _6 = _a.interval, interval = _6 === void 0 ? 5000 : _6;
|
55129
55129
|
/**
|
55130
55130
|
* Fetch hooks
|
55131
55131
|
*/
|
55132
|
-
var
|
55133
|
-
var
|
55134
|
-
var
|
55135
|
-
var
|
55136
|
-
var
|
55137
|
-
var
|
55138
|
-
var
|
55132
|
+
var _7 = useJobs(client), fetchJob = _7.fetchJob, getDuration = _7.getDuration, statusMap = _7.statusMap, deleteJob = _7.deleteJob, cancelJob = _7.cancelJob;
|
55133
|
+
var _8 = useRuns(client), listRuns = _8.listRuns, getTrigger = _8.getTrigger;
|
55134
|
+
var _9 = useWindowDimensions(), width = _9.width; _9.height;
|
55135
|
+
var _10 = useState(false), seeDescription = _10[0], setSeeDescription = _10[1];
|
55136
|
+
var _11 = useState(false), seeAction = _11[0], setSeeAction = _11[1];
|
55137
|
+
var _12 = useState(false), stopRefresh = _12[0], setStopRefresh = _12[1];
|
55138
|
+
var _13 = useState(false), isReady = _13[0], setIsReady = _13[1];
|
55139
55139
|
/**
|
55140
55140
|
* From job to run
|
55141
55141
|
*/
|
55142
|
-
var
|
55142
|
+
var _14 = useSWR(authUser && _study ? [projectOwner, projectName, _study.id] : undefined, fetchJob, {
|
55143
55143
|
revalidateOnFocus: true,
|
55144
55144
|
refreshWhenHidden: true,
|
55145
55145
|
refreshInterval: stopRefresh ? undefined : interval,
|
@@ -55173,7 +55173,7 @@ var StudyCard = function (_a) {
|
|
55173
55173
|
if (study.status.finished_at)
|
55174
55174
|
setStopRefresh(true);
|
55175
55175
|
}
|
55176
|
-
}), study =
|
55176
|
+
}), study = _14.data; _14.error; _14.isValidating;
|
55177
55177
|
var sendJob = useCallback(function (job) { return getValue(job); }, [study]);
|
55178
55178
|
var total = useMemo(function () {
|
55179
55179
|
if (!study)
|
@@ -55197,8 +55197,8 @@ var StudyCard = function (_a) {
|
|
55197
55197
|
}
|
55198
55198
|
return study.status.status.toLocaleLowerCase();
|
55199
55199
|
}, [study]);
|
55200
|
-
var
|
55201
|
-
var
|
55200
|
+
var _15 = useState(), run = _15[0], setRun = _15[1];
|
55201
|
+
var _16 = useState(getDuration(study)), duration = _16[0], setDuration = _16[1];
|
55202
55202
|
useEffect(function () {
|
55203
55203
|
setRun(undefined);
|
55204
55204
|
if (!study)
|
@@ -55229,7 +55229,7 @@ var StudyCard = function (_a) {
|
|
55229
55229
|
info: false,
|
55230
55230
|
settings: false
|
55231
55231
|
};
|
55232
|
-
var
|
55232
|
+
var _17 = useState(__assign(__assign({}, initialValues), (_b = {}, _b[defaultTab] = true, _b))), hover = _17[0], setHover = _17[1];
|
55233
55233
|
var toggleHover = useCallback(function (id, value) {
|
55234
55234
|
if (value === void 0) { value = false; }
|
55235
55235
|
setHover(function (prevHover) {
|
@@ -55363,26 +55363,26 @@ var StudyCard = function (_a) {
|
|
55363
55363
|
React__default.createElement("span", null,
|
55364
55364
|
study ? (_g = study.spec.name) !== null && _g !== void 0 ? _g : "Study: ".concat(study.id) : '--',
|
55365
55365
|
study && total > 1 && "(#".concat(total, ")"))),
|
55366
|
-
React__default.createElement("div", { className: 'item4', title: study && dayjs_min(study.status.started_at).utc(true).tz(tmz$1).format('[on] MMM DD YYYY [at]
|
55366
|
+
React__default.createElement("div", { className: 'item4', title: study && ((_h = study === null || study === void 0 ? void 0 : study.status) === null || _h === void 0 ? void 0 : _h.finished_at) && dayjs_min(study.status.started_at).utc(true).tz(tmz$1).format('[on] MMM DD YYYY [at] HH:mm') }, study ? dayjs_min(study.status.started_at).utc(true).tz(tmz$1).format('[on] MMM DD YYYY') : '--'),
|
55367
55367
|
React__default.createElement("div", { className: 'item5' },
|
55368
55368
|
React__default.createElement("span", { style: { marginRight: '0.75rem' } },
|
55369
|
-
React__default.createElement(Avatar, { src: study ? (
|
55370
|
-
React__default.createElement("a", { className: 'link', href: study ? "/".concat((
|
55369
|
+
React__default.createElement(Avatar, { src: study ? (_j = study.author) === null || _j === void 0 ? void 0 : _j.picture_url : '', size: 24, color: hover.author ? '#40a9ff' : undefined })),
|
55370
|
+
React__default.createElement("a", { className: 'link', href: study ? "/".concat((_k = study.author) === null || _k === void 0 ? void 0 : _k.name) : '', title: 'Go to author page', rel: 'noreferrer', onMouseOver: function (e) { return toggleHover('author', true); }, onMouseLeave: function (e) { return toggleHover('author', false); }, style: hover.author ? { color: '#40a9ff' } : {} }, study ? ((_m = (_l = study.author) === null || _l === void 0 ? void 0 : _l.display_name) !== null && _m !== void 0 ? _m : (_o = study.author) === null || _o === void 0 ? void 0 : _o.name) : '--')),
|
55371
55371
|
React__default.createElement("div", { className: 'item6' },
|
55372
55372
|
React__default.createElement("span", { style: { marginRight: '0.75rem' } },
|
55373
|
-
React__default.createElement(Avatar, { src: study ? (
|
55374
|
-
React__default.createElement("a", { className: 'link', href: study ? recipeLinkFromSource((
|
55373
|
+
React__default.createElement(Avatar, { src: study ? (_q = (_p = study.recipe) === null || _p === void 0 ? void 0 : _p.metadata) === null || _q === void 0 ? void 0 : _q.icon : '', size: 24, color: hover.recipe ? '#40a9ff' : undefined })),
|
55374
|
+
React__default.createElement("a", { className: 'link', href: study ? recipeLinkFromSource((_r = study === null || study === void 0 ? void 0 : study.recipe) === null || _r === void 0 ? void 0 : _r.source) : '', title: 'Go to recipe page', rel: 'noreferrer', onMouseOver: function (e) { return toggleHover('recipe', true); }, onMouseLeave: function (e) { return toggleHover('recipe', false); }, style: hover.recipe ? { color: '#40a9ff' } : {} }, study ? (_t = (_s = study.recipe) === null || _s === void 0 ? void 0 : _s.metadata) === null || _t === void 0 ? void 0 : _t.name : '--'),
|
55375
55375
|
study && React__default.createElement("span", { className: 'light-text' },
|
55376
|
-
" ", (
|
55377
|
-
|
55376
|
+
" ", (_v = (_u = study.recipe) === null || _u === void 0 ? void 0 : _u.metadata) === null || _v === void 0 ? void 0 :
|
55377
|
+
_v.tag)),
|
55378
55378
|
React__default.createElement("div", { className: 'item8' },
|
55379
55379
|
React__default.createElement("span", { className: 'status-label', style: { marginRight: '0.75rem' } }, study ? status.charAt(0).toUpperCase() + status.slice(1) : '--'),
|
55380
55380
|
React__default.createElement("span", { className: 'light-text' },
|
55381
55381
|
!isReady && React__default.createElement(LoadingOutlined$1, null),
|
55382
55382
|
(study && total == 1) && run && width > 600 &&
|
55383
|
-
"".concat((
|
55383
|
+
"".concat((_x = (_w = run.meta) === null || _w === void 0 ? void 0 : _w.progress) === null || _x === void 0 ? void 0 : _x.completed, " / ").concat((_z = (_y = run.meta) === null || _y === void 0 ? void 0 : _y.progress) === null || _z === void 0 ? void 0 : _z.total, " steps"),
|
55384
55384
|
(study && total > 1) && width > 600 &&
|
55385
|
-
"".concat((
|
55385
|
+
"".concat((_0 = study.status) === null || _0 === void 0 ? void 0 : _0.runs_completed, " / ").concat(total, " runs"))),
|
55386
55386
|
React__default.createElement("div", { className: 'item9', title: 'CPU usage' },
|
55387
55387
|
React__default.createElement(Cpu$1, { size: 18, style: { marginRight: '0.15rem' } }),
|
55388
55388
|
React__default.createElement("span", { className: 'light-text' }, study ? "".concat(formatDuration$1(dayjs_min.duration(study.resources_duration.cpu, 'seconds'))) : '--')),
|
@@ -55434,9 +55434,9 @@ var formatDuration = function (duration) {
|
|
55434
55434
|
};
|
55435
55435
|
var RunCard = function (_a) {
|
55436
55436
|
var _b;
|
55437
|
-
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
55438
|
-
var projectName = _a.projectName, projectOwner = _a.projectOwner, _run = _a.run, authUser = _a.authUser, client = _a.client,
|
55439
|
-
var
|
55437
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
55438
|
+
var projectName = _a.projectName, projectOwner = _a.projectOwner, _run = _a.run, authUser = _a.authUser, client = _a.client, _u = _a.enableClick, enableClick = _u === void 0 ? true : _u, _v = _a.style, style = _v === void 0 ? {} : _v, _w = _a.getTab, getTab = _w === void 0 ? function (tab) { return undefined; } : _w, _x = _a.defaultTab, defaultTab = _x === void 0 ? RunTabs.details : _x, _y = _a.getValue, getValue = _y === void 0 ? function (run) { return undefined; } : _y, _z = _a.interval, interval = _z === void 0 ? 5000 : _z, _0 = _a.canWrite, canWrite = _0 === void 0 ? false : _0, _1 = _a.localRun, localRun = _1 === void 0 ? false : _1, _2 = _a.loaderNode, loaderNode = _2 === void 0 ? undefined : _2;
|
55439
|
+
var _3 = usePollinationPanel(), fetchLocalRun = _3.fetchLocalRun, fetchLocalJob = _3.fetchLocalJob, fileExplorer = _3.fileExplorer, deleteJob = _3.deleteJob;
|
55440
55440
|
var disabled = useMemo(function () {
|
55441
55441
|
if (!localRun)
|
55442
55442
|
return;
|
@@ -55446,16 +55446,16 @@ var RunCard = function (_a) {
|
|
55446
55446
|
* Fetch run
|
55447
55447
|
*/
|
55448
55448
|
var fetchJob = useJobs(client).fetchJob;
|
55449
|
-
var
|
55450
|
-
var
|
55451
|
-
var
|
55452
|
-
var
|
55453
|
-
var
|
55454
|
-
var
|
55449
|
+
var _4 = useRuns(client), fetchRun = _4.fetchRun, statusMap = _4.statusMap, getDuration = _4.getDuration, cancelRun = _4.cancelRun;
|
55450
|
+
var _5 = useWindowDimensions(), width = _5.width; _5.height;
|
55451
|
+
var _6 = useState(false), seeDescription = _6[0], setSeeDescription = _6[1];
|
55452
|
+
var _7 = useState(false), seeAction = _7[0], setSeeAction = _7[1];
|
55453
|
+
var _8 = useState(false), stopRefresh = _8[0], setStopRefresh = _8[1];
|
55454
|
+
var _9 = useState(false), isReady = _9[0], setIsReady = _9[1];
|
55455
55455
|
/*
|
55456
55456
|
* From run and stop when it is done
|
55457
55457
|
*/
|
55458
|
-
var
|
55458
|
+
var _10 = useSWR(authUser && _run ? (!localRun ? [projectOwner, projectName, _run.id] : [_run.id, _run['subfolder']]) : undefined, localRun ? fetchLocalRun : fetchRun, {
|
55459
55459
|
revalidateOnFocus: true,
|
55460
55460
|
refreshWhenHidden: true,
|
55461
55461
|
refreshInterval: stopRefresh ? undefined : interval,
|
@@ -55471,7 +55471,7 @@ var RunCard = function (_a) {
|
|
55471
55471
|
setStopRefresh(true);
|
55472
55472
|
setIsReady(true);
|
55473
55473
|
},
|
55474
|
-
}), run =
|
55474
|
+
}), run = _10.data, error = _10.error;
|
55475
55475
|
var sendRun = useCallback(function (run) { return getValue(run); }, [run]);
|
55476
55476
|
/**
|
55477
55477
|
* Fetch job just one time
|
@@ -55495,9 +55495,9 @@ var RunCard = function (_a) {
|
|
55495
55495
|
return undefined;
|
55496
55496
|
return run.status.status;
|
55497
55497
|
}, [run]);
|
55498
|
-
var
|
55499
|
-
var
|
55500
|
-
var
|
55498
|
+
var _11 = useState(), study = _11[0], setStudy = _11[1];
|
55499
|
+
var _12 = useState(), localStudy = _12[0], setLocalStudy = _12[1];
|
55500
|
+
var _13 = useState(getDuration(run)), duration = _13[0], setDuration = _13[1];
|
55501
55501
|
useEffect(function () {
|
55502
55502
|
if (!run)
|
55503
55503
|
return undefined;
|
@@ -55528,7 +55528,7 @@ var RunCard = function (_a) {
|
|
55528
55528
|
info: false,
|
55529
55529
|
settings: false,
|
55530
55530
|
};
|
55531
|
-
var
|
55531
|
+
var _14 = useState(__assign(__assign({}, initialValues), (_b = {}, _b[defaultTab] = true, _b))), hover = _14[0], setHover = _14[1];
|
55532
55532
|
var toggleHover = useCallback(function (id, value) {
|
55533
55533
|
if (value === void 0) { value = false; }
|
55534
55534
|
setHover(function (prevHover) {
|
@@ -55698,11 +55698,11 @@ var RunCard = function (_a) {
|
|
55698
55698
|
}, style: { all: 'unset', cursor: 'pointer', color: "".concat(hover.study
|
55699
55699
|
? '#40a9ff' : '#000') } }, localRun ? (localStudy ? localStudy.name : _run['studyName'] // Get name from _run
|
55700
55700
|
) : (study ? (_g = study.spec.name) !== null && _g !== void 0 ? _g : "Study: ".concat(study.id) : '--'))),
|
55701
|
-
React__default.createElement("div", { className: 'item4', title: run && dayjs_min(run.status.started_at).utc(localStudy ? false : true).tz(tmz).format('[on] MMM DD YYYY [at]
|
55701
|
+
React__default.createElement("div", { className: 'item4', title: run && ((_h = run === null || run === void 0 ? void 0 : run.status) === null || _h === void 0 ? void 0 : _h.finished_at) && dayjs_min(run.status.started_at).utc(localStudy ? false : true).tz(tmz).format('[on] MMM DD YYYY [at] HH:mm') }, run ? dayjs_min(run.status.started_at).utc(localStudy ? false : true).tz(tmz).format('[on] MMM DD YYYY') : '--'),
|
55702
55702
|
React__default.createElement("div", { className: 'item5' },
|
55703
55703
|
React__default.createElement("span", { style: { marginRight: '0.75rem' } },
|
55704
|
-
!localRun && React__default.createElement(Avatar, { color: hover.author ? '#40a9ff' : undefined, src: run ? (
|
55705
|
-
localRun && run && React__default.createElement(Avatar, { color: hover.author ? '#40a9ff' : undefined, src: (localStudy && (localStudy === null || localStudy === void 0 ? void 0 : localStudy.author)) ? (
|
55704
|
+
!localRun && React__default.createElement(Avatar, { color: hover.author ? '#40a9ff' : undefined, src: run ? (_j = run.author) === null || _j === void 0 ? void 0 : _j.picture_url : '', size: 24 }),
|
55705
|
+
localRun && run && React__default.createElement(Avatar, { color: hover.author ? '#40a9ff' : undefined, src: (localStudy && (localStudy === null || localStudy === void 0 ? void 0 : localStudy.author)) ? (_k = localStudy.author) === null || _k === void 0 ? void 0 : _k.picture_url : (_l = run.author) === null || _l === void 0 ? void 0 : _l.picture_url, size: 24 })),
|
55706
55706
|
React__default.createElement("a", { className: 'link', onClick: function (e) {
|
55707
55707
|
var _a;
|
55708
55708
|
e.stopPropagation();
|
@@ -55715,11 +55715,11 @@ var RunCard = function (_a) {
|
|
55715
55715
|
window.location.href = "/".concat((_a = localStudy === null || localStudy === void 0 ? void 0 : localStudy.author) === null || _a === void 0 ? void 0 : _a.name);
|
55716
55716
|
}
|
55717
55717
|
}, title: 'Go to author page', rel: 'noreferrer', onMouseOver: function (e) { return toggleHover('author', true); }, onMouseLeave: function (e) { return toggleHover('author', false); }, style: hover.author ? { color: '#40a9ff' } : {} },
|
55718
|
-
!localRun && run && ((
|
55719
|
-
localRun && localStudy && ((
|
55718
|
+
!localRun && run && ((_o = (_m = run.author) === null || _m === void 0 ? void 0 : _m.display_name) !== null && _o !== void 0 ? _o : (_p = run.author) === null || _p === void 0 ? void 0 : _p.name),
|
55719
|
+
localRun && localStudy && ((_r = (_q = localStudy.author) === null || _q === void 0 ? void 0 : _q.display_name) !== null && _r !== void 0 ? _r : run.author.display_name))),
|
55720
55720
|
React__default.createElement("div", { className: 'item6' },
|
55721
55721
|
React__default.createElement("span", { style: { marginRight: '0.75rem' } },
|
55722
|
-
React__default.createElement(Avatar, { color: hover.recipe ? '#40a9ff' : undefined, src: run ? (
|
55722
|
+
React__default.createElement(Avatar, { color: hover.recipe ? '#40a9ff' : undefined, src: run ? (_t = (_s = run.recipe) === null || _s === void 0 ? void 0 : _s.metadata) === null || _t === void 0 ? void 0 : _t.icon : '', size: 24 })),
|
55723
55723
|
React__default.createElement("a", { className: 'link', onClick: function (e) {
|
55724
55724
|
e.stopPropagation();
|
55725
55725
|
if (!localRun) {
|