pollination-react-io 1.58.1 → 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/hooks/usePollinationPanel.d.ts +2 -0
- package/build/index.esm.js +55 -18
- package/build/index.esm.js.map +1 -1
- package/build/index.js +55 -18
- package/build/index.js.map +1 -1
- package/package.json +1 -1
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) {
|
@@ -38031,12 +38037,17 @@ var usePollinationPanel = function () {
|
|
38031
38037
|
return;
|
38032
38038
|
return panel.FromFileToBase64(filePath);
|
38033
38039
|
}, [panel]);
|
38040
|
+
var fileExplorer = React.useCallback(function (root) {
|
38041
|
+
if (!panel)
|
38042
|
+
return;
|
38043
|
+
return panel.FileExplorer(root);
|
38044
|
+
}, [panel]);
|
38034
38045
|
var fetchLocalRun = React.useCallback(function (path) {
|
38035
38046
|
if (path === void 0) { path = ''; }
|
38036
38047
|
if (!panel)
|
38037
38048
|
return;
|
38038
|
-
var message = panel.FetchLocalRun(path);
|
38039
38049
|
try {
|
38050
|
+
var message = panel.FetchSimulationFile(path, SimulationFileType[SimulationFileType.status]);
|
38040
38051
|
var run = JSON.parse(message.data);
|
38041
38052
|
return run;
|
38042
38053
|
}
|
@@ -38049,8 +38060,8 @@ var usePollinationPanel = function () {
|
|
38049
38060
|
if (path === void 0) { path = ''; }
|
38050
38061
|
if (!panel)
|
38051
38062
|
return;
|
38052
|
-
var message = panel.FetchLocalJob(path);
|
38053
38063
|
try {
|
38064
|
+
var message = panel.FetchSimulationFile(path, SimulationFileType[SimulationFileType.job]);
|
38054
38065
|
var localJob = JSON.parse(message.data);
|
38055
38066
|
var job = (_a = localJob === null || localJob === void 0 ? void 0 : localJob.LocalJob) === null || _a === void 0 ? void 0 : _a.Job;
|
38056
38067
|
return job;
|
@@ -38060,13 +38071,28 @@ var usePollinationPanel = function () {
|
|
38060
38071
|
return undefined;
|
38061
38072
|
}
|
38062
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]);
|
38063
38087
|
return {
|
38064
38088
|
getFileBase64: getFileBase64,
|
38065
38089
|
saveFileBase64: saveFileBase64,
|
38066
38090
|
fromFileToBase64: fromFileToBase64,
|
38067
38091
|
getFilesFromDir: getFilesFromDir,
|
38068
38092
|
fetchLocalRun: fetchLocalRun,
|
38069
|
-
fetchLocalJob: fetchLocalJob
|
38093
|
+
fetchLocalJob: fetchLocalJob,
|
38094
|
+
fetchLocalLog: fetchLocalLog,
|
38095
|
+
fileExplorer: fileExplorer
|
38070
38096
|
};
|
38071
38097
|
};
|
38072
38098
|
|
@@ -48749,7 +48775,7 @@ var RunCard = function (_a) {
|
|
48749
48775
|
var _b;
|
48750
48776
|
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
48751
48777
|
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;
|
48778
|
+
var _s = usePollinationPanel(), fetchLocalRun = _s.fetchLocalRun, fetchLocalJob = _s.fetchLocalJob, fileExplorer = _s.fileExplorer;
|
48753
48779
|
var disabled = React.useMemo(function () {
|
48754
48780
|
if (!localRun)
|
48755
48781
|
return;
|
@@ -48925,9 +48951,14 @@ var RunCard = function (_a) {
|
|
48925
48951
|
React__default["default"].createElement(FolderOutlined$1, { className: 'link', onClick: function (e) {
|
48926
48952
|
e.stopPropagation();
|
48927
48953
|
getTab(RunTabs.workspace);
|
48928
|
-
|
48929
|
-
|
48930
|
-
|
48954
|
+
if (localRun) {
|
48955
|
+
fileExplorer(_run.id);
|
48956
|
+
}
|
48957
|
+
else {
|
48958
|
+
toggleHover(RunTabs.workspace, true);
|
48959
|
+
toggleHover(RunTabs.details, false);
|
48960
|
+
toggleHover(RunTabs.debug, false);
|
48961
|
+
}
|
48931
48962
|
}, onMouseOver: function (e) {
|
48932
48963
|
toggleHover('workspaceOver', true);
|
48933
48964
|
}, onMouseLeave: function (e) {
|
@@ -48941,9 +48972,19 @@ var RunCard = function (_a) {
|
|
48941
48972
|
return;
|
48942
48973
|
e.stopPropagation();
|
48943
48974
|
getTab(RunTabs.debug);
|
48944
|
-
|
48945
|
-
|
48946
|
-
|
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
|
+
}
|
48947
48988
|
}, onMouseOver: function (e) {
|
48948
48989
|
toggleHover('debugOver', true);
|
48949
48990
|
}, onMouseLeave: function (e) {
|
@@ -49558,6 +49599,7 @@ styleInject(css_248z$2);
|
|
49558
49599
|
var RunContent = function (_a) {
|
49559
49600
|
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;
|
49560
49601
|
var _c = React.useState([]), currData = _c[0], setCurrData = _c[1];
|
49602
|
+
var fileExplorer = usePollinationPanel().fileExplorer;
|
49561
49603
|
var _d = React.useState([]), currParams = _d[0], setCurrParams = _d[1];
|
49562
49604
|
var _e = React.useState([]), currFiles = _e[0], setCurrFiles = _e[1];
|
49563
49605
|
var _f = React.useState([]), currFolders = _f[0], setCurrFolders = _f[1];
|
@@ -49607,14 +49649,9 @@ var RunContent = function (_a) {
|
|
49607
49649
|
* @param card Folder card props
|
49608
49650
|
*/
|
49609
49651
|
var onFolderClicked = function (card) {
|
49610
|
-
|
49611
|
-
|
49612
|
-
|
49613
|
-
}
|
49614
|
-
else {
|
49615
|
-
// TODO: Fix it later when Local is ready
|
49616
|
-
getFolderCard(card);
|
49617
|
-
// alert(runId.concat('/').concat(card.path))
|
49652
|
+
getFolderCard(card);
|
49653
|
+
if (!isCloud) {
|
49654
|
+
fileExplorer(card.path);
|
49618
49655
|
}
|
49619
49656
|
};
|
49620
49657
|
return React__default["default"].createElement("div", { className: 'cards-container', style: __assign({}, style) },
|