pollination-react-io 1.25.1 → 1.25.2

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.
@@ -44183,23 +44183,33 @@ var CreateStudy = function (_a) {
44183
44183
  if (!basePath) {
44184
44184
  throw new Error('CreateStudy: client.configuration.basepath not defined.');
44185
44185
  }
44186
- // for streamlit apps have to use window.open instead of window.location.href
44187
- window.open("".concat(basePath, "/").concat(accountName, "/projects/").concat(projectName, "/studies/").concat(studyId));
44188
- }, [basePath]);
44189
- var handleCreateStudy = useCallback(function (name, data, description, localConfig) {
44186
+ window.location.href = "".concat(basePath, "/").concat(accountName, "/projects/").concat(projectName, "/studies/").concat(studyId);
44187
+ }, []);
44188
+ var handleCreateStudySuccessLocal = useCallback(function (accountName, projectName, studyId) {
44189
+ console.log("Study is running! Do not close the console.\nYou will find output here ".concat(studyId, "."));
44190
+ }, []);
44191
+ var handleCreateStudy = useCallback(function (name, jobArgs, description, localConfig) {
44190
44192
  if (!selRecipe) {
44191
- return new Promise(function (resolve, reject) { return resolve(); });
44193
+ return Promise.reject();
44192
44194
  }
44193
- var handleSuccess = createStudySuccess !== null && createStudySuccess !== void 0 ? createStudySuccess : handleCreateStudySuccess;
44194
- // don't attempt navigation if the study is a local study
44195
- var handleWebSuccess = localConfig && localConfig.isLocalJob ? handleSuccess : undefined;
44196
- if (host !== 'web') {
44197
- return createLocalStudy({ name: name, recipe: selRecipe, description: description }, data, localConfig, handleWebSuccess);
44195
+ // Custom cloud action
44196
+ var handleCloudSuccess = createStudySuccess !== null && createStudySuccess !== void 0 ? createStudySuccess : handleCreateStudySuccess;
44197
+ var handleSuccess = localConfig && localConfig.isLocalJob ? handleCreateStudySuccessLocal : handleCloudSuccess;
44198
+ if (host !== 'web' && localConfig) {
44199
+ return createLocalStudy({
44200
+ name: name,
44201
+ recipe: selRecipe,
44202
+ description: description !== null && description !== void 0 ? description : 'Study created from pollination',
44203
+ }, jobArgs, localConfig, handleSuccess);
44198
44204
  }
44199
44205
  else {
44200
- return createStudy({ name: name, recipe: selRecipe, description: description }, data, handleWebSuccess);
44206
+ return createStudy({
44207
+ name: name,
44208
+ recipe: selRecipe,
44209
+ description: description !== null && description !== void 0 ? description : 'Study created from pollination',
44210
+ }, jobArgs, handleCloudSuccess);
44201
44211
  }
44202
- }, [createLocalStudy, createStudy, createStudySuccess, handleCreateStudySuccess, host, selRecipe]);
44212
+ }, [selRecipe, host, createLocalStudy, handleCreateStudySuccess, createStudySuccess, createStudy]);
44203
44213
  return (React__default.createElement("div", { "data-testid": "CreateProject", style: __assign(__assign({}, defaultStyle), style) },
44204
44214
  React__default.createElement(Tabs, { selectedIndex: activeTabIndex, onSelect: function (index) { return setActiveTabIndex(index); }, forceRenderTabPanel: true },
44205
44215
  React__default.createElement("div", { style: {