pollination-react-io 1.24.5 → 1.25.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/StudyCard/StudyCard.types.d.ts +2 -0
- package/build/index.esm.js +38 -36
- package/build/index.esm.js.map +1 -1
- package/build/index.js +38 -36
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.esm.js
CHANGED
|
@@ -46618,14 +46618,14 @@ var formatDuration = function (duration) {
|
|
|
46618
46618
|
};
|
|
46619
46619
|
var StudyCard = function (_a) {
|
|
46620
46620
|
var _b, _c;
|
|
46621
|
-
var projectName = _a.projectName, projectOwner = _a.projectOwner, _study = _a.study, _d = _a.canWrite, canWrite = _d === void 0 ? false : _d, _e = _a.runList, runList = _e === void 0 ? true : _e, style = _a.style, authUser = _a.authUser, client = _a.client;
|
|
46622
|
-
var
|
|
46623
|
-
var
|
|
46621
|
+
var projectName = _a.projectName, projectOwner = _a.projectOwner, _study = _a.study, _d = _a.canWrite, canWrite = _d === void 0 ? false : _d, _e = _a.runList, runList = _e === void 0 ? true : _e, style = _a.style, authUser = _a.authUser, client = _a.client, showMenu = _a.showMenu, _f = _a.onDelete, onDelete = _f === void 0 ? function () { return window.history.back(); } : _f;
|
|
46622
|
+
var _g = useJobs(client), cancelJob = _g.cancelJob, deleteJob = _g.deleteJob, fetchJob = _g.fetchJob;
|
|
46623
|
+
var _h = useSWR(authUser && _study ? [projectOwner, projectName, _study.id] : undefined, fetchJob, {
|
|
46624
46624
|
revalidateOnFocus: false,
|
|
46625
46625
|
refreshInterval: !_study || _study.status.finished_at ? undefined : 5000,
|
|
46626
46626
|
fallbackData: _study,
|
|
46627
46627
|
errorRetryCount: 3
|
|
46628
|
-
}), study =
|
|
46628
|
+
}), study = _h.data; _h.error; var isValidating = _h.isValidating;
|
|
46629
46629
|
var status = useMemo(function () {
|
|
46630
46630
|
return ({
|
|
46631
46631
|
pending: study && study.status.runs_pending ? study.status.runs_pending : 0,
|
|
@@ -46635,7 +46635,7 @@ var StudyCard = function (_a) {
|
|
|
46635
46635
|
canceled: study && study.status.runs_cancelled ? study.status.runs_cancelled : 0,
|
|
46636
46636
|
});
|
|
46637
46637
|
}, [study]);
|
|
46638
|
-
var
|
|
46638
|
+
var _j = useState(getDuration(study)), duration = _j[0], setDuration = _j[1];
|
|
46639
46639
|
useEffect(function () {
|
|
46640
46640
|
if (!study)
|
|
46641
46641
|
return undefined;
|
|
@@ -46648,6 +46648,37 @@ var StudyCard = function (_a) {
|
|
|
46648
46648
|
}, 1000);
|
|
46649
46649
|
return study.status.finished_at ? undefined : function () { return clearInterval(handle); };
|
|
46650
46650
|
}, [study]);
|
|
46651
|
+
var menu = (React__default.createElement("button", { type: 'button', style: {
|
|
46652
|
+
width: 32,
|
|
46653
|
+
height: 32,
|
|
46654
|
+
display: 'flex',
|
|
46655
|
+
justifyContent: 'center',
|
|
46656
|
+
alignItems: 'center',
|
|
46657
|
+
borderRadius: 9999,
|
|
46658
|
+
border: '1px solid #d0d7de',
|
|
46659
|
+
backgroundColor: 'white',
|
|
46660
|
+
outlineColor: 'var(--primary)',
|
|
46661
|
+
cursor: 'pointer'
|
|
46662
|
+
} }, isValidating ? React__default.createElement(LoadingIcon, null) : React__default.createElement(Gear$1, null)));
|
|
46663
|
+
var optionsDropdown = [
|
|
46664
|
+
{
|
|
46665
|
+
options: [{
|
|
46666
|
+
type: 'button',
|
|
46667
|
+
id: 'cancel-study',
|
|
46668
|
+
label: 'Cancel',
|
|
46669
|
+
icon: React__default.createElement(XOctagon$1, null),
|
|
46670
|
+
disabled: !study || (status.pending < 1 && status.running < 1),
|
|
46671
|
+
onSelect: function () { return cancelJob(projectOwner, projectName, study.id); }
|
|
46672
|
+
}, {
|
|
46673
|
+
type: 'button',
|
|
46674
|
+
id: 'delete-study',
|
|
46675
|
+
label: 'Delete',
|
|
46676
|
+
icon: React__default.createElement(Trash$1, null),
|
|
46677
|
+
onSelect: function () { return deleteJob(projectOwner, projectName, study.id)
|
|
46678
|
+
.then(onDelete); }
|
|
46679
|
+
},]
|
|
46680
|
+
}
|
|
46681
|
+
];
|
|
46651
46682
|
return (React__default.createElement("div", { "data-testid": "StudyCard", className: 'study-card', style: __assign({ borderRadius: 8, borderWidth: 1, borderStyle: 'solid', display: 'grid', gridTemplateColumns: 'minmax(200px, 18%) 1fr', gridTemplateRows: '1fr auto', columnGap: 8, rowGap: 0 }, style) },
|
|
46652
46683
|
React__default.createElement("div", { style: {
|
|
46653
46684
|
borderRight: '1px solid #d0d7de',
|
|
@@ -46720,41 +46751,12 @@ var StudyCard = function (_a) {
|
|
|
46720
46751
|
textOverflow: 'ellipsis',
|
|
46721
46752
|
display: 'inline-block'
|
|
46722
46753
|
} }, study ? (_b = study.spec.name) !== null && _b !== void 0 ? _b : "Study: ".concat(study.id) : '--'),
|
|
46723
|
-
canWrite && study &&
|
|
46754
|
+
showMenu && canWrite && study &&
|
|
46724
46755
|
React__default.createElement("div", { style: {
|
|
46725
46756
|
display: 'flex',
|
|
46726
46757
|
alignItems: 'center'
|
|
46727
46758
|
} },
|
|
46728
|
-
React__default.createElement(Dropdown, { trigger:
|
|
46729
|
-
width: 32,
|
|
46730
|
-
height: 32,
|
|
46731
|
-
display: 'flex',
|
|
46732
|
-
justifyContent: 'center',
|
|
46733
|
-
alignItems: 'center',
|
|
46734
|
-
borderRadius: 9999,
|
|
46735
|
-
border: '1px solid #d0d7de',
|
|
46736
|
-
backgroundColor: 'white',
|
|
46737
|
-
outlineColor: 'var(--primary)',
|
|
46738
|
-
cursor: 'pointer'
|
|
46739
|
-
} }, isValidating ? React__default.createElement(LoadingIcon, null) : React__default.createElement(Gear$1, null)), optionGroups: [
|
|
46740
|
-
{
|
|
46741
|
-
options: [{
|
|
46742
|
-
type: 'button',
|
|
46743
|
-
id: 'cancel-study',
|
|
46744
|
-
label: 'Cancel',
|
|
46745
|
-
icon: React__default.createElement(XOctagon$1, null),
|
|
46746
|
-
disabled: !study || (status.pending < 1 && status.running < 1),
|
|
46747
|
-
onSelect: function () { return cancelJob(projectOwner, projectName, study.id); }
|
|
46748
|
-
}, {
|
|
46749
|
-
type: 'button',
|
|
46750
|
-
id: 'delete-study',
|
|
46751
|
-
label: 'Delete',
|
|
46752
|
-
icon: React__default.createElement(Trash$1, null),
|
|
46753
|
-
onSelect: function () { return deleteJob(projectOwner, projectName, study.id)
|
|
46754
|
-
.then(function () { return window.open("/".concat(projectOwner, "/projects/").concat(projectName)); }); }
|
|
46755
|
-
},]
|
|
46756
|
-
}
|
|
46757
|
-
], contentProps: {
|
|
46759
|
+
React__default.createElement(Dropdown, { trigger: menu, optionGroups: optionsDropdown, contentProps: {
|
|
46758
46760
|
align: 'end',
|
|
46759
46761
|
sideOffset: 2,
|
|
46760
46762
|
} }))),
|