pollination-react-io 1.88.1 → 1.90.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/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 +182 -36
- package/build/index.esm.js.map +1 -1
- package/build/index.js +182 -35
- 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
|
});
|
@@ -47030,6 +47077,19 @@ var InputType;
|
|
47030
47077
|
InputType["DAGArrayInput"] = "DAGArrayInput";
|
47031
47078
|
InputType["DAGJSONObjectInput"] = "DAGJSONObjectInput";
|
47032
47079
|
})(InputType || (InputType = {}));
|
47080
|
+
var InputTypeAlias;
|
47081
|
+
(function (InputTypeAlias) {
|
47082
|
+
InputTypeAlias["DAGGenericInputAlias"] = "DAGGenericInputAlias";
|
47083
|
+
InputTypeAlias["DAGStringInputAlias"] = "DAGStringInputAlias";
|
47084
|
+
InputTypeAlias["DAGIntegerInputAlias"] = "DAGIntegerInputAlias";
|
47085
|
+
InputTypeAlias["DAGNumberInputAlias"] = "DAGNumberInputAlias";
|
47086
|
+
InputTypeAlias["DAGBooleanInputAlias"] = "DAGBooleanInputAlias";
|
47087
|
+
InputTypeAlias["DAGFolderInputAlias"] = "DAGFolderInputAlias";
|
47088
|
+
InputTypeAlias["DAGFileInputAlias"] = "DAGFileInputAlias";
|
47089
|
+
InputTypeAlias["DAGPathInputAlias"] = "DAGPathInputAlias";
|
47090
|
+
InputTypeAlias["DAGArrayInputAlias"] = "DAGArrayInputAlias";
|
47091
|
+
InputTypeAlias["DAGJSONObjectInputAlias"] = "DAGJSONObjectInputAlias";
|
47092
|
+
})(InputTypeAlias || (InputTypeAlias = {}));
|
47033
47093
|
var RecipeForm = function (_a) {
|
47034
47094
|
var _b, _c;
|
47035
47095
|
var recipe = _a.recipe, projectName = _a.projectName, projectOwner = _a.projectOwner, client = _a.client, onSubmit = _a.onSubmit, _d = _a.style, style = _d === void 0 ? {} : _d, _e = _a.initAsLocal, initAsLocal = _e === void 0 ? false : _e;
|
@@ -47040,6 +47100,11 @@ var RecipeForm = function (_a) {
|
|
47040
47100
|
*/
|
47041
47101
|
var _h = React.useState(false), displaySettings = _h[0], setDisplaySettings = _h[1];
|
47042
47102
|
var _j = React.useState(false), overSettings = _j[0], setOverSettings = _j[1];
|
47103
|
+
/**
|
47104
|
+
* Local study
|
47105
|
+
*/
|
47106
|
+
var _k = React.useState(true), handlers = _k[0], setHandlers = _k[1];
|
47107
|
+
var _l = React.useState(__assign(__assign({}, _defaultConfig), { isLocalJob: initAsLocal, cloudProjectName: projectName, cloudProjectOwner: projectOwner, localRunFolder: simulationPath, useHandlers: handlers })), localConfig = _l[0], setLocalConfig = _l[1];
|
47043
47108
|
/**
|
47044
47109
|
* Input mapping
|
47045
47110
|
*/
|
@@ -47047,9 +47112,10 @@ var RecipeForm = function (_a) {
|
|
47047
47112
|
if (!recipe)
|
47048
47113
|
return;
|
47049
47114
|
var data = recipe.inputs.map(function (i) {
|
47050
|
-
var _a;
|
47115
|
+
var _a, _b;
|
47051
47116
|
var customTab = (_a = i === null || i === void 0 ? void 0 : i.annotations['group_identifier']) !== null && _a !== void 0 ? _a : undefined;
|
47052
|
-
return
|
47117
|
+
var alias = handlers && ((_b = i === null || i === void 0 ? void 0 : i.alias) === null || _b === void 0 ? void 0 : _b.find(function (a) { return a.platform.includes(host); }));
|
47118
|
+
var inputInfo = {
|
47053
47119
|
type: InputType[i.type],
|
47054
47120
|
required: i.required,
|
47055
47121
|
name: i.name,
|
@@ -47060,9 +47126,21 @@ var RecipeForm = function (_a) {
|
|
47060
47126
|
i['extensions'] : [],
|
47061
47127
|
customTab: customTab
|
47062
47128
|
};
|
47129
|
+
alias && Object.keys(alias).forEach(function (key) {
|
47130
|
+
if (key in inputInfo) {
|
47131
|
+
// if the alias is DAGGenericInputAlias use the native input type
|
47132
|
+
if (key == 'type') {
|
47133
|
+
if (alias[key] == 'DAGGenericInputAlias') {
|
47134
|
+
return;
|
47135
|
+
}
|
47136
|
+
}
|
47137
|
+
inputInfo[key] = alias[key];
|
47138
|
+
}
|
47139
|
+
});
|
47140
|
+
return inputInfo;
|
47063
47141
|
});
|
47064
47142
|
return data;
|
47065
|
-
}, [recipe]);
|
47143
|
+
}, [recipe, handlers]);
|
47066
47144
|
var schema = generateSchema(inputs);
|
47067
47145
|
var customTabs = React.useMemo(function () {
|
47068
47146
|
if (!inputs)
|
@@ -47080,10 +47158,10 @@ var RecipeForm = function (_a) {
|
|
47080
47158
|
/**
|
47081
47159
|
* Hooks
|
47082
47160
|
*/
|
47083
|
-
var
|
47161
|
+
var _m = useForm({
|
47084
47162
|
resolver: Oe(schema),
|
47085
47163
|
mode: 'onChange'
|
47086
|
-
}), control =
|
47164
|
+
}), control = _m.control, register = _m.register, handleSubmit = _m.handleSubmit, resetField = _m.resetField, watch = _m.watch, _o = _m.formState, errors = _o.errors, isValid = _o.isValid;
|
47087
47165
|
var watchStudyName = watch('study-name');
|
47088
47166
|
/**
|
47089
47167
|
* Form actions
|
@@ -47129,12 +47207,15 @@ var RecipeForm = function (_a) {
|
|
47129
47207
|
var _a, _b, _c, _d, _e;
|
47130
47208
|
switch (i.type) {
|
47131
47209
|
case InputType.DAGNumberInput:
|
47210
|
+
case InputTypeAlias.DAGNumberInputAlias:
|
47132
47211
|
return React__default["default"].createElement(NumberInput, { inputProps: __assign(__assign({}, register(i.name, { valueAsNumber: true })), { required: i.required, defaultValue: i.default, min: (_a = i.spec) === null || _a === void 0 ? void 0 : _a.minimum, max: (_b = i.spec) === null || _b === void 0 ? void 0 : _b.maximum, step: 0.1 }), key: i.name, reset: function () { return handleReset(i); } });
|
47133
47212
|
case InputType.DAGIntegerInput:
|
47213
|
+
case InputTypeAlias.DAGIntegerInputAlias:
|
47134
47214
|
return React__default["default"].createElement(NumberInput, { key: i.name, icon: i.name.startsWith('cpu')
|
47135
47215
|
? React__default["default"].createElement(Cpu$1, null)
|
47136
47216
|
: undefined, inputProps: __assign(__assign({}, register(i.name, { valueAsNumber: true })), { required: i.required, defaultValue: i.default, min: (_c = i.spec) === null || _c === void 0 ? void 0 : _c.minimum, max: (_d = i.spec) === null || _d === void 0 ? void 0 : _d.maximum, step: 1 }), reset: function () { return handleReset(i); } });
|
47137
47217
|
case InputType.DAGStringInput:
|
47218
|
+
case InputTypeAlias.DAGStringInputAlias:
|
47138
47219
|
return ((_e = i.spec) === null || _e === void 0 ? void 0 : _e.enum)
|
47139
47220
|
? React__default["default"].createElement(Controller, { name: i.name, control: control, defaultValue: i.default, render: function (_a) {
|
47140
47221
|
var _b = _a.field, onChange = _b.onChange, value = _b.value; __rest(_b, ["onChange", "value"]);
|
@@ -47142,6 +47223,7 @@ var RecipeForm = function (_a) {
|
|
47142
47223
|
} })
|
47143
47224
|
: React__default["default"].createElement(TextInput, { key: i.name, inputProps: __assign(__assign({}, register(i.name)), { defaultValue: i.default }), reset: function () { return handleReset(i); } });
|
47144
47225
|
case InputType.DAGFileInput:
|
47226
|
+
case InputTypeAlias.DAGFileInputAlias:
|
47145
47227
|
return React__default["default"].createElement(Controller, { name: i.name, control: control, defaultValue: i.default, render: function (_a) {
|
47146
47228
|
var _b, _c;
|
47147
47229
|
var _d = _a.field, value = _d.value, onChange = _d.onChange, field = __rest(_d, ["value", "onChange"]);
|
@@ -47158,11 +47240,6 @@ var RecipeForm = function (_a) {
|
|
47158
47240
|
return React__default["default"].createElement(TextInput, { key: i.name, inputProps: __assign(__assign({}, register(i.name)), { defaultValue: i.default }), reset: function () { return handleReset(i); } });
|
47159
47241
|
}
|
47160
47242
|
};
|
47161
|
-
/**
|
47162
|
-
* Local study
|
47163
|
-
*/
|
47164
|
-
var _m = React.useState(true), handlers = _m[0], setHandlers = _m[1];
|
47165
|
-
var _o = React.useState(__assign(__assign({}, _defaultConfig), { isLocalJob: initAsLocal, cloudProjectName: projectName, cloudProjectOwner: projectOwner, localRunFolder: simulationPath, useHandlers: handlers })), localConfig = _o[0], setLocalConfig = _o[1];
|
47166
47243
|
/**
|
47167
47244
|
* Warning for local study folder
|
47168
47245
|
*/
|
@@ -47206,7 +47283,7 @@ var RecipeForm = function (_a) {
|
|
47206
47283
|
" ",
|
47207
47284
|
recipe.metadata.name,
|
47208
47285
|
" study"),
|
47209
|
-
React__default["default"].createElement("span", { style: { display: 'inline', float: 'right' }, title: 'Show settings' },
|
47286
|
+
host != 'web' && React__default["default"].createElement("span", { style: { display: 'inline', float: 'right' }, title: 'Show settings' },
|
47210
47287
|
React__default["default"].createElement(SettingOutlined$1, { onMouseOver: function () { return setOverSettings(true); }, onMouseLeave: function () { return setOverSettings(false); }, onClick: function () { return setDisplaySettings(function (prev) { return !prev; }); }, style: {
|
47211
47288
|
fontSize: '18px',
|
47212
47289
|
cursor: 'pointer',
|
@@ -55403,7 +55480,10 @@ var SendGeometry = function (_a) {
|
|
55403
55480
|
options: geometryOptions
|
55404
55481
|
});
|
55405
55482
|
} },
|
55406
|
-
!disabled && (
|
55483
|
+
!disabled && React__default["default"].createElement("span", { style: {
|
55484
|
+
flexShrink: 0,
|
55485
|
+
display: 'flex'
|
55486
|
+
} }, currOption === null || currOption === void 0 ? void 0 : currOption.icon),
|
55407
55487
|
!disabled && ((_b = currOption === null || currOption === void 0 ? void 0 : currOption.label) !== null && _b !== void 0 ? _b : 'Pollination'),
|
55408
55488
|
disabled && React__default["default"].createElement("span", { style: { color: 'red' } }, "Enabled in Pollination CAD plugins")));
|
55409
55489
|
};
|
@@ -55537,7 +55617,10 @@ var SendModel = function (_a) {
|
|
55537
55617
|
options: {},
|
55538
55618
|
});
|
55539
55619
|
} },
|
55540
|
-
!disabled && (
|
55620
|
+
!disabled && React__default["default"].createElement("span", { style: {
|
55621
|
+
flexShrink: 0,
|
55622
|
+
display: 'flex'
|
55623
|
+
} }, currOption === null || currOption === void 0 ? void 0 : currOption.icon),
|
55541
55624
|
!disabled && ((_b = currOption === null || currOption === void 0 ? void 0 : currOption.label) !== null && _b !== void 0 ? _b : 'Pollination'),
|
55542
55625
|
disabled && React__default["default"].createElement("span", { style: { color: 'red' } }, "Enabled in Pollination CAD plugins")));
|
55543
55626
|
};
|
@@ -55724,10 +55807,14 @@ var SendResults = function (_a) {
|
|
55724
55807
|
border: 'solid 1px #fff',
|
55725
55808
|
flexShrink: '0',
|
55726
55809
|
}, placement: 'bottomRight', activeId: defaultAction, action: 'click', disabled: disabled, onSelect: onSelect, options: values },
|
55727
|
-
React__default["default"].createElement(Button, { title:
|
55810
|
+
React__default["default"].createElement(Button, { title: (((currOption === null || currOption === void 0 ? void 0 : currOption.id) === Action.preview
|
55811
|
+
|| (currOption === null || currOption === void 0 ? void 0 : currOption.id) === Action.subscribePreview)
|
55812
|
+
&& (dataSets.length >= 1)
|
55813
|
+
? dataSets === null || dataSets === void 0 ? void 0 : dataSets.map(function (d, index) { return "".concat(d.labels[initialIds[index]]); }).join(' & ')
|
55814
|
+
: helpTextButton[currOption === null || currOption === void 0 ? void 0 : currOption.id]), disabled: disabled, style: {
|
55728
55815
|
width: '100%',
|
55729
55816
|
fontSize: '14px',
|
55730
|
-
border: 'solid 1px #fff'
|
55817
|
+
border: 'solid 1px #fff',
|
55731
55818
|
}, onClick: function (e) {
|
55732
55819
|
e.stopPropagation();
|
55733
55820
|
if (disabled)
|
@@ -55740,15 +55827,22 @@ var SendResults = function (_a) {
|
|
55740
55827
|
options: geometryOptions,
|
55741
55828
|
});
|
55742
55829
|
} },
|
55743
|
-
!disabled && (
|
55830
|
+
!disabled && React__default["default"].createElement("span", { style: {
|
55831
|
+
flexShrink: 0,
|
55832
|
+
display: 'flex'
|
55833
|
+
} }, currOption === null || currOption === void 0 ? void 0 : currOption.icon),
|
55744
55834
|
!disabled &&
|
55745
55835
|
((currOption === null || currOption === void 0 ? void 0 : currOption.id) !== Action.preview && (currOption === null || currOption === void 0 ? void 0 : currOption.id) !== Action.subscribePreview)
|
55746
55836
|
&& ((_b = currOption === null || currOption === void 0 ? void 0 : currOption.label) !== null && _b !== void 0 ? _b : 'Pollination'),
|
55747
55837
|
!disabled &&
|
55748
55838
|
((currOption === null || currOption === void 0 ? void 0 : currOption.id) === Action.preview || (currOption === null || currOption === void 0 ? void 0 : currOption.id) === Action.subscribePreview)
|
55749
|
-
&& (
|
55839
|
+
&& React__default["default"].createElement("span", { style: {
|
55840
|
+
textOverflow: 'ellipsis',
|
55841
|
+
whiteSpace: 'nowrap',
|
55842
|
+
overflow: 'hidden',
|
55843
|
+
} }, (dataSets.length >= 1
|
55750
55844
|
? dataSets === null || dataSets === void 0 ? void 0 : dataSets.map(function (d, index) { return "".concat(d.labels[initialIds[index]]); }).join(' & ')
|
55751
|
-
: ((_c = currOption === null || currOption === void 0 ? void 0 : currOption.label) !== null && _c !== void 0 ? _c : 'Pollination')),
|
55845
|
+
: ((_c = currOption === null || currOption === void 0 ? void 0 : currOption.label) !== null && _c !== void 0 ? _c : 'Pollination'))),
|
55752
55846
|
disabled && React__default["default"].createElement("span", { style: { color: 'red' } }, "Enabled in Pollination CAD plugins")),
|
55753
55847
|
(currOption === null || currOption === void 0 ? void 0 : currOption.id)
|
55754
55848
|
&& ((currOption === null || currOption === void 0 ? void 0 : currOption.id) === Action.preview || (currOption === null || currOption === void 0 ? void 0 : currOption.id) === Action.subscribePreview)
|
@@ -56791,22 +56885,26 @@ var FileCard = function (_a) {
|
|
56791
56885
|
var host = getHost();
|
56792
56886
|
var fromFileToBase64 = usePollinationPanel().fromFileToBase64;
|
56793
56887
|
var _d = useVSFToHTML(), loading = _d.loading, html = _d.html, fetchHTML = _d.fetchHTML;
|
56888
|
+
// VTKJS Handlers
|
56889
|
+
var _e = useHbjsontoVTK(), loadingHBJSON = _e.loading, vtkHBJSON = _e.vtk, fetchVTKfromHBJSON = _e.fetchVTK;
|
56890
|
+
var _f = useVsftoVTK(), loadingVSF = _f.loading, vtkHBVSF = _f.vtk, fetchVTKfromVSF = _f.fetchVTK;
|
56794
56891
|
var downloadArtifact = useArtifacts(projectOwner, projectName, client).downloadArtifact;
|
56795
|
-
var
|
56892
|
+
var _g = React.useState(false), open = _g[0], setOpen = _g[1];
|
56796
56893
|
// Hover effects
|
56797
|
-
var
|
56798
|
-
var
|
56799
|
-
var
|
56800
|
-
var
|
56801
|
-
var
|
56894
|
+
var _h = React.useState(false), infoOver = _h[0], setInfoOver = _h[1];
|
56895
|
+
var _j = React.useState(false), downloadOver = _j[0], setDownloadOver = _j[1];
|
56896
|
+
var _k = React.useState(false), htmlOver = _k[0], setHtmlOver = _k[1];
|
56897
|
+
var _l = React.useState(true), isLoading = _l[0], setIsLoading = _l[1];
|
56898
|
+
var _m = React.useState(false), isInactive = _m[0], setIsInactive = _m[1];
|
56802
56899
|
// Data to use for CAD injections
|
56803
|
-
var
|
56900
|
+
var _o = React.useState(), CADdata = _o[0], setCADdata = _o[1];
|
56804
56901
|
// File to send to parent
|
56805
|
-
var
|
56902
|
+
var _p = React.useState(), currFile = _p[0], setCurrFile = _p[1];
|
56903
|
+
var _q = React.useState(), currPreview = _q[0], setCurrPreview = _q[1];
|
56806
56904
|
// HTML integration
|
56807
|
-
var
|
56905
|
+
var _r = React.useState(false), hasHtml = _r[0], setHasHtml = _r[1];
|
56808
56906
|
// ZIP integration
|
56809
|
-
var
|
56907
|
+
var _s = React.useState(), innerName = _s[0], setInnerName = _s[1];
|
56810
56908
|
/**
|
56811
56909
|
* Get file name to use
|
56812
56910
|
*/
|
@@ -56815,6 +56913,38 @@ var FileCard = function (_a) {
|
|
56815
56913
|
return;
|
56816
56914
|
return innerName !== null && innerName !== void 0 ? innerName : path.split('/').reverse()[0];
|
56817
56915
|
}, [path, innerName]);
|
56916
|
+
React.useEffect(function () {
|
56917
|
+
if (!vtkHBJSON)
|
56918
|
+
return;
|
56919
|
+
if (filename.endsWith('hbjson')) {
|
56920
|
+
setCurrPreview(vtkHBJSON);
|
56921
|
+
}
|
56922
|
+
}, [vtkHBJSON]);
|
56923
|
+
React.useEffect(function () {
|
56924
|
+
if (!vtkHBVSF)
|
56925
|
+
return;
|
56926
|
+
if (filename.endsWith('vsf')) {
|
56927
|
+
setCurrPreview(vtkHBVSF);
|
56928
|
+
}
|
56929
|
+
}, [vtkHBVSF]);
|
56930
|
+
/**
|
56931
|
+
* Preview name
|
56932
|
+
*/
|
56933
|
+
var previewName = React.useMemo(function () {
|
56934
|
+
if (!currPreview || !filename)
|
56935
|
+
return;
|
56936
|
+
var prevName;
|
56937
|
+
if (filename.endsWith('zip')) {
|
56938
|
+
prevName = filename.replace('.zip', 'vtkjs');
|
56939
|
+
}
|
56940
|
+
else if (filename.endsWith('hbjson')) {
|
56941
|
+
prevName = filename.replace('hbjson', 'vtkjs');
|
56942
|
+
}
|
56943
|
+
else if (filename.endsWith('vsf')) {
|
56944
|
+
prevName = filename.replace('vsf', 'vtkjs');
|
56945
|
+
}
|
56946
|
+
return prevName;
|
56947
|
+
}, [currPreview, filename]);
|
56818
56948
|
/**
|
56819
56949
|
* Get file from a ZIP file.
|
56820
56950
|
* 1 zip = 1 file for now
|
@@ -56842,10 +56972,12 @@ var FileCard = function (_a) {
|
|
56842
56972
|
setInnerName(name);
|
56843
56973
|
var blob = f.slice(0, f.size, 'text/plain');
|
56844
56974
|
setCurrFile(blob);
|
56975
|
+
// Note: inputs are always available
|
56845
56976
|
if (name.endsWith('vsf')) {
|
56846
56977
|
setHasHtml(true);
|
56847
56978
|
fetchHTML(blob);
|
56848
56979
|
setCADintegration(blob, name);
|
56980
|
+
fetchVTKfromVSF(blob);
|
56849
56981
|
}
|
56850
56982
|
});
|
56851
56983
|
});
|
@@ -56899,6 +57031,7 @@ var FileCard = function (_a) {
|
|
56899
57031
|
// Deleted from cloud
|
56900
57032
|
setIsInactive(true);
|
56901
57033
|
setCurrFile(undefined);
|
57034
|
+
setCurrPreview(undefined);
|
56902
57035
|
setCADintegration(undefined);
|
56903
57036
|
setIsLoading(false);
|
56904
57037
|
setHasHtml(false);
|
@@ -56918,10 +57051,12 @@ var FileCard = function (_a) {
|
|
56918
57051
|
setHasHtml(true);
|
56919
57052
|
fetchHTML(blob); // HTML button
|
56920
57053
|
setCADintegration(blob);
|
57054
|
+
fetchVTKfromVSF(blob);
|
56921
57055
|
}
|
56922
57056
|
else if (path === null || path === void 0 ? void 0 : path.endsWith('hbjson')) {
|
56923
57057
|
setHasHtml(false);
|
56924
57058
|
setCADintegration(blob);
|
57059
|
+
fetchVTKfromHBJSON(blob);
|
56925
57060
|
}
|
56926
57061
|
else {
|
56927
57062
|
setHasHtml(false);
|
@@ -56975,7 +57110,13 @@ var FileCard = function (_a) {
|
|
56975
57110
|
// Generate Blob on click
|
56976
57111
|
run && downloadArtifact(path, run.status.job_id)
|
56977
57112
|
.then(function (url) { return fetchAndSet(url); })
|
56978
|
-
.catch(function () { return onClicked({
|
57113
|
+
.catch(function () { return onClicked({
|
57114
|
+
label: label,
|
57115
|
+
path: path,
|
57116
|
+
file: undefined,
|
57117
|
+
description: description,
|
57118
|
+
name: filename
|
57119
|
+
}); });
|
56979
57120
|
}
|
56980
57121
|
else {
|
56981
57122
|
// Some inputs has path == null
|
@@ -56992,14 +57133,19 @@ var FileCard = function (_a) {
|
|
56992
57133
|
}, [run, label, path]);
|
56993
57134
|
return React__default["default"].createElement("div", { className: isInactive
|
56994
57135
|
? 'card-param card-folder-inactive'
|
56995
|
-
:
|
57136
|
+
: (loadingHBJSON || loadingVSF)
|
57137
|
+
? 'card-param'
|
57138
|
+
: 'card-param card-folder', tabIndex: 0, role: (loadingHBJSON || loadingVSF) ? 'none' : 'button', key: label, onClick: function (event) {
|
56996
57139
|
event.stopPropagation();
|
56997
|
-
if (isInactive)
|
57140
|
+
if (isInactive || (loadingHBJSON || loadingVSF))
|
56998
57141
|
return;
|
56999
|
-
onClicked({ label: label, path: path, file: currFile, description: description, name: filename
|
57142
|
+
onClicked({ label: label, path: path, file: currFile, description: description, name: filename,
|
57143
|
+
previewFile: currPreview !== null && currPreview !== void 0 ? currPreview : currFile,
|
57144
|
+
previewName: previewName !== null && previewName !== void 0 ? previewName : filename
|
57145
|
+
});
|
57000
57146
|
} },
|
57001
57147
|
React__default["default"].createElement("div", { className: 'title-param' },
|
57002
|
-
React__default["default"].createElement("div", { style: { float: 'left', margin: '0 8px 0 0' } }, !isLoading ? React__default["default"].createElement("div", { title: !isInactive
|
57148
|
+
React__default["default"].createElement("div", { style: { float: 'left', margin: '0 8px 0 0' } }, (!isLoading) ? React__default["default"].createElement("div", { title: !isInactive
|
57003
57149
|
? 'Open the viewer'
|
57004
57150
|
: 'File is missing. Check run workspace' },
|
57005
57151
|
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()) || '')),
|
@@ -58123,5 +58269,6 @@ exports.useRuns = useRuns;
|
|
58123
58269
|
exports.useSendHbjson = useSendHbjson;
|
58124
58270
|
exports.useSendMessage = useSendMessage;
|
58125
58271
|
exports.useVSFToHTML = useVSFToHTML;
|
58272
|
+
exports.useVsftoVTK = useVsftoVTK;
|
58126
58273
|
exports.useWindowDimensions = useWindowDimensions;
|
58127
58274
|
//# sourceMappingURL=index.js.map
|