pollination-react-io 1.64.1 → 1.65.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/CreateStudy/CreateStudy.types.d.ts +2 -2
- package/build/SelectRecipe/SelectRecipe.types.d.ts +3 -3
- package/build/hooks/useCreateStudy.d.ts +4 -2
- package/build/hooks/usePollinationPanel.d.ts +1 -0
- package/build/index.esm.js +66 -16
- package/build/index.esm.js.map +1 -1
- package/build/index.js +66 -16
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.js
CHANGED
@@ -38146,6 +38146,26 @@ var usePollinationPanel = function () {
|
|
38146
38146
|
return undefined;
|
38147
38147
|
}
|
38148
38148
|
};
|
38149
|
+
/**
|
38150
|
+
* Count number of simulation by platform
|
38151
|
+
* @param projectSlug Project slug
|
38152
|
+
* @returns Object with platform count
|
38153
|
+
*/
|
38154
|
+
var getPlatforms = function (projectSlug) {
|
38155
|
+
if (!panel)
|
38156
|
+
return;
|
38157
|
+
var count = {};
|
38158
|
+
try {
|
38159
|
+
var message = panel.GetJob(projectSlug);
|
38160
|
+
var arr = JSON.parse(message.data);
|
38161
|
+
arr.forEach(function (i) { count[i.platform] = (count[i.platform] || 0) + 1; });
|
38162
|
+
return count;
|
38163
|
+
}
|
38164
|
+
catch (error) {
|
38165
|
+
// Do nothing. It is written at the end
|
38166
|
+
return undefined;
|
38167
|
+
}
|
38168
|
+
};
|
38149
38169
|
/**
|
38150
38170
|
* Delete job with the same input/ouput folder from DB
|
38151
38171
|
* @param projectSlug Project slug
|
@@ -38176,7 +38196,8 @@ var usePollinationPanel = function () {
|
|
38176
38196
|
fileExplorer: fileExplorer,
|
38177
38197
|
getPaginatedJob: getPaginatedJob,
|
38178
38198
|
getJob: getJob,
|
38179
|
-
deleteJob: deleteJob
|
38199
|
+
deleteJob: deleteJob,
|
38200
|
+
getPlatforms: getPlatforms
|
38180
38201
|
};
|
38181
38202
|
};
|
38182
38203
|
|
@@ -38348,13 +38369,14 @@ var useCreateStudy = function (accountName, projectName, client) {
|
|
38348
38369
|
});
|
38349
38370
|
}, [accountName, client, processEntryCloud, projectName]);
|
38350
38371
|
var createLocalStudy = React.useCallback(function (_a, data, _b, onSuccess, key) {
|
38351
|
-
var name = _a.name, description = _a.description, recipe = _a.recipe;
|
38372
|
+
var name = _a.name, description = _a.description, recipe = _a.recipe, recipeFilter = _a.recipeFilter;
|
38352
38373
|
var localCPUCount = _b.localCPUCount, localRunFolder = _b.localRunFolder, isLocalJob = _b.isLocalJob, cloudProjectName = _b.cloudProjectName, cloudProjectOwner = _b.cloudProjectOwner;
|
38353
38374
|
if (key === void 0) { key = performance.now().toString(); }
|
38354
38375
|
return __awaiter$1(void 0, void 0, void 0, function () {
|
38355
38376
|
var job, jobInfo, response;
|
38356
|
-
|
38357
|
-
|
38377
|
+
var _c;
|
38378
|
+
return __generator$1(this, function (_d) {
|
38379
|
+
switch (_d.label) {
|
38358
38380
|
case 0:
|
38359
38381
|
if (!checkDotNet || !client || !uploadArtifact)
|
38360
38382
|
return [2 /*return*/];
|
@@ -38379,9 +38401,9 @@ var useCreateStudy = function (accountName, projectName, client) {
|
|
38379
38401
|
// JobInfo mapping
|
38380
38402
|
];
|
38381
38403
|
case 1:
|
38382
|
-
job =
|
38404
|
+
job = _d.sent();
|
38383
38405
|
jobInfo = {
|
38384
|
-
RecipeOwner: '',
|
38406
|
+
RecipeOwner: (_c = recipeFilter.owner) !== null && _c !== void 0 ? _c : 'ladybug-tools',
|
38385
38407
|
Recipe: recipe,
|
38386
38408
|
Job: job,
|
38387
38409
|
IsLocalJob: isLocalJob,
|
@@ -42427,7 +42449,7 @@ var SelectRecipe = function (_a) {
|
|
42427
42449
|
var data;
|
42428
42450
|
return __generator$1(this, function (_a) {
|
42429
42451
|
switch (_a.label) {
|
42430
|
-
case 0: return [4 /*yield*/, client.projects.
|
42452
|
+
case 0: return [4 /*yield*/, client.projects.getProjectRecipeFilters(queryConfig)];
|
42431
42453
|
case 1:
|
42432
42454
|
data = (_a.sent()).data;
|
42433
42455
|
setRecipes(function (state) { return state ? __spreadArray(__spreadArray([], state, true), data.resources, true) : __spreadArray([], data.resources, true); });
|
@@ -42450,8 +42472,8 @@ var SelectRecipe = function (_a) {
|
|
42450
42472
|
return;
|
42451
42473
|
}
|
42452
42474
|
// if (selRecipe == null) return
|
42453
|
-
if (selRecipe && selRecipe.
|
42454
|
-
comboBoxRef.current.setInputValue(selRecipe.
|
42475
|
+
if (selRecipe && selRecipe.name) {
|
42476
|
+
comboBoxRef.current.setInputValue(selRecipe.name);
|
42455
42477
|
}
|
42456
42478
|
comboBoxRef.current.selectItem(selRecipe);
|
42457
42479
|
valueRef.current = selRecipe;
|
@@ -42463,12 +42485,11 @@ var SelectRecipe = function (_a) {
|
|
42463
42485
|
return;
|
42464
42486
|
setPageNumber(projectApiRef.current.page + 1);
|
42465
42487
|
}, []);
|
42466
|
-
return (React__default["default"].createElement(ComboBox, { ref: comboBoxRef, items: (_b = recipes === null || recipes === void 0 ? void 0 : recipes.map(function (r, i) { return (__assign(__assign({}, r), { name: "".concat(r.
|
42488
|
+
return (React__default["default"].createElement(ComboBox, { ref: comboBoxRef, items: (_b = recipes === null || recipes === void 0 ? void 0 : recipes.map(function (r, i) { return (__assign(__assign({}, r), { name: "".concat(r.name, "-").concat(r.tag), id: "".concat(r.name, "-").concat(r.tag) })); })) !== null && _b !== void 0 ? _b : [], onClear: function () { return setSelRecipe(undefined); }, renderItem: function (item) { return (React__default["default"].createElement("div", { style: {
|
42467
42489
|
display: 'flex',
|
42468
42490
|
alignItems: 'center',
|
42469
42491
|
gap: 8,
|
42470
|
-
}, id: "".concat(item.
|
42471
|
-
React__default["default"].createElement(Avatar, { src: item.metadata.icon, alt: item.metadata.name, fallback: item.metadata.name, size: 24 }), "".concat(item.metadata.name, "-").concat(item.metadata.tag))); }, setSelected: setSelRecipe, inputProps: {
|
42492
|
+
}, id: "".concat(item.name, "-").concat(item.tag) }, item.name)); }, setSelected: setSelRecipe, inputProps: {
|
42472
42493
|
placeholder: 'Select a recipe...',
|
42473
42494
|
}, loading: loading, disabled: !authUser || !projectName, footer: (React__default["default"].createElement("div", { key: "footer", style: {
|
42474
42495
|
width: '100%',
|
@@ -44884,11 +44905,38 @@ var CreateStudy = function (_a) {
|
|
44884
44905
|
var _d = React.useState(0), activeTabIndex = _d[0], setActiveTabIndex = _d[1];
|
44885
44906
|
var _e = React.useState(defaultAccount), selAccount = _e[0], setSelAccount = _e[1];
|
44886
44907
|
var _f = React.useState(defaultProject), selProject = _f[0], setSelProject = _f[1];
|
44887
|
-
var _g = React.useState(
|
44908
|
+
var _g = React.useState(), selRecipe = _g[0], setSelRecipe = _g[1];
|
44909
|
+
var _h = React.useState(defaultRecipe), selRecipeFilter = _h[0], setSelRecipeFilter = _h[1];
|
44910
|
+
React.useEffect(function () {
|
44911
|
+
if (!selRecipeFilter) {
|
44912
|
+
setSelRecipe(undefined);
|
44913
|
+
return;
|
44914
|
+
}
|
44915
|
+
// Remove tag from name
|
44916
|
+
var clearName = selRecipeFilter
|
44917
|
+
.name.replace(selRecipeFilter.tag, '')
|
44918
|
+
.slice(0, -1);
|
44919
|
+
// If * use latest
|
44920
|
+
var conditionalTag = selRecipeFilter.tag === '*'
|
44921
|
+
? 'latest'
|
44922
|
+
: selRecipeFilter.tag;
|
44923
|
+
client.recipes.getRecipeByTag({
|
44924
|
+
owner: selRecipeFilter.owner,
|
44925
|
+
name: clearName,
|
44926
|
+
tag: conditionalTag
|
44927
|
+
})
|
44928
|
+
.then(function (d) {
|
44929
|
+
setSelRecipe(d.data.manifest);
|
44930
|
+
}).catch(function (err) {
|
44931
|
+
_t.error('Recipe not found. Try a new tag!', { duration: 2000, position: 'top-center', style: { minWidth: '300px', fontSize: '14px' }
|
44932
|
+
});
|
44933
|
+
setSelRecipe(undefined);
|
44934
|
+
});
|
44935
|
+
}, [selRecipeFilter]);
|
44888
44936
|
// @ts-ignore
|
44889
44937
|
var projectOwner = selAccount ? ((_b = selAccount.username) !== null && _b !== void 0 ? _b : selAccount.account_name) : undefined;
|
44890
44938
|
var projectSlug = selProject ? selProject.slug.split('/')[1] : undefined;
|
44891
|
-
var
|
44939
|
+
var _j = useCreateStudy(projectOwner, projectSlug, client), host = _j.host, createStudy = _j.createStudy, createLocalStudy = _j.createLocalStudy;
|
44892
44940
|
React.useEffect(function () {
|
44893
44941
|
if (!selRecipe)
|
44894
44942
|
return;
|
@@ -44906,7 +44954,7 @@ var CreateStudy = function (_a) {
|
|
44906
44954
|
onSuccess(projectJobInfo, true);
|
44907
44955
|
}
|
44908
44956
|
else {
|
44909
|
-
_t.success('Study submitted!', { duration: 4000, position: 'bottom-left', style: { minWidth: '300px', fontSize: '
|
44957
|
+
_t.success('Study submitted!', { duration: 4000, position: 'bottom-left', style: { minWidth: '300px', fontSize: '14px' }
|
44910
44958
|
});
|
44911
44959
|
setTimeout(function () {
|
44912
44960
|
window.location.href = "".concat(basePath, "/").concat(projectJobInfo.accountName, "/projects/").concat(projectJobInfo.projectName, "/studies/").concat(projectJobInfo.studyId, "?tab=details&perPage=5&status=null&page=1");
|
@@ -44942,6 +44990,7 @@ var CreateStudy = function (_a) {
|
|
44942
44990
|
name: name,
|
44943
44991
|
recipe: selRecipe,
|
44944
44992
|
description: description !== null && description !== void 0 ? description : 'Study created from pollination',
|
44993
|
+
recipeFilter: selRecipeFilter
|
44945
44994
|
}, jobArgs, localConfig, localConfig.isLocalJob ? _onSuccessLocal : _onSuccessCloud);
|
44946
44995
|
}
|
44947
44996
|
else {
|
@@ -44980,7 +45029,8 @@ var CreateStudy = function (_a) {
|
|
44980
45029
|
React__default["default"].createElement(SelectProject, { authUser: authUser, client: client, onChange: setSelProject, projectOwner: projectOwner, value: selProject })),
|
44981
45030
|
React__default["default"].createElement(Label, { label: selRecipe && selRecipe.metadata ?
|
44982
45031
|
selRecipe.metadata.name : 'Recipe' },
|
44983
|
-
React__default["default"].createElement(SelectRecipe, { authUser: authUser, client: client, projectOwner: projectOwner, projectName: selProject ? selProject.name : undefined, onChange:
|
45032
|
+
React__default["default"].createElement(SelectRecipe, { authUser: authUser, client: client, projectOwner: projectOwner, projectName: selProject ? selProject.name : undefined, onChange: setSelRecipeFilter, value: selRecipeFilter }),
|
45033
|
+
React__default["default"].createElement(Ie, null)))),
|
44984
45034
|
selRecipe &&
|
44985
45035
|
React__default["default"].createElement(React__default["default"].Fragment, null,
|
44986
45036
|
React__default["default"].createElement(TabPanel, { style: {
|