pollination-react-io 1.102.0 → 1.103.0
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 +123 -58
- package/build/index.esm.js.map +1 -1
- package/build/index.js +123 -58
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.js
CHANGED
@@ -56376,21 +56376,21 @@ var formatDuration$1 = function (duration) {
|
|
56376
56376
|
var StudyCard = function (_a) {
|
56377
56377
|
var _b;
|
56378
56378
|
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
56379
|
-
var projectName = _a.projectName, projectOwner = _a.projectOwner, _study = _a.study,
|
56379
|
+
var projectName = _a.projectName, projectOwner = _a.projectOwner, _study = _a.study, _1 = _a.style, style = _1 === void 0 ? {} : _1, authUser = _a.authUser, client = _a.client, enableClick = _a.enableClick, _2 = _a.getTab, getTab = _2 === void 0 ? function (tab) { } : _2, _3 = _a.defaultTab, defaultTab = _3 === void 0 ? '' : _3, _4 = _a.enableLink, enableLink = _4 === void 0 ? false : _4, _5 = _a.canWrite, canWrite = _5 === void 0 ? false : _5, _6 = _a.getValue, getValue = _6 === void 0 ? function (job) { } : _6, _7 = _a.interval, interval = _7 === void 0 ? 5000 : _7;
|
56380
56380
|
/**
|
56381
56381
|
* Fetch hooks
|
56382
56382
|
*/
|
56383
|
-
var
|
56384
|
-
var
|
56383
|
+
var _8 = useJobs(client), fetchJob = _8.fetchJob, getDuration = _8.getDuration, statusMap = _8.statusMap, deleteJob = _8.deleteJob, cancelJob = _8.cancelJob, retryFailedRuns = _8.retryFailedRuns;
|
56384
|
+
var _9 = useRuns(client), listRuns = _9.listRuns, getTrigger = _9.getTrigger;
|
56385
56385
|
var width = useWindowDimensions().width;
|
56386
|
-
var
|
56387
|
-
var
|
56388
|
-
var
|
56389
|
-
var
|
56386
|
+
var _10 = React.useState(false), seeDescription = _10[0], setSeeDescription = _10[1];
|
56387
|
+
var _11 = React.useState(false), seeAction = _11[0], setSeeAction = _11[1];
|
56388
|
+
var _12 = React.useState(false), isReady = _12[0], setIsReady = _12[1];
|
56389
|
+
var _13 = React.useState(false), retryLoading = _13[0], setRetryLoading = _13[1];
|
56390
56390
|
/**
|
56391
56391
|
* From job to run
|
56392
56392
|
*/
|
56393
|
-
var
|
56393
|
+
var _14 = useSWR(authUser && _study ? [projectOwner, projectName, _study.id] : undefined, fetchJob, {
|
56394
56394
|
revalidateOnFocus: true,
|
56395
56395
|
refreshWhenHidden: true,
|
56396
56396
|
refreshInterval: interval,
|
@@ -56422,7 +56422,7 @@ var StudyCard = function (_a) {
|
|
56422
56422
|
setIsReady(true);
|
56423
56423
|
}
|
56424
56424
|
}
|
56425
|
-
}).data;
|
56425
|
+
}), study = _14.data, mutate = _14.mutate;
|
56426
56426
|
var sendJob = React.useCallback(function (job) { return getValue(job); }, [study]);
|
56427
56427
|
var total = React.useMemo(function () {
|
56428
56428
|
if (!study)
|
@@ -56446,25 +56446,23 @@ var StudyCard = function (_a) {
|
|
56446
56446
|
}
|
56447
56447
|
return study.status.status.toLocaleLowerCase();
|
56448
56448
|
}, [study]);
|
56449
|
-
var
|
56450
|
-
var
|
56449
|
+
var _15 = React.useState(), run = _15[0], setRun = _15[1];
|
56450
|
+
var _16 = React.useState(new Date()), time = _16[0], setTime = _16[1];
|
56451
56451
|
React.useEffect(function () {
|
56452
|
-
|
56453
|
-
|
56454
|
-
return undefined;
|
56455
|
-
if (study.status.finished_at) {
|
56456
|
-
setDuration(getDuration(study));
|
56457
|
-
return;
|
56458
|
-
}
|
56459
|
-
var handle = setInterval(function () {
|
56460
|
-
setDuration(getDuration(study));
|
56452
|
+
var interval = setInterval(function () {
|
56453
|
+
setTime(new Date());
|
56461
56454
|
}, 1000);
|
56462
|
-
return function () { return clearInterval(
|
56463
|
-
}, [
|
56455
|
+
return function () { return clearInterval(interval); };
|
56456
|
+
}, []);
|
56457
|
+
var duration = React.useMemo(function () {
|
56458
|
+
if (!study || !time)
|
56459
|
+
return dayjs_min.duration({ seconds: 0 });
|
56460
|
+
return getDuration(study);
|
56461
|
+
}, [study, getDuration, time]);
|
56464
56462
|
/*
|
56465
56463
|
* Manage hover
|
56466
56464
|
*/
|
56467
|
-
var initialValues = {
|
56465
|
+
var initialValues = React.useMemo(function () { return ({
|
56468
56466
|
account: false,
|
56469
56467
|
project: false,
|
56470
56468
|
details: false,
|
@@ -56477,22 +56475,22 @@ var StudyCard = function (_a) {
|
|
56477
56475
|
recipe: false,
|
56478
56476
|
info: false,
|
56479
56477
|
settings: false
|
56480
|
-
};
|
56481
|
-
var
|
56478
|
+
}); }, []);
|
56479
|
+
var _17 = React.useState(__assign(__assign({}, initialValues), (_b = {}, _b[defaultTab] = true, _b))), hover = _17[0], setHover = _17[1];
|
56482
56480
|
var toggleHover = React.useCallback(function (id, value) {
|
56483
56481
|
if (value === void 0) { value = false; }
|
56484
56482
|
setHover(function (prevHover) {
|
56485
56483
|
var _a;
|
56486
56484
|
return (__assign(__assign({}, prevHover), (_a = {}, _a[id] = value, _a)));
|
56487
56485
|
});
|
56488
|
-
}, [
|
56486
|
+
}, [setHover]);
|
56489
56487
|
/*
|
56490
56488
|
* Reset hover and use default tab
|
56491
56489
|
*/
|
56492
56490
|
React.useEffect(function () {
|
56493
56491
|
var _a;
|
56494
56492
|
setHover(__assign(__assign({}, initialValues), (_a = {}, _a[defaultTab] = true, _a)));
|
56495
|
-
}, [defaultTab]);
|
56493
|
+
}, [defaultTab, initialValues, setHover]);
|
56496
56494
|
return (React__default["default"].createElement("div", { className: (isReady && enableClick) ? "grid-container ".concat(isReady && !((_c = study === null || study === void 0 ? void 0 : study.status) === null || _c === void 0 ? void 0 : _c.finished_at) && 'blink-effect')
|
56497
56495
|
: "grid-container disable-click ".concat(isReady && !((_d = study === null || study === void 0 ? void 0 : study.status) === null || _d === void 0 ? void 0 : _d.finished_at) && 'blink-effect'), tabIndex: 0, role: 'button', style: __assign({ borderColor: (_f = (_e = statusMap[status]) === null || _e === void 0 ? void 0 : _e.color) !== null && _f !== void 0 ? _f : '#d0d7de' }, style), onClick: function () {
|
56498
56496
|
if (!enableClick)
|
@@ -56505,6 +56503,7 @@ var StudyCard = function (_a) {
|
|
56505
56503
|
}
|
56506
56504
|
else ;
|
56507
56505
|
} },
|
56506
|
+
React__default["default"].createElement(Ie, null),
|
56508
56507
|
React__default["default"].createElement("div", { className: 'item1' },
|
56509
56508
|
React__default["default"].createElement("a", { className: 'link', style: { all: 'unset', cursor: 'pointer', marginRight: '0.25rem',
|
56510
56509
|
color: "".concat(hover.account ? '#40a9ff' : '#000') }, title: 'Go to account page', onMouseOver: function (e) { return toggleHover('account', true); }, onMouseLeave: function (e) { return toggleHover('account', false); }, href: study && "/".concat(study.owner.name) }, ((projectOwner === null || projectOwner === void 0 ? void 0 : projectOwner.length) > 20)
|
@@ -56641,32 +56640,70 @@ var StudyCard = function (_a) {
|
|
56641
56640
|
seeDescription && React__default["default"].createElement(React__default["default"].Fragment, null,
|
56642
56641
|
React__default["default"].createElement("div", { className: 'item7' }, study ? study.spec.description : '--')),
|
56643
56642
|
seeAction && width && React__default["default"].createElement(React__default["default"].Fragment, null,
|
56644
|
-
React__default["default"].createElement("div", { className: 'item7' },
|
56645
|
-
React__default["default"].createElement(Button, { style: (
|
56646
|
-
? { display: 'inline', margin: '0 10px 0 0' }
|
56647
|
-
: { display: 'inline', float: 'right', margin: '0 10px 0 0' }, disabled: !study || (![dist$1.JobStatusEnum.Cancelled, dist$1.JobStatusEnum.Completed].includes(study.status.status)), onClick: function (e) {
|
56643
|
+
React__default["default"].createElement("div", { className: 'item7', style: { display: 'flex' } },
|
56644
|
+
React__default["default"].createElement(Button, { style: { marginRight: '0.75rem' }, disabled: !study || (![dist$1.JobStatusEnum.Cancelled, dist$1.JobStatusEnum.Completed].includes(study.status.status)), onClick: function (e) {
|
56648
56645
|
e.stopPropagation();
|
56649
56646
|
if (!study)
|
56650
56647
|
return;
|
56651
|
-
deleteJob(projectOwner, projectName, study.id)
|
56652
|
-
|
56653
|
-
|
56648
|
+
n$1.promise(deleteJob(projectOwner, projectName, study.id), {
|
56649
|
+
loading: 'Deleting study...',
|
56650
|
+
success: 'Study deleted',
|
56651
|
+
error: function (err) {
|
56652
|
+
console.log(err);
|
56653
|
+
return "Failed to delete study: ".concat(err);
|
56654
|
+
}
|
56655
|
+
}, {
|
56656
|
+
style: { minWidth: '300px', fontSize: '12px' },
|
56657
|
+
success: {
|
56658
|
+
duration: 5000,
|
56659
|
+
icon: '🔥',
|
56660
|
+
position: 'bottom-left'
|
56661
|
+
},
|
56662
|
+
error: {
|
56663
|
+
duration: 5000,
|
56664
|
+
position: 'bottom-left'
|
56665
|
+
},
|
56666
|
+
loading: {
|
56667
|
+
position: 'bottom-left'
|
56668
|
+
}
|
56669
|
+
}).finally(function () {
|
56670
|
+
mutate();
|
56671
|
+
});
|
56654
56672
|
} },
|
56655
56673
|
React__default["default"].createElement(Trash$1, { style: { display: 'inline', margin: '0 5px 0 0' } }),
|
56656
56674
|
" Delete"),
|
56657
|
-
React__default["default"].createElement(Button, { style: (
|
56658
|
-
{ display: 'inline', margin: '0 10px 0 0' }
|
56659
|
-
: { display: 'inline', float: 'left', margin: '0 10px 0 0' }, disabled: !study || (study.status.runs_pending < 1 && study.status.runs_running < 1), onClick: function (e) {
|
56675
|
+
React__default["default"].createElement(Button, { style: { marginRight: '0.75rem' }, disabled: !study || (study.status.runs_pending < 1 && study.status.runs_running < 1), onClick: function (e) {
|
56660
56676
|
e.stopPropagation();
|
56661
56677
|
if (!study)
|
56662
56678
|
return;
|
56663
|
-
cancelJob(projectOwner, projectName, study.id)
|
56664
|
-
|
56665
|
-
|
56679
|
+
n$1.promise(cancelJob(projectOwner, projectName, study.id), {
|
56680
|
+
loading: 'Cancelling study...',
|
56681
|
+
success: 'Study cancelled',
|
56682
|
+
error: function (err) {
|
56683
|
+
console.log(err);
|
56684
|
+
return "Failed to cancel study: ".concat(err);
|
56685
|
+
}
|
56686
|
+
}, {
|
56687
|
+
style: { minWidth: '300px', fontSize: '12px' },
|
56688
|
+
success: {
|
56689
|
+
duration: 5000,
|
56690
|
+
icon: '🔥',
|
56691
|
+
position: 'bottom-left'
|
56692
|
+
},
|
56693
|
+
error: {
|
56694
|
+
duration: 5000,
|
56695
|
+
position: 'bottom-left'
|
56696
|
+
},
|
56697
|
+
loading: {
|
56698
|
+
position: 'bottom-left'
|
56699
|
+
}
|
56700
|
+
}).finally(function () {
|
56701
|
+
mutate();
|
56702
|
+
});
|
56666
56703
|
} },
|
56667
56704
|
React__default["default"].createElement(XOctagon$1, { style: { display: 'inline', margin: '0 5px 0 0' } }),
|
56668
56705
|
" Cancel"),
|
56669
|
-
React__default["default"].createElement(Button, { style:
|
56706
|
+
React__default["default"].createElement(Button, { style: { marginRight: '0.75rem' }, disabled: !study || (study.status.runs_cancelled == 0 && study.status.runs_failed == 0), loading: retryLoading, onClick: function (e) {
|
56670
56707
|
setRetryLoading(true);
|
56671
56708
|
e.stopPropagation();
|
56672
56709
|
if (!study)
|
@@ -56693,6 +56730,7 @@ var StudyCard = function (_a) {
|
|
56693
56730
|
position: 'bottom-left'
|
56694
56731
|
}
|
56695
56732
|
}).finally(function () {
|
56733
|
+
mutate();
|
56696
56734
|
setRetryLoading(false);
|
56697
56735
|
});
|
56698
56736
|
} },
|
@@ -56758,7 +56796,7 @@ var RunCard = function (_a) {
|
|
56758
56796
|
setStopRefresh(true);
|
56759
56797
|
setIsReady(true);
|
56760
56798
|
}
|
56761
|
-
}), run = _11.data, error = _11.error;
|
56799
|
+
}), run = _11.data, error = _11.error, mutate = _11.mutate;
|
56762
56800
|
var sendRun = React.useCallback(function (run) { return getValue(run); }, [getValue]);
|
56763
56801
|
/**
|
56764
56802
|
* Fetch job just one time
|
@@ -56784,15 +56822,18 @@ var RunCard = function (_a) {
|
|
56784
56822
|
}, [run]);
|
56785
56823
|
var _12 = React.useState(), study = _12[0], setStudy = _12[1];
|
56786
56824
|
var _13 = React.useState(), localStudy = _13[0], setLocalStudy = _13[1];
|
56787
|
-
var _14 = React.useState(
|
56825
|
+
var _14 = React.useState(new Date()), time = _14[0], setTime = _14[1];
|
56788
56826
|
React.useEffect(function () {
|
56789
|
-
|
56790
|
-
|
56791
|
-
var handle = setInterval(function () {
|
56792
|
-
setDuration(getDuration(run));
|
56827
|
+
var interval = setInterval(function () {
|
56828
|
+
setTime(new Date());
|
56793
56829
|
}, 1000);
|
56794
|
-
return function () { return clearInterval(
|
56795
|
-
}, [
|
56830
|
+
return function () { return clearInterval(interval); };
|
56831
|
+
}, []);
|
56832
|
+
var duration = React.useMemo(function () {
|
56833
|
+
if (!run || !time)
|
56834
|
+
return dayjs_min.duration({ seconds: 0 });
|
56835
|
+
return getDuration(run);
|
56836
|
+
}, [run, getDuration, time]);
|
56796
56837
|
/**
|
56797
56838
|
* Manage hover effect
|
56798
56839
|
*/
|
@@ -56867,6 +56908,7 @@ var RunCard = function (_a) {
|
|
56867
56908
|
window.location.href = "/".concat(projectOwner, "/projects/").concat(projectName, "/localStudies/").concat(localStudyURLname, "/?path=").concat(_run.id, "&subfolder=").concat(_run['subfolder']);
|
56868
56909
|
}
|
56869
56910
|
} },
|
56911
|
+
React__default["default"].createElement(Ie, null),
|
56870
56912
|
React__default["default"].createElement("div", { className: 'item1' },
|
56871
56913
|
React__default["default"].createElement("a", { className: 'link', style: { all: 'unset', cursor: 'pointer', marginRight: '0.25rem',
|
56872
56914
|
color: "".concat(hover.account ? '#40a9ff' : '#000') }, title: 'Go to account page', onMouseOver: function (e) { return toggleHover('account', true); }, onMouseLeave: function (e) { return toggleHover('account', false); }, onClick: function (e) {
|
@@ -57035,15 +57077,39 @@ var RunCard = function (_a) {
|
|
57035
57077
|
seeAction && width && React__default["default"].createElement(React__default["default"].Fragment, null,
|
57036
57078
|
React__default["default"].createElement("div", { className: 'item7', style: { display: 'flex' } },
|
57037
57079
|
!localRun && (React__default["default"].createElement(React__default["default"].Fragment, null,
|
57038
|
-
React__default["default"].createElement(Button, { style: { marginRight: '0.75rem' },
|
57080
|
+
React__default["default"].createElement(Button, { style: { marginRight: '0.75rem' },
|
57081
|
+
// disabled={!run || [RunStatusEnum.Failed, RunStatusEnum.Succeeded, RunStatusEnum.Cancelled, RunStatusEnum.Unknown].includes(run.status.status)}
|
57082
|
+
onClick: function (e) {
|
57039
57083
|
e.stopPropagation();
|
57040
57084
|
if (!run)
|
57041
57085
|
return;
|
57042
|
-
cancelRun(projectOwner, projectName, run.id)
|
57043
|
-
|
57044
|
-
|
57045
|
-
|
57046
|
-
|
57086
|
+
n$1.promise(cancelRun(projectOwner, projectName, run.id), {
|
57087
|
+
loading: 'Cancelling run...',
|
57088
|
+
success: function (data) {
|
57089
|
+
setStopRefresh(false);
|
57090
|
+
return 'Run cancelled';
|
57091
|
+
},
|
57092
|
+
error: function (err) {
|
57093
|
+
console.log(err);
|
57094
|
+
return "Failed to cancel run: ".concat(err);
|
57095
|
+
},
|
57096
|
+
}, {
|
57097
|
+
style: { minWidth: '300px', fontSize: '12px' },
|
57098
|
+
success: {
|
57099
|
+
duration: 5000,
|
57100
|
+
icon: '🔥',
|
57101
|
+
position: 'bottom-left'
|
57102
|
+
},
|
57103
|
+
error: {
|
57104
|
+
duration: 5000,
|
57105
|
+
position: 'bottom-left'
|
57106
|
+
},
|
57107
|
+
loading: {
|
57108
|
+
position: 'bottom-left'
|
57109
|
+
}
|
57110
|
+
}).finally(function () {
|
57111
|
+
mutate();
|
57112
|
+
});
|
57047
57113
|
} },
|
57048
57114
|
React__default["default"].createElement(XOctagon$1, { style: { display: 'inline', margin: '0 5px 0 0' } }),
|
57049
57115
|
" Cancel"),
|
@@ -57058,7 +57124,6 @@ var RunCard = function (_a) {
|
|
57058
57124
|
loading: 'Retrying run...',
|
57059
57125
|
success: function (data) {
|
57060
57126
|
setStopRefresh(false);
|
57061
|
-
mutate(swrKey);
|
57062
57127
|
return 'Retry in progress. Please wait.';
|
57063
57128
|
},
|
57064
57129
|
error: function (err) {
|
@@ -57080,12 +57145,12 @@ var RunCard = function (_a) {
|
|
57080
57145
|
position: 'bottom-left'
|
57081
57146
|
}
|
57082
57147
|
}).finally(function () {
|
57148
|
+
mutate();
|
57083
57149
|
setRetryLoading(false);
|
57084
57150
|
});
|
57085
57151
|
} },
|
57086
57152
|
React__default["default"].createElement(Recycle$1, { style: { display: 'inline', margin: '0 5px 0 0' } }),
|
57087
|
-
" Retry"),
|
57088
|
-
React__default["default"].createElement(Ie, null))),
|
57153
|
+
" Retry"))),
|
57089
57154
|
localRun && React__default["default"].createElement(Button, { disabled: !run || !run.status.finished_at, onClick: function (e) {
|
57090
57155
|
e.stopPropagation();
|
57091
57156
|
if (!run)
|