pollination-react-io 1.16.1 → 1.16.3

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.run-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 > .run-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: 'run-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',
@@ -42130,31 +42121,35 @@ var RunCard = function (_a) {
42130
42121
  textOverflow: 'ellipsis',
42131
42122
  display: 'inline-block'
42132
42123
  } }, run.id),
42133
- React__default.createElement(Dropdown, { trigger: React__default.createElement("button", { type: 'button', style: {
42134
- width: 32,
42135
- height: 32,
42136
- display: 'flex',
42137
- justifyContent: 'center',
42138
- alignItems: 'center',
42139
- borderRadius: 9999,
42140
- border: '1px solid #d0d7de',
42141
- backgroundColor: 'white',
42142
- outlineColor: 'var(--primary)'
42143
- } }, isValidating ? React__default.createElement(LoadingIcon, null) : React__default.createElement(Gear$1, null)), optionGroups: [
42144
- {
42145
- options: [{
42146
- type: 'button',
42147
- id: 'cancel-study',
42148
- label: 'Cancel',
42149
- icon: React__default.createElement(XOctagon$1, null),
42150
- disabled: typeof run.status.finished_at === 'string',
42151
- onSelect: function () { return cancelRun(projectOwner, projectName, _run.id); }
42152
- }]
42153
- }
42154
- ], contentProps: {
42155
- align: 'end',
42156
- sideOffset: 2,
42157
- } })),
42124
+ React__default.createElement("div", { style: {
42125
+ display: 'flex'
42126
+ } },
42127
+ React__default.createElement(Dropdown, { trigger: React__default.createElement("button", { type: 'button', style: {
42128
+ width: 32,
42129
+ height: 32,
42130
+ display: 'flex',
42131
+ justifyContent: 'center',
42132
+ alignItems: 'center',
42133
+ borderRadius: 9999,
42134
+ border: '1px solid #d0d7de',
42135
+ backgroundColor: 'white',
42136
+ outlineColor: 'var(--primary)',
42137
+ cursor: 'pointer'
42138
+ } }, isValidating ? React__default.createElement(LoadingIcon, null) : React__default.createElement(Gear$1, null)), optionGroups: [
42139
+ {
42140
+ options: [{
42141
+ type: 'button',
42142
+ id: 'cancel-study',
42143
+ label: 'Cancel',
42144
+ icon: React__default.createElement(XOctagon$1, null),
42145
+ disabled: typeof run.status.finished_at === 'string',
42146
+ onSelect: function () { return cancelRun(projectOwner, projectName, _run.id); }
42147
+ }]
42148
+ }
42149
+ ], contentProps: {
42150
+ align: 'end',
42151
+ sideOffset: 2,
42152
+ } }))),
42158
42153
  React__default.createElement("div", { style: {
42159
42154
  display: 'flex',
42160
42155
  flexDirection: 'column',
@@ -42233,11 +42228,11 @@ var RunsList = function (_a) {
42233
42228
  var _b = useState(false), open = _b[0], setOpen = _b[1];
42234
42229
  var _c = useState(1), page = _c[0], setPage = _c[1];
42235
42230
  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, {
42231
+ var _e = useRuns(client), listRuns = _e.listRuns, cancelRun = _e.cancelRun;
42232
+ var _f = useSWR(authUser ? [projectOwner, projectName, jobId, page] : undefined, listRuns, {
42238
42233
  revalidateOnFocus: false,
42239
42234
  refreshInterval: subscribe ? 5000 : undefined,
42240
- }), runs = _e.data; _e.error; var isValidating = _e.isValidating; _e.mutate;
42235
+ }), runs = _f.data; _f.error; var isValidating = _f.isValidating; _f.mutate;
42241
42236
  useEffect(function () {
42242
42237
  if (!runs || !runs.resources)
42243
42238
  return;
@@ -42254,13 +42249,26 @@ var RunsList = function (_a) {
42254
42249
  return (React__default.createElement("div", { key: item.id, style: {
42255
42250
  display: 'flex',
42256
42251
  justifyContent: 'space-between',
42252
+ alignItems: 'center',
42257
42253
  borderTop: '1px solid var(--slate5)',
42258
42254
  padding: '6px 8px',
42255
+ cursor: 'default'
42259
42256
  } },
42260
42257
  React__default.createElement("div", { style: {
42261
42258
  display: 'flex',
42259
+ alignItems: 'center',
42262
42260
  gap: 12
42263
42261
  } },
42262
+ item.status.status === dist.RunStatusEnum.Running &&
42263
+ React__default.createElement("button", { style: {
42264
+ display: 'flex',
42265
+ backgroundColor: 'rgba(0,0,0,0)',
42266
+ color: 'red',
42267
+ border: 'none'
42268
+ }, onClick: function () {
42269
+ cancelRun(projectOwner, projectName, item.id);
42270
+ } },
42271
+ React__default.createElement(XOctagon$1, null)),
42264
42272
  React__default.createElement("a", { href: "/".concat(projectOwner, "/projects/").concat(projectName, "/studies/").concat(jobId, "/runs/").concat(item.id), style: {
42265
42273
  color: statusMap[item.status.status].color
42266
42274
  } },
@@ -42297,7 +42305,7 @@ var RunsList = function (_a) {
42297
42305
  backgroundColor: 'rgba(0,0,0,0)',
42298
42306
  fontVariantNumeric: 'tabular-nums'
42299
42307
  } }, "".concat(formatBytes(item.meta.resources_duration.memory), " of storage"))))));
42300
- }, [jobId, projectName, projectOwner]);
42308
+ }, [cancelRun, jobId, projectName, projectOwner]);
42301
42309
  return (React__default.createElement("div", { "data-testid": "RunsList", className: "" },
42302
42310
  React__default.createElement($409067139f391064$export$be92b6f5f03c0fe9, { open: open, onOpenChange: function (val) { return setOpen(val); } },
42303
42311
  React__default.createElement($409067139f391064$export$41fb9f06171c75f4, { asChild: true },
@@ -42309,6 +42317,7 @@ var RunsList = function (_a) {
42309
42317
  React__default.createElement("span", { style: {
42310
42318
  display: 'flex',
42311
42319
  alignItems: 'center',
42320
+ cursor: 'pointer',
42312
42321
  gap: 8
42313
42322
  } }, "".concat(runs.total_count, " Total Runs"),
42314
42323
  runs.total_count > 0 && (isValidating ? React__default.createElement(LoadingIcon, { size: 16 }) : React__default.createElement(ChevronCompactDown$1, null))))),
@@ -43152,7 +43161,7 @@ var SendResults = function (_a) {
43152
43161
  }], asButtons: true, label: buttonLabel, helpText: "".concat(selOpt ? selOpt.charAt(0).toUpperCase() + selOpt.replace('-', ' ').slice(1) : 'Send', " results.") }));
