pollination-react-io 1.59.0 → 1.60.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.
@@ -7,5 +7,6 @@ export declare const usePollinationPanel: () => {
7
7
  getFilesFromDir: (root: any) => PanelMessageOut;
8
8
  fetchLocalRun: (path?: any) => Run;
9
9
  fetchLocalJob: (path?: any) => Job;
10
+ fetchLocalLog: (path?: any) => any;
10
11
  fileExplorer: (root: string) => PanelMessageOut;
11
12
  };
@@ -37950,6 +37950,12 @@ function formatBytes(bytes, decimals) {
37950
37950
  return "".concat(parseFloat((bytes / Math.pow(k, i)).toFixed(dm)), " ").concat(sizes[i]);
37951
37951
  }
37952
37952
 
37953
+ var SimulationFileType;
37954
+ (function (SimulationFileType) {
37955
+ SimulationFileType[SimulationFileType["status"] = 0] = "status";
37956
+ SimulationFileType[SimulationFileType["job"] = 1] = "job";
37957
+ SimulationFileType[SimulationFileType["logs"] = 2] = "logs";
37958
+ })(SimulationFileType || (SimulationFileType = {}));
37953
37959
  function blobToBase64(blob) {
37954
37960
  return __awaiter$1(this, void 0, void 0, function () {
37955
37961
  return __generator$1(this, function (_a) {
@@ -38014,8 +38020,8 @@ var usePollinationPanel = function () {
38014
38020
  if (path === void 0) { path = ''; }
38015
38021
  if (!panel)
38016
38022
  return;
38017
- var message = panel.FetchLocalRun(path);
38018
38023
  try {
38024
+ var message = panel.FetchSimulationFile(path, SimulationFileType[SimulationFileType.status]);
38019
38025
  var run = JSON.parse(message.data);
38020
38026
  return run;
38021
38027
  }
@@ -38028,8 +38034,8 @@ var usePollinationPanel = function () {
38028
38034
  if (path === void 0) { path = ''; }
38029
38035
  if (!panel)
38030
38036
  return;
38031
- var message = panel.FetchLocalJob(path);
38032
38037
  try {
38038
+ var message = panel.FetchSimulationFile(path, SimulationFileType[SimulationFileType.job]);
38033
38039
  var localJob = JSON.parse(message.data);
38034
38040
  var job = (_a = localJob === null || localJob === void 0 ? void 0 : localJob.LocalJob) === null || _a === void 0 ? void 0 : _a.Job;
38035
38041
  return job;
@@ -38039,6 +38045,19 @@ var usePollinationPanel = function () {
38039
38045
  return undefined;
38040
38046
  }
38041
38047
  }, [panel]);
38048
+ var fetchLocalLog = useCallback(function (path) {
38049
+ if (path === void 0) { path = ''; }
38050
+ if (!panel)
38051
+ return;
38052
+ try {
38053
+ var message = panel.FetchSimulationFile(path, SimulationFileType[SimulationFileType.logs]);
38054
+ return message.data;
38055
+ }
38056
+ catch (error) {
38057
+ // Do nothing. It is written at the end
38058
+ return undefined;
38059
+ }
38060
+ }, [panel]);
38042
38061
  return {
38043
38062
  getFileBase64: getFileBase64,
38044
38063
  saveFileBase64: saveFileBase64,
@@ -38046,6 +38065,7 @@ var usePollinationPanel = function () {
38046
38065
  getFilesFromDir: getFilesFromDir,
38047
38066
  fetchLocalRun: fetchLocalRun,
38048
38067
  fetchLocalJob: fetchLocalJob,
38068
+ fetchLocalLog: fetchLocalLog,
38049
38069
  fileExplorer: fileExplorer
38050
38070
  };
38051
38071
  };
@@ -48926,9 +48946,19 @@ var RunCard = function (_a) {
48926
48946
  return;
48927
48947
  e.stopPropagation();
48928
48948
  getTab(RunTabs.debug);
48929
- toggleHover(RunTabs.workspace, false);
48930
- toggleHover(RunTabs.details, false);
48931
- toggleHover(RunTabs.debug, true);
48949
+ if (localRun) {
48950
+ // Get study name
48951
+ var cleanName = localStudy.name
48952
+ .replace(/[^a-zA-Z0-9]/g, '')
48953
+ .replace(/[ ()]/g, '');
48954
+ var path = "".concat(_run.id, "/").concat(cleanName, "/__logs__/logs.log");
48955
+ fileExplorer(path);
48956
+ }
48957
+ else {
48958
+ toggleHover(RunTabs.workspace, false);
48959
+ toggleHover(RunTabs.details, false);
48960
+ toggleHover(RunTabs.debug, true);
48961
+ }
48932
48962
  }, onMouseOver: function (e) {
48933
48963
  toggleHover('debugOver', true);
48934
48964
  }, onMouseLeave: function (e) {