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.
package/build/index.js CHANGED
@@ -38031,6 +38031,11 @@ var usePollinationPanel = function () {
38031
38031
  return;
38032
38032
  return panel.FromFileToBase64(filePath);
38033
38033
  }, [panel]);
38034
+ var fileExplorer = React.useCallback(function (root) {
38035
+ if (!panel)
38036
+ return;
38037
+ return panel.FileExplorer(root);
38038
+ }, [panel]);
38034
38039
  var fetchLocalRun = React.useCallback(function (path) {
38035
38040
  if (path === void 0) { path = ''; }
38036
38041
  if (!panel)
@@ -38066,7 +38071,8 @@ var usePollinationPanel = function () {
38066
38071
  fromFileToBase64: fromFileToBase64,
38067
38072
  getFilesFromDir: getFilesFromDir,
38068
38073
  fetchLocalRun: fetchLocalRun,
38069
- fetchLocalJob: fetchLocalJob
38074
+ fetchLocalJob: fetchLocalJob,
38075
+ fileExplorer: fileExplorer
38070
38076
  };
38071
38077
  };
38072
38078
 
@@ -48749,7 +48755,7 @@ var RunCard = function (_a) {
48749
48755
  var _b;
48750
48756
  var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
48751
48757
  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;
48752
- var _s = usePollinationPanel(), fetchLocalRun = _s.fetchLocalRun, fetchLocalJob = _s.fetchLocalJob;
48758
+ var _s = usePollinationPanel(), fetchLocalRun = _s.fetchLocalRun, fetchLocalJob = _s.fetchLocalJob, fileExplorer = _s.fileExplorer;
48753
48759
  var disabled = React.useMemo(function () {
48754
48760
  if (!localRun)
48755
48761
  return;
@@ -48925,9 +48931,14 @@ var RunCard = function (_a) {
48925
48931
  React__default["default"].createElement(FolderOutlined$1, { className: 'link', onClick: function (e) {
48926
48932
  e.stopPropagation();
48927
48933
  getTab(RunTabs.workspace);
48928
- toggleHover(RunTabs.workspace, true);
48929
- toggleHover(RunTabs.details, false);
48930
- toggleHover(RunTabs.debug, false);
48934
+ if (localRun) {
48935
+ fileExplorer(_run.id);
48936
+ }
48937
+ else {
48938
+ toggleHover(RunTabs.workspace, true);
48939
+ toggleHover(RunTabs.details, false);
48940
+ toggleHover(RunTabs.debug, false);
48941
+ }
48931
48942
  }, onMouseOver: function (e) {
48932
48943
  toggleHover('workspaceOver', true);
48933
48944
  }, onMouseLeave: function (e) {
@@ -49428,6 +49439,8 @@ var FileCard = function (_a) {
49428
49439
  .finally(function () { return setIsLoading(false); });
49429
49440
  };
49430
49441
  var extension = React.useMemo(function () {
49442
+ if (!path)
49443
+ return;
49431
49444
  return path.split('/').reverse()[0];
49432
49445
  }, [path]);
49433
49446
  /**
@@ -49455,6 +49468,7 @@ var FileCard = function (_a) {
49455
49468
  }
49456
49469
  fetchAndSet("data:".concat(t, ";base64,").concat(base64Data));
49457
49470
  };
49471
+ var isPanel = React.useMemo(function () { return checkPollinationPanel(); }, []);
49458
49472
  React.useEffect(function () {
49459
49473
  if (isCloud) {
49460
49474
  // Generate Blob on click
@@ -49463,15 +49477,15 @@ var FileCard = function (_a) {
49463
49477
  .catch(function () { return onClicked({ label: label, path: path, file: undefined, description: description, runId: runId }); });
49464
49478
  }
49465
49479
  else {
49466
- var isPanel = checkPollinationPanel();
49467
49480
  if (!isPanel) {
49468
49481
  setIsInactive(true);
49469
49482
  setCurrFile(undefined);
49470
49483
  setCADintegration(undefined);
49471
49484
  setIsLoading(false);
49472
- return;
49473
49485
  }
49474
- base64AndFetch(path);
49486
+ else {
49487
+ base64AndFetch(path);
49488
+ }
49475
49489
  }
49476
49490
  }, [studyId, runId, label, path]);
49477
49491
  return React__default["default"].createElement("div", { className: isInactive
@@ -49486,7 +49500,7 @@ var FileCard = function (_a) {
49486
49500
  React__default["default"].createElement("div", { style: { float: 'left', margin: '0 8px 0 0' } }, !isLoading ? React__default["default"].createElement("div", { title: !isInactive
49487
49501
  ? 'Open the viewer'
49488
49502
  : 'File is missing. Check run workspace' },
49489
- React__default["default"].createElement("span", { style: { margin: '0 8px 0 0' } }, getFileIcon(18, ((_c = (_b = path.split('/')
49503
+ React__default["default"].createElement("span", { style: { margin: '0 8px 0 0' } }, path && getFileIcon(18, ((_c = (_b = path.split('/')
49490
49504
  .reverse()[0]) === null || _b === void 0 ? void 0 : _b.split('.')) === null || _c === void 0 ? void 0 : _c.pop()) || '')),
49491
49505
  label)
49492
49506
  : React__default["default"].createElement(LoadingIcon, { size: 14 })),
@@ -49555,6 +49569,7 @@ styleInject(css_248z$2);
49555
49569
  var RunContent = function (_a) {
49556
49570
  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;
49557
49571
  var _c = React.useState([]), currData = _c[0], setCurrData = _c[1];
49572
+ var fileExplorer = usePollinationPanel().fileExplorer;
49558
49573
  var _d = React.useState([]), currParams = _d[0], setCurrParams = _d[1];
49559
49574
  var _e = React.useState([]), currFiles = _e[0], setCurrFiles = _e[1];
49560
49575
  var _f = React.useState([]), currFolders = _f[0], setCurrFolders = _f[1];
@@ -49604,14 +49619,9 @@ var RunContent = function (_a) {
49604
49619
  * @param card Folder card props
49605
49620
  */
49606
49621
  var onFolderClicked = function (card) {
49607
- if (isCloud) {
49608
- getFolderCard(card);
49609
- // window.location.href = `/${projectOwner}/projects/${projectName}/studies/${studyId}/runs/${runId}/workspace?path=${card.path}`
49610
- }
49611
- else {
49612
- // TODO: Fix it later when Local is ready
49613
- getFolderCard(card);
49614
- // alert(runId.concat('/').concat(card.path))
49622
+ getFolderCard(card);
49623
+ if (!isCloud) {
49624
+ fileExplorer(card.path);
49615
49625
  }
49616
49626
  };
49617
49627
  return React__default["default"].createElement("div", { className: 'cards-container', style: __assign({}, style) },