pollination-react-io 1.42.3 → 1.44.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/Cards/StudyCard.types.d.ts +7 -0
- package/build/index.esm.js +57 -18
- package/build/index.esm.js.map +1 -1
- package/build/index.js +57 -18
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -47014,6 +47014,12 @@ var SendModel = function (_a) {
|
|
|
47014
47014
|
}], asButtons: true, label: buttonLabel, helpText: "".concat(selOpt ? selOpt.charAt(0).toUpperCase() + selOpt.replace('-', ' ').slice(1) : 'Send', " model.") }));
|
|
47015
47015
|
};
|
|
47016
47016
|
|
|
47017
|
+
var JobTabs;
|
|
47018
|
+
(function (JobTabs) {
|
|
47019
|
+
JobTabs["details"] = "details";
|
|
47020
|
+
JobTabs["workspace"] = "workspace";
|
|
47021
|
+
})(JobTabs || (JobTabs = {}));
|
|
47022
|
+
|
|
47017
47023
|
var css_248z$4 = ":root {\n --background: #FFFAEE;\n --primary: #1890ff;\n --primary2: #40a9ff;\n --primary1: #cceefe;\n --primary0: #e6f7ff;\n --secondary: #fff566;\n --primary3: #000;\n --success: #46A758;\n --warning: #F76809;\n --danger: #FF4616;\n /* radix-ui/colors */\n --slate1: hsl(206, 30.0%, 98.8%);\n --slate2: hsl(210, 16.7%, 97.6%);\n --slate3: hsl(209, 13.3%, 95.3%);\n --slate4: hsl(209, 12.2%, 93.2%);\n --slate5: hsl(208, 11.7%, 91.1%);\n --slate6: hsl(208, 11.3%, 88.9%);\n --slate7: hsl(207, 11.1%, 85.9%);\n --slate8: hsl(205, 10.7%, 78.0%);\n --slate9: hsl(206, 6.0%, 56.1%);\n --slate10: hsl(206, 5.8%, 52.3%);\n --slate11: hsl(206, 6.0%, 43.5%);\n --slate12: hsl(206, 24.0%, 9.0%);\n}\n\n@keyframes spin {\n from {\n transform: rotate(0);\n }\n to {\n transform: rotate(360deg);\n }\n}\n.spin {\n animation: spin 1s linear 0s infinite;\n}\n\n@keyframes Animation {\n 0% {\n background-position: 200%;\n }\n 50% {\n background-position: 100%;\n }\n 100% {\n background-position: 0%;\n }\n}\n.loading {\n background: linear-gradient(45deg, transparent, var(--primary), 12%, transparent);\n background-size: 200%;\n animation: Animation 3s ease infinite;\n}\n\n@keyframes open {\n from {\n height: 0;\n }\n to {\n height: var(--radix-collapsible-content-height);\n }\n}\n@keyframes close {\n from {\n height: var(--radix-collapsible-content-height);\n }\n to {\n height: 0;\n }\n}\n.collapse-content {\n overflow: hidden;\n font-size: inherit;\n color: inherit;\n}\n\n.collapse-content[data-state=open] {\n animation: open 300ms ease-out;\n}\n\n.collapse-content[data-state=closed] {\n animation: close 300ms ease-out;\n}\n\n.item1 {\n grid-area: accountprj;\n font-size: 1rem;\n font-weight: 500;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.item2 {\n grid-area: runworkspacedebug;\n text-align: right !important;\n font-size: 1.25rem;\n white-space: nowrap;\n}\n\n.item3 {\n grid-area: studyrun;\n font-size: 1.25rem;\n font-weight: 500;\n white-space: wrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.item4 {\n grid-area: date;\n color: var(--slate10);\n font-size: 0.9rem;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n text-align: right !important;\n}\n\n.item5 {\n grid-area: author;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.item6 {\n grid-area: recipe;\n white-space: wrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.item7 {\n grid-area: description;\n white-space: wrap;\n color: var(--slate10);\n font-size: 0.9rem;\n}\n\n.item8 {\n grid-area: status;\n font-size: 0.9rem;\n}\n\n.status-label {\n font-weight: 500;\n}\n\n.item9 {\n grid-area: time;\n text-align: right !important;\n white-space: wrap;\n}\n\n.item10 {\n grid-area: cpu;\n text-align: right !important;\n white-space: wrap;\n}\n\n.link {\n text-decoration: none;\n color: var(--primary3);\n}\n\n.link:hover {\n color: var(--primary3);\n}\n\n.light-text {\n color: var(--slate10);\n font-size: 0.9rem;\n}\n\n.grid-container {\n display: grid;\n grid-template-areas: \"accountprj accountprj accountprj accountprj accountprj runworkspacedebug\" \"studyrun studyrun studyrun studyrun date date\" \"author recipe recipe recipe recipe recipe\" \"status status status status cpu time\" \"description description description description description description\";\n gap: 0.35rem;\n border: 0.1rem solid;\n align-items: center;\n padding: 0.35rem;\n transition: box-shadow 0.3s ease 0s, border-color 0.3s ease 0s;\n grid-template-rows: 52px 38px 46px 46px auto;\n border-radius: 6px;\n line-height: 1.5;\n}\n\n.grid-container:hover {\n box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 2px -2px, rgba(0, 0, 0, 0.12) 0px 3px 6px 0px, rgba(0, 0, 0, 0.09) 0px 5px 12px 4px;\n cursor: pointer;\n}\n\n.disable-click {\n box-shadow: none !important;\n cursor: default !important;\n}\n\n.grid-container > div {\n text-align: left;\n padding: 1rem;\n vertical-align: middle;\n}\n\n.description-expander {\n all: unset;\n}\n\n.description-expander:focus {\n outline: 0 !important;\n}\n\n@media (max-width: 600px) {\n .grid-container {\n display: grid;\n grid-template-areas: \"accountprj accountprj accountprj accountprj accountprj runworkspacedebug\" \"studyrun studyrun studyrun studyrun studyrun studyrun\" \"date date date date date date\" \"author author author recipe recipe recipe\" \"time time status status cpu cpu\" \"description description description description description description\";\n gap: 0.35rem;\n border: 0.1rem solid;\n align-items: center;\n padding: 0.15rem;\n transition: box-shadow 0.3s;\n grid-template-rows: 52px 52px 32px 32px 52px auto;\n }\n .item1 {\n text-align: left !important;\n }\n .item2 {\n text-align: right !important;\n font-size: 1rem;\n white-space: nowrap;\n }\n .item3, .item4 {\n text-align: center !important;\n }\n .item5 {\n font-size: 0.8rem;\n }\n .item6 {\n white-space: nowrap;\n font-size: 0.8rem;\n }\n .item7 {\n font-size: 0.8rem;\n text-align: center !important;\n }\n .item8 {\n font-size: 1rem;\n text-align: center !important;\n }\n .item9 {\n text-align: left !important;\n font-size: 1rem;\n white-space: nowrap;\n }\n .item10 {\n text-align: right !important;\n }\n .grid-container > div {\n text-align: left;\n vertical-align: middle;\n }\n}";
|
|
47018
47024
|
styleInject(css_248z$4);
|
|
47019
47025
|
|
|
@@ -48505,15 +48511,16 @@ var formatDuration$1 = function (duration) {
|
|
|
48505
48511
|
return "".concat(duration.days() > 0 ? "".concat(duration.days(), " day").concat(duration.days() !== 1 ? 's' : '', " and ") : '', " ").concat(duration.format('HH:mm:ss'));
|
|
48506
48512
|
};
|
|
48507
48513
|
var StudyCard = function (_a) {
|
|
48508
|
-
var _b
|
|
48509
|
-
var
|
|
48514
|
+
var _b;
|
|
48515
|
+
var _c, _d, _e, _f;
|
|
48516
|
+
var projectName = _a.projectName, projectOwner = _a.projectOwner, _study = _a.study, style = _a.style, authUser = _a.authUser, client = _a.client, enableClick = _a.enableClick, _g = _a.getValue, getValue = _g === void 0 ? function (tab) { } : _g, _h = _a.defaultTab, defaultTab = _h === void 0 ? '' : _h, _j = _a.enableLink, enableLink = _j === void 0 ? false : _j;
|
|
48510
48517
|
// Fetch _study
|
|
48511
|
-
var
|
|
48518
|
+
var _k = useJobs(client), fetchJob = _k.fetchJob, getDuration = _k.getDuration, statusMap = _k.statusMap;
|
|
48512
48519
|
var listRuns = useRuns(client).listRuns;
|
|
48513
|
-
var
|
|
48514
|
-
var
|
|
48520
|
+
var _l = useWindowDimensions(), width = _l.width; _l.height;
|
|
48521
|
+
var _m = React.useState(false), open = _m[0], setOpen = _m[1];
|
|
48515
48522
|
// From job to run
|
|
48516
|
-
var
|
|
48523
|
+
var _o = useSWR(authUser && _study ? [projectOwner, projectName, _study.id] : undefined, fetchJob, {
|
|
48517
48524
|
revalidateOnFocus: false,
|
|
48518
48525
|
refreshInterval: !_study || _study.status.finished_at ? undefined : 5000,
|
|
48519
48526
|
fallbackData: _study,
|
|
@@ -48534,7 +48541,7 @@ var StudyCard = function (_a) {
|
|
|
48534
48541
|
})
|
|
48535
48542
|
.catch(function () { setRun(undefined); });
|
|
48536
48543
|
}
|
|
48537
|
-
}), study =
|
|
48544
|
+
}), study = _o.data; _o.error; _o.isValidating;
|
|
48538
48545
|
var total = React.useMemo(function () {
|
|
48539
48546
|
if (!study)
|
|
48540
48547
|
return undefined;
|
|
@@ -48557,8 +48564,8 @@ var StudyCard = function (_a) {
|
|
|
48557
48564
|
}
|
|
48558
48565
|
return study.status.status.toLocaleLowerCase();
|
|
48559
48566
|
}, [study]);
|
|
48560
|
-
var
|
|
48561
|
-
var
|
|
48567
|
+
var _p = React.useState(), run = _p[0], setRun = _p[1];
|
|
48568
|
+
var _q = React.useState(getDuration(study)), duration = _q[0], setDuration = _q[1];
|
|
48562
48569
|
React.useEffect(function () {
|
|
48563
48570
|
setRun(undefined);
|
|
48564
48571
|
if (!study)
|
|
@@ -48575,7 +48582,7 @@ var StudyCard = function (_a) {
|
|
|
48575
48582
|
/*
|
|
48576
48583
|
* Manage hover
|
|
48577
48584
|
*/
|
|
48578
|
-
var
|
|
48585
|
+
var initialValues = {
|
|
48579
48586
|
account: false,
|
|
48580
48587
|
project: false,
|
|
48581
48588
|
details: false,
|
|
@@ -48587,7 +48594,8 @@ var StudyCard = function (_a) {
|
|
|
48587
48594
|
author: false,
|
|
48588
48595
|
recipe: false,
|
|
48589
48596
|
info: false
|
|
48590
|
-
}
|
|
48597
|
+
};
|
|
48598
|
+
var _r = React.useState(__assign(__assign({}, initialValues), (_b = {}, _b[defaultTab] = true, _b))), hover = _r[0], setHover = _r[1];
|
|
48591
48599
|
var toggleHover = React.useCallback(function (id, value) {
|
|
48592
48600
|
if (value === void 0) { value = false; }
|
|
48593
48601
|
setHover(function (prevHover) {
|
|
@@ -48595,11 +48603,18 @@ var StudyCard = function (_a) {
|
|
|
48595
48603
|
return (__assign(__assign({}, prevHover), (_a = {}, _a[id] = value, _a)));
|
|
48596
48604
|
});
|
|
48597
48605
|
}, [hover]);
|
|
48598
|
-
|
|
48606
|
+
/*
|
|
48607
|
+
* Reset hover and use default tab
|
|
48608
|
+
*/
|
|
48609
|
+
React.useEffect(function () {
|
|
48610
|
+
var _a;
|
|
48611
|
+
setHover(__assign(__assign({}, initialValues), (_a = {}, _a[defaultTab] = true, _a)));
|
|
48612
|
+
}, [defaultTab]);
|
|
48613
|
+
return (React__default["default"].createElement("div", { className: enableClick ? 'grid-container' : 'grid-container disable-click', tabIndex: 0, role: 'button', style: __assign({ borderColor: (_d = (_c = statusMap[status]) === null || _c === void 0 ? void 0 : _c.color) !== null && _d !== void 0 ? _d : '#d0d7de' }, style), onClick: function () {
|
|
48599
48614
|
if (!enableClick)
|
|
48600
48615
|
return;
|
|
48601
48616
|
if (study && total > 1) {
|
|
48602
|
-
window.location.href = "/".concat(projectOwner, "/projects/").concat(projectName, "/studies/").concat(study.id);
|
|
48617
|
+
window.location.href = "/".concat(projectOwner, "/projects/").concat(projectName, "/studies/").concat(study.id, "?tab=details");
|
|
48603
48618
|
}
|
|
48604
48619
|
else if (study && run) {
|
|
48605
48620
|
window.location.href = "/".concat(projectOwner, "/projects/").concat(projectName, "/studies/").concat(study.id, "/runs/").concat(run.id, "?tab=details");
|
|
@@ -48643,18 +48658,42 @@ var StudyCard = function (_a) {
|
|
|
48643
48658
|
}, style: { color: "".concat((hover.debug || hover.debugOver) ? '#40a9ff' : '#000') } })),
|
|
48644
48659
|
(study && total > 1) &&
|
|
48645
48660
|
React__default["default"].createElement("div", null,
|
|
48661
|
+
React__default["default"].createElement(InfoCircleOutlined$1, { className: 'link', onClick: function (e) {
|
|
48662
|
+
e.stopPropagation();
|
|
48663
|
+
if (enableLink) {
|
|
48664
|
+
document.location = "/".concat(projectOwner, "/projects/").concat(projectName, "/studies/").concat(study.id, "?tab=details");
|
|
48665
|
+
}
|
|
48666
|
+
else {
|
|
48667
|
+
getValue(JobTabs.details);
|
|
48668
|
+
toggleHover(JobTabs.workspace, false);
|
|
48669
|
+
toggleHover(JobTabs.details, true);
|
|
48670
|
+
}
|
|
48671
|
+
}, onMouseOver: function (e) {
|
|
48672
|
+
toggleHover('detailsOver', true);
|
|
48673
|
+
}, onMouseLeave: function (e) {
|
|
48674
|
+
toggleHover('detailsOver', false);
|
|
48675
|
+
}, style: { marginRight: '0.75rem',
|
|
48676
|
+
color: "".concat((hover.details || hover.detailsOver)
|
|
48677
|
+
? '#40a9ff' : '#000') } }),
|
|
48646
48678
|
React__default["default"].createElement(FolderOutlined$1, { className: 'link', onClick: function (e) {
|
|
48647
48679
|
e.stopPropagation();
|
|
48648
|
-
|
|
48680
|
+
if (enableLink) {
|
|
48681
|
+
document.location = "/".concat(projectOwner, "/projects/").concat(projectName, "/studies/").concat(study.id, "?tab=workspace");
|
|
48682
|
+
}
|
|
48683
|
+
else {
|
|
48684
|
+
getValue(JobTabs.workspace);
|
|
48685
|
+
toggleHover(JobTabs.workspace, true);
|
|
48686
|
+
toggleHover(JobTabs.details, false);
|
|
48687
|
+
}
|
|
48649
48688
|
}, onMouseOver: function (e) {
|
|
48650
48689
|
toggleHover('workspaceOver', true);
|
|
48651
48690
|
}, onMouseLeave: function (e) {
|
|
48652
48691
|
toggleHover('workspaceOver', false);
|
|
48653
|
-
}, style: {
|
|
48654
|
-
|
|
48692
|
+
}, style: { color: "".concat((hover.workspace || hover.workspaceOver)
|
|
48693
|
+
? '#40a9ff' : '#000') } }))),
|
|
48655
48694
|
React__default["default"].createElement("div", { className: 'item3' },
|
|
48656
48695
|
React__default["default"].createElement("div", null,
|
|
48657
|
-
study ? (
|
|
48696
|
+
study ? (_e = study.spec.name) !== null && _e !== void 0 ? _e : "Study: ".concat(study.id) : '--',
|
|
48658
48697
|
study && total > 1 && "(#".concat(total, ")"),
|
|
48659
48698
|
React__default["default"].createElement("button", { style: { all: 'unset', margin: '0 0 0 8px' }, onMouseOver: function (e) { return toggleHover('info', true); }, onMouseLeave: function (e) { return toggleHover('info', false); }, onClick: function (e) {
|
|
48660
48699
|
e.stopPropagation();
|
|
@@ -48665,7 +48704,7 @@ var StudyCard = function (_a) {
|
|
|
48665
48704
|
React__default["default"].createElement("div", { className: 'item5' },
|
|
48666
48705
|
React__default["default"].createElement("span", { style: { marginRight: '0.75rem' } },
|
|
48667
48706
|
React__default["default"].createElement(Avatar, { src: study ? study.author.picture_url : '', size: 24, color: hover.author ? '#40a9ff' : undefined })),
|
|
48668
|
-
React__default["default"].createElement("a", { className: 'link', href: study ? "/".concat(study.author.name) : '', target: '_blank', rel: 'noreferrer', onMouseOver: function (e) { return toggleHover('author', true); }, onMouseLeave: function (e) { return toggleHover('author', false); }, style: hover.author ? { color: '#40a9ff' } : {} }, study ? ((
|
|
48707
|
+
React__default["default"].createElement("a", { className: 'link', href: study ? "/".concat(study.author.name) : '', target: '_blank', rel: 'noreferrer', onMouseOver: function (e) { return toggleHover('author', true); }, onMouseLeave: function (e) { return toggleHover('author', false); }, style: hover.author ? { color: '#40a9ff' } : {} }, study ? ((_f = study.author.display_name) !== null && _f !== void 0 ? _f : study.author.name) : '--')),
|
|
48669
48708
|
React__default["default"].createElement("div", { className: 'item6' },
|
|
48670
48709
|
React__default["default"].createElement("span", { style: { marginRight: '0.75rem' } },
|
|
48671
48710
|
React__default["default"].createElement(Avatar, { src: study ? study.recipe.metadata.icon : '', size: 24, color: hover.recipe ? '#40a9ff' : undefined })),
|