pollination-react-io 1.58.0 → 1.59.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,4 +7,5 @@ export declare const usePollinationPanel: () => {
7
7
  getFilesFromDir: (root: any) => PanelMessageOut;
8
8
  fetchLocalRun: (path?: any) => Run;
9
9
  fetchLocalJob: (path?: any) => Job;
10
+ fileExplorer: (root: string) => PanelMessageOut;
10
11
  };
@@ -38005,6 +38005,11 @@ var usePollinationPanel = function () {
38005
38005
  return;
38006
38006
  return panel.FromFileToBase64(filePath);
38007
38007
  }, [panel]);
38008
+ var fileExplorer = useCallback(function (root) {
38009
+ if (!panel)
38010
+ return;
38011
+ return panel.FileExplorer(root);
38012
+ }, [panel]);
38008
38013
  var fetchLocalRun = useCallback(function (path) {
38009
38014
  if (path === void 0) { path = ''; }
38010
38015
  if (!panel)
@@ -38040,7 +38045,8 @@ var usePollinationPanel = function () {
38040
38045
  fromFileToBase64: fromFileToBase64,
38041
38046
  getFilesFromDir: getFilesFromDir,
38042
38047
  fetchLocalRun: fetchLocalRun,
38043
- fetchLocalJob: fetchLocalJob
38048
+ fetchLocalJob: fetchLocalJob,
38049
+ fileExplorer: fileExplorer
38044
38050
  };
38045
38051
  };
38046
38052
 
@@ -48723,7 +48729,7 @@ var RunCard = function (_a) {
48723
48729
  var _b;
48724
48730
  var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
48725
48731
  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;
48726
- var _s = usePollinationPanel(), fetchLocalRun = _s.fetchLocalRun, fetchLocalJob = _s.fetchLocalJob;
48732
+ var _s = usePollinationPanel(), fetchLocalRun = _s.fetchLocalRun, fetchLocalJob = _s.fetchLocalJob, fileExplorer = _s.fileExplorer;
48727
48733
  var disabled = useMemo(function () {
48728
48734
  if (!localRun)
48729
48735
  return;
@@ -48899,9 +48905,14 @@ var RunCard = function (_a) {
48899
48905
  React__default.createElement(FolderOutlined$1, { className: 'link', onClick: function (e) {
48900
48906
  e.stopPropagation();
48901
48907
  getTab(RunTabs.workspace);
48902
- toggleHover(RunTabs.workspace, true);
48903
- toggleHover(RunTabs.details, false);
48904
- toggleHover(RunTabs.debug, false);
48908
+ if (localRun) {
48909
+ fileExplorer(_run.id);
48910
+ }
48911
+ else {
48912
+ toggleHover(RunTabs.workspace, true);
48913
+ toggleHover(RunTabs.details, false);
48914
+ toggleHover(RunTabs.debug, false);
48915
+ }
48905
48916
  }, onMouseOver: function (e) {
48906
48917
  toggleHover('workspaceOver', true);
48907
48918
  }, onMouseLeave: function (e) {
@@ -49402,6 +49413,8 @@ var FileCard = function (_a) {
49402
49413
  .finally(function () { return setIsLoading(false); });
49403
49414
  };
49404
49415
  var extension = useMemo(function () {
49416
+ if (!path)
49417
+ return;
49405
49418
  return path.split('/').reverse()[0];
49406
49419
  }, [path]);
49407
49420
  /**
@@ -49429,6 +49442,7 @@ var FileCard = function (_a) {
49429
49442
  }
49430
49443
  fetchAndSet("data:".concat(t, ";base64,").concat(base64Data));
49431
49444
  };
49445
+ var isPanel = useMemo(function () { return checkPollinationPanel(); }, []);
49432
49446
  useEffect(function () {
49433
49447
  if (isCloud) {
49434
49448
  // Generate Blob on click
@@ -49437,15 +49451,15 @@ var FileCard = function (_a) {
49437
49451
  .catch(function () { return onClicked({ label: label, path: path, file: undefined, description: description, runId: runId }); });
49438
49452
  }
49439
49453
  else {
49440
- var isPanel = checkPollinationPanel();
49441
49454
  if (!isPanel) {
49442
49455
  setIsInactive(true);
49443
49456
  setCurrFile(undefined);
49444
49457
  setCADintegration(undefined);
49445
49458
  setIsLoading(false);
49446
- return;
49447
49459
  }
49448
- base64AndFetch(path);
49460
+ else {
49461
+ base64AndFetch(path);
49462
+ }
49449
49463
  }
49450
49464
  }, [studyId, runId, label, path]);
49451
49465
  return React__default.createElement("div", { className: isInactive
@@ -49460,7 +49474,7 @@ var FileCard = function (_a) {
49460
49474
  React__default.createElement("div", { style: { float: 'left', margin: '0 8px 0 0' } }, !isLoading ? React__default.createElement("div", { title: !isInactive
49461
49475
  ? 'Open the viewer'
49462
49476
  : 'File is missing. Check run workspace' },
49463
- React__default.createElement("span", { style: { margin: '0 8px 0 0' } }, getFileIcon(18, ((_c = (_b = path.split('/')
49477
+ React__default.createElement("span", { style: { margin: '0 8px 0 0' } }, path && getFileIcon(18, ((_c = (_b = path.split('/')
49464
49478
  .reverse()[0]) === null || _b === void 0 ? void 0 : _b.split('.')) === null || _c === void 0 ? void 0 : _c.pop()) || '')),
49465
49479
  label)
49466
49480
  : React__default.createElement(LoadingIcon, { size: 14 })),
@@ -49529,6 +49543,7 @@ styleInject(css_248z$2);
49529
49543
  var RunContent = function (_a) {
49530
49544
  var inputData = _a.inputData, projectOwner = _a.projectOwner, projectName = _a.projectName, studyId = _a.studyId, runId = _a.runId, client = _a.client, title = _a.title, style = _a.style, getFileCard = _a.getFileCard, getFolderCard = _a.getFolderCard, _b = _a.isCloud, isCloud = _b === void 0 ? true : _b;
49531
49545
  var _c = useState([]), currData = _c[0], setCurrData = _c[1];
49546
+ var fileExplorer = usePollinationPanel().fileExplorer;
49532
49547
  var _d = useState([]), currParams = _d[0], setCurrParams = _d[1];
49533
49548
  var _e = useState([]), currFiles = _e[0], setCurrFiles = _e[1];
49534
49549
  var _f = useState([]), currFolders = _f[0], setCurrFolders = _f[1];
@@ -49578,14 +49593,9 @@ var RunContent = function (_a) {
49578
49593
  * @param card Folder card props
49579
49594
  */
49580
49595
  var onFolderClicked = function (card) {
49581
- if (isCloud) {
49582
- getFolderCard(card);
49583
- // window.location.href = `/${projectOwner}/projects/${projectName}/studies/${studyId}/runs/${runId}/workspace?path=${card.path}`
49584
- }
49585
- else {
49586
- // TODO: Fix it later when Local is ready
49587
- getFolderCard(card);
49588
- // alert(runId.concat('/').concat(card.path))
49596
+ getFolderCard(card);
49597
+ if (!isCloud) {
49598
+ fileExplorer(card.path);
49589
49599
  }
49590
49600
  };
49591
49601
  return React__default.createElement("div", { className: 'cards-container', style: __assign({}, style) },