pollination-react-io 1.59.0 → 1.61.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/index.d.ts +1 -0
- package/build/hooks/usePollinationPanel.d.ts +3 -0
- package/build/index.esm.js +82 -7
- package/build/index.esm.js.map +1 -1
- package/build/index.js +82 -6
- 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) {
|
@@ -37996,6 +38002,9 @@ var usePollinationPanel = function () {
|
|
37996
38002
|
var panel = React.useMemo(function () {
|
37997
38003
|
return checkPollinationPanel() && window.parent.chrome.webview.hostObjects.sync.study;
|
37998
38004
|
}, []);
|
38005
|
+
/**
|
38006
|
+
* From base64 to file
|
38007
|
+
*/
|
37999
38008
|
var saveFileBase64 = React.useCallback(function (key, file, subFolder, fileName) { return __awaiter$1(void 0, void 0, void 0, function () {
|
38000
38009
|
var base64;
|
38001
38010
|
return __generator$1(this, function (_a) {
|
@@ -38014,6 +38023,9 @@ var usePollinationPanel = function () {
|
|
38014
38023
|
}
|
38015
38024
|
});
|
38016
38025
|
}); }, [panel]);
|
38026
|
+
/**
|
38027
|
+
* Select a file and generate base64 representation
|
38028
|
+
*/
|
38017
38029
|
var getFileBase64 = React.useCallback(function (key, accept) {
|
38018
38030
|
if (key === void 0) { key = performance.now().toString(); }
|
38019
38031
|
if (accept === void 0) { accept = 'HBJSON|*.hbjson'; }
|
@@ -38021,27 +38033,39 @@ var usePollinationPanel = function () {
|
|
38021
38033
|
return;
|
38022
38034
|
return panel.GetArtifactAsBase64(key, accept);
|
38023
38035
|
}, [panel]);
|
38036
|
+
/**
|
38037
|
+
* Get file paths from dir
|
38038
|
+
*/
|
38024
38039
|
var getFilesFromDir = React.useCallback(function (root) {
|
38025
38040
|
if (!panel)
|
38026
38041
|
return;
|
38027
38042
|
return panel.GetFilePaths(root);
|
38028
38043
|
}, [panel]);
|
38044
|
+
/**
|
38045
|
+
* From file path to base64
|
38046
|
+
*/
|
38029
38047
|
var fromFileToBase64 = React.useCallback(function (filePath) {
|
38030
38048
|
if (!panel)
|
38031
38049
|
return;
|
38032
38050
|
return panel.FromFileToBase64(filePath);
|
38033
38051
|
}, [panel]);
|
38052
|
+
/**
|
38053
|
+
* Run file explorer
|
38054
|
+
*/
|
38034
38055
|
var fileExplorer = React.useCallback(function (root) {
|
38035
38056
|
if (!panel)
|
38036
38057
|
return;
|
38037
38058
|
return panel.FileExplorer(root);
|
38038
38059
|
}, [panel]);
|
38060
|
+
/**
|
38061
|
+
* Fetch local run
|
38062
|
+
*/
|
38039
38063
|
var fetchLocalRun = React.useCallback(function (path) {
|
38040
38064
|
if (path === void 0) { path = ''; }
|
38041
38065
|
if (!panel)
|
38042
38066
|
return;
|
38043
|
-
var message = panel.FetchLocalRun(path);
|
38044
38067
|
try {
|
38068
|
+
var message = panel.FetchSimulationFile(path, SimulationFileType[SimulationFileType.status]);
|
38045
38069
|
var run = JSON.parse(message.data);
|
38046
38070
|
return run;
|
38047
38071
|
}
|
@@ -38049,13 +38073,16 @@ var usePollinationPanel = function () {
|
|
38049
38073
|
throw error;
|
38050
38074
|
}
|
38051
38075
|
}, [panel]);
|
38076
|
+
/**
|
38077
|
+
* Fetch local job
|
38078
|
+
*/
|
38052
38079
|
var fetchLocalJob = React.useCallback(function (path) {
|
38053
38080
|
var _a;
|
38054
38081
|
if (path === void 0) { path = ''; }
|
38055
38082
|
if (!panel)
|
38056
38083
|
return;
|
38057
|
-
var message = panel.FetchLocalJob(path);
|
38058
38084
|
try {
|
38085
|
+
var message = panel.FetchSimulationFile(path, SimulationFileType[SimulationFileType.job]);
|
38059
38086
|
var localJob = JSON.parse(message.data);
|
38060
38087
|
var job = (_a = localJob === null || localJob === void 0 ? void 0 : localJob.LocalJob) === null || _a === void 0 ? void 0 : _a.Job;
|
38061
38088
|
return job;
|
@@ -38065,6 +38092,42 @@ var usePollinationPanel = function () {
|
|
38065
38092
|
return undefined;
|
38066
38093
|
}
|
38067
38094
|
}, [panel]);
|
38095
|
+
/**
|
38096
|
+
* Fetch local log
|
38097
|
+
*/
|
38098
|
+
var fetchLocalLog = React.useCallback(function (path) {
|
38099
|
+
if (path === void 0) { path = ''; }
|
38100
|
+
if (!panel)
|
38101
|
+
return;
|
38102
|
+
try {
|
38103
|
+
var message = panel.FetchSimulationFile(path, SimulationFileType[SimulationFileType.logs]);
|
38104
|
+
return message.data;
|
38105
|
+
}
|
38106
|
+
catch (error) {
|
38107
|
+
// Do nothing. It is written at the end
|
38108
|
+
return undefined;
|
38109
|
+
}
|
38110
|
+
}, [panel]);
|
38111
|
+
/**
|
38112
|
+
* Get array of ProjectJobInfo from DB
|
38113
|
+
* @param projectSlug Project slug <USER/PROJECT_NAME>
|
38114
|
+
* @param pageSize Page size
|
38115
|
+
* @param curPage Current page
|
38116
|
+
* @returns Array of ProjectJobInfo
|
38117
|
+
*/
|
38118
|
+
var getPaginatedJob = function (projectSlug, pageSize, curPage) {
|
38119
|
+
if (!panel)
|
38120
|
+
return;
|
38121
|
+
try {
|
38122
|
+
var message = panel.GetPaginatedJob(projectSlug, pageSize, curPage);
|
38123
|
+
var arr = JSON.parse(message.data);
|
38124
|
+
return arr;
|
38125
|
+
}
|
38126
|
+
catch (error) {
|
38127
|
+
// Do nothing. It is written at the end
|
38128
|
+
return undefined;
|
38129
|
+
}
|
38130
|
+
};
|
38068
38131
|
return {
|
38069
38132
|
getFileBase64: getFileBase64,
|
38070
38133
|
saveFileBase64: saveFileBase64,
|
@@ -38072,7 +38135,9 @@ var usePollinationPanel = function () {
|
|
38072
38135
|
getFilesFromDir: getFilesFromDir,
|
38073
38136
|
fetchLocalRun: fetchLocalRun,
|
38074
38137
|
fetchLocalJob: fetchLocalJob,
|
38075
|
-
|
38138
|
+
fetchLocalLog: fetchLocalLog,
|
38139
|
+
fileExplorer: fileExplorer,
|
38140
|
+
getPaginatedJob: getPaginatedJob
|
38076
38141
|
};
|
38077
38142
|
};
|
38078
38143
|
|
@@ -48952,9 +49017,19 @@ var RunCard = function (_a) {
|
|
48952
49017
|
return;
|
48953
49018
|
e.stopPropagation();
|
48954
49019
|
getTab(RunTabs.debug);
|
48955
|
-
|
48956
|
-
|
48957
|
-
|
49020
|
+
if (localRun) {
|
49021
|
+
// Get study name
|
49022
|
+
var cleanName = localStudy.name
|
49023
|
+
.replace(/[^a-zA-Z0-9]/g, '')
|
49024
|
+
.replace(/[ ()]/g, '');
|
49025
|
+
var path = "".concat(_run.id, "/").concat(cleanName, "/__logs__/logs.log");
|
49026
|
+
fileExplorer(path);
|
49027
|
+
}
|
49028
|
+
else {
|
49029
|
+
toggleHover(RunTabs.workspace, false);
|
49030
|
+
toggleHover(RunTabs.details, false);
|
49031
|
+
toggleHover(RunTabs.debug, true);
|
49032
|
+
}
|
48958
49033
|
}, onMouseOver: function (e) {
|
48959
49034
|
toggleHover('debugOver', true);
|
48960
49035
|
}, onMouseLeave: function (e) {
|
@@ -50578,6 +50653,7 @@ exports.useGetHbjson = useGetHbjson;
|
|
50578
50653
|
exports.useHbjsontoVTK = useHbjsontoVTK;
|
50579
50654
|
exports.useJobs = useJobs;
|
50580
50655
|
exports.useManageSettings = useManageSettings;
|
50656
|
+
exports.usePollinationPanel = usePollinationPanel;
|
50581
50657
|
exports.useRunCommand = useRunCommand;
|
50582
50658
|
exports.useRuns = useRuns;
|
50583
50659
|
exports.useSendHbjson = useSendHbjson;
|