pollination-react-io 1.65.0 → 1.66.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/index.js CHANGED
@@ -44715,6 +44715,7 @@ var InputType;
44715
44715
  var RecipeForm = function (_a) {
44716
44716
  var _b, _c;
44717
44717
  var recipe = _a.recipe, projectName = _a.projectName, projectOwner = _a.projectOwner, client = _a.client, onSubmit = _a.onSubmit, _d = _a.style, style = _d === void 0 ? {} : _d;
44718
+ var getJob = usePollinationPanel().getJob;
44718
44719
  /**
44719
44720
  * Input mapping
44720
44721
  */
@@ -44758,7 +44759,8 @@ var RecipeForm = function (_a) {
44758
44759
  var _e = useForm({
44759
44760
  resolver: Oe(schema),
44760
44761
  mode: 'onChange'
44761
- }), control = _e.control, register = _e.register, handleSubmit = _e.handleSubmit, resetField = _e.resetField, _f = _e.formState, errors = _f.errors, isValid = _f.isValid;
44762
+ }), control = _e.control, register = _e.register, handleSubmit = _e.handleSubmit, resetField = _e.resetField, watch = _e.watch, _f = _e.formState, errors = _f.errors, isValid = _f.isValid;
44763
+ var watchStudyName = watch('study-name');
44762
44764
  /**
44763
44765
  * Form actions
44764
44766
  * @param data Output data
@@ -44831,6 +44833,40 @@ var RecipeForm = function (_a) {
44831
44833
  * Local study
44832
44834
  */
44833
44835
  var _g = React.useState(__assign(__assign({}, _defaultConfig), { cloudProjectName: projectName, cloudProjectOwner: projectOwner })), localConfig = _g[0], setLocalConfig = _g[1];
44836
+ /**
44837
+ * Warning for local study folder
44838
+ */
44839
+ var localStudyWarning = React.useMemo(function () {
44840
+ if (host === 'web' || !localConfig.isLocalJob
44841
+ || !localConfig.localRunFolder || !watchStudyName)
44842
+ return;
44843
+ var jobs = getJob("".concat(projectOwner, "/").concat(projectName));
44844
+ var studyName = watchStudyName
44845
+ .replace(/[^a-zA-Z0-9]/g, '')
44846
+ .replace(/[ ()]/g, '');
44847
+ var folderCheck = "".concat(localConfig.localRunFolder, "\\").concat(studyName);
44848
+ var status = jobs
44849
+ .filter(function (j) { return j.studyId === folderCheck; }).length !== 0;
44850
+ return status;
44851
+ }, [localConfig, watchStudyName]);
44852
+ React.useEffect(function () {
44853
+ if (!localStudyWarning)
44854
+ return;
44855
+ n$1("Study with the same name and Local run folder detected. \n If the study will be submitted it will override the previous data. \n You can change the study name or Local run folder to avoid the loss of data.", {
44856
+ duration: 8000,
44857
+ position: 'top-center',
44858
+ icon: '⚠️',
44859
+ style: { fontSize: '14px' },
44860
+ iconTheme: {
44861
+ primary: '#000',
44862
+ secondary: '#fff',
44863
+ },
44864
+ ariaProps: {
44865
+ role: 'alert',
44866
+ 'aria-live': 'assertive',
44867
+ },
44868
+ });
44869
+ }, [localStudyWarning]);
44834
44870
  return React__default["default"].createElement("form", { id: recipe.metadata.name, onSubmit: handleSubmit(_onSubmit, onErrors) },
44835
44871
  React__default["default"].createElement("div", { className: 'cards-container-recipe', style: __assign(__assign({}, style), { padding: '20px' }) },
44836
44872
  React__default["default"].createElement("div", { style: { margin: '0 0 20px 0' } },
@@ -44889,6 +44925,7 @@ var RecipeForm = function (_a) {
44889
44925
  React__default["default"].createElement("div", { style: { margin: '10px 0 0 0' } },
44890
44926
  host !== 'web' &&
44891
44927
  React__default["default"].createElement(ConfigureLocalRun, { onChange: function (localConfig) { return setLocalConfig(localConfig); }, defaultVal: localConfig }),
44928
+ React__default["default"].createElement(Ie, null),
44892
44929
  React__default["default"].createElement(Button, { type: 'submit', style: { width: '100%',
44893
44930
  margin: '10px 0 0 0',
44894
44931
  justifyContent: 'center' }, disabled: isValid !== true, form: recipe.metadata.name }, "Create Study")));