pollination-react-io 1.62.6 → 1.63.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
@@ -38146,6 +38146,25 @@ var usePollinationPanel = function () {
38146
38146
  return undefined;
38147
38147
  }
38148
38148
  };
38149
+ /**
38150
+ * Delete job with the same input/ouput folder from DB
38151
+ * @param projectSlug Project slug
38152
+ * @param path Location where files are
38153
+ * @returns Message with number of deleted records
38154
+ */
38155
+ var deleteJob = function (projectSlug, path) {
38156
+ if (!panel)
38157
+ return;
38158
+ try {
38159
+ var message = panel.DeleteJob(projectSlug, path);
38160
+ var count = JSON.parse(message.data);
38161
+ return count;
38162
+ }
38163
+ catch (error) {
38164
+ // Do nothing. It is written at the end
38165
+ return undefined;
38166
+ }
38167
+ };
38149
38168
  return {
38150
38169
  getFileBase64: getFileBase64,
38151
38170
  saveFileBase64: saveFileBase64,
@@ -38156,7 +38175,8 @@ var usePollinationPanel = function () {
38156
38175
  fetchLocalLog: fetchLocalLog,
38157
38176
  fileExplorer: fileExplorer,
38158
38177
  getPaginatedJob: getPaginatedJob,
38159
- getJob: getJob
38178
+ getJob: getJob,
38179
+ deleteJob: deleteJob
38160
38180
  };
38161
38181
  };
38162
38182
 
@@ -48839,7 +48859,7 @@ var RunCard = function (_a) {
48839
48859
  var _b;
48840
48860
  var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
48841
48861
  var projectName = _a.projectName, projectOwner = _a.projectOwner, _run = _a.run, style = _a.style, authUser = _a.authUser, client = _a.client, enableClick = _a.enableClick, getTab = _a.getTab, defaultTab = _a.defaultTab, getValue = _a.getValue, _o = _a.interval, interval = _o === void 0 ? 5000 : _o, _p = _a.canWrite, canWrite = _p === void 0 ? false : _p, _q = _a.localRun, localRun = _q === void 0 ? false : _q, _r = _a.loaderNode, loaderNode = _r === void 0 ? undefined : _r;
48842
- var _s = usePollinationPanel(), fetchLocalRun = _s.fetchLocalRun, fetchLocalJob = _s.fetchLocalJob, fileExplorer = _s.fileExplorer;
48862
+ var _s = usePollinationPanel(), fetchLocalRun = _s.fetchLocalRun, fetchLocalJob = _s.fetchLocalJob, fileExplorer = _s.fileExplorer, deleteJob = _s.deleteJob;
48843
48863
  var disabled = React.useMemo(function () {
48844
48864
  if (!localRun)
48845
48865
  return;
@@ -49141,21 +49161,30 @@ var RunCard = function (_a) {
49141
49161
  localRun && localStudy && localStudy.description)),
49142
49162
  seeAction && width && React__default["default"].createElement(React__default["default"].Fragment, null,
49143
49163
  React__default["default"].createElement("div", { className: 'item7' },
49144
- React__default["default"].createElement(Button, { style: (width > 600) ? { display: 'inline' } : { display: 'inline', float: 'left' }, disabled: !run || (run.status.status === dist$1.RunStatusEnum.Failed ||
49164
+ !localRun && React__default["default"].createElement(Button, { style: (width > 600) ? { display: 'inline' } : { display: 'inline', float: 'left' }, disabled: !run || (run.status.status === dist$1.RunStatusEnum.Failed ||
49145
49165
  run.status.status === dist$1.RunStatusEnum.Succeeded ||
49146
49166
  run.status.status === dist$1.RunStatusEnum.Cancelled ||
49147
49167
  run.status.status === dist$1.RunStatusEnum.Unknown), onClick: function (e) {
49148
49168
  e.stopPropagation();
49149
49169
  if (!run)
49150
49170
  return;
49151
- if (!localRun) {
49152
- cancelRun(projectOwner, projectName, run.id)
49153
- .then(function (d) { return console.log(d); })
49154
- .catch(function (e) { return console.log(e); });
49155
- }
49171
+ cancelRun(projectOwner, projectName, run.id)
49172
+ .then(function (d) { return console.log(d); })
49173
+ .catch(function (e) { return console.log(e); });
49156
49174
  } },
49157
49175
  React__default["default"].createElement(XOctagon$1, { style: { display: 'inline', margin: '0 5px 0 0' } }),
49158
- " Cancel")))));
49176
+ " Cancel"),
49177
+ localRun && React__default["default"].createElement(Button, { style: (width > 600) ? { display: 'inline' } : { display: 'inline', float: 'left' }, disabled: !run || !run.status.finished_at, onClick: function (e) {
49178
+ e.stopPropagation();
49179
+ if (!run)
49180
+ return;
49181
+ var count = deleteJob("".concat(projectOwner, "/").concat(projectName), _run.id);
49182
+ if (count > 0) {
49183
+ window.history.go(-1);
49184
+ }
49185
+ } },
49186
+ React__default["default"].createElement(Trash$1, { style: { display: 'inline', margin: '0 5px 0 0' } }),
49187
+ " Delete")))));
49159
49188
  };
49160
49189
 
49161
49190
  var css_248z$5 = "";