pollination-react-io 1.12.0 → 1.12.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.
|
@@ -2,7 +2,7 @@ import { RecipeInterface } from '@pollination-solutions/pollination-sdk';
|
|
|
2
2
|
import { APIClient, PanelMessageOut } from '../hooks';
|
|
3
3
|
export interface RecipeInputsFormProps {
|
|
4
4
|
recipe: RecipeInterface;
|
|
5
|
-
onSubmit?: (name: string, jobArguments: any[], description?: string) => Promise<void> | Promise<PanelMessageOut
|
|
5
|
+
onSubmit?: (name: string, jobArguments: any[], description?: string) => Promise<void> | Promise<PanelMessageOut>;
|
|
6
6
|
projectOwner?: string;
|
|
7
7
|
projectName?: string;
|
|
8
8
|
client?: APIClient;
|
|
@@ -12,7 +12,7 @@ interface JobArgs {
|
|
|
12
12
|
}
|
|
13
13
|
export declare const useCreateStudy: (accountName: string, projectName: string, client: APIClient) => {
|
|
14
14
|
host: string;
|
|
15
|
-
createStudy: ({ name, source, description }: JobArgs, data: object) => Promise<void>;
|
|
15
|
+
createStudy: ({ name, source, description }: JobArgs, data: object, onSuccess?: (accountName: string, projectName: string, studyId: string) => void) => Promise<void>;
|
|
16
16
|
createLocalStudy: ({ name, source, description }: JobArgs, data: object, key?: string) => Promise<import("./types").PanelMessageIn>;
|
|
17
17
|
};
|
|
18
18
|
export {};
|
package/build/index.esm.js
CHANGED
|
@@ -21805,6 +21805,9 @@ var useCreateStudy = function (accountName, projectName, client) {
|
|
|
21805
21805
|
});
|
|
21806
21806
|
}
|
|
21807
21807
|
else {
|
|
21808
|
+
if (!uploadArtifact) {
|
|
21809
|
+
reject('useCreateStudy: uploadArtifact is undefined but the user needs to upload input files.');
|
|
21810
|
+
}
|
|
21808
21811
|
resolve(uploadArtifact(undefined, value)
|
|
21809
21812
|
.then(function (data) { return ({
|
|
21810
21813
|
name: name,
|
|
@@ -21817,14 +21820,11 @@ var useCreateStudy = function (accountName, projectName, client) {
|
|
|
21817
21820
|
}
|
|
21818
21821
|
});
|
|
21819
21822
|
}, [uploadArtifact]);
|
|
21820
|
-
var createStudy = useCallback(function (_a, data) {
|
|
21823
|
+
var createStudy = useCallback(function (_a, data, onSuccess) {
|
|
21821
21824
|
var name = _a.name, source = _a.source, description = _a.description;
|
|
21822
|
-
if (!client)
|
|
21823
|
-
return;
|
|
21824
|
-
|
|
21825
|
-
return;
|
|
21826
|
-
if (!uploadArtifact)
|
|
21827
|
-
return;
|
|
21825
|
+
if (!client || !name || !source || !data) {
|
|
21826
|
+
return new Promise(function (resolve, reject) { return resolve(); });
|
|
21827
|
+
}
|
|
21828
21828
|
return Promise.all(Object.entries(data).map(function (d) { return processEntry(d); }))
|
|
21829
21829
|
.then(function (jobArguments) {
|
|
21830
21830
|
var job = {
|
|
@@ -21835,21 +21835,21 @@ var useCreateStudy = function (accountName, projectName, client) {
|
|
|
21835
21835
|
source: source,
|
|
21836
21836
|
arguments: [jobArguments]
|
|
21837
21837
|
};
|
|
21838
|
-
client.jobs.createJob({
|
|
21838
|
+
return client.jobs.createJob({
|
|
21839
21839
|
owner: accountName,
|
|
21840
21840
|
name: projectName,
|
|
21841
21841
|
// @ts-ignore
|
|
21842
21842
|
job: job
|
|
21843
21843
|
})
|
|
21844
21844
|
.then(function (res) {
|
|
21845
|
-
|
|
21845
|
+
onSuccess && onSuccess(accountName, projectName, res.data.id);
|
|
21846
21846
|
})
|
|
21847
21847
|
.catch(function (err) {
|
|
21848
21848
|
var data = err.response.data;
|
|
21849
21849
|
throw new Error(data.detail);
|
|
21850
21850
|
});
|
|
21851
21851
|
});
|
|
21852
|
-
}, [accountName, client, processEntry, projectName
|
|
21852
|
+
}, [accountName, client, processEntry, projectName]);
|
|
21853
21853
|
var createLocalStudy = useCallback(function (_a, data, key) {
|
|
21854
21854
|
var name = _a.name, source = _a.source, description = _a.description;
|
|
21855
21855
|
if (key === void 0) { key = performance.now().toString(); }
|
|
@@ -39484,7 +39484,6 @@ var SelectCloudArtifacts = function (_a) {
|
|
|
39484
39484
|
.then(function (facts) {
|
|
39485
39485
|
var folders = facts.filter(function (f) { return f.file_type === 'folder'; });
|
|
39486
39486
|
var files = facts.filter(function (f) { return f.file_type === 'file'; });
|
|
39487
|
-
// const files = facts.filter(f => f.file_type === 'file' && f.file_name.match(fileNameMatch))
|
|
39488
39487
|
setArtifacts({ folders: folders, files: files });
|
|
39489
39488
|
})
|
|
39490
39489
|
.finally(function () { return setLoading(false); });
|
|
@@ -39913,7 +39912,7 @@ var ComboFileSelector = function (_a) {
|
|
|
39913
39912
|
case 'get_model':
|
|
39914
39913
|
return (React__default.createElement(GetModel, { onChange: onChange, inputProps: inputProps, showHelpText: false }));
|
|
39915
39914
|
case 'get_cloud':
|
|
39916
|
-
return (React__default.createElement(SelectCloudArtifacts, {
|
|
39915
|
+
return (React__default.createElement(SelectCloudArtifacts, { projectOwner: projectOwner, projectName: projectName, fileNameMatch: typeof inputProps.accept === 'string' ? ".*(".concat(inputProps.accept.replace(/\./g, '').split(', ').join('$|'), "$)") : undefined, onChange: onChange, client: client }));
|
|
39917
39916
|
case 'get_local':
|
|
39918
39917
|
return (React__default.createElement(SelectLocalArtifacts, { onChange: onChange }));
|
|
39919
39918
|
default:
|
|
@@ -39972,8 +39971,10 @@ var RecipeInputsForm = function (_a) {
|
|
|
39972
39971
|
}), control = _h.control, register = _h.register, handleSubmit = _h.handleSubmit, resetField = _h.resetField, _j = _h.formState, errors = _j.errors, isValid = _j.isValid; _j.isSubmitting;
|
|
39973
39972
|
var _onSubmit = function (_data) {
|
|
39974
39973
|
var data = __assign({}, _data);
|
|
39974
|
+
// strip study name
|
|
39975
39975
|
var studyName = data['study-name'];
|
|
39976
39976
|
delete data['study-name'];
|
|
39977
|
+
// strip default or null values
|
|
39977
39978
|
// @ts-ignore
|
|
39978
39979
|
var inputDefaults = new Map(recipe.inputs.map(function (i) { return [i.name, i.default]; }));
|
|
39979
39980
|
Object.entries(data).forEach(function (_a) {
|
|
@@ -39987,12 +39988,9 @@ var RecipeInputsForm = function (_a) {
|
|
|
39987
39988
|
});
|
|
39988
39989
|
if (typeof onSubmit !== 'undefined') {
|
|
39989
39990
|
setLoading(true);
|
|
39990
|
-
|
|
39991
|
-
|
|
39992
|
-
|
|
39993
|
-
return;
|
|
39994
|
-
}
|
|
39995
|
-
submit.finally(function () {
|
|
39991
|
+
onSubmit(studyName, data)
|
|
39992
|
+
.finally(function () {
|
|
39993
|
+
console.log('what??');
|
|
39996
39994
|
setLoading(false);
|
|
39997
39995
|
});
|
|
39998
39996
|
}
|
|
@@ -40006,7 +40004,11 @@ var RecipeInputsForm = function (_a) {
|
|
|
40006
40004
|
}
|
|
40007
40005
|
return p;
|
|
40008
40006
|
}, [[], []]);
|
|
40009
|
-
return (React__default.createElement(
|
|
40007
|
+
return (React__default.createElement("div", { style: {
|
|
40008
|
+
display: 'flex',
|
|
40009
|
+
flexDirection: 'column',
|
|
40010
|
+
gap: 20
|
|
40011
|
+
} },
|
|
40010
40012
|
React__default.createElement($409067139f391064$export$be92b6f5f03c0fe9, { style: {
|
|
40011
40013
|
display: 'flex',
|
|
40012
40014
|
flexDirection: 'column',
|
|
@@ -40107,7 +40109,7 @@ var RecipeInputsForm = function (_a) {
|
|
|
40107
40109
|
// @ts-ignore
|
|
40108
40110
|
name: input.name, control: control, render: function (_a) {
|
|
40109
40111
|
var _b = _a.field; _b.value; var onChange = _b.onChange, field = __rest(_b, ["value", "onChange"]);
|
|
40110
|
-
return (React__default.createElement(ComboFileSelector, { inputProps: __assign(__assign({}, field), { accept: input.extensions.map(function (e) { return ".".concat(e); }).join(', ') })
|
|
40112
|
+
return (React__default.createElement(ComboFileSelector, { projectOwner: projectOwner, projectName: projectName, defaultOption: getHost() === 'web' ? 'get_cloud' : 'get_file', onChange: onChange, client: client, inputProps: __assign(__assign({}, field), { accept: input.extensions.map(function (e) { return ".".concat(e); }).join(', ') }) }));
|
|
40111
40113
|
} });
|
|
40112
40114
|
case 'DAGStringInput':
|
|
40113
40115
|
return typeof ((_a = input.spec) === null || _a === void 0 ? void 0 : _a.enum) !== 'undefined' ?
|