pollination-react-io 1.89.0 → 1.90.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/RunDetails/Cards/FileCard.d.ts +2 -0
- package/build/hooks/index.d.ts +1 -0
- package/build/hooks/useVsftoVTK.d.ts +5 -0
- package/build/index.esm.js +121 -20
- package/build/index.esm.js.map +1 -1
- package/build/index.js +121 -19
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.js
CHANGED
@@ -40927,7 +40927,7 @@ var useGetHbjson = function () {
|
|
40927
40927
|
};
|
40928
40928
|
};
|
40929
40929
|
|
40930
|
-
var UTILSENDPOINT$
|
40930
|
+
var UTILSENDPOINT$2 = process.env.REACT_APP_UTILS_ENDPOINT || 'https://utilities.staging.pollination.cloud';
|
40931
40931
|
var useHbjsontoVTK = function () {
|
40932
40932
|
var _a = React.useState(false), loading = _a[0], setLoading = _a[1];
|
40933
40933
|
var _b = React.useState(), vtk = _b[0], setVTK = _b[1];
|
@@ -40936,7 +40936,7 @@ var useHbjsontoVTK = function () {
|
|
40936
40936
|
return undefined;
|
40937
40937
|
setLoading(true);
|
40938
40938
|
return hbjson.text().then(function (fileString) {
|
40939
|
-
fetch("".concat(UTILSENDPOINT$
|
40939
|
+
fetch("".concat(UTILSENDPOINT$2, "/hbjson-to-vtk"), {
|
40940
40940
|
method: 'POST',
|
40941
40941
|
headers: {
|
40942
40942
|
'Content-Type': 'application/json',
|
@@ -40976,6 +40976,53 @@ var useHbjsontoVTK = function () {
|
|
40976
40976
|
};
|
40977
40977
|
};
|
40978
40978
|
|
40979
|
+
var UTILSENDPOINT$1 = process.env.REACT_APP_UTILS_ENDPOINT || 'https://utilities.staging.pollination.cloud';
|
40980
|
+
var useVsftoVTK = function () {
|
40981
|
+
var _a = React.useState(false), loading = _a[0], setLoading = _a[1];
|
40982
|
+
var _b = React.useState(), vtk = _b[0], setVTK = _b[1];
|
40983
|
+
var fetchVTK = function (vsf) {
|
40984
|
+
if (!vsf || vsf.size < 1)
|
40985
|
+
return undefined;
|
40986
|
+
setLoading(true);
|
40987
|
+
return vsf.text().then(function (fileString) {
|
40988
|
+
fetch("".concat(UTILSENDPOINT$1, "/vsf-to-vtk"), {
|
40989
|
+
method: 'POST',
|
40990
|
+
headers: {
|
40991
|
+
'Content-Type': 'application/json',
|
40992
|
+
Accept: '*/*',
|
40993
|
+
},
|
40994
|
+
body: "{\n \"output_format\": \"vtkjs\",\n \"vsf\": ".concat(fileString, "\n }"),
|
40995
|
+
})
|
40996
|
+
.catch(function (e) {
|
40997
|
+
throw new Error(e);
|
40998
|
+
})
|
40999
|
+
.then(function (res) { return __awaiter$1(void 0, void 0, void 0, function () {
|
41000
|
+
var translatedFile;
|
41001
|
+
return __generator$1(this, function (_a) {
|
41002
|
+
switch (_a.label) {
|
41003
|
+
case 0:
|
41004
|
+
if (!res.ok) return [3 /*break*/, 2];
|
41005
|
+
return [4 /*yield*/, res.blob()];
|
41006
|
+
case 1:
|
41007
|
+
translatedFile = _a.sent();
|
41008
|
+
setVTK(translatedFile);
|
41009
|
+
return [2 /*return*/, translatedFile];
|
41010
|
+
case 2: throw new Error('Failed to retrieve .vtkjs from .vsf file.Error translating vsf to vtkjs');
|
41011
|
+
}
|
41012
|
+
});
|
41013
|
+
}); })
|
41014
|
+
.finally(function () {
|
41015
|
+
setLoading(false);
|
41016
|
+
});
|
41017
|
+
});
|
41018
|
+
};
|
41019
|
+
return {
|
41020
|
+
loading: loading,
|
41021
|
+
vtk: vtk,
|
41022
|
+
fetchVTK: fetchVTK,
|
41023
|
+
};
|
41024
|
+
};
|
41025
|
+
|
40979
41026
|
var duration = createCommonjsModule(function (module, exports) {
|
40980
41027
|
!function(t,s){module.exports=s();}(commonjsGlobal,(function(){var t,s,n=1e3,i=6e4,e=36e5,r=864e5,o=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,u=31536e6,h=2592e6,a=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,d={years:u,months:h,days:r,hours:e,minutes:i,seconds:n,milliseconds:1,weeks:6048e5},c=function(t){return t instanceof p},f=function(t,s,n){return new p(t,n,s.$l)},m=function(t){return s.p(t)+"s"},l=function(t){return t<0},$=function(t){return l(t)?Math.ceil(t):Math.floor(t)},y=function(t){return Math.abs(t)},g=function(t,s){return t?l(t)?{negative:!0,format:""+y(t)+s}:{negative:!1,format:""+t+s}:{negative:!1,format:""}},p=function(){function l(t,s,n){var i=this;if(this.$d={},this.$l=n,void 0===t&&(this.$ms=0,this.parseFromMilliseconds()),s)return f(t*d[m(s)],this);if("number"==typeof t)return this.$ms=t,this.parseFromMilliseconds(),this;if("object"==typeof t)return Object.keys(t).forEach((function(s){i.$d[m(s)]=t[s];})),this.calMilliseconds(),this;if("string"==typeof t){var e=t.match(a);if(e){var r=e.slice(2).map((function(t){return null!=t?Number(t):0}));return this.$d.years=r[0],this.$d.months=r[1],this.$d.weeks=r[2],this.$d.days=r[3],this.$d.hours=r[4],this.$d.minutes=r[5],this.$d.seconds=r[6],this.calMilliseconds(),this}}return this}var y=l.prototype;return y.calMilliseconds=function(){var t=this;this.$ms=Object.keys(this.$d).reduce((function(s,n){return s+(t.$d[n]||0)*d[n]}),0);},y.parseFromMilliseconds=function(){var t=this.$ms;this.$d.years=$(t/u),t%=u,this.$d.months=$(t/h),t%=h,this.$d.days=$(t/r),t%=r,this.$d.hours=$(t/e),t%=e,this.$d.minutes=$(t/i),t%=i,this.$d.seconds=$(t/n),t%=n,this.$d.milliseconds=t;},y.toISOString=function(){var t=g(this.$d.years,"Y"),s=g(this.$d.months,"M"),n=+this.$d.days||0;this.$d.weeks&&(n+=7*this.$d.weeks);var i=g(n,"D"),e=g(this.$d.hours,"H"),r=g(this.$d.minutes,"M"),o=this.$d.seconds||0;this.$d.milliseconds&&(o+=this.$d.milliseconds/1e3);var u=g(o,"S"),h=t.negative||s.negative||i.negative||e.negative||r.negative||u.negative,a=e.format||r.format||u.format?"T":"",d=(h?"-":"")+"P"+t.format+s.format+i.format+a+e.format+r.format+u.format;return "P"===d||"-P"===d?"P0D":d},y.toJSON=function(){return this.toISOString()},y.format=function(t){var n=t||"YYYY-MM-DDTHH:mm:ss",i={Y:this.$d.years,YY:s.s(this.$d.years,2,"0"),YYYY:s.s(this.$d.years,4,"0"),M:this.$d.months,MM:s.s(this.$d.months,2,"0"),D:this.$d.days,DD:s.s(this.$d.days,2,"0"),H:this.$d.hours,HH:s.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:s.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:s.s(this.$d.seconds,2,"0"),SSS:s.s(this.$d.milliseconds,3,"0")};return n.replace(o,(function(t,s){return s||String(i[t])}))},y.as=function(t){return this.$ms/d[m(t)]},y.get=function(t){var s=this.$ms,n=m(t);return "milliseconds"===n?s%=1e3:s="weeks"===n?$(s/d[n]):this.$d[n],0===s?0:s},y.add=function(t,s,n){var i;return i=s?t*d[m(s)]:c(t)?t.$ms:f(t,this).$ms,f(this.$ms+i*(n?-1:1),this)},y.subtract=function(t,s){return this.add(t,s,!0)},y.locale=function(t){var s=this.clone();return s.$l=t,s},y.clone=function(){return f(this.$ms,this)},y.humanize=function(s){return t().add(this.$ms,"ms").locale(this.$l).fromNow(!s)},y.milliseconds=function(){return this.get("milliseconds")},y.asMilliseconds=function(){return this.as("milliseconds")},y.seconds=function(){return this.get("seconds")},y.asSeconds=function(){return this.as("seconds")},y.minutes=function(){return this.get("minutes")},y.asMinutes=function(){return this.as("minutes")},y.hours=function(){return this.get("hours")},y.asHours=function(){return this.as("hours")},y.days=function(){return this.get("days")},y.asDays=function(){return this.as("days")},y.weeks=function(){return this.get("weeks")},y.asWeeks=function(){return this.as("weeks")},y.months=function(){return this.get("months")},y.asMonths=function(){return this.as("months")},y.years=function(){return this.get("years")},y.asYears=function(){return this.as("years")},l}();return function(n,i,e){t=e,s=e().$utils(),e.duration=function(t,s){var n=e.locale();return f(t,{$l:n},s)},e.isDuration=c;var r=i.prototype.add,o=i.prototype.subtract;i.prototype.add=function(t,s){return c(t)&&(t=t.asMilliseconds()),r.bind(this)(t,s)},i.prototype.subtract=function(t,s){return c(t)&&(t=t.asMilliseconds()),o.bind(this)(t,s)};}}));
|
40981
41028
|
});
|
@@ -47081,9 +47128,11 @@ var RecipeForm = function (_a) {
|
|
47081
47128
|
};
|
47082
47129
|
alias && Object.keys(alias).forEach(function (key) {
|
47083
47130
|
if (key in inputInfo) {
|
47084
|
-
// if the alias is DAGGenericInputAlias
|
47131
|
+
// if the alias is DAGGenericInputAlias
|
47132
|
+
// or DAGLinkedInputAlias use the native input type
|
47085
47133
|
if (key == 'type') {
|
47086
|
-
if (alias[key]
|
47134
|
+
if (alias[key] === 'DAGGenericInputAlias'
|
47135
|
+
|| alias[key] === 'DAGLinkedInputAlias') {
|
47087
47136
|
return;
|
47088
47137
|
}
|
47089
47138
|
}
|
@@ -56838,22 +56887,26 @@ var FileCard = function (_a) {
|
|
56838
56887
|
var host = getHost();
|
56839
56888
|
var fromFileToBase64 = usePollinationPanel().fromFileToBase64;
|
56840
56889
|
var _d = useVSFToHTML(), loading = _d.loading, html = _d.html, fetchHTML = _d.fetchHTML;
|
56890
|
+
// VTKJS Handlers
|
56891
|
+
var _e = useHbjsontoVTK(), loadingHBJSON = _e.loading, vtkHBJSON = _e.vtk, fetchVTKfromHBJSON = _e.fetchVTK;
|
56892
|
+
var _f = useVsftoVTK(), loadingVSF = _f.loading, vtkHBVSF = _f.vtk, fetchVTKfromVSF = _f.fetchVTK;
|
56841
56893
|
var downloadArtifact = useArtifacts(projectOwner, projectName, client).downloadArtifact;
|
56842
|
-
var
|
56894
|
+
var _g = React.useState(false), open = _g[0], setOpen = _g[1];
|
56843
56895
|
// Hover effects
|
56844
|
-
var
|
56845
|
-
var
|
56846
|
-
var
|
56847
|
-
var
|
56848
|
-
var
|
56896
|
+
var _h = React.useState(false), infoOver = _h[0], setInfoOver = _h[1];
|
56897
|
+
var _j = React.useState(false), downloadOver = _j[0], setDownloadOver = _j[1];
|
56898
|
+
var _k = React.useState(false), htmlOver = _k[0], setHtmlOver = _k[1];
|
56899
|
+
var _l = React.useState(true), isLoading = _l[0], setIsLoading = _l[1];
|
56900
|
+
var _m = React.useState(false), isInactive = _m[0], setIsInactive = _m[1];
|
56849
56901
|
// Data to use for CAD injections
|
56850
|
-
var
|
56902
|
+
var _o = React.useState(), CADdata = _o[0], setCADdata = _o[1];
|
56851
56903
|
// File to send to parent
|
56852
|
-
var
|
56904
|
+
var _p = React.useState(), currFile = _p[0], setCurrFile = _p[1];
|
56905
|
+
var _q = React.useState(), currPreview = _q[0], setCurrPreview = _q[1];
|
56853
56906
|
// HTML integration
|
56854
|
-
var
|
56907
|
+
var _r = React.useState(false), hasHtml = _r[0], setHasHtml = _r[1];
|
56855
56908
|
// ZIP integration
|
56856
|
-
var
|
56909
|
+
var _s = React.useState(), innerName = _s[0], setInnerName = _s[1];
|
56857
56910
|
/**
|
56858
56911
|
* Get file name to use
|
56859
56912
|
*/
|
@@ -56862,6 +56915,38 @@ var FileCard = function (_a) {
|
|
56862
56915
|
return;
|
56863
56916
|
return innerName !== null && innerName !== void 0 ? innerName : path.split('/').reverse()[0];
|
56864
56917
|
}, [path, innerName]);
|
56918
|
+
React.useEffect(function () {
|
56919
|
+
if (!vtkHBJSON)
|
56920
|
+
return;
|
56921
|
+
if (filename.endsWith('hbjson')) {
|
56922
|
+
setCurrPreview(vtkHBJSON);
|
56923
|
+
}
|
56924
|
+
}, [vtkHBJSON]);
|
56925
|
+
React.useEffect(function () {
|
56926
|
+
if (!vtkHBVSF)
|
56927
|
+
return;
|
56928
|
+
if (filename.endsWith('vsf')) {
|
56929
|
+
setCurrPreview(vtkHBVSF);
|
56930
|
+
}
|
56931
|
+
}, [vtkHBVSF]);
|
56932
|
+
/**
|
56933
|
+
* Preview name
|
56934
|
+
*/
|
56935
|
+
var previewName = React.useMemo(function () {
|
56936
|
+
if (!currPreview || !filename)
|
56937
|
+
return;
|
56938
|
+
var prevName;
|
56939
|
+
if (filename.endsWith('zip')) {
|
56940
|
+
prevName = filename.replace('.zip', 'vtkjs');
|
56941
|
+
}
|
56942
|
+
else if (filename.endsWith('hbjson')) {
|
56943
|
+
prevName = filename.replace('hbjson', 'vtkjs');
|
56944
|
+
}
|
56945
|
+
else if (filename.endsWith('vsf')) {
|
56946
|
+
prevName = filename.replace('vsf', 'vtkjs');
|
56947
|
+
}
|
56948
|
+
return prevName;
|
56949
|
+
}, [currPreview, filename]);
|
56865
56950
|
/**
|
56866
56951
|
* Get file from a ZIP file.
|
56867
56952
|
* 1 zip = 1 file for now
|
@@ -56889,10 +56974,12 @@ var FileCard = function (_a) {
|
|
56889
56974
|
setInnerName(name);
|
56890
56975
|
var blob = f.slice(0, f.size, 'text/plain');
|
56891
56976
|
setCurrFile(blob);
|
56977
|
+
// Note: inputs are always available
|
56892
56978
|
if (name.endsWith('vsf')) {
|
56893
56979
|
setHasHtml(true);
|
56894
56980
|
fetchHTML(blob);
|
56895
56981
|
setCADintegration(blob, name);
|
56982
|
+
fetchVTKfromVSF(blob);
|
56896
56983
|
}
|
56897
56984
|
});
|
56898
56985
|
});
|
@@ -56946,6 +57033,7 @@ var FileCard = function (_a) {
|
|
56946
57033
|
// Deleted from cloud
|
56947
57034
|
setIsInactive(true);
|
56948
57035
|
setCurrFile(undefined);
|
57036
|
+
setCurrPreview(undefined);
|
56949
57037
|
setCADintegration(undefined);
|
56950
57038
|
setIsLoading(false);
|
56951
57039
|
setHasHtml(false);
|
@@ -56965,10 +57053,12 @@ var FileCard = function (_a) {
|
|
56965
57053
|
setHasHtml(true);
|
56966
57054
|
fetchHTML(blob); // HTML button
|
56967
57055
|
setCADintegration(blob);
|
57056
|
+
fetchVTKfromVSF(blob);
|
56968
57057
|
}
|
56969
57058
|
else if (path === null || path === void 0 ? void 0 : path.endsWith('hbjson')) {
|
56970
57059
|
setHasHtml(false);
|
56971
57060
|
setCADintegration(blob);
|
57061
|
+
fetchVTKfromHBJSON(blob);
|
56972
57062
|
}
|
56973
57063
|
else {
|
56974
57064
|
setHasHtml(false);
|
@@ -57022,7 +57112,13 @@ var FileCard = function (_a) {
|
|
57022
57112
|
// Generate Blob on click
|
57023
57113
|
run && downloadArtifact(path, run.status.job_id)
|
57024
57114
|
.then(function (url) { return fetchAndSet(url); })
|
57025
|
-
.catch(function () { return onClicked({
|
57115
|
+
.catch(function () { return onClicked({
|
57116
|
+
label: label,
|
57117
|
+
path: path,
|
57118
|
+
file: undefined,
|
57119
|
+
description: description,
|
57120
|
+
name: filename
|
57121
|
+
}); });
|
57026
57122
|
}
|
57027
57123
|
else {
|
57028
57124
|
// Some inputs has path == null
|
@@ -57039,14 +57135,19 @@ var FileCard = function (_a) {
|
|
57039
57135
|
}, [run, label, path]);
|
57040
57136
|
return React__default["default"].createElement("div", { className: isInactive
|
57041
57137
|
? 'card-param card-folder-inactive'
|
57042
|
-
:
|
57138
|
+
: (loadingHBJSON || loadingVSF)
|
57139
|
+
? 'card-param'
|
57140
|
+
: 'card-param card-folder', tabIndex: 0, role: (loadingHBJSON || loadingVSF) ? 'none' : 'button', key: label, onClick: function (event) {
|
57043
57141
|
event.stopPropagation();
|
57044
|
-
if (isInactive)
|
57142
|
+
if (isInactive || (loadingHBJSON || loadingVSF))
|
57045
57143
|
return;
|
57046
|
-
onClicked({ label: label, path: path, file: currFile, description: description, name: filename
|
57144
|
+
onClicked({ label: label, path: path, file: currFile, description: description, name: filename,
|
57145
|
+
previewFile: currPreview !== null && currPreview !== void 0 ? currPreview : currFile,
|
57146
|
+
previewName: previewName !== null && previewName !== void 0 ? previewName : filename
|
57147
|
+
});
|
57047
57148
|
} },
|
57048
57149
|
React__default["default"].createElement("div", { className: 'title-param' },
|
57049
|
-
React__default["default"].createElement("div", { style: { float: 'left', margin: '0 8px 0 0' } }, !isLoading ? React__default["default"].createElement("div", { title: !isInactive
|
57150
|
+
React__default["default"].createElement("div", { style: { float: 'left', margin: '0 8px 0 0' } }, (!isLoading) ? React__default["default"].createElement("div", { title: !isInactive
|
57050
57151
|
? 'Open the viewer'
|
57051
57152
|
: 'File is missing. Check run workspace' },
|
57052
57153
|
React__default["default"].createElement("span", { style: { margin: '0 8px 0 0' } }, path && filename && getFileIcon(18, ((_b = filename === null || filename === void 0 ? void 0 : filename.split('.')) === null || _b === void 0 ? void 0 : _b.pop()) || '')),
|
@@ -58170,5 +58271,6 @@ exports.useRuns = useRuns;
|
|
58170
58271
|
exports.useSendHbjson = useSendHbjson;
|
58171
58272
|
exports.useSendMessage = useSendMessage;
|
58172
58273
|
exports.useVSFToHTML = useVSFToHTML;
|
58274
|
+
exports.useVsftoVTK = useVsftoVTK;
|
58173
58275
|
exports.useWindowDimensions = useWindowDimensions;
|
58174
58276
|
//# sourceMappingURL=index.js.map
|