pollination-react-io 1.16.1 → 1.16.2

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.
@@ -1,10 +1,12 @@
1
1
  import { Run, UserPrivate } from '@pollination-solutions/pollination-sdk';
2
+ import { CSSProperties } from 'react';
2
3
  import { APIClient } from '../hooks';
3
4
  export interface RunCardProps {
4
5
  projectOwner: string;
5
6
  projectName: string;
6
7
  jobId: string;
7
8
  run: Run;
9
+ style?: CSSProperties;
8
10
  client?: APIClient;
9
11
  authUser?: UserPrivate;
10
12
  }
@@ -1,9 +1,11 @@
1
1
  import { CloudJob, UserPrivate } from '@pollination-solutions/pollination-sdk';
2
+ import { CSSProperties } from 'react';
2
3
  import { APIClient } from '../hooks';
3
4
  export interface StudyCardProps {
4
5
  projectOwner: string;
5
6
  projectName: string;
6
7
  study: CloudJob;
8
+ style?: CSSProperties;
7
9
  authUser?: UserPrivate;
8
10
  client: APIClient;
9
11
  }
@@ -42031,14 +42031,14 @@ var useSWRHandler = function (_key, fetcher, config) {
42031
42031
  };
42032
42032
  var useSWR = withArgs(useSWRHandler);
42033
42033
 
42034
- var css_248z$2 = "";
42034
+ var css_248z$2 = ":root {\n --background: #FFFAEE;\n --primary: #1890ff;\n --primary2: #40a9ff;\n --primary1: #cceefe;\n --primary0: #e6f7ff;\n --secondary: #fff566;\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.hover-card {\n transition: box-shadow 250ms ease-in-out, border-color 250ms ease-in-out;\n border-color: #d0d7de;\n width: 100%;\n background-color: white;\n}\n\na > .hover-card:hover {\n box-shadow: rgba(0, 0, 0, 0.08) 0px 4px 8px 0px;\n border-color: var(--primary);\n}";
42035
42035
  styleInject(css_248z$2);
42036
42036
 
42037
42037
  dayjs_min.extend(duration);
42038
42038
  dayjs_min.extend(utc);
42039
42039
  var RunCard = function (_a) {
42040
42040
  var _b;
42041
- var projectOwner = _a.projectOwner, projectName = _a.projectName, jobId = _a.jobId, _run = _a.run, client = _a.client, authUser = _a.authUser;
42041
+ var projectOwner = _a.projectOwner, projectName = _a.projectName, jobId = _a.jobId, _run = _a.run, style = _a.style, client = _a.client, authUser = _a.authUser;
42042
42042
  var _c = useRuns(client); _c.listRuns; var fetchRun = _c.fetchRun, cancelRun = _c.cancelRun;
42043
42043
  var _d = useSWR(authUser && typeof _run !== 'undefined' ? [projectOwner, projectName, _run.id] : null, fetchRun, {
42044
42044
  revalidateOnFocus: false,
@@ -42056,16 +42056,7 @@ var RunCard = function (_a) {
42056
42056
  }, 1000);
42057
42057
  return run.status.finished_at ? undefined : function () { return clearInterval(handle); };
42058
42058
  }, [run]);
42059
- return (React__default.createElement("div", { "data-testid": "RunCard", className: 'hover-card', style: {
42060
- borderRadius: 8,
42061
- borderWidth: 1,
42062
- borderStyle: 'solid',
42063
- display: 'grid',
42064
- gridTemplateColumns: 'minmax(200px, 18%) 1fr',
42065
- gridTemplateRows: '1fr auto',
42066
- columnGap: 8,
42067
- rowGap: 0
42068
- } },
42059
+ return (React__default.createElement("div", { "data-testid": "RunCard", className: 'hover-card', style: __assign({ borderRadius: 8, borderWidth: 1, borderStyle: 'solid', display: 'grid', gridTemplateColumns: 'minmax(200px, 18%) 1fr', gridTemplateRows: '1fr auto', columnGap: 8, rowGap: 0 }, style) },
42069
42060
  React__default.createElement("div", { style: {
42070
42061
  borderRight: '1px solid #d0d7de',
42071
42062
  display: 'flex',
@@ -42233,11 +42224,11 @@ var RunsList = function (_a) {
42233
42224
  var _b = useState(false), open = _b[0], setOpen = _b[1];
42234
42225
  var _c = useState(1), page = _c[0], setPage = _c[1];
42235
42226
  var _d = useState([]), items = _d[0], setItems = _d[1];
42236
- var listRuns = useRuns(client).listRuns;
42237
- var _e = useSWR(authUser ? [projectOwner, projectName, jobId, page] : undefined, listRuns, {
42227
+ var _e = useRuns(client), listRuns = _e.listRuns, cancelRun = _e.cancelRun;
42228
+ var _f = useSWR(authUser ? [projectOwner, projectName, jobId, page] : undefined, listRuns, {
42238
42229
  revalidateOnFocus: false,
42239
42230
  refreshInterval: subscribe ? 5000 : undefined,
42240
- }), runs = _e.data; _e.error; var isValidating = _e.isValidating; _e.mutate;
42231
+ }), runs = _f.data; _f.error; var isValidating = _f.isValidating; _f.mutate;
42241
42232
  useEffect(function () {
42242
42233
  if (!runs || !runs.resources)
42243
42234
  return;
@@ -42261,6 +42252,14 @@ var RunsList = function (_a) {
42261
42252
  display: 'flex',
42262
42253
  gap: 12
42263
42254
  } },
42255
+ React__default.createElement("button", { style: {
42256
+ backgroundColor: 'rgba(0,0,0,0)',
42257
+ color: 'red',
42258
+ border: 'none'
42259
+ }, onClick: function () {
42260
+ cancelRun(projectOwner, projectName, item.id);
42261
+ } },
42262
+ React__default.createElement(XOctagon$1, null)),
42264
42263
  React__default.createElement("a", { href: "/".concat(projectOwner, "/projects/").concat(projectName, "/studies/").concat(jobId, "/runs/").concat(item.id), style: {
42265
42264
  color: statusMap[item.status.status].color
42266
42265
  } },
@@ -42297,7 +42296,7 @@ var RunsList = function (_a) {
42297
42296
  backgroundColor: 'rgba(0,0,0,0)',
42298
42297
  fontVariantNumeric: 'tabular-nums'
42299
42298
  } }, "".concat(formatBytes(item.meta.resources_duration.memory), " of storage"))))));
42300
- }, [jobId, projectName, projectOwner]);
42299
+ }, [cancelRun, jobId, projectName, projectOwner]);
42301
42300
  return (React__default.createElement("div", { "data-testid": "RunsList", className: "" },
42302
42301
  React__default.createElement($409067139f391064$export$be92b6f5f03c0fe9, { open: open, onOpenChange: function (val) { return setOpen(val); } },
42303
42302
  React__default.createElement($409067139f391064$export$41fb9f06171c75f4, { asChild: true },
@@ -43152,7 +43151,7 @@ var SendResults = function (_a) {
43152
43151
  }], asButtons: true, label: buttonLabel, helpText: "".concat(selOpt ? selOpt.charAt(0).toUpperCase() + selOpt.replace('-', ' ').slice(1) : 'Send', " results.") }));
