pollination-react-io 1.70.2 → 1.71.1
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/hooks/usePollinationPanel.d.ts +9 -2
- package/build/index.esm.js +45 -35
- package/build/index.esm.js.map +1 -1
- package/build/index.js +44 -34
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.js
CHANGED
@@ -38020,6 +38020,14 @@ function formatBytes(bytes, decimals) {
|
|
38020
38020
|
return "".concat(parseFloat((bytes / Math.pow(k, i)).toFixed(dm)), " ").concat(sizes[i]);
|
38021
38021
|
}
|
38022
38022
|
|
38023
|
+
exports.TargetPlaform = void 0;
|
38024
|
+
(function (TargetPlaform) {
|
38025
|
+
TargetPlaform["all"] = "all";
|
38026
|
+
TargetPlaform["rhino"] = "rhino";
|
38027
|
+
TargetPlaform["revit"] = "revit";
|
38028
|
+
TargetPlaform["grasshopper"] = "grasshopper";
|
38029
|
+
TargetPlaform["sketchup"] = "sketchup";
|
38030
|
+
})(exports.TargetPlaform || (exports.TargetPlaform = {}));
|
38023
38031
|
var SimulationFileType;
|
38024
38032
|
(function (SimulationFileType) {
|
38025
38033
|
SimulationFileType[SimulationFileType["status"] = 0] = "status";
|
@@ -38171,11 +38179,13 @@ var usePollinationPanel = function () {
|
|
38171
38179
|
* @param curPage Current page
|
38172
38180
|
* @returns Array of ProjectJobInfo
|
38173
38181
|
*/
|
38174
|
-
var getPaginatedJob = function (projectSlug, pageSize, curPage) {
|
38182
|
+
var getPaginatedJob = function (projectSlug, pageSize, curPage, status, platform) {
|
38183
|
+
if (status === void 0) { status = undefined; }
|
38184
|
+
if (platform === void 0) { platform = exports.TargetPlaform.all; }
|
38175
38185
|
if (!panel)
|
38176
38186
|
return;
|
38177
38187
|
try {
|
38178
|
-
var message = panel.GetPaginatedJob(projectSlug, pageSize, curPage);
|
38188
|
+
var message = panel.GetPaginatedJob(projectSlug, pageSize, curPage, status, platform);
|
38179
38189
|
var arr = JSON.parse(message.data);
|
38180
38190
|
return arr;
|
38181
38191
|
}
|
@@ -48769,22 +48779,22 @@ var formatDuration$1 = function (duration) {
|
|
48769
48779
|
};
|
48770
48780
|
var StudyCard = function (_a) {
|
48771
48781
|
var _b;
|
48772
|
-
var _c, _d, _e, _f, _g, _h;
|
48773
|
-
var projectName = _a.projectName, projectOwner = _a.projectOwner, _study = _a.study, style = _a.style, authUser = _a.authUser, client = _a.client, enableClick = _a.enableClick,
|
48782
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
48783
|
+
var projectName = _a.projectName, projectOwner = _a.projectOwner, _study = _a.study, style = _a.style, authUser = _a.authUser, client = _a.client, enableClick = _a.enableClick, _m = _a.getTab, getTab = _m === void 0 ? function (tab) { } : _m, _o = _a.defaultTab, defaultTab = _o === void 0 ? '' : _o, _p = _a.enableLink, enableLink = _p === void 0 ? false : _p, _q = _a.canWrite, canWrite = _q === void 0 ? false : _q, _r = _a.getValue, getValue = _r === void 0 ? function (job) { } : _r, _s = _a.interval, interval = _s === void 0 ? 5000 : _s;
|
48774
48784
|
/**
|
48775
48785
|
* Fetch hooks
|
48776
48786
|
*/
|
48777
|
-
var
|
48787
|
+
var _t = useJobs(client), fetchJob = _t.fetchJob, getDuration = _t.getDuration, statusMap = _t.statusMap, deleteJob = _t.deleteJob, cancelJob = _t.cancelJob;
|
48778
48788
|
var listRuns = useRuns(client).listRuns;
|
48779
|
-
var
|
48780
|
-
var
|
48781
|
-
var
|
48782
|
-
var
|
48783
|
-
var
|
48789
|
+
var _u = useWindowDimensions(), width = _u.width; _u.height;
|
48790
|
+
var _v = React.useState(false), seeDescription = _v[0], setSeeDescription = _v[1];
|
48791
|
+
var _w = React.useState(false), seeAction = _w[0], setSeeAction = _w[1];
|
48792
|
+
var _x = React.useState(false), stopRefresh = _x[0], setStopRefresh = _x[1];
|
48793
|
+
var _y = React.useState(false), isReady = _y[0], setIsReady = _y[1];
|
48784
48794
|
/**
|
48785
48795
|
* From job to run
|
48786
48796
|
*/
|
48787
|
-
var
|
48797
|
+
var _z = useSWR(authUser && _study ? [projectOwner, projectName, _study.id] : undefined, fetchJob, {
|
48788
48798
|
revalidateOnFocus: false,
|
48789
48799
|
refreshInterval: stopRefresh ? undefined : interval,
|
48790
48800
|
fallbackData: _study,
|
@@ -48817,7 +48827,7 @@ var StudyCard = function (_a) {
|
|
48817
48827
|
if (study.status.finished_at)
|
48818
48828
|
setStopRefresh(true);
|
48819
48829
|
}
|
48820
|
-
}), study =
|
48830
|
+
}), study = _z.data; _z.error; _z.isValidating;
|
48821
48831
|
var sendJob = React.useCallback(function (job) { return getValue(job); }, [study]);
|
48822
48832
|
var total = React.useMemo(function () {
|
48823
48833
|
if (!study)
|
@@ -48841,8 +48851,8 @@ var StudyCard = function (_a) {
|
|
48841
48851
|
}
|
48842
48852
|
return study.status.status.toLocaleLowerCase();
|
48843
48853
|
}, [study]);
|
48844
|
-
var
|
48845
|
-
var
|
48854
|
+
var _0 = React.useState(), run = _0[0], setRun = _0[1];
|
48855
|
+
var _1 = React.useState(getDuration(study)), duration = _1[0], setDuration = _1[1];
|
48846
48856
|
React.useEffect(function () {
|
48847
48857
|
setRun(undefined);
|
48848
48858
|
if (!study)
|
@@ -48873,7 +48883,7 @@ var StudyCard = function (_a) {
|
|
48873
48883
|
info: false,
|
48874
48884
|
settings: false
|
48875
48885
|
};
|
48876
|
-
var
|
48886
|
+
var _2 = React.useState(__assign(__assign({}, initialValues), (_b = {}, _b[defaultTab] = true, _b))), hover = _2[0], setHover = _2[1];
|
48877
48887
|
var toggleHover = React.useCallback(function (id, value) {
|
48878
48888
|
if (value === void 0) { value = false; }
|
48879
48889
|
setHover(function (prevHover) {
|
@@ -49008,11 +49018,11 @@ var StudyCard = function (_a) {
|
|
49008
49018
|
React__default["default"].createElement("div", { className: 'item4', title: study && dayjs_min(study.status.started_at).format('[on] MMM DD YYYY [at] hh:mm') }, study ? dayjs_min(study.status.started_at).format('[on] MMM DD YYYY') : '--'),
|
49009
49019
|
React__default["default"].createElement("div", { className: 'item5' },
|
49010
49020
|
React__default["default"].createElement("span", { style: { marginRight: '0.75rem' } },
|
49011
|
-
React__default["default"].createElement(Avatar, { src: study ? study.author.picture_url : '', size: 24, color: hover.author ? '#40a9ff' : undefined })),
|
49012
|
-
React__default["default"].createElement("a", { className: 'link', href: study ? "/".concat(study.author.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 ? ((
|
49021
|
+
React__default["default"].createElement(Avatar, { src: study ? (_h = study.author) === null || _h === void 0 ? void 0 : _h.picture_url : '', size: 24, color: hover.author ? '#40a9ff' : undefined })),
|
49022
|
+
React__default["default"].createElement("a", { className: 'link', href: study ? "/".concat(study.author.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 ? ((_j = study.author.display_name) !== null && _j !== void 0 ? _j : study.author.name) : '--')),
|
49013
49023
|
React__default["default"].createElement("div", { className: 'item6' },
|
49014
49024
|
React__default["default"].createElement("span", { style: { marginRight: '0.75rem' } },
|
49015
|
-
React__default["default"].createElement(Avatar, { src: study ? study.recipe.metadata.icon : '', size: 24, color: hover.recipe ? '#40a9ff' : undefined })),
|
49025
|
+
React__default["default"].createElement(Avatar, { src: study ? (_l = (_k = study.recipe) === null || _k === void 0 ? void 0 : _k.metadata) === null || _l === void 0 ? void 0 : _l.icon : '', size: 24, color: hover.recipe ? '#40a9ff' : undefined })),
|
49016
49026
|
React__default["default"].createElement("a", { className: 'link', href: study ? recipeLinkFromSource(study.recipe.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 ? study.recipe.metadata.name : '--'),
|
49017
49027
|
study && React__default["default"].createElement("span", { className: 'light-text' },
|
49018
49028
|
" ",
|
@@ -49073,9 +49083,9 @@ var formatDuration = function (duration) {
|
|
49073
49083
|
};
|
49074
49084
|
var RunCard = function (_a) {
|
49075
49085
|
var _b;
|
49076
|
-
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
49077
|
-
var projectName = _a.projectName, projectOwner = _a.projectOwner, _run = _a.run, authUser = _a.authUser, client = _a.client,
|
49078
|
-
var
|
49086
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
49087
|
+
var projectName = _a.projectName, projectOwner = _a.projectOwner, _run = _a.run, authUser = _a.authUser, client = _a.client, _t = _a.enableClick, enableClick = _t === void 0 ? true : _t, _u = _a.style, style = _u === void 0 ? {} : _u, _v = _a.getTab, getTab = _v === void 0 ? function (tab) { return undefined; } : _v, _w = _a.defaultTab, defaultTab = _w === void 0 ? RunTabs.details : _w, _x = _a.getValue, getValue = _x === void 0 ? function (run) { return undefined; } : _x, _y = _a.interval, interval = _y === void 0 ? 5000 : _y, _z = _a.canWrite, canWrite = _z === void 0 ? false : _z, _0 = _a.localRun, localRun = _0 === void 0 ? false : _0, _1 = _a.loaderNode, loaderNode = _1 === void 0 ? undefined : _1;
|
49088
|
+
var _2 = usePollinationPanel(), fetchLocalRun = _2.fetchLocalRun, fetchLocalJob = _2.fetchLocalJob, fileExplorer = _2.fileExplorer, deleteJob = _2.deleteJob;
|
49079
49089
|
var disabled = React.useMemo(function () {
|
49080
49090
|
if (!localRun)
|
49081
49091
|
return;
|
@@ -49085,16 +49095,16 @@ var RunCard = function (_a) {
|
|
49085
49095
|
* Fetch run
|
49086
49096
|
*/
|
49087
49097
|
var fetchJob = useJobs(client).fetchJob;
|
49088
|
-
var
|
49089
|
-
var
|
49090
|
-
var
|
49091
|
-
var
|
49092
|
-
var
|
49093
|
-
var
|
49098
|
+
var _3 = useRuns(client), fetchRun = _3.fetchRun, statusMap = _3.statusMap, getDuration = _3.getDuration, cancelRun = _3.cancelRun;
|
49099
|
+
var _4 = useWindowDimensions(), width = _4.width; _4.height;
|
49100
|
+
var _5 = React.useState(false), seeDescription = _5[0], setSeeDescription = _5[1];
|
49101
|
+
var _6 = React.useState(false), seeAction = _6[0], setSeeAction = _6[1];
|
49102
|
+
var _7 = React.useState(false), stopRefresh = _7[0], setStopRefresh = _7[1];
|
49103
|
+
var _8 = React.useState(false), isReady = _8[0], setIsReady = _8[1];
|
49094
49104
|
/*
|
49095
49105
|
* From run and stop when it is done
|
49096
49106
|
*/
|
49097
|
-
var
|
49107
|
+
var _9 = useSWR(authUser && _run ? (!localRun ? [projectOwner, projectName, _run.id] : [_run.id, _run['subfolder']]) : undefined, localRun ? fetchLocalRun : fetchRun, {
|
49098
49108
|
revalidateOnFocus: false,
|
49099
49109
|
refreshInterval: stopRefresh ? undefined : interval,
|
49100
49110
|
fallbackData: localRun ? undefined : _run,
|
@@ -49109,7 +49119,7 @@ var RunCard = function (_a) {
|
|
49109
49119
|
setStopRefresh(true);
|
49110
49120
|
setIsReady(true);
|
49111
49121
|
},
|
49112
|
-
}), run =
|
49122
|
+
}), run = _9.data, error = _9.error;
|
49113
49123
|
var sendRun = React.useCallback(function (run) { return getValue(run); }, [run]);
|
49114
49124
|
/**
|
49115
49125
|
* Fetch job just one time
|
@@ -49133,9 +49143,9 @@ var RunCard = function (_a) {
|
|
49133
49143
|
return undefined;
|
49134
49144
|
return run.status.status;
|
49135
49145
|
}, [run]);
|
49136
|
-
var
|
49137
|
-
var
|
49138
|
-
var
|
49146
|
+
var _10 = React.useState(), study = _10[0], setStudy = _10[1];
|
49147
|
+
var _11 = React.useState(), localStudy = _11[0], setLocalStudy = _11[1];
|
49148
|
+
var _12 = React.useState(getDuration(run)), duration = _12[0], setDuration = _12[1];
|
49139
49149
|
React.useEffect(function () {
|
49140
49150
|
if (!run)
|
49141
49151
|
return undefined;
|
@@ -49166,7 +49176,7 @@ var RunCard = function (_a) {
|
|
49166
49176
|
info: false,
|
49167
49177
|
settings: false,
|
49168
49178
|
};
|
49169
|
-
var
|
49179
|
+
var _13 = React.useState(__assign(__assign({}, initialValues), (_b = {}, _b[defaultTab] = true, _b))), hover = _13[0], setHover = _13[1];
|
49170
49180
|
var toggleHover = React.useCallback(function (id, value) {
|
49171
49181
|
if (value === void 0) { value = false; }
|
49172
49182
|
setHover(function (prevHover) {
|
@@ -49355,7 +49365,7 @@ var RunCard = function (_a) {
|
|
49355
49365
|
localRun && localStudy && ((_q = (_p = localStudy.author) === null || _p === void 0 ? void 0 : _p.display_name) !== null && _q !== void 0 ? _q : run.author.display_name))),
|
49356
49366
|
React__default["default"].createElement("div", { className: 'item6' },
|
49357
49367
|
React__default["default"].createElement("span", { style: { marginRight: '0.75rem' } },
|
49358
|
-
React__default["default"].createElement(Avatar, { color: hover.recipe ? '#40a9ff' : undefined, src: run ? run.recipe.metadata.icon : '', size: 24 })),
|
49368
|
+
React__default["default"].createElement(Avatar, { color: hover.recipe ? '#40a9ff' : undefined, src: run ? (_s = (_r = run.recipe) === null || _r === void 0 ? void 0 : _r.metadata) === null || _s === void 0 ? void 0 : _s.icon : '', size: 24 })),
|
49359
49369
|
React__default["default"].createElement("a", { className: 'link', onClick: function (e) {
|
49360
49370
|
e.stopPropagation();
|
49361
49371
|
if (!localRun) {
|