pollination-react-io 1.50.2 → 1.51.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 +8 -2
- package/build/index.esm.js +26 -35
- package/build/index.esm.js.map +1 -1
- package/build/index.js +26 -35
- package/build/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import { CloudJob, UserPrivate } from '@pollination-solutions/pollination-sdk';
|
|
1
|
+
import { CloudJob, RunList, RunStatusEnum, UserPrivate } from '@pollination-solutions/pollination-sdk';
|
|
2
2
|
import { CSSProperties } from 'react';
|
|
3
3
|
import { APIClient } from '../hooks';
|
|
4
4
|
export declare enum JobTabs {
|
|
5
5
|
details = "details",
|
|
6
6
|
workspace = "workspace"
|
|
7
7
|
}
|
|
8
|
+
export interface RunListParams {
|
|
9
|
+
page: number;
|
|
10
|
+
pageSize: number;
|
|
11
|
+
filter: RunStatusEnum;
|
|
12
|
+
}
|
|
8
13
|
export interface StudyCardProps {
|
|
9
14
|
projectOwner: string;
|
|
10
15
|
projectName: string;
|
|
@@ -18,5 +23,6 @@ export interface StudyCardProps {
|
|
|
18
23
|
enableLink?: boolean;
|
|
19
24
|
canWrite?: boolean;
|
|
20
25
|
interval?: number;
|
|
21
|
-
getValue?: (
|
|
26
|
+
getValue?: (runList: RunList) => any;
|
|
27
|
+
runListParams?: RunListParams;
|
|
22
28
|
}
|
package/build/index.esm.js
CHANGED
|
@@ -48538,21 +48538,21 @@ var formatDuration$1 = function (duration) {
|
|
|
48538
48538
|
var StudyCard = function (_a) {
|
|
48539
48539
|
var _b;
|
|
48540
48540
|
var _c, _d, _e, _f, _g, _h;
|
|
48541
|
-
var projectName = _a.projectName, projectOwner = _a.projectOwner, _study = _a.study, style = _a.style, authUser = _a.authUser, client = _a.client, enableClick = _a.enableClick, _j = _a.getTab, getTab = _j === void 0 ? function (tab) { } : _j, _k = _a.defaultTab, defaultTab = _k === void 0 ? '' : _k, _l = _a.enableLink, enableLink = _l === void 0 ? false : _l, _m = _a.canWrite, canWrite = _m === void 0 ? false : _m, _o = _a.getValue, getValue = _o === void 0 ? function (
|
|
48541
|
+
var projectName = _a.projectName, projectOwner = _a.projectOwner, _study = _a.study, style = _a.style, authUser = _a.authUser, client = _a.client, enableClick = _a.enableClick, _j = _a.getTab, getTab = _j === void 0 ? function (tab) { } : _j, _k = _a.defaultTab, defaultTab = _k === void 0 ? '' : _k, _l = _a.enableLink, enableLink = _l === void 0 ? false : _l, _m = _a.canWrite, canWrite = _m === void 0 ? false : _m, _o = _a.getValue, getValue = _o === void 0 ? function (runList) { } : _o, _p = _a.interval, interval = _p === void 0 ? 5000 : _p, _q = _a.runListParams, runListParams = _q === void 0 ? { page: 1, pageSize: 1, filter: undefined } : _q;
|
|
48542
48542
|
/**
|
|
48543
48543
|
* Fetch hooks
|
|
48544
48544
|
*/
|
|
48545
|
-
var
|
|
48545
|
+
var _r = useJobs(client), fetchJob = _r.fetchJob, getDuration = _r.getDuration, statusMap = _r.statusMap, deleteJob = _r.deleteJob, cancelJob = _r.cancelJob;
|
|
48546
48546
|
var listRuns = useRuns(client).listRuns;
|
|
48547
|
-
var
|
|
48548
|
-
var
|
|
48549
|
-
var
|
|
48550
|
-
var
|
|
48551
|
-
var
|
|
48547
|
+
var _s = useWindowDimensions(), width = _s.width; _s.height;
|
|
48548
|
+
var _t = useState(false), seeDescription = _t[0], setSeeDescription = _t[1];
|
|
48549
|
+
var _u = useState(false), seeAction = _u[0], setSeeAction = _u[1];
|
|
48550
|
+
var _v = useState(false), stopRefresh = _v[0], setStopRefresh = _v[1];
|
|
48551
|
+
var _w = useState(false), isReady = _w[0], setIsReady = _w[1];
|
|
48552
48552
|
/**
|
|
48553
48553
|
* From job to run
|
|
48554
48554
|
*/
|
|
48555
|
-
var
|
|
48555
|
+
var _x = useSWR(authUser && _study ? [projectOwner, projectName, _study.id] : undefined, fetchJob, {
|
|
48556
48556
|
revalidateOnFocus: false,
|
|
48557
48557
|
refreshInterval: stopRefresh ? undefined : interval,
|
|
48558
48558
|
fallbackData: _study,
|
|
@@ -48560,33 +48560,24 @@ var StudyCard = function (_a) {
|
|
|
48560
48560
|
onSuccess: function (study, key, config) {
|
|
48561
48561
|
if (!study)
|
|
48562
48562
|
return;
|
|
48563
|
-
var
|
|
48564
|
-
|
|
48565
|
-
|
|
48566
|
-
|
|
48567
|
-
|
|
48568
|
-
|
|
48569
|
-
|
|
48570
|
-
|
|
48571
|
-
|
|
48572
|
-
|
|
48573
|
-
|
|
48574
|
-
})
|
|
48575
|
-
|
|
48576
|
-
.finally(function () {
|
|
48577
|
-
sendJob(study);
|
|
48578
|
-
setIsReady(true);
|
|
48579
|
-
});
|
|
48580
|
-
}
|
|
48581
|
-
else {
|
|
48582
|
-
sendJob(study);
|
|
48583
|
-
setIsReady(true);
|
|
48584
|
-
}
|
|
48563
|
+
var page = runListParams.page, pageSize = runListParams.pageSize, filter = runListParams.filter;
|
|
48564
|
+
listRuns(projectOwner, projectName, [study.id], page, pageSize, filter)
|
|
48565
|
+
.then(function (d) {
|
|
48566
|
+
if (d.resources.length === 1) {
|
|
48567
|
+
setRun(d.resources[0]);
|
|
48568
|
+
sendRunList(d);
|
|
48569
|
+
}
|
|
48570
|
+
else {
|
|
48571
|
+
sendRunList(d);
|
|
48572
|
+
}
|
|
48573
|
+
})
|
|
48574
|
+
.catch(function () { return setRun(undefined); })
|
|
48575
|
+
.finally(function () { return setIsReady(true); });
|
|
48585
48576
|
if (study.status.finished_at)
|
|
48586
48577
|
setStopRefresh(true);
|
|
48587
48578
|
}
|
|
48588
|
-
}), study =
|
|
48589
|
-
var
|
|
48579
|
+
}), study = _x.data; _x.error; _x.isValidating;
|
|
48580
|
+
var sendRunList = useCallback(function (runList) { return getValue(runList); }, [study]);
|
|
48590
48581
|
var total = useMemo(function () {
|
|
48591
48582
|
if (!study)
|
|
48592
48583
|
return undefined;
|
|
@@ -48609,8 +48600,8 @@ var StudyCard = function (_a) {
|
|
|
48609
48600
|
}
|
|
48610
48601
|
return study.status.status.toLocaleLowerCase();
|
|
48611
48602
|
}, [study]);
|
|
48612
|
-
var
|
|
48613
|
-
var
|
|
48603
|
+
var _y = useState(), run = _y[0], setRun = _y[1];
|
|
48604
|
+
var _z = useState(getDuration(study)), duration = _z[0], setDuration = _z[1];
|
|
48614
48605
|
useEffect(function () {
|
|
48615
48606
|
setRun(undefined);
|
|
48616
48607
|
if (!study)
|
|
@@ -48641,7 +48632,7 @@ var StudyCard = function (_a) {
|
|
|
48641
48632
|
info: false,
|
|
48642
48633
|
settings: false
|
|
48643
48634
|
};
|
|
48644
|
-
var
|
|
48635
|
+
var _0 = useState(__assign(__assign({}, initialValues), (_b = {}, _b[defaultTab] = true, _b))), hover = _0[0], setHover = _0[1];
|
|
48645
48636
|
var toggleHover = useCallback(function (id, value) {
|
|
48646
48637
|
if (value === void 0) { value = false; }
|
|
48647
48638
|
setHover(function (prevHover) {
|