pollination-react-io 1.54.0 → 1.56.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.
@@ -19,4 +19,5 @@ export interface RunCardProps {
19
19
  interval?: number;
20
20
  getValue?: (run: Run) => any;
21
21
  canWrite?: boolean;
22
+ localRun?: boolean;
22
23
  }
@@ -12,4 +12,5 @@ export * from './useRuns';
12
12
  export * from './useSendHbjson';
13
13
  export * from './useSendMessage';
14
14
  export * from './useWindowDimensions';
15
+ export * from './usePollinationPanel';
15
16
  export * from './utilities';
@@ -1,9 +1,10 @@
1
1
  import { PanelMessageOut } from './types';
2
- import { Run } from '@pollination-solutions/pollination-sdk';
2
+ import { Job, Run } from '@pollination-solutions/pollination-sdk';
3
3
  export declare const usePollinationPanel: () => {
4
4
  getFileBase64: (key?: any, accept?: any) => PanelMessageOut;
5
5
  saveFileBase64: (key: string, file: File | Blob, subFolder: string, fileName: string) => Promise<PanelMessageOut>;
6
6
  fromFileToBase64: (filePath: string) => PanelMessageOut;
7
7
  getFilesFromDir: (root: any) => PanelMessageOut;
8
- fetchLocalRun: (projectOwner?: any, projectName?: any, runPath?: any) => Run;
8
+ fetchLocalRun: (path?: any) => Run;
9
+ fetchLocalJob: (path?: any) => Job;
9
10
  };
@@ -38005,24 +38005,41 @@ var usePollinationPanel = function () {
38005
38005
  return;
38006
38006
  return panel.FromFileToBase64(filePath);
38007
38007
  }, [panel]);
38008
- var fetchLocalRun = useCallback(function (projectOwner, projectName, runPath) {
38008
+ var fetchLocalRun = useCallback(function (path) {
38009
+ if (path === void 0) { path = ''; }
38010
+ if (!panel)
38011
+ return;
38012
+ var message = panel.FetchLocalRun(path);
38013
+ try {
38014
+ var run = JSON.parse(message.data);
38015
+ return run;
38016
+ }
38017
+ catch (error) {
38018
+ console.error(error);
38019
+ }
38020
+ }, [panel]);
38021
+ var fetchLocalJob = useCallback(function (path) {
38009
38022
  var _a;
38010
- if (projectOwner === void 0) { projectOwner = 'project-owner'; }
38011
- if (projectName === void 0) { projectName = 'project-name'; }
38012
- if (runPath === void 0) { runPath = ''; }
38023
+ if (path === void 0) { path = ''; }
38013
38024
  if (!panel)
38014
38025
  return;
38015
- var message = panel.FetchLocalRun(projectOwner, projectName, runPath);
38016
- var runContent = (_a = JSON.parse(message.data)) === null || _a === void 0 ? void 0 : _a.runContent;
38017
- var run = JSON.parse(runContent);
38018
- return run;
38026
+ var message = panel.FetchLocalJob(path);
38027
+ try {
38028
+ var localJob = JSON.parse(message.data);
38029
+ var job = (_a = localJob === null || localJob === void 0 ? void 0 : localJob.LocalJob) === null || _a === void 0 ? void 0 : _a.Job;
38030
+ return job;
38031
+ }
38032
+ catch (error) {
38033
+ console.error(error);
38034
+ }
38019
38035
  }, [panel]);
38020
38036
  return {
38021
38037
  getFileBase64: getFileBase64,
38022
38038
  saveFileBase64: saveFileBase64,
38023
38039
  fromFileToBase64: fromFileToBase64,
38024
38040
  getFilesFromDir: getFilesFromDir,
38025
- fetchLocalRun: fetchLocalRun
38041
+ fetchLocalRun: fetchLocalRun,
38042
+ fetchLocalJob: fetchLocalJob
38026
38043
  };
38027
38044
  };
38028
38045
 
@@ -44717,6 +44734,7 @@ var CreateStudy = function (_a) {
44717
44734
  }, 3000);
44718
44735
  }
44719
44736
  };
