@terasky/backstage-plugin-vcf-automation 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/VCFAutomationDeploymentDetails.esm.js +33 -29
- package/dist/components/VCFAutomationDeploymentDetails.esm.js.map +1 -1
- package/dist/components/VCFAutomationDeploymentOverview.esm.js +66 -7
- package/dist/components/VCFAutomationDeploymentOverview.esm.js.map +1 -1
- package/dist/components/VCFAutomationGenericResourceDetails.esm.js +6 -6
- package/dist/components/VCFAutomationGenericResourceDetails.esm.js.map +1 -1
- package/dist/components/VCFAutomationGenericResourceOverview.esm.js +6 -6
- package/dist/components/VCFAutomationGenericResourceOverview.esm.js.map +1 -1
- package/dist/components/VCFAutomationProjectDetails.esm.js +99 -87
- package/dist/components/VCFAutomationProjectDetails.esm.js.map +1 -1
- package/dist/components/VCFAutomationProjectOverview.esm.js +75 -13
- package/dist/components/VCFAutomationProjectOverview.esm.js.map +1 -1
- package/dist/components/VCFAutomationVSphereVMDetails.esm.js +75 -69
- package/dist/components/VCFAutomationVSphereVMDetails.esm.js.map +1 -1
- package/dist/components/VCFAutomationVSphereVMOverview.esm.js +57 -10
- package/dist/components/VCFAutomationVSphereVMOverview.esm.js.map +1 -1
- package/dist/index.d.ts +9 -10
- package/package.json +14 -14
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { useEntity, catalogApiRef } from '@backstage/plugin-catalog-react';
|
|
3
3
|
import { useApi } from '@backstage/core-plugin-api';
|
|
4
4
|
import { vcfAutomationApiRef } from '../api/VcfAutomationClient.esm.js';
|
|
@@ -40,7 +40,7 @@ const resourceColumns = [
|
|
|
40
40
|
{
|
|
41
41
|
title: "Name",
|
|
42
42
|
field: "title",
|
|
43
|
-
render: (row) => /* @__PURE__ */
|
|
43
|
+
render: (row) => /* @__PURE__ */ jsx(Link, { to: `/catalog/${row.namespace}/${row.kind.toLowerCase()}/${row.name}`, children: row.title || row.name })
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
46
|
title: "Type",
|
|
@@ -113,16 +113,16 @@ const VCFAutomationDeploymentDetails = () => {
|
|
|
113
113
|
return allResources;
|
|
114
114
|
}, [deploymentId]);
|
|
115
115
|
if (!deploymentId) {
|
|
116
|
-
return /* @__PURE__ */
|
|
116
|
+
return /* @__PURE__ */ jsx(InfoCard, { title: "VCF Automation Deployment", children: /* @__PURE__ */ jsx(Typography, { children: "No deployment ID found for this entity." }) });
|
|
117
117
|
}
|
|
118
118
|
if (detailsLoading || eventsLoading || permissionLoading || resourcesLoading) {
|
|
119
|
-
return /* @__PURE__ */
|
|
119
|
+
return /* @__PURE__ */ jsx(InfoCard, { title: "VCF Automation Deployment", children: /* @__PURE__ */ jsx(Progress, {}) });
|
|
120
120
|
}
|
|
121
121
|
if (!hasViewPermission) {
|
|
122
|
-
return /* @__PURE__ */
|
|
122
|
+
return /* @__PURE__ */ jsx(InfoCard, { title: "VCF Automation Deployment", children: /* @__PURE__ */ jsx(Typography, { children: "You don't have permission to view deployment information." }) });
|
|
123
123
|
}
|
|
124
124
|
if (detailsError || eventsError || resourcesError) {
|
|
125
|
-
return /* @__PURE__ */
|
|
125
|
+
return /* @__PURE__ */ jsx(ResponseErrorPanel, { error: detailsError ?? eventsError ?? resourcesError ?? new Error("Unknown error") });
|
|
126
126
|
}
|
|
127
127
|
const metadata = {
|
|
128
128
|
"Basic Information": {
|
|
@@ -151,31 +151,35 @@ const VCFAutomationDeploymentDetails = () => {
|
|
|
151
151
|
} : {},
|
|
152
152
|
"Input Parameters": deploymentDetails?.inputs || {}
|
|
153
153
|
};
|
|
154
|
-
return /* @__PURE__ */
|
|
155
|
-
|
|
156
|
-
{
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
154
|
+
return /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 3, children: [
|
|
155
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(InfoCard, { title: "Deployment Details", children: /* @__PURE__ */ jsx(StructuredMetadataTable, { metadata }) }) }),
|
|
156
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(InfoCard, { title: "Deployment Resources", children: resources && resources.length > 0 ? /* @__PURE__ */ jsx(
|
|
157
|
+
Table,
|
|
158
|
+
{
|
|
159
|
+
columns: resourceColumns,
|
|
160
|
+
data: resources,
|
|
161
|
+
options: {
|
|
162
|
+
search: true,
|
|
163
|
+
paging: true,
|
|
164
|
+
pageSize: 10,
|
|
165
|
+
padding: "dense"
|
|
166
|
+
}
|
|
164
167
|
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
168
|
+
) : /* @__PURE__ */ jsx(Typography, { children: "No resources found for this deployment." }) }) }),
|
|
169
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(InfoCard, { title: "Deployment Events", children: eventsResponse?.content && eventsResponse.content.length > 0 ? /* @__PURE__ */ jsx(
|
|
170
|
+
Table,
|
|
171
|
+
{
|
|
172
|
+
columns: eventColumns,
|
|
173
|
+
data: eventsResponse.content,
|
|
174
|
+
options: {
|
|
175
|
+
search: true,
|
|
176
|
+
paging: true,
|
|
177
|
+
pageSize: eventsResponse.pageable?.pageSize || 10,
|
|
178
|
+
padding: "dense"
|
|
179
|
+
}
|
|
176
180
|
}
|
|
177
|
-
}
|
|
178
|
-
|
|
181
|
+
) : /* @__PURE__ */ jsx(Typography, { children: "No deployment events available." }) }) })
|
|
182
|
+
] });
|
|
179
183
|
};
|
|
180
184
|
|
|
181
185
|
export { VCFAutomationDeploymentDetails };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VCFAutomationDeploymentDetails.esm.js","sources":["../../src/components/VCFAutomationDeploymentDetails.tsx"],"sourcesContent":["import React from 'react';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { vcfAutomationApiRef } from '../api/VcfAutomationClient';\nimport {\n InfoCard,\n Progress,\n ResponseErrorPanel,\n Table,\n TableColumn,\n StructuredMetadataTable,\n Link,\n} from '@backstage/core-components';\nimport { Grid, Typography } from '@material-ui/core';\nimport useAsync from 'react-use/lib/useAsync';\nimport { usePermission } from '@backstage/plugin-permission-react';\nimport { viewDeploymentHistoryPermission } from '@terasky/backstage-plugin-vcf-automation-common';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\nimport { Entity } from '@backstage/catalog-model';\n\ntype DeploymentEvent = {\n id: string;\n name: string;\n status: string;\n requestedBy: string;\n createdAt: string;\n updatedAt: string;\n details: string;\n requestId: string;\n resourceIds: string[];\n};\n\ntype DeploymentResource = {\n name: string;\n title: string;\n kind: string;\n type: string;\n namespace: string;\n};\n\nconst eventColumns: TableColumn<DeploymentEvent>[] = [\n {\n title: 'Operation',\n field: 'name',\n },\n {\n title: 'Status',\n field: 'status',\n },\n {\n title: 'User',\n field: 'requestedBy',\n },\n {\n title: 'Created',\n field: 'createdAt',\n render: (row: DeploymentEvent) => new Date(row.createdAt).toLocaleString(),\n },\n {\n title: 'Last Updated',\n field: 'updatedAt',\n render: (row: DeploymentEvent) => new Date(row.updatedAt).toLocaleString(),\n },\n {\n title: 'Details',\n field: 'details',\n },\n];\n\nconst resourceColumns: TableColumn<DeploymentResource>[] = [\n {\n title: 'Name',\n field: 'title',\n render: (row: DeploymentResource) => (\n <Link to={`/catalog/${row.namespace}/${row.kind.toLowerCase()}/${row.name}`}>\n {row.title || row.name}\n </Link>\n ),\n },\n {\n title: 'Type',\n field: 'type',\n },\n];\n\nconst getEntityType = (entity: Entity): string => {\n const type = entity.spec?.type;\n if (typeof type === 'string') {\n return type;\n }\n if (typeof type === 'object' && type !== null) {\n return JSON.stringify(type);\n }\n return String(type || 'N/A');\n};\n\nexport const VCFAutomationDeploymentDetails = () => {\n const { entity } = useEntity();\n const api = useApi(vcfAutomationApiRef);\n const catalogApi = useApi(catalogApiRef);\n const deploymentId = entity.metadata.name;\n\n const { allowed: hasViewPermission, loading: permissionLoading } = usePermission({\n permission: viewDeploymentHistoryPermission,\n });\n\n const { value: deploymentDetails, loading: detailsLoading, error: detailsError } = useAsync(async () => {\n if (!deploymentId || !hasViewPermission) {\n return undefined;\n }\n return await api.getDeploymentDetails(deploymentId);\n }, [deploymentId, hasViewPermission]);\n\n const { value: eventsResponse, loading: eventsLoading, error: eventsError } = useAsync(async () => {\n if (!deploymentId || !hasViewPermission) {\n return undefined;\n }\n const response = await api.getDeploymentEvents(deploymentId);\n return response;\n }, [deploymentId, hasViewPermission]);\n\n const { value: resources, loading: resourcesLoading, error: resourcesError } = useAsync(async () => {\n if (!deploymentId) {\n return undefined;\n }\n\n // Get all components that belong to this system\n const components = await catalogApi.getEntities({\n filter: {\n kind: 'Component',\n 'spec.system': deploymentId,\n },\n });\n\n // Get all resources that belong to this system\n const resources = await catalogApi.getEntities({\n filter: {\n kind: 'Resource',\n 'spec.system': deploymentId,\n },\n });\n\n // Combine and format the results\n const allResources: DeploymentResource[] = [\n ...components.items.map((component: Entity) => ({\n name: component.metadata.name,\n title: component.metadata.title || component.metadata.name,\n kind: component.kind,\n type: getEntityType(component),\n namespace: component.metadata.namespace || 'default',\n })),\n ...resources.items.map((resource: Entity) => ({\n name: resource.metadata.name,\n title: resource.metadata.title || resource.metadata.name,\n kind: resource.kind,\n type: getEntityType(resource),\n namespace: resource.metadata.namespace || 'default',\n })),\n ];\n\n return allResources;\n }, [deploymentId]);\n\n if (!deploymentId) {\n return (\n <InfoCard title=\"VCF Automation Deployment\">\n <Typography>No deployment ID found for this entity.</Typography>\n </InfoCard>\n );\n }\n\n if (detailsLoading || eventsLoading || permissionLoading || resourcesLoading) {\n return (\n <InfoCard title=\"VCF Automation Deployment\">\n <Progress />\n </InfoCard>\n );\n }\n\n if (!hasViewPermission) {\n return (\n <InfoCard title=\"VCF Automation Deployment\">\n <Typography>You don't have permission to view deployment information.</Typography>\n </InfoCard>\n );\n }\n\n if (detailsError || eventsError || resourcesError) {\n return <ResponseErrorPanel error={detailsError ?? eventsError ?? resourcesError ?? new Error('Unknown error')} />;\n }\n\n const metadata: Record<string, any> = {\n 'Basic Information': {\n Name: deploymentDetails?.name,\n Description: deploymentDetails?.description || 'No description',\n Status: deploymentDetails?.status,\n 'Owner Type': deploymentDetails?.ownerType,\n 'Owned By': deploymentDetails?.ownedBy,\n 'Project ID': deploymentDetails?.projectId,\n 'Blueprint ID': deploymentDetails?.blueprintId,\n 'Organization ID': deploymentDetails?.orgId,\n },\n 'Timing Information': {\n 'Created By': deploymentDetails?.createdBy,\n 'Created At': deploymentDetails?.createdAt ? new Date(deploymentDetails.createdAt).toLocaleString() : '',\n 'Last Updated By': deploymentDetails?.lastUpdatedBy,\n 'Last Updated At': deploymentDetails?.lastUpdatedAt ? new Date(deploymentDetails.lastUpdatedAt).toLocaleString() : '',\n 'Lease Grace Period (Days)': deploymentDetails?.leaseGracePeriodDays,\n },\n 'Expense Information': deploymentDetails?.expense ? {\n 'Total Expense': `${deploymentDetails.expense.totalExpense} ${deploymentDetails.expense.unit}`,\n 'Compute Expense': `${deploymentDetails.expense.computeExpense} ${deploymentDetails.expense.unit}`,\n 'Storage Expense': `${deploymentDetails.expense.storageExpense} ${deploymentDetails.expense.unit}`,\n 'Additional Expense': `${deploymentDetails.expense.additionalExpense} ${deploymentDetails.expense.unit}`,\n 'Last Updated': new Date(deploymentDetails.expense.lastUpdatedTime).toLocaleString(),\n } : {},\n 'Input Parameters': deploymentDetails?.inputs || {},\n };\n\n return (\n <Grid container spacing={3}>\n <Grid item xs={12}>\n <InfoCard title=\"Deployment Details\">\n <StructuredMetadataTable metadata={metadata} />\n </InfoCard>\n </Grid>\n <Grid item xs={12}>\n <InfoCard title=\"Deployment Resources\">\n {resources && resources.length > 0 ? (\n <Table\n columns={resourceColumns}\n data={resources}\n options={{\n search: true,\n paging: true,\n pageSize: 10,\n padding: 'dense',\n }}\n />\n ) : (\n <Typography>No resources found for this deployment.</Typography>\n )}\n </InfoCard>\n </Grid>\n <Grid item xs={12}>\n <InfoCard title=\"Deployment Events\">\n {eventsResponse?.content && eventsResponse.content.length > 0 ? (\n <Table\n columns={eventColumns}\n data={eventsResponse.content}\n options={{\n search: true,\n paging: true,\n pageSize: eventsResponse.pageable?.pageSize || 10,\n padding: 'dense',\n }}\n />\n ) : (\n <Typography>No deployment events available.</Typography>\n )}\n </InfoCard>\n </Grid>\n </Grid>\n );\n}; "],"names":["resources"],"mappings":";;;;;;;;;;AAwCA,MAAM,YAA+C,GAAA;AAAA,EACnD;AAAA,IACE,KAAO,EAAA,WAAA;AAAA,IACP,KAAO,EAAA;AAAA,GACT;AAAA,EACA;AAAA,IACE,KAAO,EAAA,QAAA;AAAA,IACP,KAAO,EAAA;AAAA,GACT;AAAA,EACA;AAAA,IACE,KAAO,EAAA,MAAA;AAAA,IACP,KAAO,EAAA;AAAA,GACT;AAAA,EACA;AAAA,IACE,KAAO,EAAA,SAAA;AAAA,IACP,KAAO,EAAA,WAAA;AAAA,IACP,MAAA,EAAQ,CAAC,GAAyB,KAAA,IAAI,KAAK,GAAI,CAAA,SAAS,EAAE,cAAe;AAAA,GAC3E;AAAA,EACA;AAAA,IACE,KAAO,EAAA,cAAA;AAAA,IACP,KAAO,EAAA,WAAA;AAAA,IACP,MAAA,EAAQ,CAAC,GAAyB,KAAA,IAAI,KAAK,GAAI,CAAA,SAAS,EAAE,cAAe;AAAA,GAC3E;AAAA,EACA;AAAA,IACE,KAAO,EAAA,SAAA;AAAA,IACP,KAAO,EAAA;AAAA;AAEX,CAAA;AAEA,MAAM,eAAqD,GAAA;AAAA,EACzD;AAAA,IACE,KAAO,EAAA,MA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AACX;AAAA,GACF,uCAEC,UAAW,EAAA,IAAA,EAAA,yCAAuC,CAEvD,CACF,CAAA,kBACC,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,IAAI,EACb,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,YAAS,KAAM,EAAA,mBAAA,EAAA,EACb,gBAAgB,OAAW,IAAA,cAAA,CAAe,OAAQ,CAAA,MAAA,GAAS,CAC1D,mBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,OAAS,EAAA,YAAA;AAAA,MACT,MAAM,cAAe,CAAA,OAAA;AAAA,MACrB,OAAS,EAAA;AAAA,QACP,MAAQ,EAAA,IAAA;AAAA,QACR,MAAQ,EAAA,IAAA;AAAA,QACR,QAAA,EAAU,cAAe,CAAA,QAAA,EAAU,QAAY,IAAA,EAAA;AAAA,QAC/C,OAAS,EAAA;AAAA;AACX;AAAA,sBAGD,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,IAAA,EAAW,iCAA+B,CAE/C,CACF,CACF,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"VCFAutomationDeploymentDetails.esm.js","sources":["../../src/components/VCFAutomationDeploymentDetails.tsx"],"sourcesContent":["import { useEntity } from '@backstage/plugin-catalog-react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { vcfAutomationApiRef } from '../api/VcfAutomationClient';\nimport {\n InfoCard,\n Progress,\n ResponseErrorPanel,\n Table,\n TableColumn,\n StructuredMetadataTable,\n Link,\n} from '@backstage/core-components';\nimport { Grid, Typography } from '@material-ui/core';\nimport useAsync from 'react-use/lib/useAsync';\nimport { usePermission } from '@backstage/plugin-permission-react';\nimport { viewDeploymentHistoryPermission } from '@terasky/backstage-plugin-vcf-automation-common';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\nimport { Entity } from '@backstage/catalog-model';\n\ntype DeploymentEvent = {\n id: string;\n name: string;\n status: string;\n requestedBy: string;\n createdAt: string;\n updatedAt: string;\n details: string;\n requestId: string;\n resourceIds: string[];\n};\n\ntype DeploymentResource = {\n name: string;\n title: string;\n kind: string;\n type: string;\n namespace: string;\n};\n\nconst eventColumns: TableColumn<DeploymentEvent>[] = [\n {\n title: 'Operation',\n field: 'name',\n },\n {\n title: 'Status',\n field: 'status',\n },\n {\n title: 'User',\n field: 'requestedBy',\n },\n {\n title: 'Created',\n field: 'createdAt',\n render: (row: DeploymentEvent) => new Date(row.createdAt).toLocaleString(),\n },\n {\n title: 'Last Updated',\n field: 'updatedAt',\n render: (row: DeploymentEvent) => new Date(row.updatedAt).toLocaleString(),\n },\n {\n title: 'Details',\n field: 'details',\n },\n];\n\nconst resourceColumns: TableColumn<DeploymentResource>[] = [\n {\n title: 'Name',\n field: 'title',\n render: (row: DeploymentResource) => (\n <Link to={`/catalog/${row.namespace}/${row.kind.toLowerCase()}/${row.name}`}>\n {row.title || row.name}\n </Link>\n ),\n },\n {\n title: 'Type',\n field: 'type',\n },\n];\n\nconst getEntityType = (entity: Entity): string => {\n const type = entity.spec?.type;\n if (typeof type === 'string') {\n return type;\n }\n if (typeof type === 'object' && type !== null) {\n return JSON.stringify(type);\n }\n return String(type || 'N/A');\n};\n\nexport const VCFAutomationDeploymentDetails = () => {\n const { entity } = useEntity();\n const api = useApi(vcfAutomationApiRef);\n const catalogApi = useApi(catalogApiRef);\n const deploymentId = entity.metadata.name;\n\n const { allowed: hasViewPermission, loading: permissionLoading } = usePermission({\n permission: viewDeploymentHistoryPermission,\n });\n\n const { value: deploymentDetails, loading: detailsLoading, error: detailsError } = useAsync(async () => {\n if (!deploymentId || !hasViewPermission) {\n return undefined;\n }\n return await api.getDeploymentDetails(deploymentId);\n }, [deploymentId, hasViewPermission]);\n\n const { value: eventsResponse, loading: eventsLoading, error: eventsError } = useAsync(async () => {\n if (!deploymentId || !hasViewPermission) {\n return undefined;\n }\n const response = await api.getDeploymentEvents(deploymentId);\n return response;\n }, [deploymentId, hasViewPermission]);\n\n const { value: resources, loading: resourcesLoading, error: resourcesError } = useAsync(async () => {\n if (!deploymentId) {\n return undefined;\n }\n\n // Get all components that belong to this system\n const components = await catalogApi.getEntities({\n filter: {\n kind: 'Component',\n 'spec.system': deploymentId,\n },\n });\n\n // Get all resources that belong to this system\n const resources = await catalogApi.getEntities({\n filter: {\n kind: 'Resource',\n 'spec.system': deploymentId,\n },\n });\n\n // Combine and format the results\n const allResources: DeploymentResource[] = [\n ...components.items.map((component: Entity) => ({\n name: component.metadata.name,\n title: component.metadata.title || component.metadata.name,\n kind: component.kind,\n type: getEntityType(component),\n namespace: component.metadata.namespace || 'default',\n })),\n ...resources.items.map((resource: Entity) => ({\n name: resource.metadata.name,\n title: resource.metadata.title || resource.metadata.name,\n kind: resource.kind,\n type: getEntityType(resource),\n namespace: resource.metadata.namespace || 'default',\n })),\n ];\n\n return allResources;\n }, [deploymentId]);\n\n if (!deploymentId) {\n return (\n <InfoCard title=\"VCF Automation Deployment\">\n <Typography>No deployment ID found for this entity.</Typography>\n </InfoCard>\n );\n }\n\n if (detailsLoading || eventsLoading || permissionLoading || resourcesLoading) {\n return (\n <InfoCard title=\"VCF Automation Deployment\">\n <Progress />\n </InfoCard>\n );\n }\n\n if (!hasViewPermission) {\n return (\n <InfoCard title=\"VCF Automation Deployment\">\n <Typography>You don't have permission to view deployment information.</Typography>\n </InfoCard>\n );\n }\n\n if (detailsError || eventsError || resourcesError) {\n return <ResponseErrorPanel error={detailsError ?? eventsError ?? resourcesError ?? new Error('Unknown error')} />;\n }\n\n const metadata: Record<string, any> = {\n 'Basic Information': {\n Name: deploymentDetails?.name,\n Description: deploymentDetails?.description || 'No description',\n Status: deploymentDetails?.status,\n 'Owner Type': deploymentDetails?.ownerType,\n 'Owned By': deploymentDetails?.ownedBy,\n 'Project ID': deploymentDetails?.projectId,\n 'Blueprint ID': deploymentDetails?.blueprintId,\n 'Organization ID': deploymentDetails?.orgId,\n },\n 'Timing Information': {\n 'Created By': deploymentDetails?.createdBy,\n 'Created At': deploymentDetails?.createdAt ? new Date(deploymentDetails.createdAt).toLocaleString() : '',\n 'Last Updated By': deploymentDetails?.lastUpdatedBy,\n 'Last Updated At': deploymentDetails?.lastUpdatedAt ? new Date(deploymentDetails.lastUpdatedAt).toLocaleString() : '',\n 'Lease Grace Period (Days)': deploymentDetails?.leaseGracePeriodDays,\n },\n 'Expense Information': deploymentDetails?.expense ? {\n 'Total Expense': `${deploymentDetails.expense.totalExpense} ${deploymentDetails.expense.unit}`,\n 'Compute Expense': `${deploymentDetails.expense.computeExpense} ${deploymentDetails.expense.unit}`,\n 'Storage Expense': `${deploymentDetails.expense.storageExpense} ${deploymentDetails.expense.unit}`,\n 'Additional Expense': `${deploymentDetails.expense.additionalExpense} ${deploymentDetails.expense.unit}`,\n 'Last Updated': new Date(deploymentDetails.expense.lastUpdatedTime).toLocaleString(),\n } : {},\n 'Input Parameters': deploymentDetails?.inputs || {},\n };\n\n return (\n <Grid container spacing={3}>\n <Grid item xs={12}>\n <InfoCard title=\"Deployment Details\">\n <StructuredMetadataTable metadata={metadata} />\n </InfoCard>\n </Grid>\n <Grid item xs={12}>\n <InfoCard title=\"Deployment Resources\">\n {resources && resources.length > 0 ? (\n <Table\n columns={resourceColumns}\n data={resources}\n options={{\n search: true,\n paging: true,\n pageSize: 10,\n padding: 'dense',\n }}\n />\n ) : (\n <Typography>No resources found for this deployment.</Typography>\n )}\n </InfoCard>\n </Grid>\n <Grid item xs={12}>\n <InfoCard title=\"Deployment Events\">\n {eventsResponse?.content && eventsResponse.content.length > 0 ? (\n <Table\n columns={eventColumns}\n data={eventsResponse.content}\n options={{\n search: true,\n paging: true,\n pageSize: eventsResponse.pageable?.pageSize || 10,\n padding: 'dense',\n }}\n />\n ) : (\n <Typography>No deployment events available.</Typography>\n )}\n </InfoCard>\n </Grid>\n </Grid>\n );\n}; "],"names":["resources"],"mappings":";;;;;;;;;;AAuCA,MAAM,YAA+C,GAAA;AAAA,EACnD;AA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AAU,QAAY,IAAA,EAAA;AAAA,UAC/C,OAAS,EAAA;AAAA;AACX;AAAA,KAGF,mBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,QAAA,EAAA,iCAAA,EAA+B,GAE/C,CACF,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
3
3
|
import { useApi } from '@backstage/core-plugin-api';
|
|
4
4
|
import { vcfAutomationApiRef } from '../api/VcfAutomationClient.esm.js';
|
|
@@ -22,21 +22,80 @@ const VCFAutomationDeploymentOverview = () => {
|
|
|
22
22
|
return await api.getDeploymentDetails(deploymentId);
|
|
23
23
|
}, [deploymentId, hasViewPermission]);
|
|
24
24
|
if (!deploymentId) {
|
|
25
|
-
return /* @__PURE__ */
|
|
25
|
+
return /* @__PURE__ */ jsx(InfoCard, { title: "VCF Automation Deployment", children: /* @__PURE__ */ jsx(Typography, { children: "No deployment ID found for this entity." }) });
|
|
26
26
|
}
|
|
27
27
|
if (loading || permissionLoading) {
|
|
28
|
-
return /* @__PURE__ */
|
|
28
|
+
return /* @__PURE__ */ jsx(InfoCard, { title: "VCF Automation Deployment", children: /* @__PURE__ */ jsx(Progress, {}) });
|
|
29
29
|
}
|
|
30
30
|
if (!hasViewPermission) {
|
|
31
|
-
return /* @__PURE__ */
|
|
31
|
+
return /* @__PURE__ */ jsx(InfoCard, { title: "VCF Automation Deployment", children: /* @__PURE__ */ jsx(Typography, { children: "You don't have permission to view deployment details." }) });
|
|
32
32
|
}
|
|
33
33
|
if (error) {
|
|
34
|
-
return /* @__PURE__ */
|
|
34
|
+
return /* @__PURE__ */ jsx(ResponseErrorPanel, { error });
|
|
35
35
|
}
|
|
36
36
|
if (!deploymentDetails) {
|
|
37
|
-
return /* @__PURE__ */
|
|
37
|
+
return /* @__PURE__ */ jsx(InfoCard, { title: "VCF Automation Deployment", children: /* @__PURE__ */ jsx(Typography, { children: "No deployment details available." }) });
|
|
38
38
|
}
|
|
39
|
-
return /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ jsx(InfoCard, { title: "VCF Automation Deployment", children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
|
|
40
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(Typography, { variant: "h6", children: "Deployment Information" }) }),
|
|
41
|
+
/* @__PURE__ */ jsxs(Grid, { item: true, xs: 6, children: [
|
|
42
|
+
/* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: "Name" }),
|
|
43
|
+
/* @__PURE__ */ jsx(Typography, { children: deploymentDetails.name })
|
|
44
|
+
] }),
|
|
45
|
+
/* @__PURE__ */ jsxs(Grid, { item: true, xs: 6, children: [
|
|
46
|
+
/* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: "Status" }),
|
|
47
|
+
/* @__PURE__ */ jsx(Typography, { children: deploymentDetails.status })
|
|
48
|
+
] }),
|
|
49
|
+
/* @__PURE__ */ jsxs(Grid, { item: true, xs: 6, children: [
|
|
50
|
+
/* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: "Created By" }),
|
|
51
|
+
/* @__PURE__ */ jsx(Typography, { children: deploymentDetails.createdBy })
|
|
52
|
+
] }),
|
|
53
|
+
/* @__PURE__ */ jsxs(Grid, { item: true, xs: 6, children: [
|
|
54
|
+
/* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: "Created At" }),
|
|
55
|
+
/* @__PURE__ */ jsx(Typography, { children: new Date(deploymentDetails.createdAt).toLocaleString() })
|
|
56
|
+
] }),
|
|
57
|
+
/* @__PURE__ */ jsxs(Grid, { item: true, xs: 6, children: [
|
|
58
|
+
/* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: "Last Updated By" }),
|
|
59
|
+
/* @__PURE__ */ jsx(Typography, { children: deploymentDetails.lastUpdatedBy })
|
|
60
|
+
] }),
|
|
61
|
+
/* @__PURE__ */ jsxs(Grid, { item: true, xs: 6, children: [
|
|
62
|
+
/* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: "Last Updated At" }),
|
|
63
|
+
/* @__PURE__ */ jsx(Typography, { children: new Date(deploymentDetails.lastUpdatedAt).toLocaleString() })
|
|
64
|
+
] }),
|
|
65
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(Typography, { variant: "h6", children: "Expenses" }) }),
|
|
66
|
+
/* @__PURE__ */ jsxs(Grid, { item: true, xs: 3, children: [
|
|
67
|
+
/* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: "Total" }),
|
|
68
|
+
/* @__PURE__ */ jsxs(Typography, { children: [
|
|
69
|
+
deploymentDetails.expense?.totalExpense || "N/A",
|
|
70
|
+
" ",
|
|
71
|
+
deploymentDetails.expense?.unit || ""
|
|
72
|
+
] })
|
|
73
|
+
] }),
|
|
74
|
+
/* @__PURE__ */ jsxs(Grid, { item: true, xs: 3, children: [
|
|
75
|
+
/* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: "Compute" }),
|
|
76
|
+
/* @__PURE__ */ jsxs(Typography, { children: [
|
|
77
|
+
deploymentDetails.expense?.computeExpense || "N/A",
|
|
78
|
+
" ",
|
|
79
|
+
deploymentDetails.expense?.unit || ""
|
|
80
|
+
] })
|
|
81
|
+
] }),
|
|
82
|
+
/* @__PURE__ */ jsxs(Grid, { item: true, xs: 3, children: [
|
|
83
|
+
/* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: "Storage" }),
|
|
84
|
+
/* @__PURE__ */ jsxs(Typography, { children: [
|
|
85
|
+
deploymentDetails.expense?.storageExpense || "N/A",
|
|
86
|
+
" ",
|
|
87
|
+
deploymentDetails.expense?.unit || ""
|
|
88
|
+
] })
|
|
89
|
+
] }),
|
|
90
|
+
/* @__PURE__ */ jsxs(Grid, { item: true, xs: 3, children: [
|
|
91
|
+
/* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: "Additional" }),
|
|
92
|
+
/* @__PURE__ */ jsxs(Typography, { children: [
|
|
93
|
+
deploymentDetails.expense?.additionalExpense || "N/A",
|
|
94
|
+
" ",
|
|
95
|
+
deploymentDetails.expense?.unit || ""
|
|
96
|
+
] })
|
|
97
|
+
] })
|
|
98
|
+
] }) });
|
|
40
99
|
};
|
|
41
100
|
|
|
42
101
|
export { VCFAutomationDeploymentOverview };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VCFAutomationDeploymentOverview.esm.js","sources":["../../src/components/VCFAutomationDeploymentOverview.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"VCFAutomationDeploymentOverview.esm.js","sources":["../../src/components/VCFAutomationDeploymentOverview.tsx"],"sourcesContent":["import { useEntity } from '@backstage/plugin-catalog-react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { vcfAutomationApiRef } from '../api/VcfAutomationClient';\nimport {\n InfoCard,\n Progress,\n ResponseErrorPanel,\n} from '@backstage/core-components';\nimport { Grid, Typography } from '@material-ui/core';\nimport useAsync from 'react-use/lib/useAsync';\nimport { usePermission } from '@backstage/plugin-permission-react';\nimport { viewDeploymentHistoryPermission } from '@terasky/backstage-plugin-vcf-automation-common';\n\nexport const VCFAutomationDeploymentOverview = () => {\n const { entity } = useEntity();\n const api = useApi(vcfAutomationApiRef);\n const deploymentId = entity.metadata.name;\n\n const { allowed: hasViewPermission, loading: permissionLoading } = usePermission({\n permission: viewDeploymentHistoryPermission,\n });\n\n const { value: deploymentDetails, loading, error } = useAsync(async () => {\n if (!deploymentId || !hasViewPermission) {\n return undefined;\n }\n return await api.getDeploymentDetails(deploymentId);\n }, [deploymentId, hasViewPermission]);\n\n if (!deploymentId) {\n return (\n <InfoCard title=\"VCF Automation Deployment\">\n <Typography>No deployment ID found for this entity.</Typography>\n </InfoCard>\n );\n }\n\n if (loading || permissionLoading) {\n return (\n <InfoCard title=\"VCF Automation Deployment\">\n <Progress />\n </InfoCard>\n );\n }\n\n if (!hasViewPermission) {\n return (\n <InfoCard title=\"VCF Automation Deployment\">\n <Typography>You don't have permission to view deployment details.</Typography>\n </InfoCard>\n );\n }\n\n if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n if (!deploymentDetails) {\n return (\n <InfoCard title=\"VCF Automation Deployment\">\n <Typography>No deployment details available.</Typography>\n </InfoCard>\n );\n }\n\n return (\n <InfoCard title=\"VCF Automation Deployment\">\n <Grid container spacing={2}>\n <Grid item xs={12}>\n <Typography variant=\"h6\">Deployment Information</Typography>\n </Grid>\n <Grid item xs={6}>\n <Typography variant=\"subtitle2\">Name</Typography>\n <Typography>{deploymentDetails.name}</Typography>\n </Grid>\n <Grid item xs={6}>\n <Typography variant=\"subtitle2\">Status</Typography>\n <Typography>{deploymentDetails.status}</Typography>\n </Grid>\n <Grid item xs={6}>\n <Typography variant=\"subtitle2\">Created By</Typography>\n <Typography>{deploymentDetails.createdBy}</Typography>\n </Grid>\n <Grid item xs={6}>\n <Typography variant=\"subtitle2\">Created At</Typography>\n <Typography>\n {new Date(deploymentDetails.createdAt).toLocaleString()}\n </Typography>\n </Grid>\n <Grid item xs={6}>\n <Typography variant=\"subtitle2\">Last Updated By</Typography>\n <Typography>{deploymentDetails.lastUpdatedBy}</Typography>\n </Grid>\n <Grid item xs={6}>\n <Typography variant=\"subtitle2\">Last Updated At</Typography>\n <Typography>\n {new Date(deploymentDetails.lastUpdatedAt).toLocaleString()}\n </Typography>\n </Grid>\n <Grid item xs={12}>\n <Typography variant=\"h6\">Expenses</Typography>\n </Grid>\n <Grid item xs={3}>\n <Typography variant=\"subtitle2\">Total</Typography>\n <Typography>\n {deploymentDetails.expense?.totalExpense || 'N/A'} {deploymentDetails.expense?.unit || ''}\n </Typography>\n </Grid>\n <Grid item xs={3}>\n <Typography variant=\"subtitle2\">Compute</Typography>\n <Typography>\n {deploymentDetails.expense?.computeExpense || 'N/A'} {deploymentDetails.expense?.unit || ''}\n </Typography>\n </Grid>\n <Grid item xs={3}>\n <Typography variant=\"subtitle2\">Storage</Typography>\n <Typography>\n {deploymentDetails.expense?.storageExpense || 'N/A'} {deploymentDetails.expense?.unit || ''}\n </Typography>\n </Grid>\n <Grid item xs={3}>\n <Typography variant=\"subtitle2\">Additional</Typography>\n <Typography>\n {deploymentDetails.expense?.additionalExpense || 'N/A'} {deploymentDetails.expense?.unit || ''}\n </Typography>\n </Grid>\n </Grid>\n </InfoCard>\n );\n}; "],"names":[],"mappings":";;;;;;;;;;AAaO,MAAM,kCAAkC,MAAM;AACnD,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAC7B,EAAM,MAAA,GAAA,GAAM,OAAO,mBAAmB,CAAA;AACtC,EAAM,MAAA,YAAA,GAAe,OAAO,QAAS,CAAA,IAAA;AAErC,EAAA,MAAM,EAAE,OAAS,EAAA,iBAAA,EAAmB,OAAS,EAAA,iBAAA,KAAsB,aAAc,CAAA;AAAA,IAC/E,UAAY,EAAA;AAAA,GACb,CAAA;AAED,EAAA,MAAM,EAAE,KAAO,EAAA,iBAAA,EAAmB,SAAS,KAAM,EAAA,GAAI,SAAS,YAAY;AACxE,IAAI,IAAA,CAAC,YAAgB,IAAA,CAAC,iBAAmB,EAAA;AACvC,MAAO,OAAA,KAAA,CAAA;AAAA;AAET,IAAO,OAAA,MAAM,GAAI,CAAA,oBAAA,CAAqB,YAAY,CAAA;AAAA,GACjD,EAAA,CAAC,YAAc,EAAA,iBAAiB,CAAC,CAAA;AAEpC,EAAA,IAAI,CAAC,YAAc,EAAA;AACjB,IAAA,2BACG,QAAS,EAAA,EAAA,KAAA,EAAM,6BACd,QAAC,kBAAA,GAAA,CAAA,UAAA,EAAA,EAAW,qDAAuC,CACrD,EAAA,CAAA;AAAA;AAIJ,EAAA,IAAI,WAAW,iBAAmB,EAAA;AAChC,IAAA,2BACG,QAAS,EAAA,EAAA,KAAA,EAAM,2BACd,EAAA,QA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EAAA,IAAA,EAAC,IAAI,CACb,EAAA,QAAA,EAAA;AAAA,sBAAC,GAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,WAAA,EAAY,QAAO,EAAA,SAAA,EAAA,CAAA;AAAA,2BACtC,UACE,EAAA,EAAA,QAAA,EAAA;AAAA,QAAA,iBAAA,CAAkB,SAAS,cAAkB,IAAA,KAAA;AAAA,QAAM,GAAA;AAAA,QAAE,iBAAA,CAAkB,SAAS,IAAQ,IAAA;AAAA,OAC3F,EAAA;AAAA,KACF,EAAA,CAAA;AAAA,oBACC,IAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,IAAI,CACb,EAAA,QAAA,EAAA;AAAA,sBAAC,GAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,WAAA,EAAY,QAAU,EAAA,YAAA,EAAA,CAAA;AAAA,2BACzC,UACE,EAAA,EAAA,QAAA,EAAA;AAAA,QAAA,iBAAA,CAAkB,SAAS,iBAAqB,IAAA,KAAA;AAAA,QAAM,GAAA;AAAA,QAAE,iBAAA,CAAkB,SAAS,IAAQ,IAAA;AAAA,OAC9F,EAAA;AAAA,KACF,EAAA;AAAA,GAAA,EACF,CACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
3
3
|
import { ResponseErrorPanel, Progress, InfoCard, StructuredMetadataTable } from '@backstage/core-components';
|
|
4
4
|
import useAsync from 'react-use/lib/useAsync';
|
|
@@ -33,19 +33,19 @@ const VCFAutomationGenericResourceDetails = () => {
|
|
|
33
33
|
return await vcfAutomationApi.getGenericResourceDetails(deploymentId, resourceId);
|
|
34
34
|
}, [deploymentId, resourceId]);
|
|
35
35
|
if (error) {
|
|
36
|
-
return /* @__PURE__ */
|
|
36
|
+
return /* @__PURE__ */ jsx(ResponseErrorPanel, { error });
|
|
37
37
|
}
|
|
38
38
|
if (loading) {
|
|
39
|
-
return /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ jsx(Progress, {});
|
|
40
40
|
}
|
|
41
41
|
if (!deploymentId || !resourceId) {
|
|
42
|
-
return /* @__PURE__ */
|
|
42
|
+
return /* @__PURE__ */ jsx(InfoCard, { title: "No Resource Information", children: "This entity is not associated with a VCF resource." });
|
|
43
43
|
}
|
|
44
44
|
if (!resourceData) {
|
|
45
|
-
return /* @__PURE__ */
|
|
45
|
+
return /* @__PURE__ */ jsx(InfoCard, { title: "No Data", children: "No resource details available." });
|
|
46
46
|
}
|
|
47
47
|
const formattedData = formatValue(resourceData);
|
|
48
|
-
return /* @__PURE__ */
|
|
48
|
+
return /* @__PURE__ */ jsx(InfoCard, { title: "Resource Details", children: /* @__PURE__ */ jsx(StructuredMetadataTable, { metadata: formattedData }) });
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
export { VCFAutomationGenericResourceDetails };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VCFAutomationGenericResourceDetails.esm.js","sources":["../../src/components/VCFAutomationGenericResourceDetails.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"VCFAutomationGenericResourceDetails.esm.js","sources":["../../src/components/VCFAutomationGenericResourceDetails.tsx"],"sourcesContent":["import { useEntity } from '@backstage/plugin-catalog-react';\nimport {\n InfoCard,\n Progress,\n ResponseErrorPanel,\n StructuredMetadataTable,\n} from '@backstage/core-components';\nimport useAsync from 'react-use/lib/useAsync';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { vcfAutomationApiRef } from '../api/VcfAutomationClient';\n\nconst formatValue = (value: any): any => {\n if (value === null) return 'null';\n if (typeof value === 'undefined') return 'undefined';\n if (typeof value === 'object') {\n if (Array.isArray(value)) {\n return value.map(formatValue);\n }\n const formattedObj: Record<string, any> = {};\n Object.entries(value).forEach(([key, val]) => {\n formattedObj[key] = formatValue(val);\n });\n return formattedObj;\n }\n if (typeof value === 'string' && value.match(/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}/)) {\n return new Date(value).toLocaleString();\n }\n return value;\n};\n\nexport const VCFAutomationGenericResourceDetails = () => {\n const { entity } = useEntity();\n const vcfAutomationApi = useApi(vcfAutomationApiRef);\n const deploymentId = entity.spec?.system || '';\n const resourceId = entity.metadata.name;\n\n const { value: resourceData, loading, error } = useAsync(async () => {\n if (!deploymentId || !resourceId) return undefined;\n return await vcfAutomationApi.getGenericResourceDetails(deploymentId as string, resourceId as string);\n }, [deploymentId, resourceId]);\n\n if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n if (loading) {\n return <Progress />;\n }\n\n if (!deploymentId || !resourceId) {\n return (\n <InfoCard title=\"No Resource Information\">\n This entity is not associated with a VCF resource.\n </InfoCard>\n );\n }\n\n if (!resourceData) {\n return <InfoCard title=\"No Data\">No resource details available.</InfoCard>;\n }\n\n // Format all data for display\n const formattedData = formatValue(resourceData);\n\n return (\n <InfoCard title=\"Resource Details\">\n <StructuredMetadataTable metadata={formattedData} />\n </InfoCard>\n );\n}; "],"names":[],"mappings":";;;;;;;AAWA,MAAM,WAAA,GAAc,CAAC,KAAoB,KAAA;AACvC,EAAI,IAAA,KAAA,KAAU,MAAa,OAAA,MAAA;AAC3B,EAAI,IAAA,OAAO,KAAU,KAAA,WAAA,EAAoB,OAAA,WAAA;AACzC,EAAI,IAAA,OAAO,UAAU,QAAU,EAAA;AAC7B,IAAI,IAAA,KAAA,CAAM,OAAQ,CAAA,KAAK,CAAG,EAAA;AACxB,MAAO,OAAA,KAAA,CAAM,IAAI,WAAW,CAAA;AAAA;AAE9B,IAAA,MAAM,eAAoC,EAAC;AAC3C,IAAO,MAAA,CAAA,OAAA,CAAQ,KAAK,CAAE,CAAA,OAAA,CAAQ,CAAC,CAAC,GAAA,EAAK,GAAG,CAAM,KAAA;AAC5C,MAAa,YAAA,CAAA,GAAG,CAAI,GAAA,WA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AAA,QAAA,EAAA,EAAS,KAAM,EAAA,SAAA,EAAU,QAA8B,EAAA,gCAAA,EAAA,CAAA;AAAA;AAIjE,EAAM,MAAA,aAAA,GAAgB,YAAY,YAAY,CAAA;AAE9C,EACE,uBAAA,GAAA,CAAC,YAAS,KAAM,EAAA,kBAAA,EACd,8BAAC,uBAAwB,EAAA,EAAA,QAAA,EAAU,eAAe,CACpD,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
3
3
|
import { ResponseErrorPanel, Progress, InfoCard, StructuredMetadataTable } from '@backstage/core-components';
|
|
4
4
|
import useAsync from 'react-use/lib/useAsync';
|
|
@@ -15,16 +15,16 @@ const VCFAutomationGenericResourceOverview = () => {
|
|
|
15
15
|
return await vcfAutomationApi.getGenericResourceDetails(deploymentId, resourceId);
|
|
16
16
|
}, [deploymentId, resourceId]);
|
|
17
17
|
if (error) {
|
|
18
|
-
return /* @__PURE__ */
|
|
18
|
+
return /* @__PURE__ */ jsx(ResponseErrorPanel, { error });
|
|
19
19
|
}
|
|
20
20
|
if (loading) {
|
|
21
|
-
return /* @__PURE__ */
|
|
21
|
+
return /* @__PURE__ */ jsx(Progress, {});
|
|
22
22
|
}
|
|
23
23
|
if (!deploymentId || !resourceId) {
|
|
24
|
-
return /* @__PURE__ */
|
|
24
|
+
return /* @__PURE__ */ jsx(InfoCard, { title: "No Resource Information", children: "This entity is not associated with a VCF resource." });
|
|
25
25
|
}
|
|
26
26
|
if (!resourceData) {
|
|
27
|
-
return /* @__PURE__ */
|
|
27
|
+
return /* @__PURE__ */ jsx(InfoCard, { title: "No Data", children: "No resource details available." });
|
|
28
28
|
}
|
|
29
29
|
const overviewData = {};
|
|
30
30
|
if (resourceData.name) overviewData["Name"] = resourceData.name;
|
|
@@ -33,7 +33,7 @@ const VCFAutomationGenericResourceOverview = () => {
|
|
|
33
33
|
if (resourceData.syncStatus) overviewData["Sync Status"] = resourceData.syncStatus;
|
|
34
34
|
if (resourceData.origin) overviewData["Origin"] = resourceData.origin;
|
|
35
35
|
if (resourceData.status) overviewData["Status"] = resourceData.status;
|
|
36
|
-
return /* @__PURE__ */
|
|
36
|
+
return /* @__PURE__ */ jsx(InfoCard, { title: "Resource Overview", children: /* @__PURE__ */ jsx(StructuredMetadataTable, { metadata: overviewData }) });
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
export { VCFAutomationGenericResourceOverview };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VCFAutomationGenericResourceOverview.esm.js","sources":["../../src/components/VCFAutomationGenericResourceOverview.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"VCFAutomationGenericResourceOverview.esm.js","sources":["../../src/components/VCFAutomationGenericResourceOverview.tsx"],"sourcesContent":["import { useEntity } from '@backstage/plugin-catalog-react';\nimport {\n InfoCard,\n Progress,\n ResponseErrorPanel,\n StructuredMetadataTable,\n} from '@backstage/core-components';\nimport useAsync from 'react-use/lib/useAsync';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { vcfAutomationApiRef } from '../api/VcfAutomationClient';\n\nexport const VCFAutomationGenericResourceOverview = () => {\n const { entity } = useEntity();\n const vcfAutomationApi = useApi(vcfAutomationApiRef);\n const deploymentId = entity.spec?.system || '';\n const resourceId = entity.metadata.name;\n\n const { value: resourceData, loading, error } = useAsync(async () => {\n if (!deploymentId || !resourceId) return undefined;\n return await vcfAutomationApi.getGenericResourceDetails(deploymentId as string, resourceId as string);\n }, [deploymentId, resourceId]);\n\n if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n if (loading) {\n return <Progress />;\n }\n\n if (!deploymentId || !resourceId) {\n return (\n <InfoCard title=\"No Resource Information\">\n This entity is not associated with a VCF resource.\n </InfoCard>\n );\n }\n\n if (!resourceData) {\n return <InfoCard title=\"No Data\">No resource details available.</InfoCard>;\n }\n\n // Extract the overview fields if they exist\n const overviewData: Record<string, any> = {};\n \n if (resourceData.name) overviewData['Name'] = resourceData.name;\n if (resourceData.type) overviewData['Type'] = resourceData.type;\n if (resourceData.createdAt) overviewData['Created At'] = new Date(resourceData.createdAt).toLocaleString();\n if (resourceData.syncStatus) overviewData['Sync Status'] = resourceData.syncStatus;\n if (resourceData.origin) overviewData['Origin'] = resourceData.origin;\n if (resourceData.status) overviewData['Status'] = resourceData.status;\n\n return (\n <InfoCard title=\"Resource Overview\">\n <StructuredMetadataTable metadata={overviewData} />\n </InfoCard>\n );\n}; "],"names":[],"mappings":";;;;;;;AAWO,MAAM,uCAAuC,MAAM;AACxD,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAC7B,EAAM,MAAA,gBAAA,GAAmB,OAAO,mBAAmB,CAAA;AACnD,EAAM,MAAA,YAAA,GAAe,MAAO,CAAA,IAAA,EAAM,MAAU,IAAA,EAAA;AAC5C,EAAM,MAAA,UAAA,GAAa,OAAO,QAAS,CAAA,IAAA;AAEnC,EAAA,MAAM,EAAE,KAAO,EAAA,YAAA,EAAc,SAAS,KAAM,EAAA,GAAI,SAAS,YAAY;AACnE,IAAA,IAAI,CAAC,YAAA,IAAgB,CAAC,UAAA,EAAmB,OAAA,KAAA,CAAA;AACzC,IAAA,OAAO,MAAM,gBAAA,CAAiB,yBAA0B,CAAA,YAAA,EAAwB,UAAoB,CAAA;AAAA,GACnG,EAAA,CAAC,YAAc,EAAA,UAAU,CAAC,CAAA;AAE7B,EAAA,IAAI,KAAO,EAAA;AACT,IAAO,uBAAA,GAAA,CAAC,sBAAmB,KAAc,EAAA,CAAA;AAAA;AAG3C,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2BAAQ,QAAS,EAAA,EAAA,CAAA;AAAA;AAGnB,EAAI,IAAA,CAAC,YAAgB,IAAA,CAAC,UAAY,EAAA;AAChC,IAAA,uBACG,GAAA,CAAA,QAAA,EAAA,EAAS,K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