pollination-react-io 1.60.0 → 1.61.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,26 @@ 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
+ };
38087
38131
  return {
38088
38132
  getFileBase64: getFileBase64,
38089
38133
  saveFileBase64: saveFileBase64,
@@ -38092,7 +38136,8 @@ var usePollinationPanel = function () {
38092
38136
  fetchLocalRun: fetchLocalRun,
38093
38137
  fetchLocalJob: fetchLocalJob,
38094
38138
  fetchLocalLog: fetchLocalLog,
38095
- fileExplorer: fileExplorer
38139
+ fileExplorer: fileExplorer,
38140
+ getPaginatedJob: getPaginatedJob
38096
38141
  };
38097
38142
  };
38098
38143
 
@@ -50608,6 +50653,7 @@ exports.useGetHbjson = useGetHbjson;
50608
50653
  exports.useHbjsontoVTK = useHbjsontoVTK;
50609
50654
  exports.useJobs = useJobs;
50610
50655
  exports.useManageSettings = useManageSettings;
50656
+ exports.usePollinationPanel = usePollinationPanel;
50611
50657
  exports.useRunCommand = useRunCommand;
50612
50658
  exports.useRuns = useRuns;
50613
50659
  exports.useSendHbjson = useSendHbjson;