-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvirtualmachinestatus
More file actions
320 lines (276 loc) · 9.03 KB
/
Copy pathvirtualmachinestatus
File metadata and controls
320 lines (276 loc) · 9.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
import React from "react";
import { makeStyles } from "@mui/styles";
import PageHeader from "../../../components/PageHeader";
import Chip from "../../../components/chip/Chip";
import { dividerClasses } from "@mui/material";
import NewChip from "../../../components/newChip/NewChip";
import PaginationTwo from "../../../components/PaginationTwo";
import { useState } from "react";
import { ExandableComponentList } from "../../../components/hoc/expandableList";
import InvokeApi from "../../../util/apiInvoker";
import properties from "../../../properties/properties";
import GenerateURL, { GenerateSearchURL } from "../../../util/APIUrlProvider";
import { Link } from "react-router-dom";
import BlankPage from "../../../components/BlankPage";
const useStyles = makeStyles(() => ({
root: {
backgroundColor: "#fff",
padding: "20px",
minHeight: "calc(100vh - 70px)",
"& .table-view": {
marginTop: "20px",
border: "1px solid #E6E6E6",
borderRadius: "6px",
display: "grid",
gridTemplateColumns: "1fr 1fr 1fr 1fr 1fr 60px",
color: "#787878",
fontSize: "12px",
"& .table-view-row": {
borderBottom: "1px solid #E6E6E6",
padding: "9.5px 12px",
display: "flex",
alignItems: "center",
color: "#2F2F2F",
"&:nth-last-child(-n+5)": {
borderTop: "1px solid #E6E6E6",
},
},
"& .table-view-row-header": {
borderBottom: "1px solid #E6E6E6",
padding: "9.5px 12px",
display: "flex",
alignItems: "center",
fontSize: "12px",
justifyContent: "flex-start",
fontWeight: 600,
color: "#2F2F2F",
},
},
},
header: {
display: "flex",
alignItems: "center",
justifyContent: "space-between",
marginTop: "32px",
backgroundColor: "#FFFFFF",
},
titleWrapper: {
display: "flex",
alignItems: "center",
justifyContent: "space-between",
gap: "8px",
},
title: {
fontSize: "16px",
fontWeight: 600,
color: "#1F2937",
},
actions: {
display: "flex",
gap: "12px",
},
vmHeader: {
display: "flex",
alignItems: "center",
},
vmHeaderEnvTitle: {
display: "flex",
alignItems: "center",
gap: "6px",
}
}));
export default function VirtualMachineStatus() {
const classes = useStyles();
const [state, setState] = useState({
curr_page: "",
total_page: "",
count: 0,
});
function fetchPageInfo(enteredPageNumber) {
var requestInfo = {
endPoint: GenerateURL({}, properties.api.create_vm_group),
httpMethod: "GET",
httpHeaders: { "Content-Type": "application/json" },
};
if (enteredPageNumber > 1) {
requestInfo.endPoint =
requestInfo.endPoint +
"?limit=10&offset=" +
(enteredPageNumber - 1) * 10;
}
var current_page = enteredPageNumber;
setState((prevState) => ({
...prevState,
loading: true,
}));
InvokeApi(
requestInfo,
(response) => {
handleWorkflowPageDataSuccessApiHit(response, current_page);
},
fetchAllVMGroupsDataFailed
);
function onFileUpload(e) {
ParseFile(e, handleSuccessFileParse, handleFailedFileParse);
}
function handleSuccessFileParse(file_data) {
const key = file_data.event_name;
const value = {
name: file_data.name,
content: file_data.content,
};
updateData(key, value);
}
function updateData(key, value) {
setState((new_state) => ({
...new_state,
show_save_button: true,
data: {
...new_state.data,
[key]: value,
},
error: {
...new_state.error,
[key]: "",
},
}));
}
function handleFailedFileParse(error) {
setState((new_state) => ({
...new_state,
error: {
vm_config: "Invalid File Format",
},
}));
}
}
return (
<div className={classes.root}>
{/* Wrap all content in a single parent div */}
<>
<div className={classes.vmHeader}>
<div style={{ flex: 1 }}>
<PageHeader
heading="Virtual Machine Group: Example_Demo"
subHeading={
<div className={classes.vmHeaderEnvTitle}>
Environment Restriction:
<NewChip variant={"success"} label={"DEV"} shape="standard" style></NewChip>
<NewChip variant={"info"} label={"Prod"} shape="standard"></NewChip>
<NewChip variant={"highlight"} label={"UAT"} shape="standard"></NewChip>
<NewChip variant={"warning"} label={"OA"} shape="standard"></NewChip>
</div>
}
primaryButton={{
actionType: "link",
icon: <span className="ri-add-line"> </span>,
text: "FETCH PUBLIC KEY",
buttonClass: "btn btn-pagintaion ",
}}
// <div className='root-dialog-header d-flex align-center space-between'>
// <p>Fetch Public Key</p>
// <button className="btn btn-transparent" onClick={handleClose}>
// <span className='ri-close-fill font-24'></span>
// </button>
// </div>
icon="ri-cpu-line font-24"
/>
</div>
<span className="ri-more-2-fill font-24" />
</div>
<div className={classes.header}>
<div className={classes.titleWrapper}>
<span className={classes.title}>Virtual Machines</span>
<span className="ri-information-line font-16" />
</div>
<div className={classes.actions}>
<button className="btn btn-pagintaion">
<span className="ri-add-line"></span> <span>Add More</span>
</button>
<button className="btn btn-pagintaion">
<span className="ri-upload-2-line"></span>
<span>Upload CSV File</span>
</button>
</div>
</div>
<div className="table-view mb-24">
<div className="table-view-row-header">VM Name</div>
<div className="table-view-row-header">Primary Tags</div>
<div className="table-view-row-header">Secondary Tags</div>
<div className="table-view-row-header">IP Address</div>
<div className="table-view-row-header">Status</div>
<div className="table-view-row-header"></div>
<BlankPage
additionalClass={'mb-16'}
text={'No Virtual Machine added' }
subHeading={"Add VM through “add more” or “Upload CSV Above”"}
pageIcon={
<span className="ri-cpu-line font-28 color-key-gray"></span>
}
variant="inside-table"
additionalStyles={{padding: '55px 0',
textAlign: "center",
height:'auto',
display: "flex",
flexDirection: "column",
alignItems: "center",
justifyContent: "center",
gridColumn: "1 / -1"
}}
backgroundColor="#F4F4F4"
/>
{/* <div
style={{
gridColumn: "1 / -1",
display: "flex",
flexDirection: "column",
alignItems: "center",
justifyContent: "center",
padding: "55px 0",
textAlign: "center",
// lastChild: { marginBottom: "1px solid #E6E6E6" },
}}
>
<div
style={{
width: "52px",
height: "52px",
borderRadius: "6.82px",
backgroundColor: "#F4F4F4",
marginBottom: "16px",
padding: "12.67px",
display: "flex",
alignItems: "center",
justifyContent: "center",
}}
>
<span className="ri-cpu-line font-28 color-key-gray" />
</div>
<span style={{ fontSize: "14px", fontWeight: 600, color: "#000000" , marginBottom: "12px" }}>
No Virtual Machine added
</span>
<span style={{ fontSize: "13px", fontWeight:400, color: "#000000" }}>
Add VM through “add more” or “Upload CSV Above”
</span>
</div> */}
</div>
<PaginationTwo
current_page_count={state.curr_page}
total_count={state.total_page}
next={state.next}
count={state.count}
previous={state.previous}
on_previous_click={() => {
fetchPrevInfo(null, state.previous);
}}
on_next_click={() => {
fetchNextInfo(null, state.next);
}}
on_pageNumber_click={(pageNumber) => {
fetchPageInfo(pageNumber);
}}
/>
</>
</div>
);
}