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
@@ -1,6 +1,13 @@
|
|
1
1
|
import { PanelMessageOut } from './types';
|
2
|
-
import { Job, Run } from '@pollination-solutions/pollination-sdk';
|
2
|
+
import { Job, Run, RunStatusEnum } from '@pollination-solutions/pollination-sdk';
|
3
3
|
import { ProjectJobInfo } from './useCreateStudy';
|
4
|
+
export declare enum TargetPlaform {
|
5
|
+
all = "all",
|
6
|
+
rhino = "rhino",
|
7
|
+
revit = "revit",
|
8
|
+
grasshopper = "grasshopper",
|
9
|
+
sketchup = "sketchup"
|
10
|
+
}
|
4
11
|
export declare const usePollinationPanel: () => {
|
5
12
|
getFileBase64: (key?: any, accept?: any) => PanelMessageOut;
|
6
13
|
saveFileBase64: (key: string, file: File | Blob, subFolder: string, fileName: string) => Promise<PanelMessageOut>;
|
@@ -10,7 +17,7 @@ export declare const usePollinationPanel: () => {
|
|
10
17
|
fetchLocalJob: (path?: any, subfolder?: any) => Job;
|
11
18
|
fetchLocalLog: (path?: any, subfolder?: any) => any;
|
12
19
|
fileExplorer: (root: string) => PanelMessageOut;
|
13
|
-
getPaginatedJob: (projectSlug: string, pageSize: number, curPage: number) => ProjectJobInfo[];
|
20
|
+
getPaginatedJob: (projectSlug: string, pageSize: number, curPage: number, status?: RunStatusEnum, platform?: TargetPlaform) => ProjectJobInfo[];
|
14
21
|
getJob: (projectSlug: string) => ProjectJobInfo[];
|
15
22
|
deleteJob: (projectSlug: string, path: string, subfolder: string) => any;
|
16
23
|
getPlatforms: (projectSlug: string) => {};
|
package/build/index.esm.js
CHANGED
@@ -37994,6 +37994,14 @@ function formatBytes(bytes, decimals) {
|
|
37994
37994
|
return "".concat(parseFloat((bytes / Math.pow(k, i)).toFixed(dm)), " ").concat(sizes[i]);
|
37995
37995
|
}
|
37996
37996
|
|
37997
|
+
var TargetPlaform;
|
37998
|
+
(function (TargetPlaform) {
|
37999
|
+
TargetPlaform["all"] = "all";
|
38000
|
+
TargetPlaform["rhino"] = "rhino";
|
38001
|
+
TargetPlaform["revit"] = "revit";
|
38002
|
+
TargetPlaform["grasshopper"] = "grasshopper";
|
38003
|
+
TargetPlaform["sketchup"] = "sketchup";
|
38004
|
+
})(TargetPlaform || (TargetPlaform = {}));
|
37997
38005
|
var SimulationFileType;
|
37998
38006
|
(function (SimulationFileType) {
|
37999
38007
|
SimulationFileType[SimulationFileType["status"] = 0] = "status";
|
@@ -38145,11 +38153,13 @@ var usePollinationPanel = function () {
|
|
38145
38153
|
* @param curPage Current page
|
38146
38154
|
* @returns Array of ProjectJobInfo
|
38147
38155
|
*/
|
38148
|
-
var getPaginatedJob = function (projectSlug, pageSize, curPage) {
|
38156
|
+
var getPaginatedJob = function (projectSlug, pageSize, curPage, status, platform) {
|
38157
|
+
if (status === void 0) { status = undefined; }
|
38158
|
+
if (platform === void 0) { platform = TargetPlaform.all; }
|
38149
38159
|
if (!panel)
|
38150
38160
|
return;
|
38151
38161
|
try {
|
38152
|
-
var message = panel.GetPaginatedJob(projectSlug, pageSize, curPage);
|
38162
|
+
var message = panel.GetPaginatedJob(projectSlug, pageSize, curPage, status, platform);
|
38153
38163
|
var arr = JSON.parse(message.data);
|
38154
38164
|
return arr;
|
38155
38165
|
}
|
@@ -48743,22 +48753,22 @@ var formatDuration$1 = function (duration) {
|
|
48743
48753
|
};
|
48744
48754
|
var StudyCard = function (_a) {
|
48745
48755
|
var _b;
|
48746
|
-
var _c, _d, _e, _f, _g, _h;
|
48747
|
-
var projectName = _a.projectName, projectOwner = _a.projectOwner, _study = _a.study, style = _a.style, authUser = _a.authUser, client = _a.client, enableClick = _a.enableClick,
|
48756
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
48757
|
+
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;
|
48748
48758
|
/**
|
48749
48759
|
* Fetch hooks
|
48750
48760
|
*/
|
48751
|
-
var
|
48761
|
+
var _t = useJobs(client), fetchJob = _t.fetchJob, getDuration = _t.getDuration, statusMap = _t.statusMap, deleteJob = _t.deleteJob, cancelJob = _t.cancelJob;
|
48752
48762
|
var listRuns = useRuns(client).listRuns;
|
48753
|
-
var
|
48754
|
-
var
|
48755
|
-
var
|
48756
|
-
var
|
48757
|
-
var
|
48763
|
+
var _u = useWindowDimensions(), width = _u.width; _u.height;
|
48764
|
+
var _v = useState(false), seeDescription = _v[0], setSeeDescription = _v[1];
|
48765
|
+
var _w = useState(false), seeAction = _w[0], setSeeAction = _w[1];
|
48766
|
+
var _x = useState(false), stopRefresh = _x[0], setStopRefresh = _x[1];
|
48767
|
+
var _y = useState(false), isReady = _y[0], setIsReady = _y[1];
|
48758
48768
|
/**
|
48759
48769
|
* From job to run
|
48760
48770
|
*/
|
48761
|
-
var
|
48771
|
+
var _z = useSWR(authUser && _study ? [projectOwner, projectName, _study.id] : undefined, fetchJob, {
|
48762
48772
|
revalidateOnFocus: false,
|
48763
48773
|
refreshInterval: stopRefresh ? undefined : interval,
|
48764
48774
|
fallbackData: _study,
|
@@ -48791,7 +48801,7 @@ var StudyCard = function (_a) {
|
|
48791
48801
|
if (study.status.finished_at)
|
48792
48802
|
setStopRefresh(true);
|
48793
48803
|
}
|
48794
|
-
}), study =
|
48804
|
+
}), study = _z.data; _z.error; _z.isValidating;
|
48795
48805
|
var sendJob = useCallback(function (job) { return getValue(job); }, [study]);
|
48796
48806
|
var total = useMemo(function () {
|
48797
48807
|
if (!study)
|
@@ -48815,8 +48825,8 @@ var StudyCard = function (_a) {
|
|
48815
48825
|
}
|
48816
48826
|
return study.status.status.toLocaleLowerCase();
|
48817
48827
|
}, [study]);
|
48818
|
-
var
|
48819
|
-
var
|
48828
|
+
var _0 = useState(), run = _0[0], setRun = _0[1];
|
48829
|
+
var _1 = useState(getDuration(study)), duration = _1[0], setDuration = _1[1];
|
48820
48830
|
useEffect(function () {
|
48821
48831
|
setRun(undefined);
|
48822
48832
|
if (!study)
|
@@ -48847,7 +48857,7 @@ var StudyCard = function (_a) {
|
|
48847
48857
|
info: false,
|
48848
48858
|
settings: false
|
48849
48859
|
};
|
48850
|
-
var
|
48860
|
+
var _2 = useState(__assign(__assign({}, initialValues), (_b = {}, _b[defaultTab] = true, _b))), hover = _2[0], setHover = _2[1];
|
48851
48861
|
var toggleHover = useCallback(function (id, value) {
|
48852
48862
|
if (value === void 0) { value = false; }
|
48853
48863
|
setHover(function (prevHover) {
|
@@ -48982,11 +48992,11 @@ var StudyCard = function (_a) {
|
|
48982
48992
|
React__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') : '--'),
|
48983
48993
|
React__default.createElement("div", { className: 'item5' },
|
48984
48994
|
React__default.createElement("span", { style: { marginRight: '0.75rem' } },
|
48985
|
-
React__default.createElement(Avatar, { src: study ? study.author.picture_url : '', size: 24, color: hover.author ? '#40a9ff' : undefined })),
|
48986
|
-
React__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 ? ((
|
48995
|
+
React__default.createElement(Avatar, { src: study ? (_h = study.author) === null || _h === void 0 ? void 0 : _h.picture_url : '', size: 24, color: hover.author ? '#40a9ff' : undefined })),
|
48996
|
+
React__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) : '--')),
|
48987
48997
|
React__default.createElement("div", { className: 'item6' },
|
48988
48998
|
React__default.createElement("span", { style: { marginRight: '0.75rem' } },
|
48989
|
-
React__default.createElement(Avatar, { src: study ? study.recipe.metadata.icon : '', size: 24, color: hover.recipe ? '#40a9ff' : undefined })),
|
48999
|
+
React__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 })),
|
48990
49000
|
React__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 : '--'),
|
48991
49001
|
study && React__default.createElement("span", { className: 'light-text' },
|
48992
49002
|
" ",
|
@@ -49047,9 +49057,9 @@ var formatDuration = function (duration) {
|
|
49047
49057
|
};
|
49048
49058
|
var RunCard = function (_a) {
|
49049
49059
|
var _b;
|
49050
|
-
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
49051
|
-
var projectName = _a.projectName, projectOwner = _a.projectOwner, _run = _a.run, authUser = _a.authUser, client = _a.client,
|
49052
|
-
var
|
49060
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
49061
|
+
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;
|
49062
|
+
var _2 = usePollinationPanel(), fetchLocalRun = _2.fetchLocalRun, fetchLocalJob = _2.fetchLocalJob, fileExplorer = _2.fileExplorer, deleteJob = _2.deleteJob;
|
49053
49063
|
var disabled = useMemo(function () {
|
49054
49064
|
if (!localRun)
|
49055
49065
|
return;
|
@@ -49059,16 +49069,16 @@ var RunCard = function (_a) {
|
|
49059
49069
|
* Fetch run
|
49060
49070
|
*/
|
49061
49071
|
var fetchJob = useJobs(client).fetchJob;
|
49062
|
-
var
|
49063
|
-
var
|
49064
|
-
var
|
49065
|
-
var
|
49066
|
-
var
|
49067
|
-
var
|
49072
|
+
var _3 = useRuns(client), fetchRun = _3.fetchRun, statusMap = _3.statusMap, getDuration = _3.getDuration, cancelRun = _3.cancelRun;
|
49073
|
+
var _4 = useWindowDimensions(), width = _4.width; _4.height;
|
49074
|
+
var _5 = useState(false), seeDescription = _5[0], setSeeDescription = _5[1];
|
49075
|
+
var _6 = useState(false), seeAction = _6[0], setSeeAction = _6[1];
|
49076
|
+
var _7 = useState(false), stopRefresh = _7[0], setStopRefresh = _7[1];
|
49077
|
+
var _8 = useState(false), isReady = _8[0], setIsReady = _8[1];
|
49068
49078
|
/*
|
49069
49079
|
* From run and stop when it is done
|
49070
49080
|
*/
|
49071
|
-
var
|
49081
|
+
var _9 = useSWR(authUser && _run ? (!localRun ? [projectOwner, projectName, _run.id] : [_run.id, _run['subfolder']]) : undefined, localRun ? fetchLocalRun : fetchRun, {
|
49072
49082
|
revalidateOnFocus: false,
|
49073
49083
|
refreshInterval: stopRefresh ? undefined : interval,
|
49074
49084
|
fallbackData: localRun ? undefined : _run,
|
@@ -49083,7 +49093,7 @@ var RunCard = function (_a) {
|
|
49083
49093
|
setStopRefresh(true);
|
49084
49094
|
setIsReady(true);
|
49085
49095
|
},
|
49086
|
-
}), run =
|
49096
|
+
}), run = _9.data, error = _9.error;
|
49087
49097
|
var sendRun = useCallback(function (run) { return getValue(run); }, [run]);
|
49088
49098
|
/**
|
49089
49099
|
* Fetch job just one time
|
@@ -49107,9 +49117,9 @@ var RunCard = function (_a) {
|
|
49107
49117
|
return undefined;
|
49108
49118
|
return run.status.status;
|
49109
49119
|
}, [run]);
|
49110
|
-
var
|
49111
|
-
var
|
49112
|
-
var
|
49120
|
+
var _10 = useState(), study = _10[0], setStudy = _10[1];
|
49121
|
+
var _11 = useState(), localStudy = _11[0], setLocalStudy = _11[1];
|
49122
|
+
var _12 = useState(getDuration(run)), duration = _12[0], setDuration = _12[1];
|
49113
49123
|
useEffect(function () {
|
49114
49124
|
if (!run)
|
49115
49125
|
return undefined;
|
@@ -49140,7 +49150,7 @@ var RunCard = function (_a) {
|
|
49140
49150
|
info: false,
|
49141
49151
|
settings: false,
|
49142
49152
|
};
|
49143
|
-
var
|
49153
|
+
var _13 = useState(__assign(__assign({}, initialValues), (_b = {}, _b[defaultTab] = true, _b))), hover = _13[0], setHover = _13[1];
|
49144
49154
|
var toggleHover = useCallback(function (id, value) {
|
49145
49155
|
if (value === void 0) { value = false; }
|
49146
49156
|
setHover(function (prevHover) {
|
@@ -49329,7 +49339,7 @@ var RunCard = function (_a) {
|
|
49329
49339
|
localRun && localStudy && ((_q = (_p = localStudy.author) === null || _p === void 0 ? void 0 : _p.display_name) !== null && _q !== void 0 ? _q : run.author.display_name))),
|
49330
49340
|
React__default.createElement("div", { className: 'item6' },
|
49331
49341
|
React__default.createElement("span", { style: { marginRight: '0.75rem' } },
|
49332
|
-
React__default.createElement(Avatar, { color: hover.recipe ? '#40a9ff' : undefined, src: run ? run.recipe.metadata.icon : '', size: 24 })),
|
49342
|
+
React__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 })),
|
49333
49343
|
React__default.createElement("a", { className: 'link', onClick: function (e) {
|
49334
49344
|
e.stopPropagation();
|
49335
49345
|
if (!localRun) {
|
@@ -50864,5 +50874,5 @@ var RunTable = function (_a) {
|
|
50864
50874
|
React__default.createElement(ChevronRight$1, null)))))));
|
50865
50875
|
};
|
50866
50876
|
|
50867
|
-
export { APIClient, AuthUser, Avatar, Button, ComboBox, ComboFileSelector, ConditionalWrapper, ConfigureLocalRun, CreateStudy, Dropdown, FileInput, FilePreview, FormInput, GetGeometry, GetModel, InputDescription, Label, Logo, NumberInput, RadioList, RecipeForm, RunCard, RunDetails, RunRow, RunTable, SelectAccount, SelectCloudArtifacts, SelectLocalArtifacts, SelectProject, SelectRecipe, SelectRun, SelectStudy, SendGeometry, SendModel, SendResults, SettingsButton, StudyCard, TextInput, Tooltip, _defaultConfig, checkDotNet, checkPollinationPanel, checkRuby, formatBytes, getHost, recipeLinkFromSource, sendMessageDotNet, sendMessageRuby, useAPIClient, useArtifacts, useCreateStudy, useGetGeometry, useGetHbjson, useHbjsontoVTK, useJobs, useManageSettings, usePollinationPanel, useRunCommand, useRuns, useSendHbjson, useSendMessage, useWindowDimensions };
|
50877
|
+
export { APIClient, AuthUser, Avatar, Button, ComboBox, ComboFileSelector, ConditionalWrapper, ConfigureLocalRun, CreateStudy, Dropdown, FileInput, FilePreview, FormInput, GetGeometry, GetModel, InputDescription, Label, Logo, NumberInput, RadioList, RecipeForm, RunCard, RunDetails, RunRow, RunTable, SelectAccount, SelectCloudArtifacts, SelectLocalArtifacts, SelectProject, SelectRecipe, SelectRun, SelectStudy, SendGeometry, SendModel, SendResults, SettingsButton, StudyCard, TargetPlaform, TextInput, Tooltip, _defaultConfig, checkDotNet, checkPollinationPanel, checkRuby, formatBytes, getHost, recipeLinkFromSource, sendMessageDotNet, sendMessageRuby, useAPIClient, useArtifacts, useCreateStudy, useGetGeometry, useGetHbjson, useHbjsontoVTK, useJobs, useManageSettings, usePollinationPanel, useRunCommand, useRuns, useSendHbjson, useSendMessage, useWindowDimensions };
|
50868
50878
|
//# sourceMappingURL=index.esm.js.map
|