@backstage-community/plugin-ocm 5.4.3 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/components/ClusterAvailableResourcesCard/ClusterAvailableResourcesCard.esm.js +3 -3
- package/dist/components/ClusterAvailableResourcesCard/ClusterAvailableResourcesCard.esm.js.map +1 -1
- package/dist/components/ClusterContext/ClusterContext.esm.js +4 -3
- package/dist/components/ClusterContext/ClusterContext.esm.js.map +1 -1
- package/dist/components/ClusterInfoCard/ClusterInfoCard.esm.js +4 -4
- package/dist/components/ClusterInfoCard/ClusterInfoCard.esm.js.map +1 -1
- package/dist/components/ClusterStatusPage/ClusterStatusPage.esm.js +30 -20
- package/dist/components/ClusterStatusPage/ClusterStatusPage.esm.js.map +1 -1
- package/dist/components/TableCardFromData/TableCardFromData.esm.js +26 -23
- package/dist/components/TableCardFromData/TableCardFromData.esm.js.map +1 -1
- package/dist/components/common.esm.js +19 -16
- package/dist/components/common.esm.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/package.json +16 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
### Dependencies
|
|
2
2
|
|
|
3
|
+
## 5.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- fde918d: Backstage version bump to v1.38.1
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [fde918d]
|
|
12
|
+
- @backstage-community/plugin-ocm-common@3.9.0
|
|
13
|
+
|
|
14
|
+
## 5.4.4
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 1ac3b94: remove @spotify/prettier-config direct dependency
|
|
19
|
+
- Updated dependencies [1ac3b94]
|
|
20
|
+
- @backstage-community/plugin-ocm-common@3.8.3
|
|
21
|
+
|
|
3
22
|
## 5.4.3
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { RequirePermission } from '@backstage/plugin-permission-react';
|
|
3
3
|
import { ocmEntityReadPermission } from '@backstage-community/plugin-ocm-common';
|
|
4
4
|
import { useCluster } from '../ClusterContext/ClusterContext.esm.js';
|
|
@@ -17,14 +17,14 @@ const ClusterAvailableResourceCard = () => {
|
|
|
17
17
|
["memorySize", "Memory size"],
|
|
18
18
|
["numberOfPods", "Number of pods"]
|
|
19
19
|
]);
|
|
20
|
-
return /* @__PURE__ */
|
|
20
|
+
return /* @__PURE__ */ jsx(RequirePermission, { permission: ocmEntityReadPermission, children: /* @__PURE__ */ jsx(
|
|
21
21
|
TableCardFromData,
|
|
22
22
|
{
|
|
23
23
|
data: data.availableResources,
|
|
24
24
|
title: "Available",
|
|
25
25
|
nameMap
|
|
26
26
|
}
|
|
27
|
-
));
|
|
27
|
+
) });
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
export { ClusterAvailableResourceCard };
|
package/dist/components/ClusterAvailableResourcesCard/ClusterAvailableResourcesCard.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClusterAvailableResourcesCard.esm.js","sources":["../../../src/components/ClusterAvailableResourcesCard/ClusterAvailableResourcesCard.tsx"],"sourcesContent":["/*\n * Copyright 2024 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
|
|
1
|
+
{"version":3,"file":"ClusterAvailableResourcesCard.esm.js","sources":["../../../src/components/ClusterAvailableResourcesCard/ClusterAvailableResourcesCard.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { RequirePermission } from '@backstage/plugin-permission-react';\n\nimport { ocmEntityReadPermission } from '@backstage-community/plugin-ocm-common';\n\nimport { useCluster } from '../ClusterContext';\nimport { TableCardFromData } from '../TableCardFromData';\n\n/**\n * @public\n */\nexport const ClusterAvailableResourceCard = (): any => {\n const { data } = useCluster();\n\n if (!data) {\n return null;\n }\n\n if (!('availableResources' in data!)) {\n return null;\n }\n\n const nameMap = new Map<string, string>([\n ['cpuCores', 'CPU cores'],\n ['memorySize', 'Memory size'],\n ['numberOfPods', 'Number of pods'],\n ]);\n return (\n <RequirePermission permission={ocmEntityReadPermission}>\n <TableCardFromData\n data={data.availableResources}\n title=\"Available\"\n nameMap={nameMap}\n />\n </RequirePermission>\n );\n};\n"],"names":[],"mappings":";;;;;;AAyBO,MAAM,+BAA+B,MAAW;AACrD,EAAM,MAAA,EAAE,IAAK,EAAA,GAAI,UAAW,EAAA;AAE5B,EAAA,IAAI,CAAC,IAAM,EAAA;AACT,IAAO,OAAA,IAAA;AAAA;AAGT,EAAI,IAAA,EAAE,wBAAwB,IAAQ,CAAA,EAAA;AACpC,IAAO,OAAA,IAAA;AAAA;AAGT,EAAM,MAAA,OAAA,uBAAc,GAAoB,CAAA;AAAA,IACtC,CAAC,YAAY,WAAW,CAAA;AAAA,IACxB,CAAC,cAAc,aAAa,CAAA;AAAA,IAC5B,CAAC,gBAAgB,gBAAgB;AAAA,GAClC,CAAA;AACD,EACE,uBAAA,GAAA,CAAC,iBAAkB,EAAA,EAAA,UAAA,EAAY,uBAC7B,EAAA,QAAA,kBAAA,GAAA;AAAA,IAAC,iBAAA;AAAA,IAAA;AAAA,MACC,MAAM,IAAK,CAAA,kBAAA;AAAA,MACX,KAAM,EAAA,WAAA;AAAA,MACN;AAAA;AAAA,GAEJ,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { createContext, useMemo, useContext } from 'react';
|
|
2
3
|
import useAsyncFn from 'react-use/lib/useAsyncFn';
|
|
3
4
|
import useDebounce from 'react-use/lib/useDebounce';
|
|
4
5
|
import { useApi } from '@backstage/core-plugin-api';
|
|
@@ -41,9 +42,9 @@ const ClusterContextProvider = (props) => {
|
|
|
41
42
|
[cluster, isError, loading, error]
|
|
42
43
|
);
|
|
43
44
|
if (!providerId) {
|
|
44
|
-
return /* @__PURE__ */
|
|
45
|
+
return /* @__PURE__ */ jsx(Fragment, { children: props.children });
|
|
45
46
|
}
|
|
46
|
-
return /* @__PURE__ */
|
|
47
|
+
return /* @__PURE__ */ jsx(ClusterContext.Provider, { value, children: props.children });
|
|
47
48
|
};
|
|
48
49
|
const useCluster = () => useContext(ClusterContext);
|
|
49
50
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClusterContext.esm.js","sources":["../../../src/components/ClusterContext/ClusterContext.tsx"],"sourcesContent":["/*\n * Copyright 2024 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
|
|
1
|
+
{"version":3,"file":"ClusterContext.esm.js","sources":["../../../src/components/ClusterContext/ClusterContext.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { createContext, useContext, useMemo } from 'react';\nimport useAsyncFn from 'react-use/lib/useAsyncFn';\nimport useDebounce from 'react-use/lib/useDebounce';\n\nimport { useApi } from '@backstage/core-plugin-api';\nimport { ErrorResponseBody } from '@backstage/errors';\nimport { useEntity } from '@backstage/plugin-catalog-react';\n\nimport {\n ANNOTATION_PROVIDER_ID,\n Cluster,\n} from '@backstage-community/plugin-ocm-common';\n\nimport { OcmApiRef } from '../../api';\n\n/**\n * @public\n */\nexport type ClusterContextType = {\n data: Cluster | null;\n loading: boolean;\n error: Error | null;\n};\n\nconst ClusterContext = createContext<ClusterContextType>(\n {} as ClusterContextType,\n);\n\n/**\n * @public\n */\nexport const ClusterContextProvider = (props: any) => {\n const { entity } = useEntity();\n const ocmApi = useApi(OcmApiRef);\n const providerId = entity.metadata.annotations![ANNOTATION_PROVIDER_ID];\n const [{ value: cluster, loading, error: asyncError }, refresh] = useAsyncFn(\n async () => {\n if (providerId) {\n const cl = await ocmApi.getClusterByName(\n providerId,\n entity.metadata.name,\n );\n return cl;\n }\n return null;\n },\n [providerId, entity.metadata.name],\n { loading: true },\n );\n useDebounce(refresh, 10);\n const isError = Boolean(asyncError || (cluster && 'error' in cluster));\n const error = isError\n ? asyncError ||\n Object.assign(new Error((cluster as ErrorResponseBody)?.error?.message), {\n ...(cluster as ErrorResponseBody)?.error,\n })\n : null;\n\n const value = useMemo(\n () => ({\n data: isError || loading ? null : (cluster as Cluster),\n loading,\n error,\n }),\n [cluster, isError, loading, error],\n );\n\n if (!providerId) {\n return <>{props.children}</>;\n }\n\n return (\n <ClusterContext.Provider value={value}>\n {props.children}\n </ClusterContext.Provider>\n );\n};\n\n/**\n * @public\n */\nexport const useCluster = () => useContext(ClusterContext);\n"],"names":[],"mappings":";;;;;;;;;AAuCA,MAAM,cAAiB,GAAA,aAAA;AAAA,EACrB;AACF,CAAA;AAKa,MAAA,sBAAA,GAAyB,CAAC,KAAe,KAAA;AACpD,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAC7B,EAAM,MAAA,MAAA,GAAS,OAAO,SAAS,CAAA;AAC/B,EAAA,MAAM,UAAa,GAAA,MAAA,CAAO,QAAS,CAAA,WAAA,CAAa,sBAAsB,CAAA;AACtE,EAAM,MAAA,CAAC,EAAE,KAAO,EAAA,OAAA,EAAS,SAAS,KAAO,EAAA,UAAA,EAAc,EAAA,OAAO,CAAI,GAAA,UAAA;AAAA,IAChE,YAAY;AACV,MAAA,IAAI,UAAY,EAAA;AACd,QAAM,MAAA,EAAA,GAAK,MAAM,MAAO,CAAA,gBAAA;AAAA,UACtB,UAAA;AAAA,UACA,OAAO,QAAS,CAAA;AAAA,SAClB;AACA,QAAO,OAAA,EAAA;AAAA;AAET,MAAO,OAAA,IAAA;AAAA,KACT;AAAA,IACA,CAAC,UAAA,EAAY,MAAO,CAAA,QAAA,CAAS,IAAI,CAAA;AAAA,IACjC,EAAE,SAAS,IAAK;AAAA,GAClB;AACA,EAAA,WAAA,CAAY,SAAS,EAAE,CAAA;AACvB,EAAA,MAAM,OAAU,GAAA,OAAA,CAAQ,UAAe,IAAA,OAAA,IAAW,WAAW,OAAQ,CAAA;AACrE,EAAM,MAAA,KAAA,GAAQ,OACV,GAAA,UAAA,IACA,MAAO,CAAA,MAAA,CAAO,IAAI,KAAO,CAAA,OAAA,EAA+B,KAAO,EAAA,OAAO,CAAG,EAAA;AAAA,IACvE,GAAI,OAA+B,EAAA;AAAA,GACpC,CACD,GAAA,IAAA;AAEJ,EAAA,MAAM,KAAQ,GAAA,OAAA;AAAA,IACZ,OAAO;AAAA,MACL,IAAA,EAAM,OAAW,IAAA,OAAA,GAAU,IAAQ,GAAA,OAAA;AAAA,MACnC,OAAA;AAAA,MACA;AAAA,KACF,CAAA;AAAA,IACA,CAAC,OAAA,EAAS,OAAS,EAAA,OAAA,EAAS,KAAK;AAAA,GACnC;AAEA,EAAA,IAAI,CAAC,UAAY,EAAA;AACf,IAAO,uBAAA,GAAA,CAAA,QAAA,EAAA,EAAG,gBAAM,QAAS,EAAA,CAAA;AAAA;AAG3B,EAAA,2BACG,cAAe,CAAA,QAAA,EAAf,EAAwB,KAAA,EACtB,gBAAM,QACT,EAAA,CAAA;AAEJ;AAKa,MAAA,UAAA,GAAa,MAAM,UAAA,CAAW,cAAc;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { RequirePermission } from '@backstage/plugin-permission-react';
|
|
3
3
|
import { ocmEntityReadPermission } from '@backstage-community/plugin-ocm-common';
|
|
4
4
|
import { useCluster } from '../ClusterContext/ClusterContext.esm.js';
|
|
@@ -10,8 +10,8 @@ const ClusterInfoCard = () => {
|
|
|
10
10
|
if (!data) {
|
|
11
11
|
return null;
|
|
12
12
|
}
|
|
13
|
-
data.openshiftVersion = /* @__PURE__ */
|
|
14
|
-
data.status = /* @__PURE__ */
|
|
13
|
+
data.openshiftVersion = /* @__PURE__ */ jsx(Update, { data: { version: data.openshiftVersion, update: data.update } });
|
|
14
|
+
data.status = /* @__PURE__ */ jsx(Status, { status: data.status });
|
|
15
15
|
const nameMap = /* @__PURE__ */ new Map([
|
|
16
16
|
["name", "Name"],
|
|
17
17
|
["status", "Status"],
|
|
@@ -20,7 +20,7 @@ const ClusterInfoCard = () => {
|
|
|
20
20
|
["openshiftVersion", "OpenShift version"],
|
|
21
21
|
["platform", "Platform"]
|
|
22
22
|
]);
|
|
23
|
-
return /* @__PURE__ */
|
|
23
|
+
return /* @__PURE__ */ jsx(RequirePermission, { permission: ocmEntityReadPermission, children: /* @__PURE__ */ jsx(TableCardFromData, { data, title: "Cluster Info", nameMap }) });
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
export { ClusterInfoCard };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClusterInfoCard.esm.js","sources":["../../../src/components/ClusterInfoCard/ClusterInfoCard.tsx"],"sourcesContent":["/*\n * Copyright 2024 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
|
|
1
|
+
{"version":3,"file":"ClusterInfoCard.esm.js","sources":["../../../src/components/ClusterInfoCard/ClusterInfoCard.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { RequirePermission } from '@backstage/plugin-permission-react';\n\nimport { ocmEntityReadPermission } from '@backstage-community/plugin-ocm-common';\n\nimport { useCluster } from '../ClusterContext';\nimport { Status, Update } from '../common';\nimport { TableCardFromData } from '../TableCardFromData';\n\n/**\n * @public\n */\nexport const ClusterInfoCard = () => {\n const { data } = useCluster();\n\n if (!data) {\n return null;\n }\n\n data.openshiftVersion = (\n <Update data={{ version: data.openshiftVersion!, update: data.update! }} />\n ) as any;\n data.status = (<Status status={data.status} />) as any;\n const nameMap = new Map<string, string>([\n ['name', 'Name'],\n ['status', 'Status'],\n ['kubernetesVersion', 'Kubernetes version'],\n ['openshiftId', 'OpenShift ID'],\n ['openshiftVersion', 'OpenShift version'],\n ['platform', 'Platform'],\n ]);\n return (\n <RequirePermission permission={ocmEntityReadPermission}>\n <TableCardFromData data={data} title=\"Cluster Info\" nameMap={nameMap} />\n </RequirePermission>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA0BO,MAAM,kBAAkB,MAAM;AACnC,EAAM,MAAA,EAAE,IAAK,EAAA,GAAI,UAAW,EAAA;AAE5B,EAAA,IAAI,CAAC,IAAM,EAAA;AACT,IAAO,OAAA,IAAA;AAAA;AAGT,EAAK,IAAA,CAAA,gBAAA,mBACF,GAAA,CAAA,MAAA,EAAA,EAAO,IAAM,EAAA,EAAE,OAAS,EAAA,IAAA,CAAK,gBAAmB,EAAA,MAAA,EAAQ,IAAK,CAAA,MAAA,EAAW,EAAA,CAAA;AAE3E,EAAA,IAAA,CAAK,MAAU,mBAAA,GAAA,CAAC,MAAO,EAAA,EAAA,MAAA,EAAQ,KAAK,MAAQ,EAAA,CAAA;AAC5C,EAAM,MAAA,OAAA,uBAAc,GAAoB,CAAA;AAAA,IACtC,CAAC,QAAQ,MAAM,CAAA;AAAA,IACf,CAAC,UAAU,QAAQ,CAAA;AAAA,IACnB,CAAC,qBAAqB,oBAAoB,CAAA;AAAA,IAC1C,CAAC,eAAe,cAAc,CAAA;AAAA,IAC9B,CAAC,oBAAoB,mBAAmB,CAAA;AAAA,IACxC,CAAC,YAAY,UAAU;AAAA,GACxB,CAAA;AACD,EACE,uBAAA,GAAA,CAAC,iBAAkB,EAAA,EAAA,UAAA,EAAY,uBAC7B,EAAA,QAAA,kBAAA,GAAA,CAAC,qBAAkB,IAAY,EAAA,KAAA,EAAM,cAAe,EAAA,OAAA,EAAkB,CACxE,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import useAsyncFn from 'react-use/lib/useAsyncFn';
|
|
3
3
|
import useDebounce from 'react-use/lib/useDebounce';
|
|
4
4
|
import { Page, Header, Content, WarningPanel, CodeSnippet, Table, StatusOK, StatusError, StatusAborted } from '@backstage/core-components';
|
|
@@ -34,10 +34,10 @@ const NodeChip = ({
|
|
|
34
34
|
if (!count) {
|
|
35
35
|
return null;
|
|
36
36
|
}
|
|
37
|
-
return /* @__PURE__ */
|
|
37
|
+
return /* @__PURE__ */ jsx(
|
|
38
38
|
Chip,
|
|
39
39
|
{
|
|
40
|
-
label: /* @__PURE__ */
|
|
40
|
+
label: /* @__PURE__ */ jsx(IndicatorComponent, { children: count }),
|
|
41
41
|
variant: "outlined"
|
|
42
42
|
}
|
|
43
43
|
);
|
|
@@ -48,15 +48,19 @@ const NodeChips = ({ nodes }) => {
|
|
|
48
48
|
(node) => node.status === "False"
|
|
49
49
|
).length;
|
|
50
50
|
if (nodes.length === 0) {
|
|
51
|
-
return /* @__PURE__ */
|
|
51
|
+
return /* @__PURE__ */ jsx(Fragment, { children: "-" });
|
|
52
52
|
}
|
|
53
|
-
return /* @__PURE__ */
|
|
54
|
-
NodeChip,
|
|
55
|
-
{
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
54
|
+
/* @__PURE__ */ jsx(NodeChip, { count: readyChipsNodes, indicatorComponent: StatusOK }),
|
|
55
|
+
/* @__PURE__ */ jsx(NodeChip, { count: notReadyNodesCount, indicatorComponent: StatusError }),
|
|
56
|
+
/* @__PURE__ */ jsx(
|
|
57
|
+
NodeChip,
|
|
58
|
+
{
|
|
59
|
+
count: nodes.length - readyChipsNodes - notReadyNodesCount,
|
|
60
|
+
indicatorComponent: StatusAborted
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
] });
|
|
60
64
|
};
|
|
61
65
|
const CatalogClusters = () => {
|
|
62
66
|
const catalogApi = useApi(catalogApiRef);
|
|
@@ -89,17 +93,17 @@ const CatalogClusters = () => {
|
|
|
89
93
|
);
|
|
90
94
|
useDebounce(refresh, 10);
|
|
91
95
|
if (error) {
|
|
92
|
-
return /* @__PURE__ */
|
|
96
|
+
return /* @__PURE__ */ jsx(WarningPanel, { severity: "error", title: "Could not fetch clusters from Hub.", children: /* @__PURE__ */ jsx(CodeSnippet, { language: "text", text: error.toString() }) });
|
|
93
97
|
}
|
|
94
98
|
if (loading) {
|
|
95
|
-
return /* @__PURE__ */
|
|
99
|
+
return /* @__PURE__ */ jsx(CircularProgress, {});
|
|
96
100
|
}
|
|
97
101
|
const data = clusterEntities ? clusterEntities.map((ce) => {
|
|
98
102
|
return {
|
|
99
|
-
name: /* @__PURE__ */
|
|
100
|
-
status: /* @__PURE__ */
|
|
103
|
+
name: /* @__PURE__ */ jsx(EntityRefLink, { entityRef: ce.entity, children: ce.cluster.name }),
|
|
104
|
+
status: /* @__PURE__ */ jsx(Status, { status: ce.cluster.status }),
|
|
101
105
|
infrastructure: ce.cluster.platform,
|
|
102
|
-
version: /* @__PURE__ */
|
|
106
|
+
version: /* @__PURE__ */ jsx(
|
|
103
107
|
Update,
|
|
104
108
|
{
|
|
105
109
|
data: {
|
|
@@ -108,10 +112,10 @@ const CatalogClusters = () => {
|
|
|
108
112
|
}
|
|
109
113
|
}
|
|
110
114
|
),
|
|
111
|
-
nodes: /* @__PURE__ */
|
|
115
|
+
nodes: /* @__PURE__ */ jsx(NodeChips, { nodes: ce.cluster.nodes })
|
|
112
116
|
};
|
|
113
117
|
}) : [];
|
|
114
|
-
return /* @__PURE__ */
|
|
118
|
+
return /* @__PURE__ */ jsx("div", { className: classes.container, children: /* @__PURE__ */ jsx(
|
|
115
119
|
Table,
|
|
116
120
|
{
|
|
117
121
|
options: { paging: false },
|
|
@@ -119,11 +123,17 @@ const CatalogClusters = () => {
|
|
|
119
123
|
columns,
|
|
120
124
|
title: "All"
|
|
121
125
|
}
|
|
122
|
-
));
|
|
126
|
+
) });
|
|
123
127
|
};
|
|
124
128
|
const ClusterStatusPage = ({ logo }) => {
|
|
125
129
|
const { container } = useStyles();
|
|
126
|
-
return /* @__PURE__ */
|
|
130
|
+
return /* @__PURE__ */ jsx(SearchContextProvider, { children: /* @__PURE__ */ jsx(RequirePermission, { permission: ocmClusterReadPermission, children: /* @__PURE__ */ jsxs(Page, { themeId: "clusters", children: [
|
|
131
|
+
/* @__PURE__ */ jsx(Header, { title: "Your Managed Clusters" }),
|
|
132
|
+
/* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsxs(Grid, { container: true, justifyContent: "center", spacing: 6, children: [
|
|
133
|
+
logo && /* @__PURE__ */ jsx(HomePageCompanyLogo, { className: container, logo }),
|
|
134
|
+
/* @__PURE__ */ jsx(Grid, { container: true, item: true, xs: 12, justifyContent: "center", children: /* @__PURE__ */ jsx(CatalogClusters, {}) })
|
|
135
|
+
] }) })
|
|
136
|
+
] }) }) });
|
|
127
137
|
};
|
|
128
138
|
|
|
129
139
|
export { ClusterStatusPage, ClusterStatusPage as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClusterStatusPage.esm.js","sources":["../../../src/components/ClusterStatusPage/ClusterStatusPage.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 useAsyncFn from 'react-use/lib/useAsyncFn';\nimport useDebounce from 'react-use/lib/useDebounce';\n\nimport {\n CodeSnippet,\n Content,\n Header,\n Page,\n StatusAborted,\n StatusError,\n StatusOK,\n Table,\n WarningPanel,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { catalogApiRef, EntityRefLink } from '@backstage/plugin-catalog-react';\nimport { HomePageCompanyLogo } from '@backstage/plugin-home';\nimport { RequirePermission } from '@backstage/plugin-permission-react';\nimport { SearchContextProvider } from '@backstage/plugin-search-react';\n\nimport { Chip, CircularProgress, Grid, makeStyles } from '@material-ui/core';\n\nimport {\n ClusterNodesStatus,\n ClusterOverview,\n ocmClusterReadPermission,\n} from '@backstage-community/plugin-ocm-common';\n\nimport { OcmApiRef } from '../../api';\nimport { ClusterStatusRowData } from '../../types';\nimport { Status, Update } from '../common';\nimport { columns } from './tableHeading';\n\nconst useStylesTwo = makeStyles({\n container: {\n width: '100%',\n },\n});\n\nconst useStyles = makeStyles(theme => ({\n container: {\n margin: theme.spacing(5, 0),\n '& > svg': {\n width: 'auto',\n height: 150,\n },\n },\n}));\n\nconst NodeChip = ({\n count,\n indicatorComponent: IndicatorComponent,\n}: {\n count: number;\n indicatorComponent: React.FC<React.PropsWithChildren<{}>>;\n}) => {\n if (!count) {\n return null;\n }\n return (\n <Chip\n label={<IndicatorComponent>{count}</IndicatorComponent>}\n variant=\"outlined\"\n />\n );\n};\n\nconst NodeChips = ({ nodes }: { nodes: ClusterNodesStatus[] }) => {\n const readyChipsNodes = nodes.filter(node => node.status === 'True').length;\n // TODO: Check if not ready correctly\n const notReadyNodesCount = nodes.filter(\n node => node.status === 'False',\n ).length;\n\n if (nodes.length === 0) {\n return <>-</>;\n }\n\n return (\n <>\n <NodeChip count={readyChipsNodes} indicatorComponent={StatusOK} />\n <NodeChip count={notReadyNodesCount} indicatorComponent={StatusError} />\n <NodeChip\n count={nodes.length - readyChipsNodes - notReadyNodesCount}\n indicatorComponent={StatusAborted}\n />\n </>\n );\n};\n\nconst CatalogClusters = () => {\n const catalogApi = useApi(catalogApiRef);\n const ocmApi = useApi(OcmApiRef);\n const classes = useStylesTwo();\n\n const [{ value: clusterEntities, loading, error }, refresh] = useAsyncFn(\n async () => {\n const clusterResourceEntities = await catalogApi.getEntities({\n filter: { kind: 'Resource', 'spec.type': 'kubernetes-cluster' },\n });\n\n const clusters = await ocmApi.getClusters();\n\n if ('error' in clusters) {\n throw new Error(clusters.error.message);\n }\n\n const clusterEntityMappings = clusterResourceEntities.items.map(\n entity => {\n const cluster = (clusters as ClusterOverview[]).find(\n cd => cd.name === entity.metadata.name,\n );\n return {\n cluster: cluster!,\n entity: entity,\n };\n },\n );\n return clusterEntityMappings;\n },\n [catalogApi],\n { loading: true },\n );\n useDebounce(refresh, 10);\n\n if (error) {\n return (\n <WarningPanel severity=\"error\" title=\"Could not fetch clusters from Hub.\">\n <CodeSnippet language=\"text\" text={error.toString()} />\n </WarningPanel>\n );\n }\n\n if (loading) {\n return <CircularProgress />;\n }\n\n const data: ClusterStatusRowData[] = clusterEntities\n ? clusterEntities.map(ce => {\n return {\n name: (\n <EntityRefLink entityRef={ce.entity}>\n {ce.cluster.name}\n </EntityRefLink>\n ),\n status: <Status status={ce.cluster.status} />,\n infrastructure: ce.cluster.platform,\n version: (\n <Update\n data={{\n version: ce.cluster.openshiftVersion,\n update: ce.cluster.update,\n }}\n />\n ),\n nodes: <NodeChips nodes={ce.cluster.nodes} />,\n };\n })\n : [];\n\n return (\n <div className={classes.container}>\n <Table\n options={{ paging: false }}\n data={data}\n columns={columns}\n title=\"All\"\n />\n </div>\n );\n};\n\nexport const ClusterStatusPage = ({ logo }: { logo?: React.ReactNode }) => {\n const { container } = useStyles();\n\n return (\n <SearchContextProvider>\n <RequirePermission permission={ocmClusterReadPermission}>\n <Page themeId=\"clusters\">\n <Header title=\"Your Managed Clusters\" />\n <Content>\n <Grid container justifyContent=\"center\" spacing={6}>\n {logo && (\n <HomePageCompanyLogo className={container} logo={logo} />\n )}\n <Grid container item xs={12} justifyContent=\"center\">\n <CatalogClusters />\n </Grid>\n </Grid>\n </Content>\n </Page>\n </RequirePermission>\n </SearchContextProvider>\n );\n};\n\nexport default ClusterStatusPage;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAiDA,MAAM,eAAe,UAAW,CAAA;AAAA,EAC9B,SAAW,EAAA;AAAA,IACT,KAAO,EAAA;AAAA;AAEX,CAAC,CAAA;AAED,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,SAAW,EAAA;AAAA,IACT,MAAQ,EAAA,KAAA,CAAM,OAAQ,CAAA,CAAA,EAAG,CAAC,CAAA;AAAA,IAC1B,SAAW,EAAA;AAAA,MACT,KAAO,EAAA,MAAA;AAAA,MACP,MAAQ,EAAA;AAAA;AACV;AAEJ,CAAE,CAAA,CAAA;AAEF,MAAM,WAAW,CAAC;AAAA,EAChB,KAAA;AAAA,EACA,kBAAoB,EAAA;AACtB,CAGM,KAAA;AACJ,EAAA,IAAI,CAAC,KAAO,EAAA;AACV,IAAO,OAAA,IAAA;AAAA;AAET,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,KAAA,kBAAQ,KAAA,CAAA,aAAA,CAAA,kBAAA,EAAA,IAAA,EAAoB,KAAM,CAAA;AAAA,MAClC,OAAQ,EAAA;AAAA;AAAA,GACV;AAEJ,CAAA;AAEA,MAAM,SAAY,GAAA,CAAC,EAAE,KAAA,EAA6C,KAAA;AAChE,EAAA,MAAM,kBAAkB,KAAM,CAAA,MAAA,CAAO,UAAQ,IAAK,CAAA,MAAA,KAAW,MAAM,CAAE,CAAA,MAAA;AAErE,EAAA,MAAM,qBAAqB,KAAM,CAAA,MAAA;AAAA,IAC/B,CAAA,IAAA,KAAQ,KAAK,MAAW,KAAA;AAAA,GACxB,CAAA,MAAA;AAEF,EAAI,IAAA,KAAA,CAAM,WAAW,CAAG,EAAA;AACtB,IAAA,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AAgB,CACnB,CACF,CACF,CACF,CACF,CACF,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"ClusterStatusPage.esm.js","sources":["../../../src/components/ClusterStatusPage/ClusterStatusPage.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 type { FC, PropsWithChildren, ReactNode } from 'react';\nimport useAsyncFn from 'react-use/lib/useAsyncFn';\nimport useDebounce from 'react-use/lib/useDebounce';\n\nimport {\n CodeSnippet,\n Content,\n Header,\n Page,\n StatusAborted,\n StatusError,\n StatusOK,\n Table,\n WarningPanel,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { catalogApiRef, EntityRefLink } from '@backstage/plugin-catalog-react';\nimport { HomePageCompanyLogo } from '@backstage/plugin-home';\nimport { RequirePermission } from '@backstage/plugin-permission-react';\nimport { SearchContextProvider } from '@backstage/plugin-search-react';\n\nimport { Chip, CircularProgress, Grid, makeStyles } from '@material-ui/core';\n\nimport {\n ClusterNodesStatus,\n ClusterOverview,\n ocmClusterReadPermission,\n} from '@backstage-community/plugin-ocm-common';\n\nimport { OcmApiRef } from '../../api';\nimport { ClusterStatusRowData } from '../../types';\nimport { Status, Update } from '../common';\nimport { columns } from './tableHeading';\n\nconst useStylesTwo = makeStyles({\n container: {\n width: '100%',\n },\n});\n\nconst useStyles = makeStyles(theme => ({\n container: {\n margin: theme.spacing(5, 0),\n '& > svg': {\n width: 'auto',\n height: 150,\n },\n },\n}));\n\nconst NodeChip = ({\n count,\n indicatorComponent: IndicatorComponent,\n}: {\n count: number;\n indicatorComponent: FC<PropsWithChildren<{}>>;\n}) => {\n if (!count) {\n return null;\n }\n return (\n <Chip\n label={<IndicatorComponent>{count}</IndicatorComponent>}\n variant=\"outlined\"\n />\n );\n};\n\nconst NodeChips = ({ nodes }: { nodes: ClusterNodesStatus[] }) => {\n const readyChipsNodes = nodes.filter(node => node.status === 'True').length;\n // TODO: Check if not ready correctly\n const notReadyNodesCount = nodes.filter(\n node => node.status === 'False',\n ).length;\n\n if (nodes.length === 0) {\n return <>-</>;\n }\n\n return (\n <>\n <NodeChip count={readyChipsNodes} indicatorComponent={StatusOK} />\n <NodeChip count={notReadyNodesCount} indicatorComponent={StatusError} />\n <NodeChip\n count={nodes.length - readyChipsNodes - notReadyNodesCount}\n indicatorComponent={StatusAborted}\n />\n </>\n );\n};\n\nconst CatalogClusters = () => {\n const catalogApi = useApi(catalogApiRef);\n const ocmApi = useApi(OcmApiRef);\n const classes = useStylesTwo();\n\n const [{ value: clusterEntities, loading, error }, refresh] = useAsyncFn(\n async () => {\n const clusterResourceEntities = await catalogApi.getEntities({\n filter: { kind: 'Resource', 'spec.type': 'kubernetes-cluster' },\n });\n\n const clusters = await ocmApi.getClusters();\n\n if ('error' in clusters) {\n throw new Error(clusters.error.message);\n }\n\n const clusterEntityMappings = clusterResourceEntities.items.map(\n entity => {\n const cluster = (clusters as ClusterOverview[]).find(\n cd => cd.name === entity.metadata.name,\n );\n return {\n cluster: cluster!,\n entity: entity,\n };\n },\n );\n return clusterEntityMappings;\n },\n [catalogApi],\n { loading: true },\n );\n useDebounce(refresh, 10);\n\n if (error) {\n return (\n <WarningPanel severity=\"error\" title=\"Could not fetch clusters from Hub.\">\n <CodeSnippet language=\"text\" text={error.toString()} />\n </WarningPanel>\n );\n }\n\n if (loading) {\n return <CircularProgress />;\n }\n\n const data: ClusterStatusRowData[] = clusterEntities\n ? clusterEntities.map(ce => {\n return {\n name: (\n <EntityRefLink entityRef={ce.entity}>\n {ce.cluster.name}\n </EntityRefLink>\n ),\n status: <Status status={ce.cluster.status} />,\n infrastructure: ce.cluster.platform,\n version: (\n <Update\n data={{\n version: ce.cluster.openshiftVersion,\n update: ce.cluster.update,\n }}\n />\n ),\n nodes: <NodeChips nodes={ce.cluster.nodes} />,\n };\n })\n : [];\n\n return (\n <div className={classes.container}>\n <Table\n options={{ paging: false }}\n data={data}\n columns={columns}\n title=\"All\"\n />\n </div>\n );\n};\n\nexport const ClusterStatusPage = ({ logo }: { logo?: ReactNode }) => {\n const { container } = useStyles();\n\n return (\n <SearchContextProvider>\n <RequirePermission permission={ocmClusterReadPermission}>\n <Page themeId=\"clusters\">\n <Header title=\"Your Managed Clusters\" />\n <Content>\n <Grid container justifyContent=\"center\" spacing={6}>\n {logo && (\n <HomePageCompanyLogo className={container} logo={logo} />\n )}\n <Grid container item xs={12} justifyContent=\"center\">\n <CatalogClusters />\n </Grid>\n </Grid>\n </Content>\n </Page>\n </RequirePermission>\n </SearchContextProvider>\n );\n};\n\nexport default ClusterStatusPage;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAiDA,MAAM,eAAe,UAAW,CAAA;AAAA,EAC9B,SAAW,EAAA;AAAA,IACT,KAAO,EAAA;AAAA;AAEX,CAAC,CAAA;AAED,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,SAAW,EAAA;AAAA,IACT,MAAQ,EAAA,KAAA,CAAM,OAAQ,CAAA,CAAA,EAAG,CAAC,CAAA;AAAA,IAC1B,SAAW,EAAA;AAAA,MACT,KAAO,EAAA,MAAA;AAAA,MACP,MAAQ,EAAA;AAAA;AACV;AAEJ,CAAE,CAAA,CAAA;AAEF,MAAM,WAAW,CAAC;AAAA,EAChB,KAAA;AAAA,EACA,kBAAoB,EAAA;AACtB,CAGM,KAAA;AACJ,EAAA,IAAI,CAAC,KAAO,EAAA;AACV,IAAO,OAAA,IAAA;AAAA;AAET,EACE,uBAAA,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,KAAA,kB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wB,EAAA,CAAA;AAAA,oBACtC,GAAA,CAAC,WACC,QAAC,kBAAA,IAAA,CAAA,IAAA,EAAA,EAAK,WAAS,IAAC,EAAA,cAAA,EAAe,QAAS,EAAA,OAAA,EAAS,CAC9C,EAAA,QAAA,EAAA;AAAA,MAAA,IAAA,oBACE,GAAA,CAAA,mBAAA,EAAA,EAAoB,SAAW,EAAA,SAAA,EAAW,IAAY,EAAA,CAAA;AAAA,sBAExD,GAAA,CAAA,IAAA,EAAA,EAAK,SAAS,EAAA,IAAA,EAAC,IAAI,EAAA,IAAA,EAAC,EAAI,EAAA,EAAA,EAAI,cAAe,EAAA,QAAA,EAC1C,QAAC,kBAAA,GAAA,CAAA,eAAA,EAAA,EAAgB,CACnB,EAAA;AAAA,KAAA,EACF,CACF,EAAA;AAAA,GAAA,EACF,GACF,CACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { Table, Link } from '@backstage/core-components';
|
|
3
3
|
import { Card, CardHeader, CardContent } from '@material-ui/core';
|
|
4
4
|
|
|
@@ -14,7 +14,7 @@ const valueFormatter = (value) => {
|
|
|
14
14
|
if (value.endsWith("Ki")) {
|
|
15
15
|
return convertToGibibytes(value);
|
|
16
16
|
} else if (value.startsWith("http")) {
|
|
17
|
-
return /* @__PURE__ */
|
|
17
|
+
return /* @__PURE__ */ jsx(Link, { to: value, children: value });
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
return value;
|
|
@@ -41,28 +41,31 @@ const TableCardFromData = ({
|
|
|
41
41
|
if (parsedData.length === 0) {
|
|
42
42
|
return null;
|
|
43
43
|
}
|
|
44
|
-
return /* @__PURE__ */
|
|
45
|
-
|
|
46
|
-
{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
columns: [
|
|
56
|
-
{
|
|
57
|
-
field: "name",
|
|
58
|
-
highlight: true,
|
|
59
|
-
width: "15%",
|
|
60
|
-
cellStyle: { whiteSpace: "nowrap" }
|
|
44
|
+
return /* @__PURE__ */ jsxs(Card, { children: [
|
|
45
|
+
/* @__PURE__ */ jsx(CardHeader, { title }),
|
|
46
|
+
/* @__PURE__ */ jsx(CardContent, { style: { padding: 0 }, children: /* @__PURE__ */ jsx(
|
|
47
|
+
Table,
|
|
48
|
+
{
|
|
49
|
+
options: {
|
|
50
|
+
search: false,
|
|
51
|
+
paging: false,
|
|
52
|
+
toolbar: false,
|
|
53
|
+
header: false,
|
|
54
|
+
padding: "dense"
|
|
61
55
|
},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
56
|
+
data: parsedData,
|
|
57
|
+
columns: [
|
|
58
|
+
{
|
|
59
|
+
field: "name",
|
|
60
|
+
highlight: true,
|
|
61
|
+
width: "15%",
|
|
62
|
+
cellStyle: { whiteSpace: "nowrap" }
|
|
63
|
+
},
|
|
64
|
+
{ field: "value" }
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
) })
|
|
68
|
+
] });
|
|
66
69
|
};
|
|
67
70
|
|
|
68
71
|
export { TableCardFromData };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableCardFromData.esm.js","sources":["../../../src/components/TableCardFromData/TableCardFromData.tsx"],"sourcesContent":["/*\n * Copyright 2024 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
|
|
1
|
+
{"version":3,"file":"TableCardFromData.esm.js","sources":["../../../src/components/TableCardFromData/TableCardFromData.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { Link, Table } from '@backstage/core-components';\n\nimport { Card, CardContent, CardHeader } from '@material-ui/core';\n\nconst convertToGibibytes = (kibibytes: string): string => {\n const sizeInKibibytes = parseInt(\n kibibytes.substring(0, kibibytes.length - 2),\n 10,\n );\n return `${(sizeInKibibytes / 2 ** 20).toFixed(0)} Gi`;\n};\n\nconst valueFormatter = (value: any): any => {\n if (typeof value === 'string') {\n if (value.endsWith('Ki')) {\n return convertToGibibytes(value);\n } else if (value.startsWith('http')) {\n return <Link to={value}>{value}</Link>;\n }\n }\n return value;\n};\n\nexport const TableCardFromData = ({\n data,\n title,\n nameMap,\n}: {\n data: any;\n title: string;\n nameMap: Map<string, string>;\n}) => {\n const parsedData: { name: string; value: any }[] = [];\n const entries = Object.entries(data);\n\n nameMap.forEach((_, key) => {\n const entry = entries.find(e => e[0] === key)!;\n // If key of the map doesn't have an prop in the cluster object, continue\n if (entry === undefined) {\n return;\n }\n parsedData.push({\n // entry[0] === name of the prop\n name: nameMap.get(entry[0])!,\n // entry[1] === value of the prop\n value: valueFormatter(entry[1]),\n });\n });\n\n if (parsedData.length === 0) {\n return null;\n }\n\n return (\n <Card>\n <CardHeader title={title} />\n <CardContent style={{ padding: 0 }}>\n <Table\n options={{\n search: false,\n paging: false,\n toolbar: false,\n header: false,\n padding: 'dense',\n }}\n data={parsedData}\n columns={[\n {\n field: 'name',\n highlight: true,\n width: '15%',\n cellStyle: { whiteSpace: 'nowrap' },\n },\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AEd,IAAM,EAAA,OAAA,CAAQ,GAAI,CAAA,KAAA,CAAM,CAAC,CAAC,CAAA;AAAA;AAAA,MAE1B,KAAO,EAAA,cAAA,CAAe,KAAM,CAAA,CAAC,CAAC;AAAA,KAC/B,CAAA;AAAA,GACF,CAAA;AAED,EAAI,IAAA,UAAA,CAAW,WAAW,CAAG,EAAA;AAC3B,IAAO,OAAA,IAAA;AAAA;AAGT,EAAA,4BACG,IACC,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,cAAW,KAAc,EAAA,CAAA;AAAA,wBACzB,WAAY,EAAA,EAAA,KAAA,EAAO,EAAE,OAAA,EAAS,GAC7B,EAAA,QAAA,kBAAA,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,OAAS,EAAA;AAAA,UACP,MAAQ,EAAA,KAAA;AAAA,UACR,MAAQ,EAAA,KAAA;AAAA,UACR,OAAS,EAAA,KAAA;AAAA,UACT,MAAQ,EAAA,KAAA;AAAA,UACR,OAAS,EAAA;AAAA,SACX;AAAA,QACA,IAAM,EAAA,UAAA;AAAA,QACN,OAAS,EAAA;AAAA,UACP;AAAA,YACE,KAAO,EAAA,MAAA;AAAA,YACP,SAAW,EAAA,IAAA;AAAA,YACX,KAAO,EAAA,KAAA;AAAA,YACP,SAAA,EAAW,EAAE,UAAA,EAAY,QAAS;AAAA,WACpC;AAAA,UACA,EAAE,OAAO,OAAQ;AAAA;AACnB;AAAA,KAEJ,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { StatusAborted, StatusOK, StatusError } from '@backstage/core-components';
|
|
3
3
|
import { makeStyles, Grid, Tooltip, Button } from '@material-ui/core';
|
|
4
4
|
import ArrowCircleUpIcon from '@mui/icons-material/ArrowCircleUp';
|
|
@@ -14,26 +14,29 @@ const useStyles = makeStyles({
|
|
|
14
14
|
});
|
|
15
15
|
const Status = ({ status }) => {
|
|
16
16
|
if (!status) {
|
|
17
|
-
return /* @__PURE__ */
|
|
17
|
+
return /* @__PURE__ */ jsx(StatusAborted, { children: "Unknown" });
|
|
18
18
|
} else if (status.available) {
|
|
19
|
-
return /* @__PURE__ */
|
|
19
|
+
return /* @__PURE__ */ jsx(StatusOK, { children: "Ready" });
|
|
20
20
|
}
|
|
21
|
-
return /* @__PURE__ */
|
|
21
|
+
return /* @__PURE__ */ jsx(StatusError, { children: "Not Ready" });
|
|
22
22
|
};
|
|
23
23
|
const Update = ({ data }) => {
|
|
24
24
|
const classes = useStyles();
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
|
|
27
|
-
{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
25
|
+
return /* @__PURE__ */ jsx(Fragment, { children: data.update.available ? /* @__PURE__ */ jsxs(Grid, { container: true, direction: "column", spacing: 0, children: [
|
|
26
|
+
/* @__PURE__ */ jsx(Grid, { item: true, children: data.version }),
|
|
27
|
+
/* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Tooltip, { title: `Version ${data.update.version} available`, children: /* @__PURE__ */ jsx(
|
|
28
|
+
Button,
|
|
29
|
+
{
|
|
30
|
+
variant: "text",
|
|
31
|
+
color: "primary",
|
|
32
|
+
startIcon: /* @__PURE__ */ jsx(ArrowCircleUpIcon, {}),
|
|
33
|
+
className: classes.button,
|
|
34
|
+
href: data.update.url,
|
|
35
|
+
size: "small",
|
|
36
|
+
children: "Upgrade available"
|
|
37
|
+
}
|
|
38
|
+
) }) })
|
|
39
|
+
] }) : data.version });
|
|
37
40
|
};
|
|
38
41
|
|
|
39
42
|
export { Status, Update };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.esm.js","sources":["../../src/components/common.tsx"],"sourcesContent":["/*\n * Copyright 2024 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
|
|
1
|
+
{"version":3,"file":"common.esm.js","sources":["../../src/components/common.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 {\n StatusAborted,\n StatusError,\n StatusOK,\n} from '@backstage/core-components';\n\nimport { Button, Grid, makeStyles, Tooltip } from '@material-ui/core';\nimport ArrowCircleUpIcon from '@mui/icons-material/ArrowCircleUp';\n\nimport { ClusterStatus } from '@backstage-community/plugin-ocm-common';\n\nimport { versionDetails } from '../types';\n\nconst useStyles = makeStyles({\n button: {\n textTransform: 'none',\n borderRadius: 16,\n margin: '0px',\n paddingLeft: '4px',\n paddingRight: '4px',\n },\n});\n\nexport const Status = ({ status }: { status: ClusterStatus }) => {\n if (!status) {\n return <StatusAborted>Unknown</StatusAborted>;\n } else if (status.available) {\n return <StatusOK>Ready</StatusOK>;\n }\n return <StatusError>Not Ready</StatusError>;\n};\n\nexport const Update = ({ data }: { data: versionDetails }) => {\n const classes = useStyles();\n return (\n <>\n {data.update.available ? (\n <Grid container direction=\"column\" spacing={0}>\n <Grid item>{data.version}</Grid>\n <Grid item>\n <Tooltip title={`Version ${data.update.version!} available`}>\n <Button\n variant=\"text\"\n color=\"primary\"\n startIcon={<ArrowCircleUpIcon />}\n className={classes.button}\n href={data.update.url}\n size=\"small\"\n >\n Upgrade available\n </Button>\n </Tooltip>\n </Grid>\n </Grid>\n ) : (\n data.version\n )}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;AA4BA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,MAAQ,EAAA;AAAA,IACN,aAAe,EAAA,MAAA;AAAA,IACf,YAAc,EAAA,EAAA;AAAA,IACd,MAAQ,EAAA,KAAA;AAAA,IACR,WAAa,EAAA,KAAA;AAAA,IACb,YAAc,EAAA;AAAA;AAElB,CAAC,CAAA;AAEM,MAAM,MAAS,GAAA,CAAC,EAAE,MAAA,EAAwC,KAAA;AAC/D,EAAA,IAAI,CAAC,MAAQ,EAAA;AACX,IAAO,uBAAA,GAAA,CAAC,iBAAc,QAAO,EAAA,SAAA,EAAA,CAAA;AAAA,GAC/B,MAAA,IAAW,OAAO,SAAW,EAAA;AAC3B,IAAO,uBAAA,GAAA,CAAC,YAAS,QAAK,EAAA,OAAA,EAAA,CAAA;AAAA;AAExB,EAAO,uBAAA,GAAA,CAAC,eAAY,QAAS,EAAA,WAAA,EAAA,CAAA;AAC/B;AAEO,MAAM,MAAS,GAAA,CAAC,EAAE,IAAA,EAAqC,KAAA;AAC5D,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EACE,uBAAA,GAAA,CAAA,QAAA,EAAA,EACG,QAAK,EAAA,IAAA,CAAA,MAAA,CAAO,SACX,mBAAA,IAAA,CAAC,IAAK,EAAA,EAAA,SAAA,EAAS,IAAC,EAAA,SAAA,EAAU,QAAS,EAAA,OAAA,EAAS,CAC1C,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IAAE,EAAA,QAAA,EAAA,IAAA,CAAK,OAAQ,EAAA,CAAA;AAAA,oBACzB,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,QAAA,kBAAA,GAAA,CAAC,OAAQ,EAAA,EAAA,KAAA,EAAO,CAAW,QAAA,EAAA,IAAA,CAAK,MAAO,CAAA,OAAQ,CAC7C,UAAA,CAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,OAAQ,EAAA,MAAA;AAAA,QACR,KAAM,EAAA,SAAA;AAAA,QACN,SAAA,sBAAY,iBAAkB,EAAA,EAAA,CAAA;AAAA,QAC9B,WAAW,OAAQ,CAAA,MAAA;AAAA,QACnB,IAAA,EAAM,KAAK,MAAO,CAAA,GAAA;AAAA,QAClB,IAAK,EAAA,OAAA;AAAA,QACN,QAAA,EAAA;AAAA;AAAA,OAGH,CACF,EAAA;AAAA,GACF,EAAA,CAAA,GAEA,KAAK,OAET,EAAA,CAAA;AAEJ;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
3
|
import * as react from 'react';
|
|
3
|
-
import react__default from 'react';
|
|
4
4
|
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
5
5
|
import { IconComponent } from '@backstage/core-plugin-api';
|
|
6
6
|
import { Cluster } from '@backstage-community/plugin-ocm-common';
|
|
@@ -16,7 +16,7 @@ declare const ocmPlugin: _backstage_core_plugin_api.BackstagePlugin<{
|
|
|
16
16
|
*/
|
|
17
17
|
declare const OcmPage: ({ logo }: {
|
|
18
18
|
logo?: react.ReactNode;
|
|
19
|
-
}) =>
|
|
19
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
20
20
|
/**
|
|
21
21
|
* @public
|
|
22
22
|
*/
|
|
@@ -38,7 +38,7 @@ type ClusterContextType = {
|
|
|
38
38
|
/**
|
|
39
39
|
* @public
|
|
40
40
|
*/
|
|
41
|
-
declare const ClusterContextProvider: (props: any) =>
|
|
41
|
+
declare const ClusterContextProvider: (props: any) => react_jsx_runtime.JSX.Element;
|
|
42
42
|
/**
|
|
43
43
|
* @public
|
|
44
44
|
*/
|
|
@@ -47,6 +47,6 @@ declare const useCluster: () => ClusterContextType;
|
|
|
47
47
|
/**
|
|
48
48
|
* @public
|
|
49
49
|
*/
|
|
50
|
-
declare const ClusterInfoCard: () =>
|
|
50
|
+
declare const ClusterInfoCard: () => react_jsx_runtime.JSX.Element | null;
|
|
51
51
|
|
|
52
52
|
export { ClusterAvailableResourceCard, ClusterContextProvider, type ClusterContextType, ClusterInfoCard, OcmIcon, OcmPage, ocmPlugin, useCluster };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage-community/plugin-ocm",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.0",
|
|
4
4
|
"main": "dist/index.esm.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
"prettier:fix": "prettier --ignore-unknown --write ."
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@backstage-community/plugin-ocm-common": "^3.
|
|
37
|
+
"@backstage-community/plugin-ocm-common": "^3.9.0",
|
|
38
38
|
"@backstage/catalog-model": "^1.7.3",
|
|
39
|
-
"@backstage/core-components": "^0.
|
|
40
|
-
"@backstage/core-plugin-api": "^1.10.
|
|
39
|
+
"@backstage/core-components": "^0.17.1",
|
|
40
|
+
"@backstage/core-plugin-api": "^1.10.6",
|
|
41
41
|
"@backstage/errors": "^1.2.7",
|
|
42
|
-
"@backstage/plugin-catalog-react": "^1.
|
|
43
|
-
"@backstage/plugin-home": "^0.8.
|
|
44
|
-
"@backstage/plugin-permission-react": "^0.4.
|
|
45
|
-
"@backstage/plugin-search-react": "^1.8.
|
|
46
|
-
"@backstage/theme": "^0.6.
|
|
42
|
+
"@backstage/plugin-catalog-react": "^1.17.0",
|
|
43
|
+
"@backstage/plugin-home": "^0.8.7",
|
|
44
|
+
"@backstage/plugin-permission-react": "^0.4.33",
|
|
45
|
+
"@backstage/plugin-search-react": "^1.8.8",
|
|
46
|
+
"@backstage/theme": "^0.6.5",
|
|
47
47
|
"@material-ui/core": "^4.9.13",
|
|
48
48
|
"@material-ui/icons": "^4.11.3",
|
|
49
49
|
"@mui/icons-material": "^5.16.4",
|
|
@@ -56,13 +56,12 @@
|
|
|
56
56
|
"react-router-dom": "6.0.0-beta.0 || ^6.3.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@backstage/cli": "^0.
|
|
60
|
-
"@backstage/core-app-api": "^1.
|
|
61
|
-
"@backstage/dev-utils": "^1.1.
|
|
62
|
-
"@backstage/plugin-catalog": "^1.
|
|
63
|
-
"@backstage/test-utils": "^1.7.
|
|
59
|
+
"@backstage/cli": "^0.32.0",
|
|
60
|
+
"@backstage/core-app-api": "^1.16.1",
|
|
61
|
+
"@backstage/dev-utils": "^1.1.9",
|
|
62
|
+
"@backstage/plugin-catalog": "^1.29.0",
|
|
63
|
+
"@backstage/test-utils": "^1.7.7",
|
|
64
64
|
"@redhat-developer/red-hat-developer-hub-theme": "0.4.0",
|
|
65
|
-
"@spotify/prettier-config": "^15.0.0",
|
|
66
65
|
"@testing-library/dom": "^10.0.0",
|
|
67
66
|
"@testing-library/jest-dom": "^6.0.0",
|
|
68
67
|
"@testing-library/react": "^15.0.0",
|
|
@@ -97,8 +96,8 @@
|
|
|
97
96
|
"author": "Red Hat",
|
|
98
97
|
"typesVersions": {
|
|
99
98
|
"*": {
|
|
100
|
-
"
|
|
101
|
-
"
|
|
99
|
+
"package.json": [
|
|
100
|
+
"package.json"
|
|
102
101
|
]
|
|
103
102
|
}
|
|
104
103
|
},
|