44737
+ var toUnixPath = function (path) { return path.replace(/[\\/]+/g, '/').replace(/^([a-zA-Z]+:|\.\/)/, ''); };
44720
44738
  var _onSuccessLocal = function (projectJobInfo) {
44721
44739
  if (!basePath) {
44722
44740
  throw new Error('CreateStudy: client.configuration.basepath not defined.');
@@ -44728,6 +44746,12 @@ var CreateStudy = function (_a) {
44728
44746
  }
44729
44747
  else {
44730
44748
  _t.success("Study is running! Do not close the console.\nYou will find output here ".concat(projectJobInfo.studyId, "."), { duration: 4000, position: 'bottom-left', style: { minWidth: '300px', fontSize: '12px' } });
44749
+ // Formatted name of the job
44750
+ var jobName_1 = toUnixPath(projectJobInfo.studyId).split('/').reverse()[0];
44751
+ // Path is the full path of the local machine where the run input/output are
44752
+ setTimeout(function () {
44753
+ window.location.href = "http://localhost:3000/".concat(projectJobInfo.accountName, "/projects/").concat(projectJobInfo.projectName, "/localStudies/").concat(jobName_1, "/?path=").concat(projectJobInfo.studyId);
44754
+ }, 3000);
44731
44755
  }
44732
44756
  };
44733
44757
  var handleCreateStudy = useCallback(function (name, jobArgs, description, localConfig) {
@@ -46889,7 +46913,7 @@ var JobTabs;
46889
46913
  JobTabs["workspace"] = "workspace";
46890
46914
  })(JobTabs || (JobTabs = {}));
46891
46915
 
46892
- var css_248z$6 = ":root {\n --background: #FFFAEE;\n --primary: #1890ff;\n --primary2: #40a9ff;\n --primary1: #cceefe;\n --primary0: #e6f7ff;\n --secondary: #fff566;\n --primary3: #000;\n --success: #46A758;\n --warning: #F76809;\n --danger: #FF4616;\n /* radix-ui/colors */\n --slate1: hsl(206, 30.0%, 98.8%);\n --slate2: hsl(210, 16.7%, 97.6%);\n --slate3: hsl(209, 13.3%, 95.3%);\n --slate4: hsl(209, 12.2%, 93.2%);\n --slate5: hsl(208, 11.7%, 91.1%);\n --slate6: hsl(208, 11.3%, 88.9%);\n --slate7: hsl(207, 11.1%, 85.9%);\n --slate8: hsl(205, 10.7%, 78.0%);\n --slate9: hsl(206, 6.0%, 56.1%);\n --slate10: hsl(206, 5.8%, 52.3%);\n --slate11: hsl(206, 6.0%, 43.5%);\n --slate12: hsl(206, 24.0%, 9.0%);\n}\n\n@keyframes spin {\n from {\n transform: rotate(0);\n }\n to {\n transform: rotate(360deg);\n }\n}\n.spin {\n animation: spin 1s linear 0s infinite;\n}\n\n@keyframes Animation {\n 0% {\n background-position: 200%;\n }\n 50% {\n background-position: 100%;\n }\n 100% {\n background-position: 0%;\n }\n}\n.loading {\n background: linear-gradient(45deg, transparent, var(--primary), 12%, transparent);\n background-size: 200%;\n animation: Animation 3s ease infinite;\n}\n\n@keyframes open {\n from {\n height: 0;\n }\n to {\n height: var(--radix-collapsible-content-height);\n }\n}\n@keyframes close {\n from {\n height: var(--radix-collapsible-content-height);\n }\n to {\n height: 0;\n }\n}\n.collapse-content {\n overflow: hidden;\n font-size: inherit;\n color: inherit;\n}\n\n.collapse-content[data-state=open] {\n animation: open 300ms ease-out;\n}\n\n.collapse-content[data-state=closed] {\n animation: close 300ms ease-out;\n}\n\n.item1 {\n grid-area: accountprj;\n font-size: 1rem;\n font-weight: 500;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.item2 {\n grid-area: runworkspacedebug;\n text-align: right !important;\n font-size: 1.25rem;\n white-space: nowrap;\n}\n\n.item3 {\n grid-area: studyrun;\n font-size: 1.25rem;\n font-weight: 500;\n white-space: wrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.item4 {\n grid-area: date;\n color: var(--slate10);\n font-size: 0.9rem;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n text-align: right !important;\n}\n\n.item5 {\n grid-area: author;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.item6 {\n grid-area: recipe;\n white-space: wrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.item7 {\n grid-area: description;\n white-space: wrap;\n color: var(--slate10);\n font-size: 0.9rem;\n}\n\n.item8 {\n grid-area: status;\n font-size: 0.9rem;\n}\n\n.status-label {\n font-weight: 500;\n}\n\n.item9 {\n grid-area: time;\n text-align: right !important;\n white-space: wrap;\n}\n\n.item10 {\n grid-area: cpu;\n text-align: right !important;\n white-space: wrap;\n}\n\n.link {\n text-decoration: none;\n color: var(--primary3);\n}\n\n.link:hover {\n color: var(--primary3);\n}\n\n.light-text {\n color: var(--slate10);\n font-size: 0.9rem;\n}\n\n.grid-container {\n display: grid;\n grid-template-areas: \"accountprj accountprj accountprj accountprj runworkspacedebug runworkspacedebug\" \"studyrun studyrun studyrun studyrun date date\" \"author recipe recipe recipe recipe recipe\" \"status status status status cpu time\" \"description description description description description description\";\n gap: 0.35rem;\n border: 0.1rem solid;\n align-items: center;\n padding: 0.35rem;\n transition: box-shadow 0.3s ease 0s, border-color 0.3s ease 0s;\n grid-template-rows: 52px 38px 46px 46px auto;\n border-radius: 6px;\n line-height: 1.5;\n}\n\n.grid-container:hover {\n box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 2px -2px, rgba(0, 0, 0, 0.12) 0px 3px 6px 0px, rgba(0, 0, 0, 0.09) 0px 5px 12px 4px;\n cursor: pointer;\n}\n\n.disable-click {\n box-shadow: none !important;\n cursor: default !important;\n}\n\n.grid-container > div {\n text-align: left;\n padding: 1rem;\n vertical-align: middle;\n}\n\n.description-expander {\n all: unset;\n}\n\n.description-expander:focus {\n outline: 0 !important;\n}\n\n@media (max-width: 600px) {\n .grid-container {\n display: grid;\n grid-template-areas: \"accountprj accountprj accountprj accountprj runworkspacedebug runworkspacedebug\" \"studyrun studyrun studyrun studyrun studyrun studyrun\" \"date date date date date date\" \"author author author recipe recipe recipe\" \"status status status status status status\" \"time time time cpu cpu cpu\" \"description description description description description description\";\n gap: 0.35rem;\n border: 0.1rem solid;\n align-items: center;\n padding: 0.15rem;\n transition: box-shadow 0.3s;\n grid-template-rows: 52px 52px 32px 32px 32px 32px auto;\n }\n .item1 {\n text-align: left !important;\n }\n .item2 {\n text-align: right !important;\n font-size: 1rem;\n white-space: nowrap;\n }\n .item3, .item4 {\n text-align: center !important;\n }\n .item5 {\n font-size: 0.8rem;\n }\n .item6 {\n white-space: nowrap;\n font-size: 0.8rem;\n }\n .item7 {\n font-size: 0.8rem;\n text-align: center !important;\n }\n .item8 {\n font-size: 1rem;\n text-align: center !important;\n }\n .item9 {\n text-align: left !important;\n font-size: 1rem;\n white-space: nowrap;\n }\n .item10 {\n text-align: right !important;\n }\n .grid-container > div {\n text-align: left;\n vertical-align: middle;\n }\n}\n.blink-effect {\n animation: blinker 5s linear infinite;\n}\n\n@keyframes blinker {\n 50% {\n border: 0.1rem solid white;\n }\n}";
46916
+ var css_248z$6 = ":root {\n --background: #FFFAEE;\n --primary: #1890ff;\n --primary2: #40a9ff;\n --primary1: #cceefe;\n --primary0: #e6f7ff;\n --secondary: #fff566;\n --primary3: #000;\n --success: #46A758;\n --warning: #F76809;\n --danger: #FF4616;\n /* radix-ui/colors */\n --slate1: hsl(206, 30.0%, 98.8%);\n --slate2: hsl(210, 16.7%, 97.6%);\n --slate3: hsl(209, 13.3%, 95.3%);\n --slate4: hsl(209, 12.2%, 93.2%);\n --slate5: hsl(208, 11.7%, 91.1%);\n --slate6: hsl(208, 11.3%, 88.9%);\n --slate7: hsl(207, 11.1%, 85.9%);\n --slate8: hsl(205, 10.7%, 78.0%);\n --slate9: hsl(206, 6.0%, 56.1%);\n --slate10: hsl(206, 5.8%, 52.3%);\n --slate11: hsl(206, 6.0%, 43.5%);\n --slate12: hsl(206, 24.0%, 9.0%);\n}\n\n@keyframes spin {\n from {\n transform: rotate(0);\n }\n to {\n transform: rotate(360deg);\n }\n}\n.spin {\n animation: spin 1s linear 0s infinite;\n}\n\n@keyframes Animation {\n 0% {\n background-position: 200%;\n }\n 50% {\n background-position: 100%;\n }\n 100% {\n background-position: 0%;\n }\n}\n.loading {\n background: linear-gradient(45deg, transparent, var(--primary), 12%, transparent);\n background-size: 200%;\n animation: Animation 3s ease infinite;\n}\n\n@keyframes open {\n from {\n height: 0;\n }\n to {\n height: var(--radix-collapsible-content-height);\n }\n}\n@keyframes close {\n from {\n height: var(--radix-collapsible-content-height);\n }\n to {\n height: 0;\n }\n}\n.collapse-content {\n overflow: hidden;\n font-size: inherit;\n color: inherit;\n}\n\n.collapse-content[data-state=open] {\n animation: open 300ms ease-out;\n}\n\n.collapse-content[data-state=closed] {\n animation: close 300ms ease-out;\n}\n\n.item1 {\n grid-area: accountprj;\n font-size: 1rem;\n font-weight: 500;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.item2 {\n grid-area: runworkspacedebug;\n text-align: right !important;\n font-size: 1.25rem;\n white-space: nowrap;\n}\n\n.item3 {\n grid-area: studyrun;\n font-size: 1.25rem;\n font-weight: 500;\n white-space: wrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.item4 {\n grid-area: date;\n color: var(--slate10);\n font-size: 0.9rem;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n text-align: right !important;\n}\n\n.item5 {\n grid-area: author;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.item6 {\n grid-area: recipe;\n white-space: wrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.item7 {\n grid-area: description;\n white-space: wrap;\n color: var(--slate10);\n font-size: 0.9rem;\n}\n\n.item8 {\n grid-area: status;\n font-size: 0.9rem;\n}\n\n.status-label {\n font-weight: 500;\n}\n\n.item9 {\n grid-area: time;\n text-align: right !important;\n white-space: wrap;\n}\n\n.item10 {\n grid-area: cpu;\n text-align: right !important;\n white-space: wrap;\n}\n\n.link {\n text-decoration: none;\n color: var(--primary3);\n cursor: pointer;\n}\n\n.link:hover {\n color: var(--primary3);\n}\n\n.light-text {\n color: var(--slate10);\n font-size: 0.9rem;\n}\n\n.grid-container {\n display: grid;\n grid-template-areas: \"accountprj accountprj accountprj accountprj runworkspacedebug runworkspacedebug\" \"studyrun studyrun studyrun studyrun date date\" \"author recipe recipe recipe recipe recipe\" \"status status status status cpu time\" \"description description description description description description\";\n gap: 0.35rem;\n border: 0.1rem solid;\n align-items: center;\n padding: 0.35rem;\n transition: box-shadow 0.3s ease 0s, border-color 0.3s ease 0s;\n grid-template-rows: 52px 38px 46px 46px auto;\n border-radius: 6px;\n line-height: 1.5;\n}\n\n.grid-container:hover {\n box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 2px -2px, rgba(0, 0, 0, 0.12) 0px 3px 6px 0px, rgba(0, 0, 0, 0.09) 0px 5px 12px 4px;\n cursor: pointer;\n}\n\n.disable-click {\n box-shadow: none !important;\n cursor: default !important;\n}\n\n.grid-container > div {\n text-align: left;\n padding: 1rem;\n vertical-align: middle;\n}\n\n.description-expander {\n all: unset;\n}\n\n.description-expander:focus {\n outline: 0 !important;\n}\n\n@media (max-width: 600px) {\n .grid-container {\n display: grid;\n grid-template-areas: \"accountprj accountprj accountprj accountprj runworkspacedebug runworkspacedebug\" \"studyrun studyrun studyrun studyrun studyrun studyrun\" \"date date date date date date\" \"author author author recipe recipe recipe\" \"status status status status status status\" \"time time time cpu cpu cpu\" \"description description description description description description\";\n gap: 0.35rem;\n border: 0.1rem solid;\n align-items: center;\n padding: 0.15rem;\n transition: box-shadow 0.3s;\n grid-template-rows: 52px 52px 32px 32px 32px 32px auto;\n }\n .item1 {\n text-align: left !important;\n }\n .item2 {\n text-align: right !important;\n font-size: 1rem;\n white-space: nowrap;\n }\n .item3, .item4 {\n text-align: center !important;\n }\n .item5 {\n font-size: 0.8rem;\n }\n .item6 {\n white-space: nowrap;\n font-size: 0.8rem;\n }\n .item7 {\n font-size: 0.8rem;\n text-align: center !important;\n }\n .item8 {\n font-size: 1rem;\n text-align: center !important;\n }\n .item9 {\n text-align: left !important;\n font-size: 1rem;\n white-space: nowrap;\n }\n .item10 {\n text-align: right !important;\n }\n .grid-container > div {\n text-align: left;\n vertical-align: middle;\n }\n}\n.blink-effect {\n animation: blinker 5s linear infinite;\n}\n\n@keyframes blinker {\n 50% {\n border: 0.1rem solid white;\n }\n}";
46893
46917
  styleInject(css_248z$6);
46894
46918
 
46895
46919
  var IconContext = /*#__PURE__*/createContext({});
@@ -48696,25 +48720,26 @@ var formatDuration = function (duration) {
48696
48720
  };
48697
48721
  var RunCard = function (_a) {
48698
48722
  var _b;
48699
- var _c, _d, _e, _f;
48700
- 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, _g = _a.interval, interval = _g === void 0 ? 5000 : _g, _h = _a.canWrite, canWrite = _h === void 0 ? false : _h;
48723
+ var _c, _d, _e, _f, _g, _h, _j, _k;
48724
+ 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, _l = _a.interval, interval = _l === void 0 ? 5000 : _l, _m = _a.canWrite, canWrite = _m === void 0 ? false : _m, _o = _a.localRun, localRun = _o === void 0 ? false : _o;
48725
+ var _p = usePollinationPanel(), fetchLocalRun = _p.fetchLocalRun, fetchLocalJob = _p.fetchLocalJob;
48701
48726
  /*
48702
48727
  * Fetch run
48703
48728
  */
48704
48729
  var fetchJob = useJobs(client).fetchJob;
48705
- var _j = useRuns(client), fetchRun = _j.fetchRun, statusMap = _j.statusMap, getDuration = _j.getDuration, cancelRun = _j.cancelRun;
48706
- var _k = useWindowDimensions(), width = _k.width; _k.height;
48707
- var _l = useState(false), seeDescription = _l[0], setSeeDescription = _l[1];
48708
- var _m = useState(false), seeAction = _m[0], setSeeAction = _m[1];
48709
- var _o = useState(false), stopRefresh = _o[0], setStopRefresh = _o[1];
48710
- var _p = useState(false), isReady = _p[0], setIsReady = _p[1];
48730
+ var _q = useRuns(client), fetchRun = _q.fetchRun, statusMap = _q.statusMap, getDuration = _q.getDuration, cancelRun = _q.cancelRun;
48731
+ var _r = useWindowDimensions(), width = _r.width; _r.height;
48732
+ var _s = useState(false), seeDescription = _s[0], setSeeDescription = _s[1];
48733
+ var _t = useState(false), seeAction = _t[0], setSeeAction = _t[1];
48734
+ var _u = useState(false), stopRefresh = _u[0], setStopRefresh = _u[1];
48735
+ var _v = useState(false), isReady = _v[0], setIsReady = _v[1];
48711
48736
  /*
48712
48737
  * From run and stop when it is done
48713
48738
  */
48714
- var _q = useSWR(authUser && _run ? [projectOwner, projectName, _run.id] : undefined, fetchRun, {
48739
+ var _w = useSWR(authUser && _run ? (!localRun ? [projectOwner, projectName, _run.id] : [_run.id]) : undefined, localRun ? fetchLocalRun : fetchRun, {
48715
48740
  revalidateOnFocus: false,
48716
48741
  refreshInterval: stopRefresh ? undefined : interval,
48717
- fallbackData: _run,
48742
+ fallbackData: localRun ? undefined : _run,
48718
48743
  errorRetryCount: 3,
48719
48744
  onSuccess: function (run, key, config) {
48720
48745
  sendRun(run);
@@ -48722,7 +48747,7 @@ var RunCard = function (_a) {
48722
48747
  setStopRefresh(true);
48723
48748
  setIsReady(true);
48724
48749
  },
48725
- }), run = _q.data; _q.error; _q.isValidating;
48750
+ }), run = _w.data, error = _w.error; _w.isValidating;
48726
48751
  var sendRun = useCallback(function (run) { return getValue(run); }, [run]);
48727
48752
  /**
48728
48753
  * Fetch job just one time
@@ -48730,11 +48755,17 @@ var RunCard = function (_a) {
48730
48755
  useEffect(function () {
48731
48756
  if (!_run)
48732
48757
  return;
48733
- fetchJob(projectOwner, projectName, run.status.job_id)
48734
- .then(function (d) {
48735
- setStudy(d);
48736
- })
48737
- .catch(function () { setStudy(undefined); });
48758
+ if (localRun) {
48759
+ var jobInfo = fetchLocalJob(_run.id);
48760
+ setLocalStudy(jobInfo);
48761
+ }
48762
+ else {
48763
+ fetchJob(projectOwner, projectName, run.status.job_id)
48764
+ .then(function (d) {
48765
+ setStudy(d);
48766
+ })
48767
+ .catch(function () { setStudy(undefined); });
48768
+ }
48738
48769
  }, [_run]);
48739
48770
  /**
48740
48771
  * Refresh status
@@ -48744,8 +48775,9 @@ var RunCard = function (_a) {
48744
48775
  return undefined;
48745
48776
  return run.status.status;
48746
48777
  }, [run]);
48747
- var _r = useState(), study = _r[0], setStudy = _r[1];
48748
- var _s = useState(getDuration(run)), duration = _s[0], setDuration = _s[1];
48778
+ var _x = useState(), study = _x[0], setStudy = _x[1];
48779
+ var _y = useState(), localStudy = _y[0], setLocalStudy = _y[1];
48780
+ var _z = useState(getDuration(run)), duration = _z[0], setDuration = _z[1];
48749
48781
  useEffect(function () {
48750
48782
  if (!run)
48751
48783
  return undefined;
@@ -48776,7 +48808,7 @@ var RunCard = function (_a) {
48776
48808
  info: false,
48777
48809
  settings: false,
48778
48810
  };
48779
- var _t = useState(__assign(__assign({}, initialValues), (_b = {}, _b[defaultTab] = true, _b))), hover = _t[0], setHover = _t[1];
48811
+ var _0 = useState(__assign(__assign({}, initialValues), (_b = {}, _b[defaultTab] = true, _b))), hover = _0[0], setHover = _0[1];
48780
48812
  var toggleHover = useCallback(function (id, value) {
48781
48813
  if (value === void 0) { value = false; }
48782
48814
  setHover(function (prevHover) {
@@ -48791,21 +48823,39 @@ var RunCard = function (_a) {
48791
48823
  var _a;
48792
48824
  setHover(__assign(__assign({}, initialValues), (_a = {}, _a[defaultTab] = true, _a)));
48793
48825
  }, [defaultTab]);
48826
+ if (error)
48827
+ return React__default.createElement("div", { style: { textAlign: 'center' } }, "ERROR");
48794
48828
  return (React__default.createElement("div", { className: enableClick ? "grid-container ".concat(isReady && !run.status.finished_at && 'blink-effect')
48795
48829
  : "grid-container disable-click ".concat(isReady && !run.status.finished_at && 'blink-effect'), tabIndex: 0, role: 'button', style: __assign({ borderColor: (_d = (_c = statusMap[status]) === null || _c === void 0 ? void 0 : _c.color) !== null && _d !== void 0 ? _d : '#d0d7de' }, style), onClick: function () {
48796
- if (run && enableClick) {
48830
+ if (!enableClick)
48831
+ return;
48832
+ if (!localRun) {
48797
48833
  window.location.href = "/".concat(projectOwner, "/projects/").concat(projectName, "/studies/").concat(study.id, "/runs/").concat(run.id);
48798
48834
  }
48799
48835
  } },
48800
48836
  React__default.createElement("div", { className: 'item1' },
48801
- React__default.createElement("a", { className: 'link', style: { marginRight: '0.75rem' }, title: 'Go to account page', onMouseOver: function (e) { return toggleHover('account', true); }, onMouseLeave: function (e) { return toggleHover('account', false); }, href: study && "/".concat(study.owner.name) },
48802
- React__default.createElement(Avatar, { src: study ? study.owner.picture_url : '', size: 32, color: hover.account ? '#40a9ff' : undefined })),
48837
+ React__default.createElement("button", { className: 'link', style: { all: 'unset', cursor: 'pointer', marginRight: '0.75rem' }, title: 'Go to account page', onMouseOver: function (e) { return toggleHover('account', true); }, onMouseLeave: function (e) { return toggleHover('account', false); }, onClick: function (e) {
48838
+ e.stopPropagation();
48839
+ if (!localRun) {
48840
+ if (!run)
48841
+ return;
48842
+ window.location.href = "/".concat(run.owner.name);
48843
+ }
48844
+ } },
48845
+ React__default.createElement(Avatar, { src: run ? (_e = run.owner) === null || _e === void 0 ? void 0 : _e.picture_url : '', size: 32, color: hover.account ? '#40a9ff' : undefined })),
48803
48846
  React__default.createElement("span", { style: { marginRight: '0.75rem' } }, "/"),
48804
- React__default.createElement("a", { className: 'link', href: projectName && "/".concat(projectOwner, "/projects/").concat(projectName), title: 'Go to project page', onMouseOver: function (e) { return toggleHover('project', true); }, onMouseLeave: function (e) { return toggleHover('project', false); }, style: hover.project ? { color: '#40a9ff' } : {} }, projectName !== null && projectName !== void 0 ? projectName : '--')),
48847
+ React__default.createElement("button", { className: 'link', title: 'Go to project page', onMouseOver: function (e) { return toggleHover('project', true); }, onMouseLeave: function (e) { return toggleHover('project', false); }, onClick: function (e) {
48848
+ e.stopPropagation();
48849
+ if (!localRun) {
48850
+ if (!projectOwner)
48851
+ return;
48852
+ window.location.href = "/".concat(projectOwner, "/projects/").concat(projectName);
48853
+ }
48854
+ }, style: hover.project ? { all: 'unset', cursor: 'pointer', color: '#40a9ff' } : { all: 'unset', cursor: 'pointer' } }, projectName !== null && projectName !== void 0 ? projectName : '--')),
48805
48855
  React__default.createElement("div", { className: 'item2' },
48806
48856
  React__default.createElement("div", null,
48807
- (!isReady || !study) && React__default.createElement(LoadingOutlined$1, { style: { margin: '0 10px 0 0' } }),
48808
- (study && run) &&
48857
+ !localRun && (!isReady || !study) && React__default.createElement(LoadingOutlined$1, { style: { margin: '0 10px 0 0' } }),
48858
+ run &&
48809
48859
  React__default.createElement(React__default.Fragment, null,
48810
48860
  React__default.createElement("span", { title: 'Go to run page' },
48811
48861
  React__default.createElement(InfoCircleOutlined$1, { onClick: function (e) {
@@ -48866,40 +48916,65 @@ var RunCard = function (_a) {
48866
48916
  } }))))),
48867
48917
  React__default.createElement("div", { className: 'item3' },
48868
48918
  React__default.createElement("div", null,
48869
- React__default.createElement("a", { className: 'link', href: projectName && study && "/".concat(projectOwner, "/projects/").concat(projectName, "/studies/").concat(study.id), title: 'Go to study page', onMouseOver: function (e) { return toggleHover('study', true); }, onMouseLeave: function (e) { return toggleHover('study', false); }, style: { color: "".concat(hover.study
48870
- ? '#40a9ff' : '#000') } }, study ? (_e = study.spec.name) !== null && _e !== void 0 ? _e : "Study: ".concat(study.id) : '--'),
48919
+ React__default.createElement("button", { className: 'link', title: 'Go to study page', onMouseOver: function (e) { return toggleHover('study', true); }, onMouseLeave: function (e) { return toggleHover('study', false); }, onClick: function (e) {
48920
+ e.stopPropagation();
48921
+ if (!localRun) {
48922
+ if (!projectName || !study)
48923
+ return;
48924
+ window.location.href = "/".concat(projectOwner, "/projects/").concat(projectName, "/studies/").concat(study.id);
48925
+ }
48926
+ }, style: { all: 'unset', cursor: 'pointer', color: "".concat(hover.study
48927
+ ? '#40a9ff' : '#000') } },
48928
+ !localRun && study ? (_f = study.spec.name) !== null && _f !== void 0 ? _f : "Study: ".concat(study.id) : '',
48929
+ localRun && localStudy && localStudy.name),
48871
48930
  React__default.createElement("button", { style: { all: 'unset', margin: '0 0 0 8px', cursor: 'pointer' }, onMouseOver: function (e) { return toggleHover('info', true); }, onMouseLeave: function (e) { return toggleHover('info', false); }, onClick: function (e) {
48872
48931
  e.stopPropagation();
48873
48932
  setSeeDescription(function (prev) { return !prev; });
48874
48933
  setSeeAction(false);
48875
48934
  } },
48876
48935
  React__default.createElement(InfoCircle$1, { size: 14, style: hover.info ? { color: '#40a9ff' } : {} })))),
48877
- React__default.createElement("div", { className: 'item4', title: study && dayjs_min(study.status.started_at).format('[on] MMM DD YYYY [at] hh:mm') }, study ? dayjs_min(study.status.started_at).format('[on] MMM DD YYYY') : '--'),
48936
+ React__default.createElement("div", { className: 'item4', title: run && dayjs_min(run.status.started_at).format('[on] MMM DD YYYY [at] hh:mm') }, run ? dayjs_min(run.status.started_at).format('[on] MMM DD YYYY') : '--'),
48878
48937
  React__default.createElement("div", { className: 'item5' },
48879
48938
  React__default.createElement("span", { style: { marginRight: '0.75rem' } },
48880
- React__default.createElement(Avatar, { color: hover.author ? '#40a9ff' : undefined, src: study ? study.author.picture_url : '', size: 24 })),
48881
- React__default.createElement("a", { className: 'link', href: study ? "/".concat(study.author.name) : '', title: 'Go to author page', target: '_blank', rel: 'noreferrer', onMouseOver: function (e) { return toggleHover('author', true); }, onMouseLeave: function (e) { return toggleHover('author', false); }, style: hover.author ? { color: '#40a9ff' } : {} }, study ? ((_f = study.author.display_name) !== null && _f !== void 0 ? _f : study.author.name) : '--')),
48939
+ React__default.createElement(Avatar, { color: hover.author ? '#40a9ff' : undefined, src: run ? (_g = run.author) === null || _g === void 0 ? void 0 : _g.picture_url : '', size: 24 })),
48940
+ React__default.createElement("a", { className: 'link', onClick: function (e) {
48941
+ e.stopPropagation();
48942
+ if (!localRun) {
48943
+ if (!run)
48944
+ return;
48945
+ window.location.href = "/".concat(run.author.name);
48946
+ }
48947
+ }, title: 'Go to author page', target: '_blank', rel: 'noreferrer', onMouseOver: function (e) { return toggleHover('author', true); }, onMouseLeave: function (e) { return toggleHover('author', false); }, style: hover.author ? { color: '#40a9ff' } : {} }, run ? ((_j = (_h = run.author) === null || _h === void 0 ? void 0 : _h.display_name) !== null && _j !== void 0 ? _j : (_k = run.author) === null || _k === void 0 ? void 0 : _k.name) : '--')),
48882
48948
  React__default.createElement("div", { className: 'item6' },
48883
48949
  React__default.createElement("span", { style: { marginRight: '0.75rem' } },
48884
- React__default.createElement(Avatar, { color: hover.recipe ? '#40a9ff' : undefined, src: study ? study.recipe.metadata.icon : '', size: 24 })),
48885
- React__default.createElement("a", { className: 'link', href: study ? recipeLinkFromSource(study.recipe.source) : '', title: 'Go to recipe page', target: '_blank', rel: 'noreferrer', onMouseOver: function (e) { return toggleHover('recipe', true); }, onMouseLeave: function (e) { return toggleHover('recipe', false); }, style: hover.recipe ? { color: '#40a9ff' } : {} }, study ? study.recipe.metadata.name : '--'),
48886
- study && React__default.createElement("span", { className: 'light-text' },
48950
+ React__default.createElement(Avatar, { color: hover.recipe ? '#40a9ff' : undefined, src: run ? run.recipe.metadata.icon : '', size: 24 })),
48951
+ React__default.createElement("a", { className: 'link', onClick: function (e) {
48952
+ e.stopPropagation();
48953
+ if (!localRun) {
48954
+ if (!run)
48955
+ return;
48956
+ window.location.href = recipeLinkFromSource(run.recipe.source);
48957
+ }
48958
+ }, title: 'Go to recipe page', target: '_blank', rel: 'noreferrer', onMouseOver: function (e) { return toggleHover('recipe', true); }, onMouseLeave: function (e) { return toggleHover('recipe', false); }, style: hover.recipe ? { color: '#40a9ff' } : {} }, run ? run.recipe.metadata.name : '--'),
48959
+ run && React__default.createElement("span", { className: 'light-text' },
48887
48960
  " ",
48888
- study.recipe.metadata.tag)),
48961
+ run.recipe.metadata.tag)),
48889
48962
  React__default.createElement("div", { className: 'item8' },
48890
- React__default.createElement("span", { className: 'status-label', style: { marginRight: '0.75rem' } }, study ? status : '--'),
48963
+ React__default.createElement("span", { className: 'status-label', style: { marginRight: '0.75rem' } }, run ? status : '--'),
48891
48964
  React__default.createElement("span", { className: 'light-text' },
48892
48965
  !isReady && React__default.createElement(LoadingOutlined$1, null),
48893
48966
  study && run && width > 600 &&
48894
48967
  "".concat(run.meta.progress.completed, " / ").concat(run.meta.progress.total, " steps"))),
48895
48968
  React__default.createElement("div", { className: 'item9', title: 'CPU usage' },
48896
48969
  React__default.createElement(Cpu$1, { size: 18, style: { marginRight: '0.15rem' } }),
48897
- React__default.createElement("span", { className: 'light-text' }, study ? "".concat(formatDuration(dayjs_min.duration(run.meta.resources_duration.cpu, 'seconds'))) : '--')),
48970
+ React__default.createElement("span", { className: 'light-text' }, run ? "".concat(formatDuration(dayjs_min.duration(run.meta.resources_duration.cpu, 'seconds'))) : '--')),
48898
48971
  React__default.createElement("div", { className: 'item10', title: 'Duration of the simulation' },
48899
48972
  React__default.createElement(Clock$1, { size: 18, style: { marginRight: '0.15rem' } }),
48900
- React__default.createElement("span", { className: 'light-text' }, study ? "".concat(formatDuration(duration)) : '--')),
48973
+ React__default.createElement("span", { className: 'light-text' }, run ? "".concat(formatDuration(duration)) : '--')),
48901
48974
  seeDescription && React__default.createElement(React__default.Fragment, null,
48902
- React__default.createElement("div", { className: 'item7' }, study ? study.spec.description : '--')),
48975
+ React__default.createElement("div", { className: 'item7' },
48976
+ !localRun && study && study.spec.description,
48977
+ localRun && localStudy && localStudy.description)),
48903
48978
  seeAction && width && React__default.createElement(React__default.Fragment, null,
48904
48979
  React__default.createElement("div", { className: 'item7' },
48905
48980
  React__default.createElement(Button, { style: (width > 600) ? { display: 'inline' } : { display: 'inline', float: 'left' }, disabled: !run || (run.status.status === dist$1.RunStatusEnum.Failed ||
@@ -48909,9 +48984,11 @@ var RunCard = function (_a) {
48909
48984
  e.stopPropagation();
48910
48985
  if (!run)
48911
48986
  return;
48912
- cancelRun(projectOwner, projectName, run.id)
48913
- .then(function (d) { return console.log(d); })
48914
- .catch(function (e) { return console.log(e); });
48987
+ if (!localRun) {
48988
+ cancelRun(projectOwner, projectName, run.id)
48989
+ .then(function (d) { return console.log(d); })
48990
+ .catch(function (e) { return console.log(e); });
48991
+ }
48915
48992
  } },
48916
48993
  React__default.createElement(XOctagon$1, { style: { display: 'inline', margin: '0 5px 0 0' } }),
48917
48994
  " Cancel")))));
@@ -50350,5 +50427,5 @@ var RunTable = function (_a) {
50350
50427
  React__default.createElement(ChevronRight$1, null)))))));
50351
50428
  };
50352
50429
 
50353
- export { APIClient, AuthUser, Avatar, Button, ComboBox, ComboFileSelector, ConditionalWrapper, ConfigureLocalRun, CreateStudy, Dropdown, FileInput, FilePreview, FormInput, GetGeometry, GetModel, InputDescription, Label, Logo, NumberInput, RadioList, RecipeForm, RunCard, RunDetails, RunRow, RunTable, SelectAccount, SelectCloudArtifacts, SelectLocalArtifacts, SelectProject, SelectRecipe, SelectRun, SelectStudy, SendGeometry, SendModel, SendResults, SettingsButton, StudyCard, TextInput, Tooltip, _defaultConfig, checkDotNet, checkPollinationPanel, checkRuby, formatBytes, getHost, recipeLinkFromSource, sendMessageDotNet, sendMessageRuby, useAPIClient, useArtifacts, useCreateStudy, useGetGeometry, useGetHbjson, useHbjsontoVTK, useJobs, useManageSettings, useRunCommand, useRuns, useSendHbjson, useSendMessage, useWindowDimensions };
50430
+ export { APIClient, AuthUser, Avatar, Button, ComboBox, ComboFileSelector, ConditionalWrapper, ConfigureLocalRun, CreateStudy, Dropdown, FileInput, FilePreview, FormInput, GetGeometry, GetModel, InputDescription, Label, Logo, NumberInput, RadioList, RecipeForm, RunCard, RunDetails, RunRow, RunTable, SelectAccount, SelectCloudArtifacts, SelectLocalArtifacts, SelectProject, SelectRecipe, SelectRun, SelectStudy, SendGeometry, SendModel, SendResults, SettingsButton, StudyCard, TextInput, Tooltip, _defaultConfig, checkDotNet, checkPollinationPanel, checkRuby, formatBytes, getHost, recipeLinkFromSource, sendMessageDotNet, sendMessageRuby, useAPIClient, useArtifacts, useCreateStudy, useGetGeometry, useGetHbjson, useHbjsontoVTK, useJobs, useManageSettings, usePollinationPanel, useRunCommand, useRuns, useSendHbjson, useSendMessage, useWindowDimensions };
50354
50431
  //# sourceMappingURL=index.esm.js.map