@terasky/backstage-plugin-vcf-automation 0.0.1 → 0.1.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/README.md +36 -0
- package/dist/api/VcfAutomationClient.esm.js +90 -0
- package/dist/api/VcfAutomationClient.esm.js.map +1 -0
- package/dist/components/VCFAutomationDeploymentDetails.esm.js +182 -0
- package/dist/components/VCFAutomationDeploymentDetails.esm.js.map +1 -0
- package/dist/components/VCFAutomationDeploymentOverview.esm.js +43 -0
- package/dist/components/VCFAutomationDeploymentOverview.esm.js.map +1 -0
- package/dist/components/VCFAutomationGenericResourceDetails.esm.js +52 -0
- package/dist/components/VCFAutomationGenericResourceDetails.esm.js.map +1 -0
- package/dist/components/VCFAutomationGenericResourceOverview.esm.js +40 -0
- package/dist/components/VCFAutomationGenericResourceOverview.esm.js.map +1 -0
- package/dist/components/VCFAutomationProjectDetails.esm.js +172 -0
- package/dist/components/VCFAutomationProjectDetails.esm.js.map +1 -0
- package/dist/components/VCFAutomationProjectOverview.esm.js +47 -0
- package/dist/components/VCFAutomationProjectOverview.esm.js.map +1 -0
- package/dist/components/VCFAutomationVSphereVMDetails.esm.js +110 -0
- package/dist/components/VCFAutomationVSphereVMDetails.esm.js.map +1 -0
- package/dist/components/VCFAutomationVSphereVMOverview.esm.js +69 -0
- package/dist/components/VCFAutomationVSphereVMOverview.esm.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +11 -881
- package/dist/index.esm.js.map +1 -1
- package/dist/plugin.esm.js +82 -0
- package/dist/plugin.esm.js.map +1 -0
- package/dist/routes.esm.js +20 -0
- package/dist/routes.esm.js.map +1 -0
- package/package.json +17 -10
package/dist/index.esm.js
CHANGED
|
@@ -1,882 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
});
|
|
13
|
-
createRouteRef({
|
|
14
|
-
id: "vcf-automation:deployment",
|
|
15
|
-
params: ["deploymentId"]
|
|
16
|
-
});
|
|
17
|
-
createRouteRef({
|
|
18
|
-
id: "vcf-automation:resource",
|
|
19
|
-
params: ["deploymentId", "resourceId"]
|
|
20
|
-
});
|
|
21
|
-
createRouteRef({
|
|
22
|
-
id: "vcf-automation:project",
|
|
23
|
-
params: ["projectId"]
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
var __defProp = Object.defineProperty;
|
|
27
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
28
|
-
var __publicField = (obj, key, value) => {
|
|
29
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
30
|
-
return value;
|
|
31
|
-
};
|
|
32
|
-
const vcfAutomationApiRef = createApiRef({
|
|
33
|
-
id: "plugin.vcf-automation.service"
|
|
34
|
-
});
|
|
35
|
-
class VcfAutomationClient {
|
|
36
|
-
constructor(options) {
|
|
37
|
-
__publicField(this, "discoveryApi");
|
|
38
|
-
__publicField(this, "identityApi");
|
|
39
|
-
this.discoveryApi = options.discoveryApi;
|
|
40
|
-
this.identityApi = options.identityApi;
|
|
41
|
-
}
|
|
42
|
-
async getAuthHeaders() {
|
|
43
|
-
const token = await this.identityApi.getCredentials();
|
|
44
|
-
return {
|
|
45
|
-
"Content-Type": "application/json",
|
|
46
|
-
...(token == null ? void 0 : token.token) ? { Authorization: `Bearer ${token.token}` } : {}
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
async getDeploymentEvents(deploymentId) {
|
|
50
|
-
const baseUrl = await this.discoveryApi.getBaseUrl("vcf-automation");
|
|
51
|
-
const headers = await this.getAuthHeaders();
|
|
52
|
-
const response = await fetch(`${baseUrl}/deployments/${deploymentId}/events`, {
|
|
53
|
-
headers
|
|
54
|
-
});
|
|
55
|
-
if (!response.ok) {
|
|
56
|
-
throw new Error(`Failed to fetch deployment events: ${response.statusText}`);
|
|
57
|
-
}
|
|
58
|
-
return await response.json();
|
|
59
|
-
}
|
|
60
|
-
async getVSphereVMDetails(deploymentId, resourceId) {
|
|
61
|
-
const baseUrl = await this.discoveryApi.getBaseUrl("vcf-automation");
|
|
62
|
-
const headers = await this.getAuthHeaders();
|
|
63
|
-
const response = await fetch(`${baseUrl}/deployments/${deploymentId}/resources/${resourceId}`, {
|
|
64
|
-
headers
|
|
65
|
-
});
|
|
66
|
-
if (!response.ok) {
|
|
67
|
-
throw new Error(`Failed to fetch resource details: ${response.statusText}`);
|
|
68
|
-
}
|
|
69
|
-
return await response.json();
|
|
70
|
-
}
|
|
71
|
-
async getGenericResourceDetails(deploymentId, resourceId) {
|
|
72
|
-
const baseUrl = await this.discoveryApi.getBaseUrl("vcf-automation");
|
|
73
|
-
const headers = await this.getAuthHeaders();
|
|
74
|
-
const response = await fetch(
|
|
75
|
-
`${baseUrl}/deployments/${deploymentId}/resources/${resourceId}`,
|
|
76
|
-
{
|
|
77
|
-
headers: {
|
|
78
|
-
"Content-Type": "application/json",
|
|
79
|
-
...headers
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
);
|
|
83
|
-
if (!response.ok) {
|
|
84
|
-
throw new Error(`Failed to fetch resource details: ${response.statusText}`);
|
|
85
|
-
}
|
|
86
|
-
return await response.json();
|
|
87
|
-
}
|
|
88
|
-
async getDeploymentDetails(deploymentId) {
|
|
89
|
-
const baseUrl = await this.discoveryApi.getBaseUrl("vcf-automation");
|
|
90
|
-
const headers = await this.getAuthHeaders();
|
|
91
|
-
const response = await fetch(
|
|
92
|
-
`${baseUrl}/deployments/${deploymentId}`,
|
|
93
|
-
{
|
|
94
|
-
headers: {
|
|
95
|
-
"Content-Type": "application/json",
|
|
96
|
-
...headers
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
);
|
|
100
|
-
if (!response.ok) {
|
|
101
|
-
throw new Error(`Failed to fetch deployment details: ${response.statusText}`);
|
|
102
|
-
}
|
|
103
|
-
return await response.json();
|
|
104
|
-
}
|
|
105
|
-
async getProjectDetails(projectId) {
|
|
106
|
-
const baseUrl = await this.discoveryApi.getBaseUrl("vcf-automation");
|
|
107
|
-
const headers = await this.getAuthHeaders();
|
|
108
|
-
const response = await fetch(`${baseUrl}/projects/${projectId}`, {
|
|
109
|
-
headers
|
|
110
|
-
});
|
|
111
|
-
if (!response.ok) {
|
|
112
|
-
throw new Error(`Failed to fetch project details: ${response.statusText}`);
|
|
113
|
-
}
|
|
114
|
-
return await response.json();
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const catalogIndexRouteRef = createExternalRouteRef({
|
|
119
|
-
id: "catalog-index"
|
|
120
|
-
});
|
|
121
|
-
const vcfAutomationPlugin = createPlugin({
|
|
122
|
-
id: "vcf-automation",
|
|
123
|
-
apis: [
|
|
124
|
-
createApiFactory({
|
|
125
|
-
api: vcfAutomationApiRef,
|
|
126
|
-
deps: { discoveryApi: discoveryApiRef, identityApi: identityApiRef },
|
|
127
|
-
factory: ({ discoveryApi, identityApi }) => new VcfAutomationClient({ discoveryApi, identityApi })
|
|
128
|
-
})
|
|
129
|
-
],
|
|
130
|
-
routes: {
|
|
131
|
-
root: rootRouteRef
|
|
132
|
-
},
|
|
133
|
-
externalRoutes: {
|
|
134
|
-
catalogIndex: catalogIndexRouteRef
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
vcfAutomationPlugin.provide(
|
|
138
|
-
createRoutableExtension({
|
|
139
|
-
name: "VcfAutomationDeploymentDetails",
|
|
140
|
-
component: () => Promise.resolve().then(function () { return VCFAutomationDeploymentDetails$1; }).then((m) => m.VCFAutomationDeploymentDetails),
|
|
141
|
-
mountPoint: rootRouteRef
|
|
142
|
-
})
|
|
143
|
-
);
|
|
144
|
-
vcfAutomationPlugin.provide(
|
|
145
|
-
createRoutableExtension({
|
|
146
|
-
name: "VcfAutomationVSphereVMDetails",
|
|
147
|
-
component: () => Promise.resolve().then(function () { return VCFAutomationVSphereVMDetails$1; }).then((m) => m.VCFAutomationVSphereVMDetails),
|
|
148
|
-
mountPoint: rootRouteRef
|
|
149
|
-
})
|
|
150
|
-
);
|
|
151
|
-
vcfAutomationPlugin.provide(
|
|
152
|
-
createRoutableExtension({
|
|
153
|
-
name: "VcfAutomationProjectDetails",
|
|
154
|
-
component: () => Promise.resolve().then(function () { return VCFAutomationProjectDetails$1; }).then((m) => m.VCFAutomationProjectDetails),
|
|
155
|
-
mountPoint: rootRouteRef
|
|
156
|
-
})
|
|
157
|
-
);
|
|
158
|
-
vcfAutomationPlugin.provide(
|
|
159
|
-
createRoutableExtension({
|
|
160
|
-
name: "VcfAutomationDeploymentOverview",
|
|
161
|
-
component: () => Promise.resolve().then(function () { return VCFAutomationDeploymentOverview$1; }).then((m) => m.VCFAutomationDeploymentOverview),
|
|
162
|
-
mountPoint: rootRouteRef
|
|
163
|
-
})
|
|
164
|
-
);
|
|
165
|
-
vcfAutomationPlugin.provide(
|
|
166
|
-
createRoutableExtension({
|
|
167
|
-
name: "VcfAutomationVSphereVMOverview",
|
|
168
|
-
component: () => Promise.resolve().then(function () { return VCFAutomationVSphereVMOverview$1; }).then((m) => m.VCFAutomationVSphereVMOverview),
|
|
169
|
-
mountPoint: rootRouteRef
|
|
170
|
-
})
|
|
171
|
-
);
|
|
172
|
-
vcfAutomationPlugin.provide(
|
|
173
|
-
createRoutableExtension({
|
|
174
|
-
name: "VcfAutomationProjectOverview",
|
|
175
|
-
component: () => Promise.resolve().then(function () { return VCFAutomationProjectOverview$1; }).then((m) => m.VCFAutomationProjectOverview),
|
|
176
|
-
mountPoint: rootRouteRef
|
|
177
|
-
})
|
|
178
|
-
);
|
|
179
|
-
vcfAutomationPlugin.provide(
|
|
180
|
-
createRoutableExtension({
|
|
181
|
-
name: "VcfAutomationGenericResourceDetails",
|
|
182
|
-
component: () => Promise.resolve().then(function () { return VCFAutomationGenericResourceDetails$1; }).then((m) => m.VCFAutomationGenericResourceDetails),
|
|
183
|
-
mountPoint: rootRouteRef
|
|
184
|
-
})
|
|
185
|
-
);
|
|
186
|
-
vcfAutomationPlugin.provide(
|
|
187
|
-
createRoutableExtension({
|
|
188
|
-
name: "VcfAutomationGenericResourceOverview",
|
|
189
|
-
component: () => Promise.resolve().then(function () { return VCFAutomationGenericResourceOverview$1; }).then((m) => m.VCFAutomationGenericResourceOverview),
|
|
190
|
-
mountPoint: rootRouteRef
|
|
191
|
-
})
|
|
192
|
-
);
|
|
193
|
-
|
|
194
|
-
const useStyles = makeStyles((theme) => ({
|
|
195
|
-
statusText: {
|
|
196
|
-
fontWeight: "bold",
|
|
197
|
-
"&.success": {
|
|
198
|
-
color: theme.palette.success.main
|
|
199
|
-
},
|
|
200
|
-
"&.error": {
|
|
201
|
-
color: theme.palette.error.main
|
|
202
|
-
},
|
|
203
|
-
"&.pending": {
|
|
204
|
-
color: theme.palette.warning.main
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}));
|
|
208
|
-
const VCFAutomationVSphereVMOverview = () => {
|
|
209
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
210
|
-
const { entity } = useEntity();
|
|
211
|
-
const api = useApi(vcfAutomationApiRef);
|
|
212
|
-
const classes = useStyles();
|
|
213
|
-
const deploymentId = ((_a = entity.spec) == null ? void 0 : _a.system) || "";
|
|
214
|
-
const resourceId = entity.metadata.name;
|
|
215
|
-
const { allowed: hasViewPermission, loading: permissionLoading } = usePermission({
|
|
216
|
-
permission: showDeploymentResourcesDataPermission
|
|
217
|
-
});
|
|
218
|
-
const { value: resource, loading, error } = useAsync(async () => {
|
|
219
|
-
if (!resourceId || !deploymentId || !hasViewPermission)
|
|
220
|
-
return void 0;
|
|
221
|
-
return await api.getVSphereVMDetails(deploymentId, resourceId);
|
|
222
|
-
}, [resourceId, deploymentId, hasViewPermission]);
|
|
223
|
-
if (!resourceId || !deploymentId) {
|
|
224
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "VCF Automation Resource" }, /* @__PURE__ */ React.createElement(Typography, null, "No resource ID or deployment ID found for this entity."));
|
|
225
|
-
}
|
|
226
|
-
if (loading || permissionLoading) {
|
|
227
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "VCF Automation Resource" }, /* @__PURE__ */ React.createElement(Progress, null));
|
|
228
|
-
}
|
|
229
|
-
if (!hasViewPermission) {
|
|
230
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "VCF Automation Resource" }, /* @__PURE__ */ React.createElement(Typography, null, "You don't have permission to view resource details."));
|
|
231
|
-
}
|
|
232
|
-
if (error) {
|
|
233
|
-
return /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error });
|
|
234
|
-
}
|
|
235
|
-
if (!resource) {
|
|
236
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "VCF Automation Resource" }, /* @__PURE__ */ React.createElement(Typography, null, "No resource details available."));
|
|
237
|
-
}
|
|
238
|
-
const getStatusComponent = (state) => {
|
|
239
|
-
switch (state.toUpperCase()) {
|
|
240
|
-
case "SUCCESS":
|
|
241
|
-
case "OK":
|
|
242
|
-
return /* @__PURE__ */ React.createElement(StatusOK, null);
|
|
243
|
-
case "ERROR":
|
|
244
|
-
case "FAILED":
|
|
245
|
-
return /* @__PURE__ */ React.createElement(StatusError, null);
|
|
246
|
-
default:
|
|
247
|
-
return /* @__PURE__ */ React.createElement(StatusPending, null);
|
|
248
|
-
}
|
|
249
|
-
};
|
|
250
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "VCF Automation Resource" }, /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 2 }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2" }, "Name"), /* @__PURE__ */ React.createElement(Typography, null, resource.name)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2" }, "Type"), /* @__PURE__ */ React.createElement(Typography, null, resource.type)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2" }, "State"), /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 1, alignItems: "center" }, getStatusComponent(resource.state), /* @__PURE__ */ React.createElement(Typography, { className: `${classes.statusText} ${resource.state.toLowerCase()}` }, resource.state))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2" }, "Sync Status"), /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 1, alignItems: "center" }, getStatusComponent(resource.syncStatus), /* @__PURE__ */ React.createElement(Typography, { className: `${classes.statusText} ${resource.syncStatus.toLowerCase()}` }, resource.syncStatus))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2" }, "Created At"), /* @__PURE__ */ React.createElement(Typography, null, new Date(resource.createdAt).toLocaleString())), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2" }, "Region"), /* @__PURE__ */ React.createElement(Typography, null, ((_b = resource.properties) == null ? void 0 : _b.region) || "N/A")), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2" }, "Resource Metrics"), /* @__PURE__ */ React.createElement(Typography, null, `CPU: ${((_c = resource.properties) == null ? void 0 : _c.cpuCount) || "N/A"} cores, `, `Memory: ${((_d = resource.properties) == null ? void 0 : _d.memoryGB) || "N/A"} GB, `, `Storage: ${((_h = (_g = (_f = (_e = resource.properties) == null ? void 0 : _e.storage) == null ? void 0 : _f.disks) == null ? void 0 : _g[0]) == null ? void 0 : _h.capacityGb) || "N/A"} GB`)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2" }, "Expense Information"), /* @__PURE__ */ React.createElement(Typography, null, `Total: $${((_j = (_i = resource.expense) == null ? void 0 : _i.totalExpense) == null ? void 0 : _j.toFixed(2)) || "N/A"}, `, `Compute: $${((_l = (_k = resource.expense) == null ? void 0 : _k.computeExpense) == null ? void 0 : _l.toFixed(2)) || "N/A"}, `, `Storage: $${((_n = (_m = resource.expense) == null ? void 0 : _m.storageExpense) == null ? void 0 : _n.toFixed(2)) || "N/A"}`))));
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
var VCFAutomationVSphereVMOverview$1 = /*#__PURE__*/Object.freeze({
|
|
254
|
-
__proto__: null,
|
|
255
|
-
VCFAutomationVSphereVMOverview: VCFAutomationVSphereVMOverview
|
|
256
|
-
});
|
|
257
|
-
|
|
258
|
-
const VCFAutomationProjectOverview = () => {
|
|
259
|
-
const { entity } = useEntity();
|
|
260
|
-
const api = useApi(vcfAutomationApiRef);
|
|
261
|
-
const projectId = entity.metadata.name;
|
|
262
|
-
const { allowed: hasViewPermission, loading: permissionLoading } = usePermission({
|
|
263
|
-
permission: viewProjectDetailsPermission
|
|
264
|
-
});
|
|
265
|
-
const { value: project, loading, error } = useAsync(async () => {
|
|
266
|
-
if (!projectId || !hasViewPermission)
|
|
267
|
-
return void 0;
|
|
268
|
-
return await api.getProjectDetails(projectId);
|
|
269
|
-
}, [projectId, hasViewPermission]);
|
|
270
|
-
if (!projectId) {
|
|
271
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "VCF Automation Project" }, /* @__PURE__ */ React.createElement(Typography, null, "No project ID found for this entity."));
|
|
272
|
-
}
|
|
273
|
-
if (loading || permissionLoading) {
|
|
274
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "VCF Automation Project" }, /* @__PURE__ */ React.createElement(Progress, null));
|
|
275
|
-
}
|
|
276
|
-
if (!hasViewPermission) {
|
|
277
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "VCF Automation Project" }, /* @__PURE__ */ React.createElement(Typography, null, "You don't have permission to view project details."));
|
|
278
|
-
}
|
|
279
|
-
if (error) {
|
|
280
|
-
return /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error });
|
|
281
|
-
}
|
|
282
|
-
if (!project) {
|
|
283
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "VCF Automation Project" }, /* @__PURE__ */ React.createElement(Typography, null, "No project details available."));
|
|
284
|
-
}
|
|
285
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "VCF Automation Project" }, /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 2 }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2" }, "Name"), /* @__PURE__ */ React.createElement(Typography, null, project.name)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2" }, "Description"), /* @__PURE__ */ React.createElement(Typography, null, project.description || "No description")), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2" }, "Administrators"), /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 1 }, project.administrators.map((admin) => /* @__PURE__ */ React.createElement(Grid, { item: true, key: `${admin.email}-${admin.type}` }, /* @__PURE__ */ React.createElement(
|
|
286
|
-
Chip,
|
|
287
|
-
{
|
|
288
|
-
label: `${admin.email} (${admin.type})`,
|
|
289
|
-
size: "small"
|
|
290
|
-
}
|
|
291
|
-
))))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2" }, "Resource Allocation"), project.zones.map((zone) => /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 2, key: zone.id }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Typography, { variant: "body2" }, "Zone: ", zone.zoneId)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 4 }, /* @__PURE__ */ React.createElement(Typography, { variant: "caption" }, "Instances"), /* @__PURE__ */ React.createElement(Typography, null, zone.allocatedInstancesCount, " / ", zone.maxNumberInstances || "Unlimited")), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 4 }, /* @__PURE__ */ React.createElement(Typography, { variant: "caption" }, "Memory (MB)"), /* @__PURE__ */ React.createElement(Typography, null, zone.allocatedMemoryMB, " / ", zone.memoryLimitMB || "Unlimited")), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 4 }, /* @__PURE__ */ React.createElement(Typography, { variant: "caption" }, "CPU"), /* @__PURE__ */ React.createElement(Typography, null, zone.allocatedCpu, " / ", zone.cpuLimit || "Unlimited")), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 4 }, /* @__PURE__ */ React.createElement(Typography, { variant: "caption" }, "Storage (GB)"), /* @__PURE__ */ React.createElement(Typography, null, zone.allocatedStorageGB, " / ", zone.storageLimitGB || "Unlimited"))))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2" }, "Shared Resources"), /* @__PURE__ */ React.createElement(Typography, null, project.sharedResources ? "Yes" : "No")), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2" }, "Placement Policy"), /* @__PURE__ */ React.createElement(Typography, null, project.placementPolicy))));
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
var VCFAutomationProjectOverview$1 = /*#__PURE__*/Object.freeze({
|
|
295
|
-
__proto__: null,
|
|
296
|
-
VCFAutomationProjectOverview: VCFAutomationProjectOverview
|
|
297
|
-
});
|
|
298
|
-
|
|
299
|
-
const VCFAutomationProjectDetails = () => {
|
|
300
|
-
const { entity } = useEntity();
|
|
301
|
-
const vcfAutomationApi = useApi(vcfAutomationApiRef);
|
|
302
|
-
const catalogApi = useApi(catalogApiRef);
|
|
303
|
-
const projectId = entity.metadata.name;
|
|
304
|
-
const { allowed } = usePermission({
|
|
305
|
-
permission: viewProjectDetailsPermission
|
|
306
|
-
});
|
|
307
|
-
const { value: projectData, loading: projectLoading, error: projectError } = useAsync(async () => {
|
|
308
|
-
if (!projectId || !allowed)
|
|
309
|
-
return void 0;
|
|
310
|
-
return await vcfAutomationApi.getProjectDetails(projectId);
|
|
311
|
-
}, [projectId, allowed]);
|
|
312
|
-
const { value: systemsData, loading: systemsLoading } = useAsync(async () => {
|
|
313
|
-
if (!projectId || !allowed)
|
|
314
|
-
return void 0;
|
|
315
|
-
const systems = await catalogApi.getEntities({
|
|
316
|
-
filter: {
|
|
317
|
-
kind: "System",
|
|
318
|
-
"spec.domain": projectId
|
|
319
|
-
}
|
|
320
|
-
});
|
|
321
|
-
const deployments = await Promise.all(
|
|
322
|
-
systems.items.map(async (system) => {
|
|
323
|
-
var _a;
|
|
324
|
-
const vms = await catalogApi.getEntities({
|
|
325
|
-
filter: {
|
|
326
|
-
kind: "Component",
|
|
327
|
-
"spec.type": "Cloud.vSphere.Machine",
|
|
328
|
-
"spec.system": system.metadata.name
|
|
329
|
-
}
|
|
330
|
-
});
|
|
331
|
-
const resources = await catalogApi.getEntities({
|
|
332
|
-
filter: {
|
|
333
|
-
kind: "Resource",
|
|
334
|
-
"spec.system": system.metadata.name
|
|
335
|
-
}
|
|
336
|
-
});
|
|
337
|
-
const owner = (_a = system.spec) == null ? void 0 : _a.owner;
|
|
338
|
-
return {
|
|
339
|
-
name: system.metadata.name,
|
|
340
|
-
title: system.metadata.title || system.metadata.name,
|
|
341
|
-
owner: typeof owner === "string" ? owner : "N/A",
|
|
342
|
-
vmCount: vms.items.length,
|
|
343
|
-
resourceCount: resources.items.length,
|
|
344
|
-
entityRef: `/catalog/${system.metadata.namespace || "default"}/system/${system.metadata.name}`
|
|
345
|
-
};
|
|
346
|
-
})
|
|
347
|
-
);
|
|
348
|
-
return deployments;
|
|
349
|
-
}, [projectId, allowed]);
|
|
350
|
-
if (projectError) {
|
|
351
|
-
return /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error: projectError });
|
|
352
|
-
}
|
|
353
|
-
if (projectLoading || systemsLoading) {
|
|
354
|
-
return /* @__PURE__ */ React.createElement(Progress, null);
|
|
355
|
-
}
|
|
356
|
-
if (!projectId) {
|
|
357
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "No project ID found" }, "This entity is not associated with a VCF project.");
|
|
358
|
-
}
|
|
359
|
-
if (!allowed) {
|
|
360
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "Permission Denied" }, "You don't have permission to view project details.");
|
|
361
|
-
}
|
|
362
|
-
if (!projectData) {
|
|
363
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "No Data" }, "No project details available.");
|
|
364
|
-
}
|
|
365
|
-
const renderMemberTable = (members, title) => /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, md: 6 }, /* @__PURE__ */ React.createElement(InfoCard, { title }, /* @__PURE__ */ React.createElement(
|
|
366
|
-
Table,
|
|
367
|
-
{
|
|
368
|
-
columns: [
|
|
369
|
-
{ title: "Email", field: "email" },
|
|
370
|
-
{ title: "Type", field: "type" }
|
|
371
|
-
],
|
|
372
|
-
data: members,
|
|
373
|
-
options: { search: false, paging: false }
|
|
374
|
-
}
|
|
375
|
-
)));
|
|
376
|
-
return /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3 }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(InfoCard, { title: "Project Overview" }, /* @__PURE__ */ React.createElement(
|
|
377
|
-
StructuredMetadataTable,
|
|
378
|
-
{
|
|
379
|
-
metadata: {
|
|
380
|
-
"Project Name": projectData.name,
|
|
381
|
-
"Project ID": projectData.id,
|
|
382
|
-
Description: projectData.description,
|
|
383
|
-
"Organization ID": projectData.organizationId,
|
|
384
|
-
"Operation Timeout": `${projectData.operationTimeout} seconds`,
|
|
385
|
-
"Machine Naming Template": projectData.machineNamingTemplate || "N/A",
|
|
386
|
-
"Shared Resources": projectData.sharedResources ? "Yes" : "No"
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(InfoCard, { title: "Project Deployments" }, /* @__PURE__ */ React.createElement(
|
|
390
|
-
Table,
|
|
391
|
-
{
|
|
392
|
-
columns: [
|
|
393
|
-
{
|
|
394
|
-
title: "Name",
|
|
395
|
-
field: "title",
|
|
396
|
-
render: (row) => /* @__PURE__ */ React.createElement(Link, { to: row.entityRef }, row.title)
|
|
397
|
-
},
|
|
398
|
-
{ title: "Owner", field: "owner" },
|
|
399
|
-
{
|
|
400
|
-
title: "VMs",
|
|
401
|
-
field: "vmCount",
|
|
402
|
-
align: "right"
|
|
403
|
-
},
|
|
404
|
-
{
|
|
405
|
-
title: "Additional Resources",
|
|
406
|
-
field: "resourceCount",
|
|
407
|
-
align: "right"
|
|
408
|
-
}
|
|
409
|
-
],
|
|
410
|
-
data: systemsData || [],
|
|
411
|
-
options: {
|
|
412
|
-
search: true,
|
|
413
|
-
paging: true
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(InfoCard, { title: "Project Members" }, /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3 }, renderMemberTable(projectData.administrators, "Administrators"), renderMemberTable(projectData.members, "Members"), renderMemberTable(projectData.viewers, "Viewers"), renderMemberTable(projectData.supervisors, "Supervisors")))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(InfoCard, { title: "Project Zones" }, /* @__PURE__ */ React.createElement(
|
|
417
|
-
Table,
|
|
418
|
-
{
|
|
419
|
-
columns: [
|
|
420
|
-
{ title: "Zone ID", field: "zoneId" },
|
|
421
|
-
{ title: "Priority", field: "priority" },
|
|
422
|
-
{
|
|
423
|
-
title: "Instances",
|
|
424
|
-
field: "instances",
|
|
425
|
-
render: (row) => `${row.allocatedInstancesCount}/${row.maxNumberInstances || "\u221E"}`
|
|
426
|
-
},
|
|
427
|
-
{
|
|
428
|
-
title: "Memory (MB)",
|
|
429
|
-
field: "memory",
|
|
430
|
-
render: (row) => `${row.allocatedMemoryMB}/${row.memoryLimitMB || "\u221E"}`
|
|
431
|
-
},
|
|
432
|
-
{
|
|
433
|
-
title: "CPU",
|
|
434
|
-
field: "cpu",
|
|
435
|
-
render: (row) => `${row.allocatedCpu}/${row.cpuLimit || "\u221E"}`
|
|
436
|
-
},
|
|
437
|
-
{
|
|
438
|
-
title: "Storage (GB)",
|
|
439
|
-
field: "storage",
|
|
440
|
-
render: (row) => `${row.allocatedStorageGB}/${row.storageLimitGB || "\u221E"}`
|
|
441
|
-
}
|
|
442
|
-
],
|
|
443
|
-
data: projectData.zones,
|
|
444
|
-
options: {
|
|
445
|
-
search: true,
|
|
446
|
-
paging: true
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
))), Object.keys(projectData.constraints).length > 0 && /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(InfoCard, { title: "Constraints" }, /* @__PURE__ */ React.createElement(
|
|
450
|
-
StructuredMetadataTable,
|
|
451
|
-
{
|
|
452
|
-
metadata: projectData.constraints
|
|
453
|
-
}
|
|
454
|
-
))), Object.keys(projectData.customProperties).length > 0 && /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(InfoCard, { title: "Custom Properties" }, /* @__PURE__ */ React.createElement(
|
|
455
|
-
StructuredMetadataTable,
|
|
456
|
-
{
|
|
457
|
-
metadata: projectData.customProperties
|
|
458
|
-
}
|
|
459
|
-
))));
|
|
460
|
-
};
|
|
461
|
-
|
|
462
|
-
var VCFAutomationProjectDetails$1 = /*#__PURE__*/Object.freeze({
|
|
463
|
-
__proto__: null,
|
|
464
|
-
VCFAutomationProjectDetails: VCFAutomationProjectDetails
|
|
465
|
-
});
|
|
466
|
-
|
|
467
|
-
const eventColumns = [
|
|
468
|
-
{
|
|
469
|
-
title: "Operation",
|
|
470
|
-
field: "name"
|
|
471
|
-
},
|
|
472
|
-
{
|
|
473
|
-
title: "Status",
|
|
474
|
-
field: "status"
|
|
475
|
-
},
|
|
476
|
-
{
|
|
477
|
-
title: "User",
|
|
478
|
-
field: "requestedBy"
|
|
479
|
-
},
|
|
480
|
-
{
|
|
481
|
-
title: "Created",
|
|
482
|
-
field: "createdAt",
|
|
483
|
-
render: (row) => new Date(row.createdAt).toLocaleString()
|
|
484
|
-
},
|
|
485
|
-
{
|
|
486
|
-
title: "Last Updated",
|
|
487
|
-
field: "updatedAt",
|
|
488
|
-
render: (row) => new Date(row.updatedAt).toLocaleString()
|
|
489
|
-
},
|
|
490
|
-
{
|
|
491
|
-
title: "Details",
|
|
492
|
-
field: "details"
|
|
493
|
-
}
|
|
494
|
-
];
|
|
495
|
-
const resourceColumns = [
|
|
496
|
-
{
|
|
497
|
-
title: "Name",
|
|
498
|
-
field: "title",
|
|
499
|
-
render: (row) => /* @__PURE__ */ React.createElement(Link, { to: `/catalog/${row.namespace}/${row.kind.toLowerCase()}/${row.name}` }, row.title || row.name)
|
|
500
|
-
},
|
|
501
|
-
{
|
|
502
|
-
title: "Type",
|
|
503
|
-
field: "type"
|
|
504
|
-
}
|
|
505
|
-
];
|
|
506
|
-
const getEntityType = (entity) => {
|
|
507
|
-
var _a;
|
|
508
|
-
const type = (_a = entity.spec) == null ? void 0 : _a.type;
|
|
509
|
-
if (typeof type === "string") {
|
|
510
|
-
return type;
|
|
511
|
-
}
|
|
512
|
-
if (typeof type === "object" && type !== null) {
|
|
513
|
-
return JSON.stringify(type);
|
|
514
|
-
}
|
|
515
|
-
return String(type || "N/A");
|
|
516
|
-
};
|
|
517
|
-
const VCFAutomationDeploymentDetails = () => {
|
|
518
|
-
var _a, _b, _c;
|
|
519
|
-
const { entity } = useEntity();
|
|
520
|
-
const api = useApi(vcfAutomationApiRef);
|
|
521
|
-
const catalogApi = useApi(catalogApiRef);
|
|
522
|
-
const deploymentId = entity.metadata.name;
|
|
523
|
-
const { allowed: hasViewPermission, loading: permissionLoading } = usePermission({
|
|
524
|
-
permission: viewDeploymentHistoryPermission
|
|
525
|
-
});
|
|
526
|
-
const { value: deploymentDetails, loading: detailsLoading, error: detailsError } = useAsync(async () => {
|
|
527
|
-
if (!deploymentId || !hasViewPermission) {
|
|
528
|
-
return void 0;
|
|
529
|
-
}
|
|
530
|
-
return await api.getDeploymentDetails(deploymentId);
|
|
531
|
-
}, [deploymentId, hasViewPermission]);
|
|
532
|
-
const { value: eventsResponse, loading: eventsLoading, error: eventsError } = useAsync(async () => {
|
|
533
|
-
if (!deploymentId || !hasViewPermission) {
|
|
534
|
-
return void 0;
|
|
535
|
-
}
|
|
536
|
-
const response = await api.getDeploymentEvents(deploymentId);
|
|
537
|
-
return response;
|
|
538
|
-
}, [deploymentId, hasViewPermission]);
|
|
539
|
-
const { value: resources, loading: resourcesLoading, error: resourcesError } = useAsync(async () => {
|
|
540
|
-
if (!deploymentId) {
|
|
541
|
-
return void 0;
|
|
542
|
-
}
|
|
543
|
-
const components = await catalogApi.getEntities({
|
|
544
|
-
filter: {
|
|
545
|
-
kind: "Component",
|
|
546
|
-
"spec.system": deploymentId
|
|
547
|
-
}
|
|
548
|
-
});
|
|
549
|
-
const resources2 = await catalogApi.getEntities({
|
|
550
|
-
filter: {
|
|
551
|
-
kind: "Resource",
|
|
552
|
-
"spec.system": deploymentId
|
|
553
|
-
}
|
|
554
|
-
});
|
|
555
|
-
const allResources = [
|
|
556
|
-
...components.items.map((component) => ({
|
|
557
|
-
name: component.metadata.name,
|
|
558
|
-
title: component.metadata.title || component.metadata.name,
|
|
559
|
-
kind: component.kind,
|
|
560
|
-
type: getEntityType(component),
|
|
561
|
-
namespace: component.metadata.namespace || "default"
|
|
562
|
-
})),
|
|
563
|
-
...resources2.items.map((resource) => ({
|
|
564
|
-
name: resource.metadata.name,
|
|
565
|
-
title: resource.metadata.title || resource.metadata.name,
|
|
566
|
-
kind: resource.kind,
|
|
567
|
-
type: getEntityType(resource),
|
|
568
|
-
namespace: resource.metadata.namespace || "default"
|
|
569
|
-
}))
|
|
570
|
-
];
|
|
571
|
-
return allResources;
|
|
572
|
-
}, [deploymentId]);
|
|
573
|
-
if (!deploymentId) {
|
|
574
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "VCF Automation Deployment" }, /* @__PURE__ */ React.createElement(Typography, null, "No deployment ID found for this entity."));
|
|
575
|
-
}
|
|
576
|
-
if (detailsLoading || eventsLoading || permissionLoading || resourcesLoading) {
|
|
577
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "VCF Automation Deployment" }, /* @__PURE__ */ React.createElement(Progress, null));
|
|
578
|
-
}
|
|
579
|
-
if (!hasViewPermission) {
|
|
580
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "VCF Automation Deployment" }, /* @__PURE__ */ React.createElement(Typography, null, "You don't have permission to view deployment information."));
|
|
581
|
-
}
|
|
582
|
-
if (detailsError || eventsError || resourcesError) {
|
|
583
|
-
return /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error: (_b = (_a = detailsError != null ? detailsError : eventsError) != null ? _a : resourcesError) != null ? _b : new Error("Unknown error") });
|
|
584
|
-
}
|
|
585
|
-
const metadata = {
|
|
586
|
-
"Basic Information": {
|
|
587
|
-
Name: deploymentDetails == null ? void 0 : deploymentDetails.name,
|
|
588
|
-
Description: (deploymentDetails == null ? void 0 : deploymentDetails.description) || "No description",
|
|
589
|
-
Status: deploymentDetails == null ? void 0 : deploymentDetails.status,
|
|
590
|
-
"Owner Type": deploymentDetails == null ? void 0 : deploymentDetails.ownerType,
|
|
591
|
-
"Owned By": deploymentDetails == null ? void 0 : deploymentDetails.ownedBy,
|
|
592
|
-
"Project ID": deploymentDetails == null ? void 0 : deploymentDetails.projectId,
|
|
593
|
-
"Blueprint ID": deploymentDetails == null ? void 0 : deploymentDetails.blueprintId,
|
|
594
|
-
"Organization ID": deploymentDetails == null ? void 0 : deploymentDetails.orgId
|
|
595
|
-
},
|
|
596
|
-
"Timing Information": {
|
|
597
|
-
"Created By": deploymentDetails == null ? void 0 : deploymentDetails.createdBy,
|
|
598
|
-
"Created At": (deploymentDetails == null ? void 0 : deploymentDetails.createdAt) ? new Date(deploymentDetails.createdAt).toLocaleString() : "",
|
|
599
|
-
"Last Updated By": deploymentDetails == null ? void 0 : deploymentDetails.lastUpdatedBy,
|
|
600
|
-
"Last Updated At": (deploymentDetails == null ? void 0 : deploymentDetails.lastUpdatedAt) ? new Date(deploymentDetails.lastUpdatedAt).toLocaleString() : "",
|
|
601
|
-
"Lease Grace Period (Days)": deploymentDetails == null ? void 0 : deploymentDetails.leaseGracePeriodDays
|
|
602
|
-
},
|
|
603
|
-
"Expense Information": (deploymentDetails == null ? void 0 : deploymentDetails.expense) ? {
|
|
604
|
-
"Total Expense": `${deploymentDetails.expense.totalExpense} ${deploymentDetails.expense.unit}`,
|
|
605
|
-
"Compute Expense": `${deploymentDetails.expense.computeExpense} ${deploymentDetails.expense.unit}`,
|
|
606
|
-
"Storage Expense": `${deploymentDetails.expense.storageExpense} ${deploymentDetails.expense.unit}`,
|
|
607
|
-
"Additional Expense": `${deploymentDetails.expense.additionalExpense} ${deploymentDetails.expense.unit}`,
|
|
608
|
-
"Last Updated": new Date(deploymentDetails.expense.lastUpdatedTime).toLocaleString()
|
|
609
|
-
} : {},
|
|
610
|
-
"Input Parameters": (deploymentDetails == null ? void 0 : deploymentDetails.inputs) || {}
|
|
611
|
-
};
|
|
612
|
-
return /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3 }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(InfoCard, { title: "Deployment Details" }, /* @__PURE__ */ React.createElement(StructuredMetadataTable, { metadata }))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(InfoCard, { title: "Deployment Resources" }, resources && resources.length > 0 ? /* @__PURE__ */ React.createElement(
|
|
613
|
-
Table,
|
|
614
|
-
{
|
|
615
|
-
columns: resourceColumns,
|
|
616
|
-
data: resources,
|
|
617
|
-
options: {
|
|
618
|
-
search: true,
|
|
619
|
-
paging: true,
|
|
620
|
-
pageSize: 10,
|
|
621
|
-
padding: "dense"
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
) : /* @__PURE__ */ React.createElement(Typography, null, "No resources found for this deployment."))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(InfoCard, { title: "Deployment Events" }, (eventsResponse == null ? void 0 : eventsResponse.content) && eventsResponse.content.length > 0 ? /* @__PURE__ */ React.createElement(
|
|
625
|
-
Table,
|
|
626
|
-
{
|
|
627
|
-
columns: eventColumns,
|
|
628
|
-
data: eventsResponse.content,
|
|
629
|
-
options: {
|
|
630
|
-
search: true,
|
|
631
|
-
paging: true,
|
|
632
|
-
pageSize: ((_c = eventsResponse.pageable) == null ? void 0 : _c.pageSize) || 10,
|
|
633
|
-
padding: "dense"
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
) : /* @__PURE__ */ React.createElement(Typography, null, "No deployment events available."))));
|
|
637
|
-
};
|
|
638
|
-
|
|
639
|
-
var VCFAutomationDeploymentDetails$1 = /*#__PURE__*/Object.freeze({
|
|
640
|
-
__proto__: null,
|
|
641
|
-
VCFAutomationDeploymentDetails: VCFAutomationDeploymentDetails
|
|
642
|
-
});
|
|
643
|
-
|
|
644
|
-
const VCFAutomationVSphereVMDetails = () => {
|
|
645
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
646
|
-
const { entity } = useEntity();
|
|
647
|
-
const vcfAutomationApi = useApi(vcfAutomationApiRef);
|
|
648
|
-
const deploymentId = ((_a = entity.spec) == null ? void 0 : _a.system) || "";
|
|
649
|
-
const resourceId = entity.metadata.name;
|
|
650
|
-
const { allowed } = usePermission({
|
|
651
|
-
permission: showDeploymentResourcesDataPermission
|
|
652
|
-
});
|
|
653
|
-
const { value, loading, error } = useAsync(async () => {
|
|
654
|
-
if (!resourceId || !deploymentId || !allowed)
|
|
655
|
-
return void 0;
|
|
656
|
-
return await vcfAutomationApi.getVSphereVMDetails(deploymentId, resourceId);
|
|
657
|
-
}, [resourceId, deploymentId, allowed]);
|
|
658
|
-
if (error) {
|
|
659
|
-
return /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error });
|
|
660
|
-
}
|
|
661
|
-
if (loading) {
|
|
662
|
-
return /* @__PURE__ */ React.createElement(Progress, null);
|
|
663
|
-
}
|
|
664
|
-
if (!resourceId || !deploymentId) {
|
|
665
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "No resource ID found" }, "This entity is not associated with a VCF resource or deployment.");
|
|
666
|
-
}
|
|
667
|
-
if (!allowed) {
|
|
668
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "Permission Denied" }, "You don't have permission to view resource details.");
|
|
669
|
-
}
|
|
670
|
-
if (!value) {
|
|
671
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "No Data" }, "No resource details available.");
|
|
672
|
-
}
|
|
673
|
-
return /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3 }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(InfoCard, { title: "Resource Status" }, /* @__PURE__ */ React.createElement(
|
|
674
|
-
StructuredMetadataTable,
|
|
675
|
-
{
|
|
676
|
-
metadata: {
|
|
677
|
-
Name: value.name,
|
|
678
|
-
Type: value.type,
|
|
679
|
-
State: value.state,
|
|
680
|
-
"Sync Status": value.syncStatus,
|
|
681
|
-
"Created At": new Date(value.createdAt).toLocaleString(),
|
|
682
|
-
Origin: value.origin,
|
|
683
|
-
"Depends On": value.dependsOn
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, md: 6 }, /* @__PURE__ */ React.createElement(InfoCard, { title: "VM Properties" }, /* @__PURE__ */ React.createElement(
|
|
687
|
-
StructuredMetadataTable,
|
|
688
|
-
{
|
|
689
|
-
metadata: {
|
|
690
|
-
"Power State": value.properties.powerState,
|
|
691
|
-
Zone: value.properties.zone,
|
|
692
|
-
Environment: value.properties.environmentName,
|
|
693
|
-
"Host Type": value.properties.computeHostType,
|
|
694
|
-
"Memory (GB)": value.properties.memoryGB,
|
|
695
|
-
"CPU Count": value.properties.cpuCount,
|
|
696
|
-
"Total Memory (MB)": value.properties.totalMemoryMB,
|
|
697
|
-
"OS Type": value.properties.osType,
|
|
698
|
-
Region: value.properties.region,
|
|
699
|
-
"Host Name": value.properties.hostName,
|
|
700
|
-
"Data Center": value.properties.datacenter,
|
|
701
|
-
"Datastore": value.properties.datastoreName
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, md: 6 }, /* @__PURE__ */ React.createElement(InfoCard, { title: "Storage Configuration" }, /* @__PURE__ */ React.createElement(
|
|
705
|
-
StructuredMetadataTable,
|
|
706
|
-
{
|
|
707
|
-
metadata: {
|
|
708
|
-
"Primary Disk": {
|
|
709
|
-
Name: ((_c = (_b = value.properties.storage) == null ? void 0 : _b.disks[0]) == null ? void 0 : _c.name) || "N/A",
|
|
710
|
-
"Capacity (GB)": ((_e = (_d = value.properties.storage) == null ? void 0 : _d.disks[0]) == null ? void 0 : _e.capacityGb) || "N/A",
|
|
711
|
-
Type: ((_g = (_f = value.properties.storage) == null ? void 0 : _f.disks[0]) == null ? void 0 : _g.type) || "N/A",
|
|
712
|
-
"Provisioning": ((_i = (_h = value.properties.storage) == null ? void 0 : _h.disks[0]) == null ? void 0 : _i.provisioningType) || "N/A"
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, md: 6 }, /* @__PURE__ */ React.createElement(InfoCard, { title: "Network Configuration" }, /* @__PURE__ */ React.createElement(
|
|
717
|
-
StructuredMetadataTable,
|
|
718
|
-
{
|
|
719
|
-
metadata: {
|
|
720
|
-
"Primary Network": ((_j = value.properties.networks) == null ? void 0 : _j[0]) ? {
|
|
721
|
-
Name: value.properties.networks[0].name,
|
|
722
|
-
Address: value.properties.networks[0].address,
|
|
723
|
-
"MAC Address": value.properties.networks[0].mac_address,
|
|
724
|
-
Assignment: value.properties.networks[0].assignment,
|
|
725
|
-
"IPv6 Addresses": value.properties.networks[0].ipv6Addresses || []
|
|
726
|
-
} : "No network configuration available"
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, md: 6 }, /* @__PURE__ */ React.createElement(InfoCard, { title: "Expense Information" }, /* @__PURE__ */ React.createElement(
|
|
730
|
-
StructuredMetadataTable,
|
|
731
|
-
{
|
|
732
|
-
metadata: {
|
|
733
|
-
"Total Expense": `$${value.expense.totalExpense.toFixed(2)}`,
|
|
734
|
-
"Compute Expense": `$${value.expense.computeExpense.toFixed(2)}`,
|
|
735
|
-
"Storage Expense": `$${value.expense.storageExpense.toFixed(2)}`,
|
|
736
|
-
"Additional Expense": `$${value.expense.additionalExpense.toFixed(2)}`,
|
|
737
|
-
"Currency": value.expense.unit,
|
|
738
|
-
"Last Updated": new Date(value.expense.lastUpdatedTime).toLocaleString()
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
))));
|
|
742
|
-
};
|
|
743
|
-
|
|
744
|
-
var VCFAutomationVSphereVMDetails$1 = /*#__PURE__*/Object.freeze({
|
|
745
|
-
__proto__: null,
|
|
746
|
-
VCFAutomationVSphereVMDetails: VCFAutomationVSphereVMDetails
|
|
747
|
-
});
|
|
748
|
-
|
|
749
|
-
const formatValue = (value) => {
|
|
750
|
-
if (value === null)
|
|
751
|
-
return "null";
|
|
752
|
-
if (typeof value === "undefined")
|
|
753
|
-
return "undefined";
|
|
754
|
-
if (typeof value === "object") {
|
|
755
|
-
if (Array.isArray(value)) {
|
|
756
|
-
return value.map(formatValue);
|
|
757
|
-
}
|
|
758
|
-
const formattedObj = {};
|
|
759
|
-
Object.entries(value).forEach(([key, val]) => {
|
|
760
|
-
formattedObj[key] = formatValue(val);
|
|
761
|
-
});
|
|
762
|
-
return formattedObj;
|
|
763
|
-
}
|
|
764
|
-
if (typeof value === "string" && value.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/)) {
|
|
765
|
-
return new Date(value).toLocaleString();
|
|
766
|
-
}
|
|
767
|
-
return value;
|
|
768
|
-
};
|
|
769
|
-
const VCFAutomationGenericResourceDetails = () => {
|
|
770
|
-
var _a;
|
|
771
|
-
const { entity } = useEntity();
|
|
772
|
-
const vcfAutomationApi = useApi(vcfAutomationApiRef);
|
|
773
|
-
const deploymentId = ((_a = entity.spec) == null ? void 0 : _a.system) || "";
|
|
774
|
-
const resourceId = entity.metadata.name;
|
|
775
|
-
const { value: resourceData, loading, error } = useAsync(async () => {
|
|
776
|
-
if (!deploymentId || !resourceId)
|
|
777
|
-
return void 0;
|
|
778
|
-
return await vcfAutomationApi.getGenericResourceDetails(deploymentId, resourceId);
|
|
779
|
-
}, [deploymentId, resourceId]);
|
|
780
|
-
if (error) {
|
|
781
|
-
return /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error });
|
|
782
|
-
}
|
|
783
|
-
if (loading) {
|
|
784
|
-
return /* @__PURE__ */ React.createElement(Progress, null);
|
|
785
|
-
}
|
|
786
|
-
if (!deploymentId || !resourceId) {
|
|
787
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "No Resource Information" }, "This entity is not associated with a VCF resource.");
|
|
788
|
-
}
|
|
789
|
-
if (!resourceData) {
|
|
790
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "No Data" }, "No resource details available.");
|
|
791
|
-
}
|
|
792
|
-
const formattedData = formatValue(resourceData);
|
|
793
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "Resource Details" }, /* @__PURE__ */ React.createElement(StructuredMetadataTable, { metadata: formattedData }));
|
|
794
|
-
};
|
|
795
|
-
|
|
796
|
-
var VCFAutomationGenericResourceDetails$1 = /*#__PURE__*/Object.freeze({
|
|
797
|
-
__proto__: null,
|
|
798
|
-
VCFAutomationGenericResourceDetails: VCFAutomationGenericResourceDetails
|
|
799
|
-
});
|
|
800
|
-
|
|
801
|
-
const VCFAutomationGenericResourceOverview = () => {
|
|
802
|
-
var _a;
|
|
803
|
-
const { entity } = useEntity();
|
|
804
|
-
const vcfAutomationApi = useApi(vcfAutomationApiRef);
|
|
805
|
-
const deploymentId = ((_a = entity.spec) == null ? void 0 : _a.system) || "";
|
|
806
|
-
const resourceId = entity.metadata.name;
|
|
807
|
-
const { value: resourceData, loading, error } = useAsync(async () => {
|
|
808
|
-
if (!deploymentId || !resourceId)
|
|
809
|
-
return void 0;
|
|
810
|
-
return await vcfAutomationApi.getGenericResourceDetails(deploymentId, resourceId);
|
|
811
|
-
}, [deploymentId, resourceId]);
|
|
812
|
-
if (error) {
|
|
813
|
-
return /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error });
|
|
814
|
-
}
|
|
815
|
-
if (loading) {
|
|
816
|
-
return /* @__PURE__ */ React.createElement(Progress, null);
|
|
817
|
-
}
|
|
818
|
-
if (!deploymentId || !resourceId) {
|
|
819
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "No Resource Information" }, "This entity is not associated with a VCF resource.");
|
|
820
|
-
}
|
|
821
|
-
if (!resourceData) {
|
|
822
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "No Data" }, "No resource details available.");
|
|
823
|
-
}
|
|
824
|
-
const overviewData = {};
|
|
825
|
-
if (resourceData.name)
|
|
826
|
-
overviewData["Name"] = resourceData.name;
|
|
827
|
-
if (resourceData.type)
|
|
828
|
-
overviewData["Type"] = resourceData.type;
|
|
829
|
-
if (resourceData.createdAt)
|
|
830
|
-
overviewData["Created At"] = new Date(resourceData.createdAt).toLocaleString();
|
|
831
|
-
if (resourceData.syncStatus)
|
|
832
|
-
overviewData["Sync Status"] = resourceData.syncStatus;
|
|
833
|
-
if (resourceData.origin)
|
|
834
|
-
overviewData["Origin"] = resourceData.origin;
|
|
835
|
-
if (resourceData.status)
|
|
836
|
-
overviewData["Status"] = resourceData.status;
|
|
837
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "Resource Overview" }, /* @__PURE__ */ React.createElement(StructuredMetadataTable, { metadata: overviewData }));
|
|
838
|
-
};
|
|
839
|
-
|
|
840
|
-
var VCFAutomationGenericResourceOverview$1 = /*#__PURE__*/Object.freeze({
|
|
841
|
-
__proto__: null,
|
|
842
|
-
VCFAutomationGenericResourceOverview: VCFAutomationGenericResourceOverview
|
|
843
|
-
});
|
|
844
|
-
|
|
845
|
-
const VCFAutomationDeploymentOverview = () => {
|
|
846
|
-
const { entity } = useEntity();
|
|
847
|
-
const api = useApi(vcfAutomationApiRef);
|
|
848
|
-
const deploymentId = entity.metadata.name;
|
|
849
|
-
const { allowed: hasViewPermission, loading: permissionLoading } = usePermission({
|
|
850
|
-
permission: viewDeploymentHistoryPermission
|
|
851
|
-
});
|
|
852
|
-
const { value: deploymentDetails, loading, error } = useAsync(async () => {
|
|
853
|
-
if (!deploymentId || !hasViewPermission) {
|
|
854
|
-
return void 0;
|
|
855
|
-
}
|
|
856
|
-
return await api.getDeploymentDetails(deploymentId);
|
|
857
|
-
}, [deploymentId, hasViewPermission]);
|
|
858
|
-
if (!deploymentId) {
|
|
859
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "VCF Automation Deployment" }, /* @__PURE__ */ React.createElement(Typography, null, "No deployment ID found for this entity."));
|
|
860
|
-
}
|
|
861
|
-
if (loading || permissionLoading) {
|
|
862
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "VCF Automation Deployment" }, /* @__PURE__ */ React.createElement(Progress, null));
|
|
863
|
-
}
|
|
864
|
-
if (!hasViewPermission) {
|
|
865
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "VCF Automation Deployment" }, /* @__PURE__ */ React.createElement(Typography, null, "You don't have permission to view deployment details."));
|
|
866
|
-
}
|
|
867
|
-
if (error) {
|
|
868
|
-
return /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error });
|
|
869
|
-
}
|
|
870
|
-
if (!deploymentDetails) {
|
|
871
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "VCF Automation Deployment" }, /* @__PURE__ */ React.createElement(Typography, null, "No deployment details available."));
|
|
872
|
-
}
|
|
873
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { title: "VCF Automation Deployment" }, /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 2 }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Typography, { variant: "h6" }, "Deployment Information")), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2" }, "Name"), /* @__PURE__ */ React.createElement(Typography, null, deploymentDetails.name)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2" }, "Status"), /* @__PURE__ */ React.createElement(Typography, null, deploymentDetails.status)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2" }, "Created By"), /* @__PURE__ */ React.createElement(Typography, null, deploymentDetails.createdBy)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2" }, "Created At"), /* @__PURE__ */ React.createElement(Typography, null, new Date(deploymentDetails.createdAt).toLocaleString())), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2" }, "Last Updated By"), /* @__PURE__ */ React.createElement(Typography, null, deploymentDetails.lastUpdatedBy)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2" }, "Last Updated At"), /* @__PURE__ */ React.createElement(Typography, null, new Date(deploymentDetails.lastUpdatedAt).toLocaleString())), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Typography, { variant: "h6" }, "Expenses")), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 3 }, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2" }, "Total"), /* @__PURE__ */ React.createElement(Typography, null, deploymentDetails.expense.totalExpense, " ", deploymentDetails.expense.unit)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 3 }, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2" }, "Compute"), /* @__PURE__ */ React.createElement(Typography, null, deploymentDetails.expense.computeExpense, " ", deploymentDetails.expense.unit)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 3 }, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2" }, "Storage"), /* @__PURE__ */ React.createElement(Typography, null, deploymentDetails.expense.storageExpense, " ", deploymentDetails.expense.unit)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 3 }, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2" }, "Additional"), /* @__PURE__ */ React.createElement(Typography, null, deploymentDetails.expense.additionalExpense, " ", deploymentDetails.expense.unit))));
|
|
874
|
-
};
|
|
875
|
-
|
|
876
|
-
var VCFAutomationDeploymentOverview$1 = /*#__PURE__*/Object.freeze({
|
|
877
|
-
__proto__: null,
|
|
878
|
-
VCFAutomationDeploymentOverview: VCFAutomationDeploymentOverview
|
|
879
|
-
});
|
|
880
|
-
|
|
881
|
-
export { VCFAutomationDeploymentDetails, VCFAutomationDeploymentOverview, VCFAutomationGenericResourceDetails, VCFAutomationGenericResourceOverview, VCFAutomationProjectDetails, VCFAutomationProjectOverview, VCFAutomationVSphereVMDetails, VCFAutomationVSphereVMOverview, VcfAutomationClient, rootRouteRef, vcfAutomationApiRef, vcfAutomationPlugin };
|
|
1
|
+
export { vcfAutomationPlugin } from './plugin.esm.js';
|
|
2
|
+
export { VCFAutomationVSphereVMOverview } from './components/VCFAutomationVSphereVMOverview.esm.js';
|
|
3
|
+
export { VCFAutomationProjectOverview } from './components/VCFAutomationProjectOverview.esm.js';
|
|
4
|
+
export { VCFAutomationProjectDetails } from './components/VCFAutomationProjectDetails.esm.js';
|
|
5
|
+
export { VCFAutomationDeploymentDetails } from './components/VCFAutomationDeploymentDetails.esm.js';
|
|
6
|
+
export { VCFAutomationVSphereVMDetails } from './components/VCFAutomationVSphereVMDetails.esm.js';
|
|
7
|
+
export { VCFAutomationGenericResourceDetails } from './components/VCFAutomationGenericResourceDetails.esm.js';
|
|
8
|
+
export { VCFAutomationGenericResourceOverview } from './components/VCFAutomationGenericResourceOverview.esm.js';
|
|
9
|
+
export { VCFAutomationDeploymentOverview } from './components/VCFAutomationDeploymentOverview.esm.js';
|
|
10
|
+
export { VcfAutomationClient, vcfAutomationApiRef } from './api/VcfAutomationClient.esm.js';
|
|
11
|
+
export { rootRouteRef } from './routes.esm.js';
|
|
882
12
|
//# sourceMappingURL=index.esm.js.map
|