43153
43152
  };
43154
43153
 
43155
- var css_248z = ":root {\n --background: #FFFAEE;\n --primary: #1890ff;\n --primary2: #40a9ff;\n --primary1: #cceefe;\n --primary0: #e6f7ff;\n --secondary: #fff566;\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.hover-card {\n transition: box-shadow 250ms ease-in-out, border-color 250ms ease-in-out;\n border-color: #d0d7de;\n}\n\na > .hover-card:hover {\n box-shadow: rgba(0, 0, 0, 0.08) 0px 4px 8px 0px;\n border-color: var(--primary);\n}";
43154
+ var css_248z = ":root {\n --background: #FFFAEE;\n --primary: #1890ff;\n --primary2: #40a9ff;\n --primary1: #cceefe;\n --primary0: #e6f7ff;\n --secondary: #fff566;\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.hover-card {\n transition: box-shadow 250ms ease-in-out, border-color 250ms ease-in-out;\n border-color: #d0d7de;\n width: 100%;\n background-color: white;\n}\n\na > .hover-card:hover {\n box-shadow: rgba(0, 0, 0, 0.08) 0px 4px 8px 0px;\n border-color: var(--primary);\n}";
43156
43155
  styleInject(css_248z);
43157
43156
 
43158
43157
  dayjs_min.extend(duration);
@@ -43166,7 +43165,7 @@ var getStudyDuration = function (study) {
43166
43165
  };
43167
43166
  var StudyCard = function (_a) {
43168
43167
  var _b;
43169
- var projectName = _a.projectName, projectOwner = _a.projectOwner, _study = _a.study, authUser = _a.authUser, client = _a.client;
43168
+ var projectName = _a.projectName, projectOwner = _a.projectOwner, _study = _a.study, style = _a.style, authUser = _a.authUser, client = _a.client;
43170
43169
  var _c = useJobs(client), cancelJob = _c.cancelJob, deleteJob = _c.deleteJob, fetchJob = _c.fetchJob;
43171
43170
  var _d = useSWR(authUser ? [projectOwner, projectName, _study.id] : undefined, fetchJob, {
43172
43171
  revalidateOnFocus: false,
@@ -43196,16 +43195,7 @@ var StudyCard = function (_a) {
43196
43195
  }, 1000);
43197
43196
  return study.status.finished_at ? undefined : function () { return clearInterval(handle); };
43198
43197
  }, [study]);
43199
- return (React__default.createElement("div", { "data-testid": "StudyCard", className: 'hover-card', style: {
43200
- borderRadius: 8,
43201
- borderWidth: 1,
43202
- borderStyle: 'solid',
43203
- display: 'grid',
43204
- gridTemplateColumns: 'minmax(200px, 18%) 1fr',
43205
- gridTemplateRows: '1fr auto',
43206
- columnGap: 8,
43207
- rowGap: 0
43208
- } },
43198
+ return (React__default.createElement("div", { "data-testid": "StudyCard", className: 'hover-card', style: __assign({ borderRadius: 8, borderWidth: 1, borderStyle: 'solid', display: 'grid', gridTemplateColumns: 'minmax(200px, 18%) 1fr', gridTemplateRows: '1fr auto', columnGap: 8, rowGap: 0 }, style) },
43209
43199
  React__default.createElement("div", { style: {
43210
43200
  borderRight: '1px solid #d0d7de',
43211
43201
  display: 'flex',