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.
package/build/index.js CHANGED
@@ -37976,6 +37976,12 @@ function formatBytes(bytes, decimals) {
37976
37976
  return "".concat(parseFloat((bytes / Math.pow(k, i)).toFixed(dm)), " ").concat(sizes[i]);
37977
37977
  }
37978
37978
 
37979
+ var SimulationFileType;
37980
+ (function (SimulationFileType) {
37981
+ SimulationFileType[SimulationFileType["status"] = 0] = "status";
37982
+ SimulationFileType[SimulationFileType["job"] = 1] = "job";
37983
+ SimulationFileType[SimulationFileType["logs"] = 2] = "logs";
37984
+ })(SimulationFileType || (SimulationFileType = {}));
37979
37985
  function blobToBase64(blob) {
37980
37986
  return __awaiter$1(this, void 0, void 0, function () {
37981
37987
  return __generator$1(this, function (_a) {
@@ -38040,8 +38046,8 @@ var usePollinationPanel = function () {
38040
38046
  if (path === void 0) { path = ''; }
38041
38047
  if (!panel)
38042
38048
  return;
38043
- var message = panel.FetchLocalRun(path);
38044
38049
  try {
38050
+ var message = panel.FetchSimulationFile(path, SimulationFileType[SimulationFileType.status]);
38045
38051
  var run = JSON.parse(message.data);
38046
38052
  return run;
38047
38053
  }
@@ -38054,8 +38060,8 @@ var usePollinationPanel = function () {
38054
38060
  if (path === void 0) { path = ''; }
38055
38061
  if (!panel)
38056
38062
  return;
38057
- var message = panel.FetchLocalJob(path);
38058
38063
  try {
38064
+ var message = panel.FetchSimulationFile(path, SimulationFileType[SimulationFileType.job]);
38059
38065
  var localJob = JSON.parse(message.data);
38060
38066
  var job = (_a = localJob === null || localJob === void 0 ? void 0 : localJob.LocalJob) === null || _a === void 0 ? void 0 : _a.Job;
38061
38067
  return job;
@@ -38065,6 +38071,19 @@ var usePollinationPanel = function () {
38065
38071
  return undefined;
38066
38072
  }
38067
38073
  }, [panel]);
38074
+ var fetchLocalLog = React.useCallback(function (path) {
38075
+ if (path === void 0) { path = ''; }
38076
+ if (!panel)
38077
+ return;
38078
+ try {
38079
+ var message = panel.FetchSimulationFile(path, SimulationFileType[SimulationFileType.logs]);
38080
+ return message.data;
38081
+ }
38082
+ catch (error) {
38083
+ // Do nothing. It is written at the end
38084
+ return undefined;
38085
+ }
38086
+ }, [panel]);
38068
38087
  return {
38069
38088
  getFileBase64: getFileBase64,
38070
38089
  saveFileBase64: saveFileBase64,
@@ -38072,6 +38091,7 @@ var usePollinationPanel = function () {
38072
38091
  getFilesFromDir: getFilesFromDir,
38073
38092
  fetchLocalRun: fetchLocalRun,
38074
38093
  fetchLocalJob: fetchLocalJob,
38094
+ fetchLocalLog: fetchLocalLog,
38075
38095
  fileExplorer: fileExplorer
38076
38096
  };
38077
38097
  };
@@ -48952,9 +48972,19 @@ var RunCard = function (_a) {
48952
48972
  return;
48953
48973
  e.stopPropagation();
48954
48974
  getTab(RunTabs.debug);
48955
- toggleHover(RunTabs.workspace, false);
48956
- toggleHover(RunTabs.details, false);
48957
- toggleHover(RunTabs.debug, true);
48975
+ if (localRun) {
48976
+ // 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");
48981
+ fileExplorer(path);
48982
+ }
48983
+ else {
48984
+ toggleHover(RunTabs.workspace, false);
48985
+ toggleHover(RunTabs.details, false);
48986
+ toggleHover(RunTabs.debug, true);
48987
+ }
48958
48988
  }, onMouseOver: function (e) {
48959
48989
  toggleHover('debugOver', true);
48960
48990
  }, onMouseLeave: function (e) {