pollination-react-io 1.60.0 → 1.62.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
@@ -38002,6 +38002,9 @@ var usePollinationPanel = function () {
38002
38002
  var panel = React.useMemo(function () {
38003
38003
  return checkPollinationPanel() && window.parent.chrome.webview.hostObjects.sync.study;
38004
38004
  }, []);
38005
+ /**
38006
+ * From base64 to file
38007
+ */
38005
38008
  var saveFileBase64 = React.useCallback(function (key, file, subFolder, fileName) { return __awaiter$1(void 0, void 0, void 0, function () {
38006
38009
  var base64;
38007
38010
  return __generator$1(this, function (_a) {
@@ -38020,6 +38023,9 @@ var usePollinationPanel = function () {
38020
38023
  }
38021
38024
  });
38022
38025
  }); }, [panel]);
38026
+ /**
38027
+ * Select a file and generate base64 representation
38028
+ */
38023
38029
  var getFileBase64 = React.useCallback(function (key, accept) {
38024
38030
  if (key === void 0) { key = performance.now().toString(); }
38025
38031
  if (accept === void 0) { accept = 'HBJSON|*.hbjson'; }
@@ -38027,21 +38033,33 @@ var usePollinationPanel = function () {
38027
38033
  return;
38028
38034
  return panel.GetArtifactAsBase64(key, accept);
38029
38035
  }, [panel]);
38036
+ /**
38037
+ * Get file paths from dir
38038
+ */
38030
38039
  var getFilesFromDir = React.useCallback(function (root) {
38031
38040
  if (!panel)
38032
38041
  return;
38033
38042
  return panel.GetFilePaths(root);
38034
38043
  }, [panel]);
38044
+ /**
38045
+ * From file path to base64
38046
+ */
38035
38047
  var fromFileToBase64 = React.useCallback(function (filePath) {
38036
38048
  if (!panel)
38037
38049
  return;
38038
38050
  return panel.FromFileToBase64(filePath);
38039
38051
  }, [panel]);
38052
+ /**
38053
+ * Run file explorer
38054
+ */
38040
38055
  var fileExplorer = React.useCallback(function (root) {
38041
38056
  if (!panel)
38042
38057
  return;
38043
38058
  return panel.FileExplorer(root);
38044
38059
  }, [panel]);
38060
+ /**
38061
+ * Fetch local run
38062
+ */
38045
38063
  var fetchLocalRun = React.useCallback(function (path) {
38046
38064
  if (path === void 0) { path = ''; }
38047
38065
  if (!panel)
@@ -38055,6 +38073,9 @@ var usePollinationPanel = function () {
38055
38073
  throw error;
38056
38074
  }
38057
38075
  }, [panel]);
38076
+ /**
38077
+ * Fetch local job
38078
+ */
38058
38079
  var fetchLocalJob = React.useCallback(function (path) {
38059
38080
  var _a;
38060
38081
  if (path === void 0) { path = ''; }
@@ -38071,6 +38092,9 @@ var usePollinationPanel = function () {
38071
38092
  return undefined;
38072
38093
  }
38073
38094
  }, [panel]);
38095
+ /**
38096
+ * Fetch local log
38097
+ */
38074
38098
  var fetchLocalLog = React.useCallback(function (path) {
38075
38099
  if (path === void 0) { path = ''; }
38076
38100
  if (!panel)
@@ -38084,6 +38108,44 @@ var usePollinationPanel = function () {
38084
38108
  return undefined;
38085
38109
  }
38086
38110
  }, [panel]);
38111
+ /**
38112
+ * Get array of ProjectJobInfo from DB
38113
+ * @param projectSlug Project slug <USER/PROJECT_NAME>
38114
+ * @param pageSize Page size
38115
+ * @param curPage Current page
38116
+ * @returns Array of ProjectJobInfo
38117
+ */
38118
+ var getPaginatedJob = function (projectSlug, pageSize, curPage) {
38119
+ if (!panel)
38120
+ return;
38121
+ try {
38122
+ var message = panel.GetPaginatedJob(projectSlug, pageSize, curPage);
38123
+ var arr = JSON.parse(message.data);
38124
+ return arr;
38125
+ }
38126
+ catch (error) {
38127
+ // Do nothing. It is written at the end
38128
+ return undefined;
38129
+ }
38130
+ };
38131
+ /**
38132
+ * Get array of ProjectJobInfo from DB
38133
+ * @param projectSlug Project slug
38134
+ * @returns Array of ProjectJobInfo
38135
+ */
38136
+ var getJob = function (projectSlug) {
38137
+ if (!panel)
38138
+ return;
38139
+ try {
38140
+ var message = panel.GetJob(projectSlug);
38141
+ var arr = JSON.parse(message.data);
38142
+ return arr;
38143
+ }
38144
+ catch (error) {
38145
+ // Do nothing. It is written at the end
38146
+ return undefined;
38147
+ }
38148
+ };
38087
38149
  return {
38088
38150
  getFileBase64: getFileBase64,
38089
38151
  saveFileBase64: saveFileBase64,
@@ -38092,7 +38154,9 @@ var usePollinationPanel = function () {
38092
38154
  fetchLocalRun: fetchLocalRun,
38093
38155
  fetchLocalJob: fetchLocalJob,
38094
38156
  fetchLocalLog: fetchLocalLog,
38095
- fileExplorer: fileExplorer
38157
+ fileExplorer: fileExplorer,
38158
+ getPaginatedJob: getPaginatedJob,
38159
+ getJob: getJob
38096
38160
  };
38097
38161
  };
38098
38162
 
@@ -48881,6 +48945,13 @@ var RunCard = function (_a) {
48881
48945
  var _a;
48882
48946
  setHover(__assign(__assign({}, initialValues), (_a = {}, _a[defaultTab] = true, _a)));
48883
48947
  }, [defaultTab]);
48948
+ var localStudyURLname = React.useMemo(function () {
48949
+ if (!localStudy)
48950
+ return;
48951
+ return localStudy.name
48952
+ .replace(/[^a-zA-Z0-9]/g, '')
48953
+ .replace(/[ ()]/g, '');
48954
+ }, [localStudy]);
48884
48955
  /**
48885
48956
  * Rendering - if error
48886
48957
  */
@@ -48908,6 +48979,9 @@ var RunCard = function (_a) {
48908
48979
  if (!localRun) {
48909
48980
  window.location.href = "/".concat(projectOwner, "/projects/").concat(projectName, "/studies/").concat(study.id, "/runs/").concat(run.id);
48910
48981
  }
48982
+ else {
48983
+ window.location.href = "/".concat(projectOwner, "/projects/").concat(projectName, "/localStudies/").concat(localStudyURLname, "/?path=").concat(_run.id);
48984
+ }
48911
48985
  } },