43153
43162
  };
43154
43163
 
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}";
43164
+ 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.study-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 > .study-card:hover {\n box-shadow: rgba(0, 0, 0, 0.08) 0px 4px 8px 0px;\n border-color: var(--primary);\n}";
43156
43165
  styleInject(css_248z);
43157
43166
 
43158
43167
  dayjs_min.extend(duration);
@@ -43166,7 +43175,7 @@ var getStudyDuration = function (study) {
43166
43175
  };
43167
43176
  var StudyCard = function (_a) {
43168
43177
  var _b;
43169
- var projectName = _a.projectName, projectOwner = _a.projectOwner, _study = _a.study, authUser = _a.authUser, client = _a.client;
43178
+ var projectName = _a.projectName, projectOwner = _a.projectOwner, _study = _a.study, style = _a.style, authUser = _a.authUser, client = _a.client;
43170
43179
  var _c = useJobs(client), cancelJob = _c.cancelJob, deleteJob = _c.deleteJob, fetchJob = _c.fetchJob;
43171
43180
  var _d = useSWR(authUser ? [projectOwner, projectName, _study.id] : undefined, fetchJob, {
43172
43181
  revalidateOnFocus: false,
@@ -43196,16 +43205,7 @@ var StudyCard = function (_a) {
43196
43205
  }, 1000);
43197
43206
  return study.status.finished_at ? undefined : function () { return clearInterval(handle); };
43198
43207
  }, [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
- } },
43208
+ return (React__default.createElement("div", { "data-testid": "StudyCard", className: 'study-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
43209
  React__default.createElement("div", { style: {
43210
43210
  borderRight: '1px solid #d0d7de',
43211
43211
  display: 'flex',
@@ -43274,37 +43274,40 @@ var StudyCard = function (_a) {
43274
43274
  textOverflow: 'ellipsis',
43275
43275
  display: 'inline-block'
43276
43276
  } }, study.spec.name),
43277
- React__default.createElement(Dropdown, { trigger: React__default.createElement("button", { type: 'button', style: {
43278
- width: 32,
43279
- height: 32,
43280
- display: 'flex',
43281
- justifyContent: 'center',
43282
- alignItems: 'center',
43283
- borderRadius: 9999,
43284
- border: '1px solid #d0d7de',
43285
- backgroundColor: 'white',
43286
- outlineColor: 'var(--primary)'
43287
- } }, isValidating ? React__default.createElement(LoadingIcon, null) : React__default.createElement(Gear$1, null)), optionGroups: [
43288
- {
43289
- options: [{
43290
- type: 'button',
43291
- id: 'cancel-study',
43292
- label: 'Cancel',
43293
- icon: React__default.createElement(XOctagon$1, null),
43294
- disabled: status.pending < 1 && status.running < 1,
43295
- onSelect: function () { return cancelJob(projectOwner, projectName, study.id); }
43296
- }, {
43297
- type: 'button',
43298
- id: 'delete-study',
43299
- label: 'Delete',
43300
- icon: React__default.createElement(Trash$1, null),
43301
- onSelect: function () { return deleteJob(projectOwner, projectName, study.id); }
43302
- },]
43303
- }
43304
- ], contentProps: {
43305
- align: 'end',
43306
- sideOffset: 2,
43307
- } })),
43277
+ React__default.createElement("div", { style: {
43278
+ display: 'flex'
43279
+ } },
43280
+ React__default.createElement(Dropdown, { trigger: React__default.createElement("button", { type: 'button', style: {
43281
+ width: 32,
43282
+ height: 32,
43283
+ display: 'flex',
43284
+ justifyContent: 'center',
43285
+ alignItems: 'center',
43286
+ borderRadius: 9999,
43287
+ border: '1px solid #d0d7de',
43288
+ backgroundColor: 'white',
43289
+ outlineColor: 'var(--primary)'
43290
+ } }, isValidating ? React__default.createElement(LoadingIcon, null) : React__default.createElement(Gear$1, null)), optionGroups: [
43291
+ {
43292
+ options: [{
43293
+ type: 'button',
43294
+ id: 'cancel-study',
43295
+ label: 'Cancel',
43296
+ icon: React__default.createElement(XOctagon$1, null),
43297
+ disabled: status.pending < 1 && status.running < 1,
43298
+ onSelect: function () { return cancelJob(projectOwner, projectName, study.id); }
43299
+ }, {
43300
+ type: 'button',
43301
+ id: 'delete-study',
43302
+ label: 'Delete',
43303
+ icon: React__default.createElement(Trash$1, null),
43304
+ onSelect: function () { return deleteJob(projectOwner, projectName, study.id); }
43305
+ },]
43306
+ }
43307
+ ], contentProps: {
43308
+ align: 'end',
43309
+ sideOffset: 2,
43310
+ } }))),
43308
43311
  React__default.createElement("div", { style: {
43309
43312
  display: 'flex',
43310
43313
  flexDirection: 'column',