@backstage-community/plugin-opencost 0.2.10 → 0.2.12

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/components/AllocationChart/RangeChart.esm.js +150 -0
  3. package/dist/components/AllocationChart/RangeChart.esm.js.map +1 -0
  4. package/dist/components/AllocationChart/SummaryChart.esm.js +89 -0
  5. package/dist/components/AllocationChart/SummaryChart.esm.js.map +1 -0
  6. package/dist/components/AllocationChart/index.esm.js +84 -0
  7. package/dist/components/AllocationChart/index.esm.js.map +1 -0
  8. package/dist/components/AllocationReport.esm.js +153 -0
  9. package/dist/components/AllocationReport.esm.js.map +1 -0
  10. package/dist/components/Controls/Download.esm.js +79 -0
  11. package/dist/components/Controls/Download.esm.js.map +1 -0
  12. package/dist/components/Controls/Edit.esm.js +71 -0
  13. package/dist/components/Controls/Edit.esm.js.map +1 -0
  14. package/dist/components/Controls/index.esm.js +42 -0
  15. package/dist/components/Controls/index.esm.js.map +1 -0
  16. package/dist/components/OpenCostPage/OpenCostPage.esm.js +17 -0
  17. package/dist/components/OpenCostPage/OpenCostPage.esm.js.map +1 -0
  18. package/dist/components/OpenCostPage/index.esm.js +2 -0
  19. package/dist/components/OpenCostPage/index.esm.js.map +1 -0
  20. package/dist/components/OpenCostReport/OpenCostReport.esm.js +223 -0
  21. package/dist/components/OpenCostReport/OpenCostReport.esm.js.map +1 -0
  22. package/dist/components/Page.esm.js +24 -0
  23. package/dist/components/Page.esm.js.map +1 -0
  24. package/dist/components/SelectWindow.esm.js +179 -0
  25. package/dist/components/SelectWindow.esm.js.map +1 -0
  26. package/dist/components/Subtitle.esm.js +34 -0
  27. package/dist/components/Subtitle.esm.js.map +1 -0
  28. package/dist/components/Warnings.esm.js +22 -0
  29. package/dist/components/Warnings.esm.js.map +1 -0
  30. package/dist/constants/colors.esm.js +37 -0
  31. package/dist/constants/colors.esm.js.map +1 -0
  32. package/dist/constants/currencyCodes.esm.js +183 -0
  33. package/dist/constants/currencyCodes.esm.js.map +1 -0
  34. package/dist/index.esm.js +1 -21
  35. package/dist/index.esm.js.map +1 -1
  36. package/dist/plugin.esm.js +19 -0
  37. package/dist/plugin.esm.js.map +1 -0
  38. package/dist/routes.esm.js +8 -0
  39. package/dist/routes.esm.js.map +1 -0
  40. package/dist/services/allocation.esm.js +21 -0
  41. package/dist/services/allocation.esm.js.map +1 -0
  42. package/dist/util.esm.js +229 -0
  43. package/dist/util.esm.js.map +1 -0
  44. package/package.json +10 -6
  45. package/dist/esm/index-BQC8_PDN.esm.js +0 -1536
  46. package/dist/esm/index-BQC8_PDN.esm.js.map +0 -1
