pollination-react-io 1.20.0 → 1.21.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/ComboFileSelector/ComboFileSelector.types.d.ts +5 -0
- package/build/ConfigureLocalRun/ConfigureLocalRun.d.ts +7 -0
- package/build/ConfigureLocalRun/ConfigureLocalRun.types.d.ts +1 -0
- package/build/RecipeInputsForm/RecipeInputsForm.types.d.ts +2 -2
- package/build/hooks/useCreateStudy.d.ts +2 -1
- package/build/hooks/usePollinationPanel.d.ts +1 -1
- package/build/index.esm.js +95 -67
- package/build/index.esm.js.map +1 -1
- package/build/index.js +95 -66
- package/build/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { HTMLProps } from 'react';
|
|
2
2
|
import { APIClient } from '../hooks';
|
|
3
|
+
declare type ComboFileSelectorOptions = 'get_model' | 'get_file' | 'get_cloud' | 'get_local';
|
|
3
4
|
export interface ComboFileSelectorProps {
|
|
4
5
|
projectOwner?: string;
|
|
5
6
|
projectName?: string;
|
|
6
7
|
defaultValue?: string;
|
|
7
8
|
hidden?: boolean;
|
|
8
9
|
defaultOption?: 'get_model' | 'get_file' | 'get_cloud' | 'get_local';
|
|
10
|
+
optionsConfig?: {
|
|
11
|
+
[index in ComboFileSelectorOptions]?: boolean;
|
|
12
|
+
};
|
|
9
13
|
mode?: 'local' | 'cloud';
|
|
10
14
|
onChange?: (...any: any) => void;
|
|
11
15
|
disabled?: boolean;
|
|
12
16
|
client: APIClient;
|
|
13
17
|
inputProps?: HTMLProps<HTMLInputElement>;
|
|
14
18
|
}
|
|
19
|
+
export {};
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ConfigureLocalRunProps } from './ConfigureLocalRun.types';
|
|
3
|
+
export declare const _defaultConfig: {
|
|
4
|
+
localCPUCount: number;
|
|
5
|
+
localRunFolder: string;
|
|
6
|
+
isLocalJob: boolean;
|
|
7
|
+
cloudProjectName: any;
|
|
8
|
+
cloudProjectOwner: any;
|
|
9
|
+
};
|
|
3
10
|
export declare const ConfigureLocalRun: React.FC<ConfigureLocalRunProps>;
|
|
4
11
|
export default ConfigureLocalRun;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RecipeInterface } from '@pollination-solutions/pollination-sdk';
|
|
2
|
-
import { APIClient,
|
|
2
|
+
import { APIClient, PanelMessageIn } from '../hooks';
|
|
3
3
|
export interface RecipeInputsFormProps {
|
|
4
4
|
recipe: RecipeInterface;
|
|
5
5
|
controlledValues?: {
|
|
@@ -8,7 +8,7 @@ export interface RecipeInputsFormProps {
|
|
|
8
8
|
hidden?: boolean;
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
|
-
onSubmit?: (name: string, jobArguments: any[], description?: string) => Promise<void> | Promise<
|
|
11
|
+
onSubmit?: (name: string, jobArguments: any[], description?: string, localConfig?: any) => Promise<void> | Promise<PanelMessageIn | undefined>;
|
|
12
12
|
projectOwner?: string;
|
|
13
13
|
projectName?: string;
|
|
14
14
|
client?: APIClient;
|
|
@@ -16,10 +16,11 @@ export interface LocalConfig {
|
|
|
16
16
|
localRunFolder: string;
|
|
17
17
|
isLocalJob: boolean;
|
|
18
18
|
cloudProjectName: string;
|
|
19
|
+
cloudProjectOwner: string;
|
|
19
20
|
}
|
|
20
21
|
export declare const useCreateStudy: (accountName: string, projectName: string, client: APIClient) => {
|
|
21
22
|
host: string;
|
|
22
23
|
createStudy: ({ name, recipe, description }: JobArgs, data: object, onSuccess?: (accountName: string, projectName: string, studyId: string) => void) => Promise<void>;
|
|
23
|
-
createLocalStudy: ({ name, description, recipe }: JobArgs, data: object, { localCPUCount, localRunFolder, isLocalJob }: LocalConfig, key?: string) => Promise<import("./types").PanelMessageIn>;
|
|
24
|
+
createLocalStudy: ({ name, description, recipe }: JobArgs, data: object, { localCPUCount, localRunFolder, isLocalJob, cloudProjectName, cloudProjectOwner }: LocalConfig, key?: string) => Promise<import("./types").PanelMessageIn>;
|
|
24
25
|
};
|
|
25
26
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PanelMessageOut } from './types';
|
|
2
2
|
export declare const usePollinationPanel: () => {
|
|
3
3
|
getFileBase64: (key?: any, accept?: any) => PanelMessageOut;
|
|
4
|
-
saveFileBase64: (key: string, file: File, subFolder: string, fileName: string) => Promise<PanelMessageOut>;
|
|
4
|
+
saveFileBase64: (key: string, file: File | Blob, subFolder: string, fileName: string) => Promise<PanelMessageOut>;
|
|
5
5
|
};
|
package/build/index.esm.js
CHANGED
|
@@ -618,7 +618,7 @@ function styleInject(css, ref) {
|
|
|
618
618
|
}
|
|
619
619
|
}
|
|
620
620
|
|
|
621
|
-
var css_248z$j = ":root {\n --background: #FFFAEE;\n --primary: #1890ff;\n --primary2: #40a9ff;\n --primary1: #cceefe;\n --primary0: #e6f7ff;\n --secondary: #fff566;\n --success: #46A758;\n --warning: #F76809;\n --danger: #FF4616;\n /* radix-ui/colors */\n --slate1: hsl(206, 30.0%, 98.8%);\n --slate2: hsl(210, 16.7%, 97.6%);\n --slate3: hsl(209, 13.3%, 95.3%);\n --slate4: hsl(209, 12.2%, 93.2%);\n --slate5: hsl(208, 11.7%, 91.1%);\n --slate6: hsl(208, 11.3%, 88.9%);\n --slate7: hsl(207, 11.1%, 85.9%);\n --slate8: hsl(205, 10.7%, 78.0%);\n --slate9: hsl(206, 6.0%, 56.1%);\n --slate10: hsl(206, 5.8%, 52.3%);\n --slate11: hsl(206, 6.0%, 43.5%);\n --slate12: hsl(206, 24.0%, 9.0%);\n}\n\n@keyframes spin {\n from {\n transform: rotate(0);\n }\n to {\n transform: rotate(360deg);\n }\n}\n.spin {\n animation: spin 1s linear 0s infinite;\n}\n\n@keyframes Animation {\n 0% {\n background-position: 200%;\n }\n 50% {\n background-position: 100%;\n }\n 100% {\n background-position: 0%;\n }\n}\n.loading {\n background: linear-gradient(45deg, transparent, var(--primary), 12%, transparent);\n background-size: 200%;\n animation: Animation 3s ease infinite;\n}\n\n@keyframes open {\n from {\n height: 0;\n }\n to {\n height: var(--radix-collapsible-content-height);\n }\n}\n@keyframes close {\n from {\n height: var(--radix-collapsible-content-height);\n }\n to {\n height: 0;\n }\n}\n.collapse-content {\n overflow: hidden;\n font-size: inherit;\n color: inherit;\n}\n\n.collapse-content[data-state=open] {\n animation: open 300ms ease-out;\n}\n\n.collapse-content[data-state=closed] {\n animation: close 300ms ease-out;\n}\n\n.poll-button {\n z-index: 10;\n display: flex;\n background-color: var(--primary);\n border: 1px solid var(--primary);\n color: white;\n padding: 8px 16px;\n line-height: 1.5rem;\n align-items: center;\n gap: 8px;\n border-radius: 4px;\n transition: background-color 0.25s, border-color 0.25s, color 0.25s, box-shadow 0.25s, color 0.25s;\n text-overflow: ellipsis;\n
|
|
621
|
+
var css_248z$j = ":root {\n --background: #FFFAEE;\n --primary: #1890ff;\n --primary2: #40a9ff;\n --primary1: #cceefe;\n --primary0: #e6f7ff;\n --secondary: #fff566;\n --success: #46A758;\n --warning: #F76809;\n --danger: #FF4616;\n /* radix-ui/colors */\n --slate1: hsl(206, 30.0%, 98.8%);\n --slate2: hsl(210, 16.7%, 97.6%);\n --slate3: hsl(209, 13.3%, 95.3%);\n --slate4: hsl(209, 12.2%, 93.2%);\n --slate5: hsl(208, 11.7%, 91.1%);\n --slate6: hsl(208, 11.3%, 88.9%);\n --slate7: hsl(207, 11.1%, 85.9%);\n --slate8: hsl(205, 10.7%, 78.0%);\n --slate9: hsl(206, 6.0%, 56.1%);\n --slate10: hsl(206, 5.8%, 52.3%);\n --slate11: hsl(206, 6.0%, 43.5%);\n --slate12: hsl(206, 24.0%, 9.0%);\n}\n\n@keyframes spin {\n from {\n transform: rotate(0);\n }\n to {\n transform: rotate(360deg);\n }\n}\n.spin {\n animation: spin 1s linear 0s infinite;\n}\n\n@keyframes Animation {\n 0% {\n background-position: 200%;\n }\n 50% {\n background-position: 100%;\n }\n 100% {\n background-position: 0%;\n }\n}\n.loading {\n background: linear-gradient(45deg, transparent, var(--primary), 12%, transparent);\n background-size: 200%;\n animation: Animation 3s ease infinite;\n}\n\n@keyframes open {\n from {\n height: 0;\n }\n to {\n height: var(--radix-collapsible-content-height);\n }\n}\n@keyframes close {\n from {\n height: var(--radix-collapsible-content-height);\n }\n to {\n height: 0;\n }\n}\n.collapse-content {\n overflow: hidden;\n font-size: inherit;\n color: inherit;\n}\n\n.collapse-content[data-state=open] {\n animation: open 300ms ease-out;\n}\n\n.collapse-content[data-state=closed] {\n animation: close 300ms ease-out;\n}\n\n.poll-button {\n z-index: 10;\n display: flex;\n background-color: var(--primary);\n border: 1px solid var(--primary);\n color: white;\n padding: 8px 16px;\n line-height: 1.5rem;\n align-items: center;\n gap: 8px;\n border-radius: 4px;\n transition: background-color 0.25s, border-color 0.25s, color 0.25s, box-shadow 0.25s, color 0.25s;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n cursor: pointer;\n}\n\n.poll-button:active {\n box-shadow: inset 0px 0px 9px 4px #096dd9;\n}\n\n.poll-button:disabled {\n background-color: var(--slate3);\n color: var(--slate11);\n cursor: default;\n border-color: var(--slate11);\n cursor: default;\n box-shadow: none;\n}";
|
|
622
622
|
styleInject(css_248z$j);
|
|
623
623
|
|
|
624
624
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -37906,7 +37906,7 @@ var dayjs_min = createCommonjsModule(function (module, exports) {
|
|
|
37906
37906
|
|
|
37907
37907
|
var useCreateStudy = function (accountName, projectName, client) {
|
|
37908
37908
|
var host = getHost();
|
|
37909
|
-
var
|
|
37909
|
+
var _a = useArtifacts(accountName, projectName, client), uploadArtifact = _a.uploadArtifact, downloadArtifact = _a.downloadArtifact;
|
|
37910
37910
|
var saveFileBase64 = usePollinationPanel().saveFileBase64;
|
|
37911
37911
|
// uploads all file inputs for cloud studies
|
|
37912
37912
|
var processEntryCloud = useCallback(function (_a, input) {
|
|
@@ -37962,7 +37962,7 @@ var useCreateStudy = function (accountName, projectName, client) {
|
|
|
37962
37962
|
}, [uploadArtifact]);
|
|
37963
37963
|
// downloads, saves all file inputs for handling by plugins for local runs
|
|
37964
37964
|
// regardless of whether it's a local run or cloud run, platform will handle input files
|
|
37965
|
-
var processEntryLocal = useCallback(function (_a, input) {
|
|
37965
|
+
var processEntryLocal = useCallback(function (_a, input, cloudProjectName) {
|
|
37966
37966
|
var name = _a[0], value = _a[1];
|
|
37967
37967
|
return new Promise(function (resolve, reject) {
|
|
37968
37968
|
var type = input.type;
|
|
@@ -37983,21 +37983,56 @@ var useCreateStudy = function (accountName, projectName, client) {
|
|
|
37983
37983
|
}
|
|
37984
37984
|
});
|
|
37985
37985
|
}
|
|
37986
|
-
//
|
|
37986
|
+
// first download artifact and turn it into a blob
|
|
37987
|
+
// then save it to the users machine and provide
|
|
37988
|
+
// the name to the jobInfo object
|
|
37989
|
+
if (typeof value.pollination_cloud_path === 'string') {
|
|
37990
|
+
downloadArtifact(value.pollination_cloud_path)
|
|
37991
|
+
.then(function (url) {
|
|
37992
|
+
fetch(url)
|
|
37993
|
+
.then(function (response) { return response.blob().then(function (blob) {
|
|
37994
|
+
saveFileBase64('key', blob, cloudProjectName !== null && cloudProjectName !== void 0 ? cloudProjectName : "".concat(dayjs_min().format('YYYY-DD-MMTHH-mm-ss')), value.name)
|
|
37995
|
+
.then(function (message) {
|
|
37996
|
+
if (!message || !message.data) {
|
|
37997
|
+
reject("Cloud Artifact ".concat(value.name, " could not be saved to the local machine. Try a cloud study."));
|
|
37998
|
+
}
|
|
37999
|
+
resolve({
|
|
38000
|
+
name: name,
|
|
38001
|
+
type: 'JobPathArgument',
|
|
38002
|
+
source: {
|
|
38003
|
+
type: 'ProjectFolder',
|
|
38004
|
+
path: message.data
|
|
38005
|
+
}
|
|
38006
|
+
});
|
|
38007
|
+
})
|
|
38008
|
+
.catch(function (e) {
|
|
38009
|
+
reject(e);
|
|
38010
|
+
});
|
|
38011
|
+
}); });
|
|
38012
|
+
});
|
|
38013
|
+
}
|
|
38014
|
+
// files from CAD apps
|
|
37987
38015
|
if (value instanceof File) {
|
|
37988
|
-
|
|
37989
|
-
|
|
37990
|
-
|
|
37991
|
-
|
|
37992
|
-
source: {
|
|
37993
|
-
type: 'ProjectFolder',
|
|
37994
|
-
// @ts-ignore
|
|
37995
|
-
path: saveFileBase64('key', value, "".concat(dayjs_min().format('YYYY-DD-MMTHH_MM_SS')), value.file_name)
|
|
38016
|
+
saveFileBase64('key', value, cloudProjectName !== null && cloudProjectName !== void 0 ? cloudProjectName : "".concat(dayjs_min().format('YYYY-DD-MM')), value.name)
|
|
38017
|
+
.then(function (message) {
|
|
38018
|
+
if (!message || !message.data) {
|
|
38019
|
+
reject("File ".concat(value.name, " could not be saved to the local machine. Try a cloud study."));
|
|
37996
38020
|
}
|
|
38021
|
+
resolve({
|
|
38022
|
+
name: name,
|
|
38023
|
+
type: 'JobPathArgument',
|
|
38024
|
+
source: {
|
|
38025
|
+
type: 'ProjectFolder',
|
|
38026
|
+
path: message.data
|
|
38027
|
+
}
|
|
38028
|
+
});
|
|
38029
|
+
})
|
|
38030
|
+
.catch(function (e) {
|
|
38031
|
+
reject(e);
|
|
37997
38032
|
});
|
|
37998
38033
|
}
|
|
37999
38034
|
});
|
|
38000
|
-
}, [saveFileBase64]);
|
|
38035
|
+
}, [downloadArtifact, saveFileBase64]);
|
|
38001
38036
|
var createStudy = useCallback(function (_a, data, onSuccess) {
|
|
38002
38037
|
var name = _a.name, recipe = _a.recipe, description = _a.description;
|
|
38003
38038
|
if (!client || !name || !recipe || !data) {
|
|
@@ -38033,7 +38068,7 @@ var useCreateStudy = function (accountName, projectName, client) {
|
|
|
38033
38068
|
}, [accountName, client, processEntryCloud, projectName]);
|
|
38034
38069
|
var createLocalStudy = useCallback(function (_a, data, _b, key) {
|
|
38035
38070
|
var name = _a.name, description = _a.description, recipe = _a.recipe;
|
|
38036
|
-
var localCPUCount = _b.localCPUCount, localRunFolder = _b.localRunFolder, isLocalJob = _b.isLocalJob;
|
|
38071
|
+
var localCPUCount = _b.localCPUCount, localRunFolder = _b.localRunFolder, isLocalJob = _b.isLocalJob, cloudProjectName = _b.cloudProjectName, cloudProjectOwner = _b.cloudProjectOwner;
|
|
38037
38072
|
if (key === void 0) { key = performance.now().toString(); }
|
|
38038
38073
|
return __awaiter$1(void 0, void 0, void 0, function () {
|
|
38039
38074
|
var job, jobInfo, response;
|
|
@@ -38046,7 +38081,7 @@ var useCreateStudy = function (accountName, projectName, client) {
|
|
|
38046
38081
|
return [2 /*return*/];
|
|
38047
38082
|
return [4 /*yield*/, Promise.all(Object.entries(data).map(function (d) {
|
|
38048
38083
|
var input = recipe.inputs.find(function (i) { return i.name === d[0]; });
|
|
38049
|
-
return processEntryLocal(d, input);
|
|
38084
|
+
return processEntryLocal(d, input, cloudProjectName);
|
|
38050
38085
|
}))
|
|
38051
38086
|
.then(function (jobArguments) { return ({
|
|
38052
38087
|
type: 'Job',
|
|
@@ -38062,8 +38097,12 @@ var useCreateStudy = function (accountName, projectName, client) {
|
|
|
38062
38097
|
Job: job,
|
|
38063
38098
|
IsLocalJob: isLocalJob,
|
|
38064
38099
|
LocalCPUNumber: localCPUCount,
|
|
38065
|
-
LocalRunFolder: localRunFolder
|
|
38100
|
+
LocalRunFolder: localRunFolder,
|
|
38101
|
+
CloudProject: cloudProjectName,
|
|
38102
|
+
ProjectOwner: cloudProjectOwner,
|
|
38103
|
+
SubFolderPath: ''
|
|
38066
38104
|
};
|
|
38105
|
+
console.log(jobInfo);
|
|
38067
38106
|
response = sendMessageDotNet({
|
|
38068
38107
|
action: 'AddStudy',
|
|
38069
38108
|
data: jobInfo,
|
|
@@ -40756,7 +40795,7 @@ var SelectLocalArtifactNative = function (_a) {
|
|
|
40756
40795
|
};
|
|
40757
40796
|
|
|
40758
40797
|
var ComboFileSelector = function (_a) {
|
|
40759
|
-
var projectOwner = _a.projectOwner, projectName = _a.projectName, defaultValue = _a.defaultValue, hidden = _a.hidden, defaultOption = _a.defaultOption, _b = _a.mode, mode = _b === void 0 ? 'cloud' : _b, onChange = _a.onChange, _c = _a.disabled, disabled = _c === void 0 ? false : _c, client = _a.client, inputProps = _a.inputProps;
|
|
40798
|
+
var projectOwner = _a.projectOwner, projectName = _a.projectName, defaultValue = _a.defaultValue, hidden = _a.hidden, defaultOption = _a.defaultOption, optionsConfig = _a.optionsConfig, _b = _a.mode, mode = _b === void 0 ? 'cloud' : _b, onChange = _a.onChange, _c = _a.disabled, disabled = _c === void 0 ? false : _c, client = _a.client, inputProps = _a.inputProps;
|
|
40760
40799
|
var host = getHost();
|
|
40761
40800
|
var _d = useState(function () {
|
|
40762
40801
|
if (typeof defaultOption !== 'undefined') {
|
|
@@ -40790,21 +40829,24 @@ var ComboFileSelector = function (_a) {
|
|
|
40790
40829
|
} },
|
|
40791
40830
|
!hidden &&
|
|
40792
40831
|
React__default.createElement(ButtonGroup, null,
|
|
40793
|
-
|
|
40794
|
-
|
|
40795
|
-
|
|
40796
|
-
|
|
40797
|
-
|
|
40798
|
-
|
|
40799
|
-
|
|
40800
|
-
|
|
40801
|
-
|
|
40802
|
-
|
|
40803
|
-
|
|
40804
|
-
|
|
40805
|
-
|
|
40806
|
-
|
|
40832
|
+
(typeof optionsConfig['get_file'] === 'undefined' || optionsConfig['get_file']) &&
|
|
40833
|
+
React__default.createElement("button", { type: 'button', disabled: disabled, onClick: function () { return setOption('get_file'); }, style: {
|
|
40834
|
+
display: 'flex',
|
|
40835
|
+
boxShadow: !disabled && option === 'get_file' ?
|
|
40836
|
+
'inset 0px 0px 9px 4px #096dd9' : undefined
|
|
40837
|
+
} },
|
|
40838
|
+
React__default.createElement(FileEarmarkArrowUp$1, null),
|
|
40839
|
+
"Upload"),
|
|
40840
|
+
(typeof optionsConfig['get_cloud'] === 'undefined' || optionsConfig['get_cloud']) &&
|
|
40841
|
+
React__default.createElement("button", { type: 'button', disabled: disabled, onClick: function () { return setOption('get_cloud'); }, style: {
|
|
40842
|
+
display: 'flex',
|
|
40843
|
+
boxShadow: !disabled && option === 'get_cloud' ?
|
|
40844
|
+
'inset 0px 0px 9px 4px #096dd9' : undefined
|
|
40845
|
+
} },
|
|
40846
|
+
React__default.createElement(CloudPlus$1, null),
|
|
40847
|
+
"Cloud"),
|
|
40807
40848
|
(host !== 'web' || option === 'get_model') &&
|
|
40849
|
+
(typeof optionsConfig['get_model'] === 'undefined' || optionsConfig['get_model']) &&
|
|
40808
40850
|
React__default.createElement("button", { type: 'button', disabled: disabled, onClick: function () { return setOption('get_model'); }, style: {
|
|
40809
40851
|
display: 'flex',
|
|
40810
40852
|
boxShadow: !disabled && option === 'get_model' ?
|
|
@@ -40813,6 +40855,7 @@ var ComboFileSelector = function (_a) {
|
|
|
40813
40855
|
React__default.createElement(ArrowUpSquare$1, null),
|
|
40814
40856
|
"CAD"),
|
|
40815
40857
|
(host !== 'web' || option === 'get_local') &&
|
|
40858
|
+
(typeof optionsConfig['get_local'] === 'undefined' || optionsConfig['get_local']) &&
|
|
40816
40859
|
React__default.createElement("button", { type: 'button', disabled: disabled, onClick: function () { return setOption('get_local'); }, style: {
|
|
40817
40860
|
display: 'flex',
|
|
40818
40861
|
boxShadow: !disabled && option === 'get_local' ?
|
|
@@ -40843,11 +40886,12 @@ var _defaultConfig = {
|
|
|
40843
40886
|
localCPUCount: 1,
|
|
40844
40887
|
localRunFolder: 'C:',
|
|
40845
40888
|
isLocalJob: false,
|
|
40846
|
-
cloudProjectName: undefined
|
|
40889
|
+
cloudProjectName: undefined,
|
|
40890
|
+
cloudProjectOwner: undefined
|
|
40847
40891
|
};
|
|
40848
40892
|
var ConfigureLocalRun = function (_a) {
|
|
40849
|
-
var _b = _a.disabled, disabled = _b === void 0 ? false : _b, onChange = _a.onChange;
|
|
40850
|
-
var _c = useState(_defaultConfig), localConfig = _c[0], setLocalConfig = _c[1];
|
|
40893
|
+
var _b = _a.disabled, disabled = _b === void 0 ? false : _b, defaultVal = _a.defaultVal, onChange = _a.onChange;
|
|
40894
|
+
var _c = useState(__assign(__assign({}, _defaultConfig), defaultVal)), localConfig = _c[0], setLocalConfig = _c[1];
|
|
40851
40895
|
useEffect(function () {
|
|
40852
40896
|
if (!localConfig || !onChange)
|
|
40853
40897
|
return;
|
|
@@ -43965,12 +44009,13 @@ var RecipeInputsForm = function (_a) {
|
|
|
43965
44009
|
var _b, _c;
|
|
43966
44010
|
var recipe = _a.recipe, controlledValues = _a.controlledValues, onSubmit = _a.onSubmit, projectName = _a.projectName, projectOwner = _a.projectOwner, client = _a.client;
|
|
43967
44011
|
var _d = useState(false), loading = _d[0], setLoading = _d[1];
|
|
44012
|
+
var _e = useState(__assign(__assign({}, _defaultConfig), { cloudProjectName: projectName, cloudProjectOwner: projectOwner })), localConfig = _e[0], setLocalConfig = _e[1];
|
|
43968
44013
|
var schema = generateSchema(recipe.inputs);
|
|
43969
44014
|
var host = getHost();
|
|
43970
|
-
var
|
|
44015
|
+
var _f = useForm({
|
|
43971
44016
|
resolver: Oe(schema),
|
|
43972
44017
|
mode: 'all'
|
|
43973
|
-
}), control =
|
|
44018
|
+
}), control = _f.control, register = _f.register, handleSubmit = _f.handleSubmit, reset = _f.reset, resetField = _f.resetField, _g = _f.formState, errors = _g.errors, isValid = _g.isValid; _g.isSubmitting;
|
|
43974
44019
|
var _onSubmit = function (_data) {
|
|
43975
44020
|
var data = __assign({}, _data);
|
|
43976
44021
|
// strip study name
|
|
@@ -43990,7 +44035,7 @@ var RecipeInputsForm = function (_a) {
|
|
|
43990
44035
|
});
|
|
43991
44036
|
if (typeof onSubmit !== 'undefined') {
|
|
43992
44037
|
setLoading(true);
|
|
43993
|
-
onSubmit(studyName, data)
|
|
44038
|
+
onSubmit(studyName, data, 'description', localConfig)
|
|
43994
44039
|
.finally(function () {
|
|
43995
44040
|
reset();
|
|
43996
44041
|
setLoading(false);
|
|
@@ -44015,6 +44060,8 @@ var RecipeInputsForm = function (_a) {
|
|
|
44015
44060
|
React__default.createElement(TextInput, { inputProps: __assign({ form: recipe.metadata.name }, register('study-name')),
|
|
44016
44061
|
// @ts-ignore
|
|
44017
44062
|
reset: function () { return resetField('study-name'); } })),
|
|
44063
|
+
host !== 'web' &&
|
|
44064
|
+
React__default.createElement(ConfigureLocalRun, { onChange: function (localConfig) { return setLocalConfig(localConfig); }, defaultVal: localConfig }),
|
|
44018
44065
|
React__default.createElement(Tabs, { forceRenderTabPanel: true },
|
|
44019
44066
|
React__default.createElement(TabList, { style: {
|
|
44020
44067
|
flex: 1
|
|
@@ -44054,7 +44101,11 @@ var RecipeInputsForm = function (_a) {
|
|
|
44054
44101
|
var _b = _a.field; _b.value; var onChange = _b.onChange, field = __rest(_b, ["value", "onChange"]);
|
|
44055
44102
|
return (React__default.createElement(ComboFileSelector, { projectOwner: projectOwner, projectName: projectName, defaultOption: input.extensions &&
|
|
44056
44103
|
input.extensions.includes('hbjson') &&
|
|
44057
|
-
host !== 'web' ? 'get_model' : 'get_cloud',
|
|
44104
|
+
host !== 'web' ? 'get_model' : 'get_cloud', optionsConfig: {
|
|
44105
|
+
get_model: input.extensions.includes('hbjson') && host !== 'web',
|
|
44106
|
+
get_local: host !== 'web',
|
|
44107
|
+
get_file: host === 'web'
|
|
44108
|
+
}, defaultValue: defaultValue, onChange: onChange, client: client, inputProps: __assign(__assign({}, field), { accept: input.extensions.map(function (e) { return ".".concat(e); }).join(', ') }), hidden: hidden }));
|
|
44058
44109
|
} });
|
|
44059
44110
|
case 'DAGStringInput':
|
|
44060
44111
|
return typeof ((_a = input.spec) === null || _a === void 0 ? void 0 : _a.enum) !== 'undefined' ?
|
|
@@ -44127,17 +44178,6 @@ var CreateStudy = function (_a) {
|
|
|
44127
44178
|
var projectOwner = !state || !state.account ? undefined : ((_b = state.account.username) !== null && _b !== void 0 ? _b : state.account.account_name);
|
|
44128
44179
|
var projectSlug = !state || !state.project ? undefined : state.project.slug.split('/')[1];
|
|
44129
44180
|
var _e = useCreateStudy(projectOwner, projectSlug, client), host = _e.host, createStudy = _e.createStudy, createLocalStudy = _e.createLocalStudy;
|
|
44130
|
-
var _f = useState({
|
|
44131
|
-
localCPUCount: 1,
|
|
44132
|
-
localRunFolder: 'C:',
|
|
44133
|
-
isLocalJob: false,
|
|
44134
|
-
cloudProjectName: state.project && state.project.slug
|
|
44135
|
-
}), localStudyConfig = _f[0], setLocalStudyConfig = _f[1];
|
|
44136
|
-
useEffect(function () {
|
|
44137
|
-
if (!state.project)
|
|
44138
|
-
return;
|
|
44139
|
-
setLocalStudyConfig(function (config) { return (__assign(__assign({}, config), { cloudProjectName: state.project.slug })); });
|
|
44140
|
-
}, [state]);
|
|
44141
44181
|
useEffect(function () {
|
|
44142
44182
|
if (!state.recipe)
|
|
44143
44183
|
return;
|
|
@@ -44152,17 +44192,17 @@ var CreateStudy = function (_a) {
|
|
|
44152
44192
|
}
|
|
44153
44193
|
window.open("".concat(basePath, "/").concat(accountName, "/projects/").concat(projectName, "/studies/").concat(studyId));
|
|
44154
44194
|
}, [basePath]);
|
|
44155
|
-
var handleCreateStudy = useCallback(function (name, data, description) {
|
|
44195
|
+
var handleCreateStudy = useCallback(function (name, data, description, localConfig) {
|
|
44156
44196
|
if (!state.recipe || !state.recipe.source) {
|
|
44157
44197
|
return new Promise(function (resolve, reject) { return resolve(); });
|
|
44158
44198
|
}
|
|
44159
44199
|
if (host !== 'web') {
|
|
44160
|
-
return createLocalStudy({ name: name, recipe: state.recipe, description: description }, data,
|
|
44200
|
+
return createLocalStudy({ name: name, recipe: state.recipe, description: description }, data, localConfig);
|
|
44161
44201
|
}
|
|
44162
44202
|
else {
|
|
44163
44203
|
return createStudy({ name: name, recipe: state.recipe, description: description }, data, handleCreateStudySuccess);
|
|
44164
44204
|
}
|
|
44165
|
-
}, [createStudy, createLocalStudy, handleCreateStudySuccess, host,
|
|
44205
|
+
}, [createStudy, createLocalStudy, handleCreateStudySuccess, host, state.recipe]);
|
|
44166
44206
|
return (React__default.createElement("div", { "data-testid": "CreateProject", style: __assign(__assign({}, defaultStyle), style) },
|
|
44167
44207
|
React__default.createElement(Tabs, { selectedIndex: activeTabIndex, onSelect: function (index) { return setActiveTabIndex(index); }, forceRenderTabPanel: true },
|
|
44168
44208
|
React__default.createElement("div", { style: {
|
|
@@ -44176,10 +44216,7 @@ var CreateStudy = function (_a) {
|
|
|
44176
44216
|
} },
|
|
44177
44217
|
React__default.createElement(Tab, null, "Select Recipe"),
|
|
44178
44218
|
state.recipe &&
|
|
44179
|
-
React__default.createElement(
|
|
44180
|
-
React__default.createElement(Tab, null, "Recipe Inputs"),
|
|
44181
|
-
host !== 'web' &&
|
|
44182
|
-
React__default.createElement(Tab, null, "Local Study")))),
|
|
44219
|
+
React__default.createElement(Tab, null, "Recipe Inputs"))),
|
|
44183
44220
|
React__default.createElement(TabPanel, { style: {
|
|
44184
44221
|
padding: '8px 8px'
|
|
44185
44222
|
} },
|
|
@@ -44212,16 +44249,7 @@ var CreateStudy = function (_a) {
|
|
|
44212
44249
|
.split('-')
|
|
44213
44250
|
.map(function (v) { return v.charAt(0).toUpperCase() + v.slice(1); })
|
|
44214
44251
|
.join(' ')),
|
|
44215
|
-
React__default.createElement(RecipeInputsForm, { client: client, projectOwner: projectOwner, projectName: projectSlug, recipe: state.recipe, onSubmit: handleCreateStudy })))
|
|
44216
|
-
React__default.createElement(TabPanel, { style: {
|
|
44217
|
-
padding: 8
|
|
44218
|
-
} },
|
|
44219
|
-
React__default.createElement("div", { style: {
|
|
44220
|
-
display: 'flex',
|
|
44221
|
-
flexDirection: 'column',
|
|
44222
|
-
gap: 24
|
|
44223
|
-
} },
|
|
44224
|
-
React__default.createElement(ConfigureLocalRun, { onChange: setLocalStudyConfig })))))));
|
|
44252
|
+
React__default.createElement(RecipeInputsForm, { client: client, projectOwner: projectOwner, projectName: projectSlug, recipe: state.recipe, onSubmit: handleCreateStudy })))))));
|
|
44225
44253
|
};
|
|
44226
44254
|
|
|
44227
44255
|
// Generated with util/create-component.js
|
|
@@ -46737,5 +46765,5 @@ var StudyCard = function (_a) {
|
|
|
46737
46765
|
React__default.createElement(RunsList, { projectOwner: projectOwner, projectName: projectName, jobId: [study.id], subscribe: !_study.status.finished_at, client: client, authUser: authUser }))));
|
|
46738
46766
|
};
|
|
46739
46767
|
|
|
46740
|
-
export { APIClient, AuthUser, Avatar, Button, ComboBox, ComboFileSelector, ConditionalWrapper, ConfigureLocalRun, CreateStudy, Dropdown, FileInput, FormInput, GetGeometry, GetModel, InputDescription, Label, Logo, NumberInput, RadioList, RecipeInputsForm, RunCard, SelectAccount, SelectCloudArtifacts, SelectLocalArtifacts, SelectProject, SelectRecipe, SelectRun, SelectStudy, SendGeometry, SendModel, SendResults, SettingsButton, StudyCard, TextInput, Tooltip, checkDotNet, checkPollinationPanel, checkRuby, formatBytes, getDuration, getHost, getSummaryColor, recipeLinkFromSource, sendMessageDotNet, sendMessageRuby, statusMap, useAPIClient, useArtifacts, useCreateStudy, useGetGeometry, useGetHbjson, useHbjsontoVTK, useJobs, useManageSettings, useRunCommand, useRuns, useSendHbjson, useSendMessage };
|
|
46768
|
+
export { APIClient, AuthUser, Avatar, Button, ComboBox, ComboFileSelector, ConditionalWrapper, ConfigureLocalRun, CreateStudy, Dropdown, FileInput, FormInput, GetGeometry, GetModel, InputDescription, Label, Logo, NumberInput, RadioList, RecipeInputsForm, RunCard, SelectAccount, SelectCloudArtifacts, SelectLocalArtifacts, SelectProject, SelectRecipe, SelectRun, SelectStudy, SendGeometry, SendModel, SendResults, SettingsButton, StudyCard, TextInput, Tooltip, _defaultConfig, checkDotNet, checkPollinationPanel, checkRuby, formatBytes, getDuration, getHost, getSummaryColor, recipeLinkFromSource, sendMessageDotNet, sendMessageRuby, statusMap, useAPIClient, useArtifacts, useCreateStudy, useGetGeometry, useGetHbjson, useHbjsontoVTK, useJobs, useManageSettings, useRunCommand, useRuns, useSendHbjson, useSendMessage };
|
|
46741
46769
|
//# sourceMappingURL=index.esm.js.map
|