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.
@@ -44689,6 +44689,7 @@ var InputType;
44689
44689
  var RecipeForm = function (_a) {
44690
44690
  var _b, _c;
44691
44691
  var recipe = _a.recipe, projectName = _a.projectName, projectOwner = _a.projectOwner, client = _a.client, onSubmit = _a.onSubmit, _d = _a.style, style = _d === void 0 ? {} : _d;
44692
+ var getJob = usePollinationPanel().getJob;
44692
44693
  /**
44693
44694
  * Input mapping
44694
44695
  */
@@ -44732,7 +44733,8 @@ var RecipeForm = function (_a) {
44732
44733
  var _e = useForm({
44733
44734
  resolver: Oe(schema),
44734
44735
  mode: 'onChange'
44735
- }), control = _e.control, register = _e.register, handleSubmit = _e.handleSubmit, resetField = _e.resetField, _f = _e.formState, errors = _f.errors, isValid = _f.isValid;
44736
+ }), control = _e.control, register = _e.register, handleSubmit = _e.handleSubmit, resetField = _e.resetField, watch = _e.watch, _f = _e.formState, errors = _f.errors, isValid = _f.isValid;
44737
+ var watchStudyName = watch('study-name');
44736
44738
  /**
44737
44739
  * Form actions
44738
44740
  * @param data Output data
@@ -44805,6 +44807,40 @@ var RecipeForm = function (_a) {
44805
44807
  * Local study
44806
44808
  */
44807
44809
  var _g = useState(__assign(__assign({}, _defaultConfig), { cloudProjectName: projectName, cloudProjectOwner: projectOwner })), localConfig = _g[0], setLocalConfig = _g[1];
44810
+ /**
44811
+ * Warning for local study folder
44812
+ */
44813
+ var localStudyWarning = useMemo(function () {
44814
+ if (host === 'web' || !localConfig.isLocalJob
44815
+ || !localConfig.localRunFolder || !watchStudyName)
44816
+ return;
44817
+ var jobs = getJob("".concat(projectOwner, "/").concat(projectName));
44818
+ var studyName = watchStudyName
44819
+ .replace(/[^a-zA-Z0-9]/g, '')
44820
+ .replace(/[ ()]/g, '');
44821
+ var folderCheck = "".concat(localConfig.localRunFolder, "\\").concat(studyName);
44822
+ var status = jobs
44823
+ .filter(function (j) { return j.studyId === folderCheck; }).length !== 0;
44824
+ return status;
44825
+ }, [localConfig, watchStudyName]);
44826
+ useEffect(function () {
44827
+ if (!localStudyWarning)
44828
+ return;
44829
+ 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.", {
44830
+ duration: 8000,
44831
+ position: 'top-center',
44832
+ icon: '⚠️',
44833
+ style: { fontSize: '14px' },
44834
+ iconTheme: {
44835
+ primary: '#000',
44836
+ secondary: '#fff',
44837
+ },
44838
+ ariaProps: {
44839
+ role: 'alert',
44840
+ 'aria-live': 'assertive',
44841
+ },
44842
+ });
44843
+ }, [localStudyWarning]);
44808
44844
  return React__default.createElement("form", { id: recipe.metadata.name, onSubmit: handleSubmit(_onSubmit, onErrors) },
44809
44845
  React__default.createElement("div", { className: 'cards-container-recipe', style: __assign(__assign({}, style), { padding: '20px' }) },
44810
44846
  React__default.createElement("div", { style: { margin: '0 0 20px 0' } },
@@ -44863,6 +44899,7 @@ var RecipeForm = function (_a) {
44863
44899
  React__default.createElement("div", { style: { margin: '10px 0 0 0' } },
44864
44900
  host !== 'web' &&
44865
44901
  React__default.createElement(ConfigureLocalRun, { onChange: function (localConfig) { return setLocalConfig(localConfig); }, defaultVal: localConfig }),
44902
+ React__default.createElement(Ie, null),
44866
44903
  React__default.createElement(Button, { type: 'submit', style: { width: '100%',
44867
44904
  margin: '10px 0 0 0',
44868
44905
  justifyContent: 'center' }, disabled: isValid !== true, form: recipe.metadata.name }, "Create Study")));