@@ -0,0 +1,79 @@
1
+ import React from 'react';
2
+ import { reverse, sortBy, forEach, round, get } from 'lodash';
3
+ import ExportIcon from '@material-ui/icons/GetApp';
4
+ import IconButton from '@material-ui/core/IconButton';
5
+ import Tooltip from '@material-ui/core/Tooltip';
6
+
7
+ const columns = [
8
+ {
9
+ head: "Name",
10
+ prop: "name",
11
+ currency: false
12
+ },
13
+ {
14
+ head: "CPU",
15
+ prop: "cpuCost",
16
+ currency: true
17
+ },
18
+ {
19
+ head: "GPU",
20
+ prop: "gpuCost",
21
+ currency: true
22
+ },
23
+ {
24
+ head: "RAM",
25
+ prop: "ramCost",
26
+ currency: true
27
+ },
28
+ {
29
+ head: "PV",
30
+ prop: "pvCost",
31
+ currency: true
32
+ },
33
+ {
34
+ head: "Network",
35
+ prop: "networkCost",
36
+ currency: true
37
+ },
38
+ {
39
+ head: "Shared",
40
+ prop: "sharedCost",
41
+ currency: true
42
+ },
43
+ {
44
+ head: "Total",
45
+ prop: "totalCost",
46
+ currency: true
47
+ }
48
+ ];
49
+ const toCSVLine = (datum) => {
50
+ const cols = [];
51
+ forEach(columns, (c) => {
52
+ if (c.currency) {
53
+ cols.push(round(get(datum, c.prop, 0), 2));
54
+ } else {
55
+ cols.push(`"${get(datum, c.prop, "")}"`);
56
+ }
57
+ });
58
+ return cols.join(",");
59
+ };
60
+ const DownloadControl = ({ cumulativeData, title }) => {
61
+ function downloadReport() {
62
+ const head = columns.map((c) => c.head).join(",");
63
+ const body = reverse(sortBy(cumulativeData, "totalCost")).map(toCSVLine).join("\r\n");
64
+ const csv = `${head}\r
65
+ ${body}`;
66
+ const a = document.createElement("a");
67
+ a.href = URL.createObjectURL(new Blob([csv], { type: "text/csv" }));
68
+ const filename = title.toLocaleLowerCase("en-US").replace(/\s/gi, "-");
69
+ a.setAttribute("download", `${filename}-${Date.now()}.csv`);
70
+ document.body.appendChild(a);
71
+ a.click();
72
+ document.body.removeChild(a);
73
+ }
74
+ return /* @__PURE__ */ React.createElement(Tooltip, { title: "Download CSV" }, /* @__PURE__ */ React.createElement(IconButton, { onClick: downloadReport }, /* @__PURE__ */ React.createElement(ExportIcon, null)));
75
+ };
76
+ var DownloadControl$1 = React.memo(DownloadControl);
77
+
78
+ export { DownloadControl$1 as default };
79
+ //# sourceMappingURL=Download.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Download.esm.js","sources":["../../../src/components/Controls/Download.jsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { get, forEach, reverse, round, sortBy } from 'lodash';\nimport ExportIcon from '@material-ui/icons/GetApp';\nimport IconButton from '@material-ui/core/IconButton';\nimport Tooltip from '@material-ui/core/Tooltip';\n\nconst columns = [\n {\n head: 'Name',\n prop: 'name',\n currency: false,\n },\n {\n head: 'CPU',\n prop: 'cpuCost',\n currency: true,\n },\n {\n head: 'GPU',\n prop: 'gpuCost',\n currency: true,\n },\n {\n head: 'RAM',\n prop: 'ramCost',\n currency: true,\n },\n {\n head: 'PV',\n prop: 'pvCost',\n currency: true,\n },\n {\n head: 'Network',\n prop: 'networkCost',\n currency: true,\n },\n {\n head: 'Shared',\n prop: 'sharedCost',\n currency: true,\n },\n {\n head: 'Total',\n prop: 'totalCost',\n currency: true,\n },\n];\n\nconst toCSVLine = datum => {\n const cols = [];\n\n forEach(columns, c => {\n if (c.currency) {\n cols.push(round(get(datum, c.prop, 0.0), 2));\n } else {\n cols.push(`\"${get(datum, c.prop, '')}\"`);\n }\n });\n\n return cols.join(',');\n};\n\nconst DownloadControl = ({ cumulativeData, title }) => {\n // downloadReport downloads a CSV of the cumulative allocation data\n function downloadReport() {\n // Build CSV\n const head = columns.map(c => c.head).join(',');\n const body = reverse(sortBy(cumulativeData, 'totalCost'))\n .map(toCSVLine)\n .join('\\r\\n');\n const csv = `${head}\\r\\n${body}`;\n\n // Create download link\n const a = document.createElement('a');\n a.href = URL.createObjectURL(new Blob([csv], { type: 'text/csv' }));\n const filename = title.toLocaleLowerCase('en-US').replace(/\\s/gi, '-');\n a.setAttribute('download', `${filename}-${Date.now()}.csv`);\n\n // Click the link\n document.body.appendChild(a);\n a.click();\n document.body.removeChild(a);\n }\n\n return (\n <Tooltip title=\"Download CSV\">\n <IconButton onClick={downloadReport}>\n <ExportIcon />\n </IconButton>\n </Tooltip>\n );\n};\n\nexport default React.memo(DownloadControl);\n"],"names":[],"mappings":";;;;;;AAqBA,MAAM,OAAU,GAAA;AAAA,EACd;AAAA,IACE,IAAM,EAAA,MAAA;AAAA,IACN,IAAM,EAAA,MAAA;AAAA,IACN,QAAU,EAAA,KAAA;AAAA,GACZ;AAAA,EACA;AAAA,IACE,IAAM,EAAA,KAAA;AAAA,IACN,IAAM,EAAA,SAAA;AAAA,IACN,QAAU,EAAA,IAAA;AAAA,GACZ;AAAA,EACA;AAAA,IACE,IAAM,EAAA,KAAA;AAAA,IACN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J,CAAA,CAAA;AAEA,wBAAe,KAAA,CAAM,KAAK,eAAe,CAAA;;;;"}
@@ -0,0 +1,71 @@
1
+ import { makeStyles } from '@material-ui/core/styles';
2
+ import FormControl from '@material-ui/core/FormControl';
3
+ import InputLabel from '@material-ui/core/InputLabel';
4
+ import MenuItem from '@material-ui/core/MenuItem';
5
+ import Select from '@material-ui/core/Select';
6
+ import React from 'react';
7
+ import SelectWindow from '../SelectWindow.esm.js';
8
+
9
+ const useStyles = makeStyles({
10
+ wrapper: {
11
+ display: "inline-flex"
12
+ },
13
+ formControl: {
14
+ margin: 8,
15
+ minWidth: 120
16
+ }
17
+ });
18
+ function EditControl({
19
+ windowOptions,
20
+ window,
21
+ setWindow,
22
+ aggregationOptions,
23
+ aggregateBy,
24
+ setAggregateBy,
25
+ accumulateOptions,
26
+ accumulate,
27
+ setAccumulate,
28
+ currencyOptions,
29
+ currency,
30
+ setCurrency
31
+ }) {
32
+ const classes = useStyles();
33
+ return /* @__PURE__ */ React.createElement("div", { className: classes.wrapper }, /* @__PURE__ */ React.createElement(
34
+ SelectWindow,
35
+ {
36
+ windowOptions,
37
+ window,
38
+ setWindow
39
+ }
40
+ ), /* @__PURE__ */ React.createElement(FormControl, { className: classes.formControl }, /* @__PURE__ */ React.createElement(InputLabel, { id: "aggregation-select-label" }, "Breakdown"), /* @__PURE__ */ React.createElement(
41
+ Select,
42
+ {
43
+ id: "aggregation-select",
44
+ value: aggregateBy,
45
+ onChange: (e) => {
46
+ setAggregateBy(e.target.value);
47
+ }
48
+ },
49
+ aggregationOptions.map((opt) => /* @__PURE__ */ React.createElement(MenuItem, { key: opt.value, value: opt.value }, opt.name))
50
+ )), /* @__PURE__ */ React.createElement(FormControl, { className: classes.formControl }, /* @__PURE__ */ React.createElement(InputLabel, { id: "accumulate-label" }, "Resolution"), /* @__PURE__ */ React.createElement(
51
+ Select,
52
+ {
53
+ id: "accumulate",
54
+ value: accumulate,
55
+ onChange: (e) => setAccumulate(e.target.value)
56
+ },
57
+ accumulateOptions.map((opt) => /* @__PURE__ */ React.createElement(MenuItem, { key: opt.value, value: opt.value }, opt.name))
58
+ )), /* @__PURE__ */ React.createElement(FormControl, { className: classes.formControl }, /* @__PURE__ */ React.createElement(InputLabel, { id: "currency-label" }, "Currency"), /* @__PURE__ */ React.createElement(
59
+ Select,
60
+ {
61
+ id: "currency",
62
+ value: currency,
63
+ onChange: (e) => setCurrency(e.target.value)
64
+ },
65
+ currencyOptions?.map((currencyVal) => /* @__PURE__ */ React.createElement(MenuItem, { key: currencyVal, value: currencyVal }, currencyVal))
66
+ )));
67
+ }
68
+ var EditControl$1 = React.memo(EditControl);
69
+
70
+ export { EditControl$1 as default };
71
+ //# sourceMappingURL=Edit.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Edit.esm.js","sources":["../../../src/components/Controls/Edit.jsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { makeStyles } from '@material-ui/core/styles';\nimport FormControl from '@material-ui/core/FormControl';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Select from '@material-ui/core/Select';\n\nimport React from 'react';\n\nimport SelectWindow from '../SelectWindow';\n\nconst useStyles = makeStyles({\n wrapper: {\n display: 'inline-flex',\n },\n formControl: {\n margin: 8,\n minWidth: 120,\n },\n});\n\nfunction EditControl({\n windowOptions,\n window,\n setWindow,\n aggregationOptions,\n aggregateBy,\n setAggregateBy,\n accumulateOptions,\n accumulate,\n setAccumulate,\n currencyOptions,\n currency,\n setCurrency,\n}) {\n const classes = useStyles();\n return (\n <div className={classes.wrapper}>\n <SelectWindow\n windowOptions={windowOptions}\n window={window}\n setWindow={setWindow}\n />\n <FormControl className={classes.formControl}>\n <InputLabel id=\"aggregation-select-label\">Breakdown</InputLabel>\n <Select\n id=\"aggregation-select\"\n value={aggregateBy}\n onChange={e => {\n setAggregateBy(e.target.value);\n }}\n >\n {aggregationOptions.map(opt => (\n <MenuItem key={opt.value} value={opt.value}>\n {opt.name}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n <FormControl className={classes.formControl}>\n <InputLabel id=\"accumulate-label\">Resolution</InputLabel>\n <Select\n id=\"accumulate\"\n value={accumulate}\n onChange={e => setAccumulate(e.target.value)}\n >\n {accumulateOptions.map(opt => (\n <MenuItem key={opt.value} value={opt.value}>\n {opt.name}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n <FormControl className={classes.formControl}>\n <InputLabel id=\"currency-label\">Currency</InputLabel>\n <Select\n id=\"currency\"\n value={currency}\n onChange={e => setCurrency(e.target.value)}\n >\n {currencyOptions?.map(currencyVal => (\n <MenuItem key={currencyVal} value={currencyVal}>\n {currencyVal}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n </div>\n );\n}\n\nexport default React.memo(EditControl);\n"],"names":[],"mappings":";;;;;;;;AAyBA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,OAAS,EAAA;AAAA,IACP,OAAS,EAAA,aAAA;AAAA,GACX;AAAA,EACA,WAAa,EAAA;AAAA,IACX,MAAQ,EAAA,CAAA;AAAA,IACR,QAAU,EAAA,GAAA;AAAA,GACZ;AACF,CAAC,CAAA,CAAA;AAED,SAAS,WAAY,CAAA;AAAA,EACnB,aAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,kBAAA;AAAA,EACA,WAAA;AAAA,EACA,cAAA;AAAA,EACA,iBAAA;AAAA,EACA,UAAA;AAAA,EACA,aAAA;AAAA,EACA,eAAA;AAAA,EACA,QAAA;AAAA,EACA,WAA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AAU,EAAA,CAAA,CAAA,KAAK,aAAc,CAAA,CAAA,CAAE,OAAO,KAAK,CAAA;AAAA,KAAA;AAAA,IAE1C,iBAAkB,CAAA,GAAA,CAAI,CACrB,GAAA,qBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,EAAA,GAAA,EAAK,GAAI,CAAA,KAAA,EAAO,KAAO,EAAA,GAAA,CAAI,KAClC,EAAA,EAAA,GAAA,CAAI,IACP,CACD,CAAA;AAAA,GAEL,CAAA,kBACC,KAAA,CAAA,aAAA,CAAA,WAAA,EAAA,EAAY,SAAW,EAAA,OAAA,CAAQ,WAC9B,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,EAAA,EAAG,gBAAiB,EAAA,EAAA,UAAQ,CACxC,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,EAAG,EAAA,UAAA;AAAA,MACH,KAAO,EAAA,QAAA;AAAA,MACP,QAAU,EAAA,CAAA,CAAA,KAAK,WAAY,CAAA,CAAA,CAAE,OAAO,KAAK,CAAA;AAAA,KAAA;AAAA,IAExC,eAAA,EAAiB,GAAI,CAAA,CAAA,WAAA,qBACnB,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,KAAK,WAAa,EAAA,KAAA,EAAO,WAChC,EAAA,EAAA,WACH,CACD,CAAA;AAAA,GAEL,CACF,CAAA,CAAA;AAEJ,CAAA;AAEA,oBAAe,KAAA,CAAM,KAAK,WAAW,CAAA;;;;"}
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import DownloadControl from './Download.esm.js';
3
+ import EditControl from './Edit.esm.js';
4
+
5
+ const Controls = ({
6
+ windowOptions,
7
+ window,
8
+ setWindow,
9
+ aggregationOptions,
10
+ aggregateBy,
11
+ setAggregateBy,
12
+ accumulateOptions,
13
+ accumulate,
14
+ setAccumulate,
15
+ title,
16
+ cumulativeData,
17
+ currency,
18
+ currencyOptions,
19
+ setCurrency
20
+ }) => {
21
+ return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
22
+ EditControl,
23
+ {
24
+ windowOptions,
25
+ window,
26
+ setWindow,
27
+ aggregationOptions,
28
+ aggregateBy,
29
+ setAggregateBy,
30
+ accumulateOptions,
31
+ accumulate,
32
+ setAccumulate,
33
+ currency,
34
+ currencyOptions,
35
+ setCurrency
36
+ }
37
+ ), /* @__PURE__ */ React.createElement(DownloadControl, { cumulativeData, title }));
38
+ };
39
+ var Controls$1 = React.memo(Controls);
40
+
41
+ export { Controls$1 as default };
42
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../../../src/components/Controls/index.jsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport DownloadControl from './Download';\nimport EditControl from './Edit';\n\nconst Controls = ({\n windowOptions,\n window,\n setWindow,\n aggregationOptions,\n aggregateBy,\n setAggregateBy,\n accumulateOptions,\n accumulate,\n setAccumulate,\n title,\n cumulativeData,\n currency,\n currencyOptions,\n setCurrency,\n}) => {\n return (\n <div>\n <EditControl\n windowOptions={windowOptions}\n window={window}\n setWindow={setWindow}\n aggregationOptions={aggregationOptions}\n aggregateBy={aggregateBy}\n setAggregateBy={setAggregateBy}\n accumulateOptions={accumulateOptions}\n accumulate={accumulate}\n setAccumulate={setAccumulate}\n currency={currency}\n currencyOptions={currencyOptions}\n setCurrency={setCurrency}\n />\n <DownloadControl cumulativeData={cumulativeData} title={title} />\n </div>\n );\n};\n\nexport default React.memo(Controls);\n"],"names":[],"mappings":";;;;AAmBA,MAAM,WAAW,CAAC;AAAA,EAChB,aAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,kBAAA;AAAA,EACA,WAAA;AAAA,EACA,cAAA;AAAA,EACA,iBAAA;AAAA,EACA,UAAA;AAAA,EACA,aAAA;AAAA,EACA,KAAA;AAAA,EACA,cAAA;AAAA,EACA,QAAA;AAAA,EACA,eAAA;AAAA,EACA,WAAA;AACF,CAAM,KAAA;AACJ,EAAA,2CACG,KACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,aAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,MACA,kBAAA;AAAA,MACA,WAAA;AAAA,MACA,cAAA;AAAA,MACA,iBAAA;AAAA,MACA,UAAA;AAAA,MACA,aAAA;AAAA,MACA,QAAA;AAAA,MACA,eAAA;AAAA,MACA,WAAA;AAAA,KAAA;AAAA,GAEF,kBAAA,KAAA,CAAA,aAAA,CAAC,eAAgB,EAAA,EAAA,cAAA,EAAgC,OAAc,CACjE,CAAA,CAAA;AAEJ,CAAA,CAAA;AAEA,iBAAe,KAAA,CAAM,KAAK,QAAQ,CAAA;;;;"}
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import Grid from '@material-ui/core/Grid';
3
+ import { Page, Header, Content } from '@backstage/core-components';
4
+ import { OpenCostReport } from '../OpenCostReport/OpenCostReport.esm.js';
5
+ import logo from '../../images/pig.png';
6
+
7
+ const OpenCostPage = () => /* @__PURE__ */ React.createElement(Page, { themeId: "tool" }, /* @__PURE__ */ React.createElement(
8
+ Header,
9
+ {
10
+ title: "OpenCost",
11
+ subtitle: "Open source Kubernetes cloud cost monitoring"
12
+ },
13
+ /* @__PURE__ */ React.createElement("a", { href: "https://opencost.io" }, /* @__PURE__ */ React.createElement("img", { width: 68, height: 64, src: logo, alt: "OpenCost" }))
14
+ ), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3, direction: "column" }, /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(OpenCostReport, null)))));
15
+
16
+ export { OpenCostPage };
17
+ //# sourceMappingURL=OpenCostPage.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenCostPage.esm.js","sources":["../../../src/components/OpenCostPage/OpenCostPage.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport Grid from '@material-ui/core/Grid';\nimport { Header, Page, Content } from '@backstage/core-components';\nimport { OpenCostReport } from '../OpenCostReport';\nimport logo from '../../images/pig.png';\n\nexport const OpenCostPage = () => (\n <Page themeId=\"tool\">\n <Header\n title=\"OpenCost\"\n subtitle=\"Open source Kubernetes cloud cost monitoring\"\n >\n <a href=\"https://opencost.io\">\n <img width={68} height={64} src={logo} alt=\"OpenCost\" />\n </a>\n </Header>\n <Content>\n <Grid container spacing={3} direction=\"column\">\n <Grid item>\n <OpenCostReport />\n </Grid>\n </Grid>\n </Content>\n </Page>\n);\n"],"names":[],"mappings":";;;;;;AAqBO,MAAM,YAAe,GAAA,sBACzB,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,SAAQ,MACZ,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,EAAC,MAAA;AAAA,EAAA;AAAA,IACC,KAAM,EAAA,UAAA;AAAA,IACN,QAAS,EAAA,8CAAA;AAAA,GAAA;AAAA,kBAER,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAE,IAAK,EAAA,qBAAA,EAAA,sCACL,KAAI,EAAA,EAAA,KAAA,EAAO,EAAI,EAAA,MAAA,EAAQ,EAAI,EAAA,GAAA,EAAK,IAAM,EAAA,GAAA,EAAI,YAAW,CACxD,CAAA;AACF,CAAA,sCACC,OACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,SAAS,EAAA,IAAA,EAAC,SAAS,CAAG,EAAA,SAAA,EAAU,4BACnC,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,MAAI,IACR,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,oBAAe,CAClB,CACF,CACF,CACF;;;;"}
@@ -0,0 +1,2 @@
1
+ export { OpenCostPage } from './OpenCostPage.esm.js';
2
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,223 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import CircularProgress from '@material-ui/core/CircularProgress';
3
+ import IconButton from '@material-ui/core/IconButton';
4
+ import Paper from '@material-ui/core/Paper';
5
+ import RefreshIcon from '@material-ui/icons/Refresh';
6
+ import Typography from '@material-ui/core/Typography';
7
+ import { useLocation, useNavigate } from 'react-router-dom';
8
+ import { toArray, sortBy, get, find } from 'lodash';
9
+ import { makeStyles } from '@material-ui/core/styles';
10
+ import AllocationReport from '../AllocationReport.esm.js';
11
+ import AllocationService from '../../services/allocation.esm.js';
12
+ import Controls from '../Controls/index.esm.js';
13
+ import Page from '../Page.esm.js';
14
+ import Subtitle from '../Subtitle.esm.js';
15
+ import Warnings from '../Warnings.esm.js';
16
+ import { rangeToCumulative, cumulativeToTotals, checkCustomWindow, toVerboseTimeRange } from '../../util.esm.js';
17
+ import { currencyCodes } from '../../constants/currencyCodes.esm.js';
18
+ import { useApi, configApiRef } from '@backstage/core-plugin-api';
19
+
20
+ const windowOptions = [
21
+ { name: "Today", value: "today" },
22
+ { name: "Yesterday", value: "yesterday" },
23
+ { name: "Week-to-date", value: "week" },
24
+ { name: "Month-to-date", value: "month" },
25
+ { name: "Last week", value: "lastweek" },
26
+ { name: "Last month", value: "lastmonth" },
27
+ { name: "Last 7 days", value: "6d" },
28
+ { name: "Last 30 days", value: "29d" },
29
+ { name: "Last 60 days", value: "59d" },
30
+ { name: "Last 90 days", value: "89d" }
31
+ ];
32
+ const aggregationOptions = [
33
+ { name: "Cluster", value: "cluster" },
34
+ { name: "Node", value: "node" },
35
+ { name: "Namespace", value: "namespace" },
36
+ { name: "Controller kind", value: "controllerKind" },
37
+ { name: "Controller", value: "controller" },
38
+ { name: "Service", value: "service" },
39
+ { name: "Pod", value: "pod" },
40
+ { name: "Container", value: "container" }
41
+ ];
42
+ const accumulateOptions = [
43
+ { name: "Entire window", value: true },
44
+ { name: "Daily", value: false }
45
+ ];
46
+ const useStyles = makeStyles({
47
+ reportHeader: {
48
+ display: "flex",
49
+ flexFlow: "row",
50
+ padding: 24
51
+ },
52
+ titles: {
53
+ flexGrow: 1
54
+ }
55
+ });
56
+ function generateTitle({ window, aggregateBy, accumulate }) {
57
+ let windowName = get(find(windowOptions, { value: window }), "name", "");
58
+ if (windowName === "") {
59
+ if (checkCustomWindow(window)) {
60
+ windowName = toVerboseTimeRange(window);
61
+ } else {
62
+ console.warn(`unknown window: ${window}`);
63
+ }
64
+ }
65
+ const aggregationName = get(
66
+ find(aggregationOptions, { value: aggregateBy }),
67
+ "name",
68
+ ""
69
+ ).toLocaleLowerCase("en-US");
70
+ if (aggregationName === "") {
71
+ console.warn(`unknown aggregation: ${aggregateBy}`);
72
+ }
73
+ let str = `${windowName} by ${aggregationName}`;
74
+ if (!accumulate) {
75
+ str = `${str} daily`;
76
+ }
77
+ return str;
78
+ }
79
+ const OpenCostReport = () => {
80
+ const classes = useStyles();
81
+ const [allocationData, setAllocationData] = useState([]);
82
+ const [cumulativeData, setCumulativeData] = useState({});
83
+ const [totalData, setTotalData] = useState({});
84
+ useEffect(() => {
85
+ const cumulative = rangeToCumulative(allocationData, aggregateBy);
86
+ setCumulativeData(toArray(cumulative));
87
+ setTotalData(cumulativeToTotals(cumulative));
88
+ }, [allocationData]);
89
+ const [window, setWindow] = useState(windowOptions[0].value);
90
+ const [aggregateBy, setAggregateBy] = useState(aggregationOptions[0].value);
91
+ const [accumulate, setAccumulate] = useState(accumulateOptions[0].value);
92
+ const [currency, setCurrency] = useState("USD");
93
+ const [title, setTitle] = useState("Last 7 days by namespace daily");
94
+ useEffect(() => {
95
+ setFetch(true);
96
+ setTitle(generateTitle({ window, aggregateBy, accumulate }));
97
+ }, [window, aggregateBy, accumulate]);
98
+ const [init, setInit] = useState(false);
99
+ const [fetch, setFetch] = useState(false);
100
+ const [loading, setLoading] = useState(true);
101
+ const [errors, setErrors] = useState([]);
102
+ useEffect(() => {
103
+ if (!init) {
104
+ initialize();
105
+ }
106
+ if (init && fetch) {
107
+ fetchData();
108
+ }
109
+ }, [init, fetch]);
110
+ const routerLocation = useLocation();
111
+ const searchParams = new URLSearchParams(routerLocation.search);
112
+ const routerNavigate = useNavigate();
113
+ useEffect(() => {
114
+ setWindow(searchParams.get("window") || "6d");
115
+ setAggregateBy(searchParams.get("agg") || "namespace");
116
+ setAccumulate(searchParams.get("acc") === "true" || false);
117
+ setCurrency(searchParams.get("currency") || "USD");
118
+ }, [routerLocation]);
119
+ async function initialize() {
120
+ setInit(true);
121
+ }
122
+ const configApi = useApi(configApiRef);
123
+ const baseUrl = configApi.getConfig("opencost").getString("baseUrl");
124
+ console.log(`baseUrl:${baseUrl}`);
125
+ async function fetchData() {
126
+ setLoading(true);
127
+ setErrors([]);
128
+ try {
129
+ const resp = await AllocationService.fetchAllocation(
130
+ baseUrl,
131
+ window,
132
+ aggregateBy,
133
+ { accumulate }
134
+ );
135
+ if (resp.data && resp.data.length > 0) {
136
+ const allocationRange = resp.data;
137
+ for (const i in allocationRange) {
138
+ if (Object.hasOwn(allocationRange, i)) {
139
+ allocationRange[i] = sortBy(allocationRange[i], (a) => a.totalCost);
140
+ }
141
+ }
142
+ setAllocationData(allocationRange);
143
+ } else {
144
+ setAllocationData([]);
145
+ }
146
+ } catch (err) {
147
+ if (err.message.indexOf("404") === 0) {
148
+ setErrors([
149
+ // @ts-ignore: not assignable to type 'never'
150
+ {
151
+ primary: "Failed to load report data",
152
+ secondary: "Please update OpenCost to the latest version, then open an Issue on GitHub if problems persist."
153
+ }
154
+ ]);
155
+ } else {
156
+ let secondary = "Please open an OpenCost issue with a bug report if problems persist.";
157
+ if (err.message.length > 0) {
158
+ secondary = err.message;
159
+ }
160
+ setErrors([
161
+ // @ts-ignore: not assignable to type 'never'
162
+ {
163
+ primary: "Failed to load report data",
164
+ secondary
165
+ }
166
+ ]);
167
+ }
168
+ setAllocationData([]);
169
+ }
170
+ setLoading(false);
171
+ setFetch(false);
172
+ }
173
+ return /* @__PURE__ */ React.createElement(Page, { active: "reports.html" }, !loading && errors.length > 0 && /* @__PURE__ */ React.createElement("div", { style: { marginBottom: 20 } }, /* @__PURE__ */ React.createElement(Warnings, { warnings: errors })), init && /* @__PURE__ */ React.createElement(Paper, { id: "report" }, /* @__PURE__ */ React.createElement("div", { className: classes.reportHeader }, /* @__PURE__ */ React.createElement("div", { className: classes.titles }, /* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, title), /* @__PURE__ */ React.createElement(Subtitle, { report: { window, aggregateBy, accumulate } })), /* @__PURE__ */ React.createElement(IconButton, { "aria-label": "refresh", onClick: () => setFetch(true) }, /* @__PURE__ */ React.createElement(RefreshIcon, null)), /* @__PURE__ */ React.createElement(
174
+ Controls,
175
+ {
176
+ windowOptions,
177
+ window,
178
+ setWindow: (win) => {
179
+ searchParams.set("window", win);
180
+ routerNavigate({
181
+ search: `?${searchParams.toString()}`
182
+ });
183
+ },
184
+ aggregationOptions,
185
+ aggregateBy,
186
+ setAggregateBy: (agg) => {
187
+ searchParams.set("agg", agg);
188
+ routerNavigate({
189
+ search: `?${searchParams.toString()}`
190
+ });
191
+ },
192
+ accumulateOptions,
193
+ accumulate,
194
+ setAccumulate: (acc) => {
195
+ searchParams.set("acc", acc);
196
+ routerNavigate({
197
+ search: `?${searchParams.toString()}`
198
+ });
199
+ },
200
+ title,
201
+ cumulativeData,
202
+ currency,
203
+ currencyOptions: currencyCodes,
204
+ setCurrency: (curr) => {
205
+ searchParams.set("currency", curr);
206
+ routerNavigate({
207
+ search: `?${searchParams.toString()}`
208
+ });
209
+ }
210
+ }
211
+ )), loading && /* @__PURE__ */ React.createElement("div", { style: { display: "flex", justifyContent: "center" } }, /* @__PURE__ */ React.createElement("div", { style: { paddingTop: 100, paddingBottom: 100 } }, /* @__PURE__ */ React.createElement(CircularProgress, null))), !loading && /* @__PURE__ */ React.createElement(
212
+ AllocationReport,
213
+ {
214
+ allocationData,
215
+ cumulativeData,
216
+ totalData,
217
+ currency
218
+ }
219
+ )));
220
+ };
221
+
222
+ export { OpenCostReport };
223
+ //# sourceMappingURL=OpenCostReport.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenCostReport.esm.js","sources":["../../../src/components/OpenCostReport/OpenCostReport.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// code ported from https://github.com/opencost/opencost/blob/develop/ui/src/Reports.js\n\nimport React, { useEffect, useState } from 'react';\nimport CircularProgress from '@material-ui/core/CircularProgress';\nimport IconButton from '@material-ui/core/IconButton';\nimport Paper from '@material-ui/core/Paper';\nimport RefreshIcon from '@material-ui/icons/Refresh';\nimport Typography from '@material-ui/core/Typography';\nimport { useLocation, useNavigate } from 'react-router-dom';\nimport { find, get, sortBy, toArray } from 'lodash';\nimport { makeStyles } from '@material-ui/core/styles';\nimport AllocationReport from '../AllocationReport';\nimport AllocationService from '../../services/allocation';\nimport Controls from '../Controls';\nimport Page from '../Page';\nimport Subtitle from '../Subtitle';\nimport Warnings from '../Warnings';\nimport {\n checkCustomWindow,\n cumulativeToTotals,\n rangeToCumulative,\n toVerboseTimeRange,\n} from '../../util';\nimport { currencyCodes } from '../../constants/currencyCodes';\nimport { useApi, configApiRef } from '@backstage/core-plugin-api';\n\nconst windowOptions = [\n { name: 'Today', value: 'today' },\n { name: 'Yesterday', value: 'yesterday' },\n { name: 'Week-to-date', value: 'week' },\n { name: 'Month-to-date', value: 'month' },\n { name: 'Last week', value: 'lastweek' },\n { name: 'Last month', value: 'lastmonth' },\n { name: 'Last 7 days', value: '6d' },\n { name: 'Last 30 days', value: '29d' },\n { name: 'Last 60 days', value: '59d' },\n { name: 'Last 90 days', value: '89d' },\n];\n\nconst aggregationOptions = [\n { name: 'Cluster', value: 'cluster' },\n { name: 'Node', value: 'node' },\n { name: 'Namespace', value: 'namespace' },\n { name: 'Controller kind', value: 'controllerKind' },\n { name: 'Controller', value: 'controller' },\n { name: 'Service', value: 'service' },\n { name: 'Pod', value: 'pod' },\n { name: 'Container', value: 'container' },\n];\n\nconst accumulateOptions = [\n { name: 'Entire window', value: true },\n { name: 'Daily', value: false },\n];\n\nconst useStyles = makeStyles({\n reportHeader: {\n display: 'flex',\n flexFlow: 'row',\n padding: 24,\n },\n titles: {\n flexGrow: 1,\n },\n});\n\n// generateTitle generates a string title from a report object\n// @ts-ignore: implicitly has an 'any' type\nfunction generateTitle({ window, aggregateBy, accumulate }) {\n let windowName = get(find(windowOptions, { value: window }), 'name', '');\n if (windowName === '') {\n if (checkCustomWindow(window)) {\n windowName = toVerboseTimeRange(window);\n } else {\n /* eslint no-console: [\"error\", { allow: [\"warn\"] }] */\n console.warn(`unknown window: ${window}`);\n }\n }\n\n const aggregationName = get(\n find(aggregationOptions, { value: aggregateBy }),\n 'name',\n '',\n ).toLocaleLowerCase('en-US');\n if (aggregationName === '') {\n /* eslint no-console: [\"error\", { allow: [\"warn\"] }] */\n console.warn(`unknown aggregation: ${aggregateBy}`);\n }\n\n let str = `${windowName} by ${aggregationName}`;\n\n if (!accumulate) {\n str = `${str} daily`;\n }\n\n return str;\n}\n\nexport const OpenCostReport = () => {\n const classes = useStyles();\n // Allocation data state\n const [allocationData, setAllocationData] = useState([]);\n const [cumulativeData, setCumulativeData] = useState({});\n const [totalData, setTotalData] = useState({});\n\n // When allocation data changes, create a cumulative version of it\n useEffect(() => {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n const cumulative = rangeToCumulative(allocationData, aggregateBy);\n setCumulativeData(toArray(cumulative));\n setTotalData(cumulativeToTotals(cumulative));\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [allocationData]);\n\n // Form state, which controls form elements, but not the report itself. On\n // certain actions, the form state may flow into the report state.\n const [window, setWindow] = useState(windowOptions[0].value);\n const [aggregateBy, setAggregateBy] = useState(aggregationOptions[0].value);\n const [accumulate, setAccumulate] = useState(accumulateOptions[0].value);\n const [currency, setCurrency] = useState('USD');\n\n // Report state, including current report and saved options\n const [title, setTitle] = useState('Last 7 days by namespace daily');\n\n // When parameters changes, fetch data. This should be the\n // only mechanism used to fetch data. Also generate a sensible title from the paramters.\n useEffect(() => {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n setFetch(true);\n setTitle(generateTitle({ window, aggregateBy, accumulate }));\n }, [window, aggregateBy, accumulate]);\n\n // page and settings state\n const [init, setInit] = useState(false);\n const [fetch, setFetch] = useState(false);\n const [loading, setLoading] = useState(true);\n const [errors, setErrors] = useState([]);\n\n // Initialize once, then fetch report each time setFetch(true) is called\n useEffect(() => {\n if (!init) {\n initialize();\n }\n if (init && fetch) {\n fetchData();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [init, fetch]);\n\n // parse any context information from the URL\n const routerLocation = useLocation();\n const searchParams = new URLSearchParams(routerLocation.search);\n const routerNavigate = useNavigate();\n useEffect(() => {\n setWindow(searchParams.get('window') || '6d');\n setAggregateBy(searchParams.get('agg') || 'namespace');\n setAccumulate(searchParams.get('acc') === 'true' || false);\n setCurrency(searchParams.get('currency') || 'USD');\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [routerLocation]);\n\n async function initialize() {\n setInit(true);\n }\n\n const configApi = useApi(configApiRef);\n const baseUrl = configApi.getConfig('opencost').getString('baseUrl');\n /* eslint no-console: 0 */\n console.log(`baseUrl:${baseUrl}`);\n\n async function fetchData() {\n setLoading(true);\n setErrors([]);\n\n try {\n const resp = await AllocationService.fetchAllocation(\n baseUrl,\n window,\n aggregateBy,\n { accumulate },\n );\n if (resp.data && resp.data.length > 0) {\n const allocationRange = resp.data;\n for (const i in allocationRange) {\n if (Object.hasOwn(allocationRange, i)) {\n // update cluster aggregations to use clusterName/clusterId names\n allocationRange[i] = sortBy(allocationRange[i], a => a.totalCost);\n }\n }\n setAllocationData(allocationRange);\n } else {\n setAllocationData([]);\n }\n } catch (err) {\n if (err.message.indexOf('404') === 0) {\n setErrors([\n // @ts-ignore: not assignable to type 'never'\n {\n primary: 'Failed to load report data',\n secondary:\n 'Please update OpenCost to the latest version, then open an Issue on GitHub if problems persist.',\n },\n ]);\n } else {\n let secondary =\n 'Please open an OpenCost issue with a bug report if problems persist.';\n if (err.message.length > 0) {\n secondary = err.message;\n }\n setErrors([\n // @ts-ignore: not assignable to type 'never'\n {\n primary: 'Failed to load report data',\n secondary: secondary,\n },\n ]);\n }\n setAllocationData([]);\n }\n\n setLoading(false);\n setFetch(false);\n }\n return (\n <Page active=\"reports.html\">\n {!loading && errors.length > 0 && (\n <div style={{ marginBottom: 20 }}>\n <Warnings warnings={errors} />\n </div>\n )}\n {init && (\n <Paper id=\"report\">\n <div className={classes.reportHeader}>\n <div className={classes.titles}>\n <Typography variant=\"h5\">{title}</Typography>\n <Subtitle report={{ window, aggregateBy, accumulate }} />\n </div>\n\n <IconButton aria-label=\"refresh\" onClick={() => setFetch(true)}>\n <RefreshIcon />\n </IconButton>\n\n <Controls\n windowOptions={windowOptions}\n window={window}\n // @ts-ignore: implicitly has an 'any' type\n setWindow={win => {\n searchParams.set('window', win);\n routerNavigate({\n search: `?${searchParams.toString()}`,\n });\n }}\n aggregationOptions={aggregationOptions}\n aggregateBy={aggregateBy}\n // @ts-ignore: implicitly has an 'any' type\n setAggregateBy={agg => {\n searchParams.set('agg', agg);\n routerNavigate({\n search: `?${searchParams.toString()}`,\n });\n }}\n accumulateOptions={accumulateOptions}\n accumulate={accumulate}\n // @ts-ignore: implicitly has an 'any' type\n setAccumulate={acc => {\n searchParams.set('acc', acc);\n routerNavigate({\n search: `?${searchParams.toString()}`,\n });\n }}\n title={title}\n cumulativeData={cumulativeData}\n currency={currency}\n currencyOptions={currencyCodes}\n // @ts-ignore: implicitly has an 'any' type\n setCurrency={curr => {\n searchParams.set('currency', curr);\n routerNavigate({\n search: `?${searchParams.toString()}`,\n });\n }}\n />\n </div>\n\n {loading && (\n <div style={{ display: 'flex', justifyContent: 'center' }}>\n <div style={{ paddingTop: 100, paddingBottom: 100 }}>\n <CircularProgress />\n </div>\n </div>\n )}\n {!loading && (\n <AllocationReport\n allocationData={allocationData}\n cumulativeData={cumulativeData}\n totalData={totalData}\n currency={currency}\n />\n )}\n </Paper>\n )}\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAyCA,MAAM,aAAgB,GAAA;AAAA,EACpB,EAAE,IAAA,EAAM,OAAS,EAAA,KAAA,EAAO,OAAQ,EAAA;AAAA,EAChC,EAAE,IAAA,EAAM,WAAa,EAAA,KAAA,EAAO,WAAY,EAAA;AAAA,EACxC,EAAE,IAAA,EAAM,cAAgB,EAAA,KAAA,EAAO,MAAO,EAAA;AAAA,EACtC,EAAE,IAAA,EAAM,eAAiB,EAAA,KAAA,EAAO,OA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cAAA;AAAA,MACA,QAAA;AAAA,MACA,eAAiB,EAAA,aAAA;AAAA,MAEjB,aAAa,CAAQ,IAAA,KAAA;AACnB,QAAa,YAAA,CAAA,GAAA,CAAI,YAAY,IAAI,CAAA,CAAA;AACjC,QAAe,cAAA,CAAA;AAAA,UACb,MAAQ,EAAA,CAAA,CAAA,EAAI,YAAa,CAAA,QAAA,EAAU,CAAA,CAAA;AAAA,SACpC,CAAA,CAAA;AAAA,OACH;AAAA,KAAA;AAAA,GAEJ,CAEC,EAAA,OAAA,oBACE,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAI,KAAO,EAAA,EAAE,OAAS,EAAA,MAAA,EAAQ,cAAgB,EAAA,QAAA,EAC7C,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAI,EAAA,EAAA,KAAA,EAAO,EAAE,UAAA,EAAY,GAAK,EAAA,aAAA,EAAe,GAAI,EAAA,EAAA,kBAC/C,KAAA,CAAA,aAAA,CAAA,gBAAA,EAAA,IAAiB,CACpB,CACF,CAED,EAAA,CAAC,OACA,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,gBAAA;AAAA,IAAA;AAAA,MACC,cAAA;AAAA,MACA,cAAA;AAAA,MACA,SAAA;AAAA,MACA,QAAA;AAAA,KAAA;AAAA,GAGN,CAEJ,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,24 @@
1
+ import { makeStyles } from '@material-ui/core/styles';
2
+ import React from 'react';
3
+
4
+ const useStyles = makeStyles({
5
+ wrapper: {
6
+ display: "flex",
7
+ flexFlow: "column",
8
+ flexGrow: 1,
9
+ margin: "20px 30px 0 30px",
10
+ minWidth: 800
11
+ },
12
+ flexGrow: {
13
+ display: "flex",
14
+ flexFlow: "column",
15
+ flexGrow: 1
16
+ }
17
+ });
18
+ const Page = (props) => {
19
+ const classes = useStyles();
20
+ return /* @__PURE__ */ React.createElement("div", { className: classes.flexGrow }, /* @__PURE__ */ React.createElement("div", { className: classes.wrapper }, /* @__PURE__ */ React.createElement("div", { className: classes.flexGrow }, props.children)));
21
+ };
22
+
23
+ export { Page as default };
24
+ //# sourceMappingURL=Page.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Page.esm.js","sources":["../../src/components/Page.jsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { makeStyles } from '@material-ui/core/styles';\nimport React from 'react';\n\nconst useStyles = makeStyles({\n wrapper: {\n display: 'flex',\n flexFlow: 'column',\n flexGrow: 1,\n margin: '20px 30px 0 30px',\n minWidth: 800,\n },\n flexGrow: {\n display: 'flex',\n flexFlow: 'column',\n flexGrow: 1,\n },\n});\n\nconst Page = props => {\n const classes = useStyles();\n\n return (\n <div className={classes.flexGrow}>\n <div className={classes.wrapper}>\n <div className={classes.flexGrow}>{props.children}</div>\n </div>\n </div>\n );\n};\n\nexport default Page;\n"],"names":[],"mappings":";;;AAmBA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,OAAS,EAAA;AAAA,IACP,OAAS,EAAA,MAAA;AAAA,IACT,QAAU,EAAA,QAAA;AAAA,IACV,QAAU,EAAA,CAAA;AAAA,IACV,MAAQ,EAAA,kBAAA;AAAA,IACR,QAAU,EAAA,GAAA;AAAA,GACZ;AAAA,EACA,QAAU,EAAA;AAAA,IACR,OAAS,EAAA,MAAA;AAAA,IACT,QAAU,EAAA,QAAA;AAAA,IACV,QAAU,EAAA,CAAA;AAAA,GACZ;AACF,CAAC,CAAA,CAAA;AAED,MAAM,OAAO,CAAS,KAAA,KAAA;AACpB,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAE1B,EAAA,2CACG,KAAI,EAAA,EAAA,SAAA,EAAW,QAAQ,QACtB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,SAAI,SAAW,EAAA,OAAA,CAAQ,OACtB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,SAAI,SAAW,EAAA,OAAA,CAAQ,YAAW,KAAM,CAAA,QAAS,CACpD,CACF,CAAA,CAAA;AAEJ;;;;"}