48912
48986
  React__default["default"].createElement("div", { className: 'item1' },
48913
48987
  React__default["default"].createElement("button", { className: 'link', style: { all: 'unset', cursor: 'pointer', marginRight: '0.75rem' }, title: 'Go to account page', onMouseOver: function (e) { return toggleHover('account', true); }, onMouseLeave: function (e) { return toggleHover('account', false); }, onClick: function (e) {
@@ -48974,10 +49048,7 @@ var RunCard = function (_a) {
48974
49048
  getTab(RunTabs.debug);
48975
49049
  if (localRun) {
48976
49050
  // Get study name
48977
- var cleanName = localStudy.name
48978
- .replace(/[^a-zA-Z0-9]/g, '')
48979
- .replace(/[ ()]/g, '');
48980
- var path = "".concat(_run.id, "/").concat(cleanName, "/__logs__/logs.log");
49051
+ var path = "".concat(_run.id, "/").concat(localStudyURLname, "/__logs__/logs.log");
48981
49052
  fileExplorer(path);
48982
49053
  }
48983
49054
  else {
@@ -50608,6 +50679,7 @@ exports.useGetHbjson = useGetHbjson;
50608
50679
  exports.useHbjsontoVTK = useHbjsontoVTK;
50609
50680
  exports.useJobs = useJobs;
50610
50681
  exports.useManageSettings = useManageSettings;
50682
+ exports.usePollinationPanel = usePollinationPanel;
50611
50683
  exports.useRunCommand = useRunCommand;
50612
50684
  exports.useRuns = useRuns;
50613
50685
  exports.useSendHbjson = useSendHbjson;