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.
@@ -12,4 +12,5 @@ export declare const usePollinationPanel: () => {
12
12
  fileExplorer: (root: string) => PanelMessageOut;
13
13
  getPaginatedJob: (projectSlug: string, pageSize: number, curPage: number) => ProjectJobInfo[];
14
14
  getJob: (projectSlug: string) => ProjectJobInfo[];
15
+ deleteJob: (projectSlug: string, path: string) => any;
15
16
  };
@@ -38120,6 +38120,25 @@ var usePollinationPanel = function () {
38120
38120
  return undefined;
38121
38121
  }
38122
38122
  };
38123
+ /**
38124
+ * Delete job with the same input/ouput folder from DB
38125
+ * @param projectSlug Project slug
38126
+ * @param path Location where files are
38127
+ * @returns Message with number of deleted records
38128
+ */
38129
+ var deleteJob = function (projectSlug, path) {
38130
+ if (!panel)
38131
+ return;
38132
+ try {
38133
+ var message = panel.DeleteJob(projectSlug, path);
38134
+ var count = JSON.parse(message.data);
38135
+ return count;
38136
+ }
38137
+ catch (error) {
38138
+ // Do nothing. It is written at the end
38139
+ return undefined;
38140
+ }
38141
+ };
38123
38142
  return {
38124
38143
  getFileBase64: getFileBase64,
38125
38144
  saveFileBase64: saveFileBase64,
@@ -38130,7 +38149,8 @@ var usePollinationPanel = function () {
38130
38149
  fetchLocalLog: fetchLocalLog,
38131
38150
  fileExplorer: fileExplorer,
38132
38151
  getPaginatedJob: getPaginatedJob,
38133
- getJob: getJob
38152
+ getJob: getJob,
38153
+ deleteJob: deleteJob
38134
38154
  };
38135
38155
  };
38136
38156
 
@@ -48813,7 +48833,7 @@ var RunCard = function (_a) {
48813
48833
  var _b;
48814
48834
  var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
48815
48835
  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;
48816
- var _s = usePollinationPanel(), fetchLocalRun = _s.fetchLocalRun, fetchLocalJob = _s.fetchLocalJob, fileExplorer = _s.fileExplorer;
48836
+ var _s = usePollinationPanel(), fetchLocalRun = _s.fetchLocalRun, fetchLocalJob = _s.fetchLocalJob, fileExplorer = _s.fileExplorer, deleteJob = _s.deleteJob;
48817
48837
  var disabled = useMemo(function () {
48818
48838
  if (!localRun)
48819
48839
  return;
@@ -49115,21 +49135,30 @@ var RunCard = function (_a) {
49115
49135
  localRun && localStudy && localStudy.description)),
49116
49136
  seeAction && width && React__default.createElement(React__default.Fragment, null,
49117
49137
  React__default.createElement("div", { className: 'item7' },
49118
- React__default.createElement(Button, { style: (width > 600) ? { display: 'inline' } : { display: 'inline', float: 'left' }, disabled: !run || (run.status.status === dist$1.RunStatusEnum.Failed ||
49138
+ !localRun && React__default.createElement(Button, { style: (width > 600) ? { display: 'inline' } : { display: 'inline', float: 'left' }, disabled: !run || (run.status.status === dist$1.RunStatusEnum.Failed ||
49119
49139
  run.status.status === dist$1.RunStatusEnum.Succeeded ||
49120
49140
  run.status.status === dist$1.RunStatusEnum.Cancelled ||
49121
49141
  run.status.status === dist$1.RunStatusEnum.Unknown), onClick: function (e) {
49122
49142
  e.stopPropagation();
49123
49143
  if (!run)
49124
49144
  return;
49125
- if (!localRun) {
49126
- cancelRun(projectOwner, projectName, run.id)
49127
- .then(function (d) { return console.log(d); })
49128
- .catch(function (e) { return console.log(e); });
49129
- }
49145
+ cancelRun(projectOwner, projectName, run.id)
49146
+ .then(function (d) { return console.log(d); })
49147
+ .catch(function (e) { return console.log(e); });
49130
49148
  } },
49131
49149
  React__default.createElement(XOctagon$1, { style: { display: 'inline', margin: '0 5px 0 0' } }),
49132
- " Cancel")))));
49150
+ " Cancel"),
49151
+ localRun && React__default.createElement(Button, { style: (width > 600) ? { display: 'inline' } : { display: 'inline', float: 'left' }, disabled: !run || !run.status.finished_at, onClick: function (e) {
49152
+ e.stopPropagation();
49153
+ if (!run)
49154
+ return;
49155
+ var count = deleteJob("".concat(projectOwner, "/").concat(projectName), _run.id);
49156
+ if (count > 0) {
49157
+ window.history.go(-1);
49158
+ }
49159
+ } },
49160
+ React__default.createElement(Trash$1, { style: { display: 'inline', margin: '0 5px 0 0' } }),
49161
+ " Delete")))));
49133
49162
  };
49134
49163
 
49135
49164
  var css_248z$5 = "";