-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDialog Box template
More file actions
248 lines (233 loc) · 7.58 KB
/
Copy pathDialog Box template
File metadata and controls
248 lines (233 loc) · 7.58 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
import React, { useState, useEffect } from "react";
import { makeStyles } from "@mui/styles";
import Dialog from "@mui/material/Dialog";
import { Input } from "../../../components/genericComponents/Input";
import properties from "../../../properties/properties";
import { showErrorHandlerUpdated } from "../../../util/util";
import Button from "../../../components/genericComponents/Button";
const AddPolicyTemplatee = ({
open = true,
handleSuccess,
handleClose,
}) => {
const classes = useStyles();
const [isOpen, setIsOpen] = useState(open);
const localStorageKey = "vm_group_creation_info_flag";
const hideInfoSection = JSON.parse(localStorage.getItem(localStorageKey));
const [state, setState] = useState({
showLeftPanel: !hideInfoSection,
dontShowAgain: !!hideInfoSection,
});
useEffect(() => {
setIsOpen(open);
}, [open]);
const onChangeHandler = (e) => {
const { name, value } = e.target;
setState((prev) => ({
...prev,
data: {
...prev.data,
[name]: value,
},
error: {
...prev.error,
[name]: "",
},
}));
};
const handleCloseLeftStrip = () => {
if (state.dontShowAgain) {
localStorage.setItem(localStorageKey, JSON.stringify(true));
}
setState((prev) => ({
...prev,
showLeftPanel: false,
}));
};
const handleDontShowCheckbox = (e) => {
const value = e?.target?.type === "checkbox" ? e.target.checked : e;
setState((prev) => ({ ...prev, dontShowAgain: value }));
};
const closeDialog = () => {
setIsOpen(false);
if (handleClose) handleClose();
};
const dialogTitle ="Add New Policy Template";
return (
<Dialog
fullWidth={true}
maxWidth={"md"}
open={isOpen}
onClose={closeDialog}
className={`${classes.root} dialog-align-corner`}
aria-labelledby="max-width-dialog-title"
data-testid="vmgrp-dlg"
>
<div
className="d-grid ml-auto dialog-sub-component"
style={{
gridTemplateColumns: state.showLeftPanel
? "var(--space-396) var(--space-650)"
: "var(--space-0) var(--space-650)",
}}
>
{!hideInfoSection && (
<div
className={
state.showLeftPanel
? "left-panel-dialog bg-white position-relative"
: "left-panel-dialog-down"
}
>
<div
className={
"d-flex align-center space-between left-panel-header pd-10"
}
style={{ padding: "var(--space-9) var(--space-20)" }}
>
<p>INFORMATION</p>
<button
className="btn btn-icon-only"
onClick={handleCloseLeftStrip}
>
<span className="ri-close-line color-icon-secondary"></span>
</button>
</div>
<div className="pd-10" style={{ padding: "var(--space-16) var(--space-20)" }}>
<p className="font-16 font-weight-600 color-primary mb-10">
Lets Create a New Policy Template
</p>
<p
className="font-12 color-icon-secondary"
style={{ color: "var(--color-grey-900)" }}
>
In Buildpiper, for a monolithic application, we need to onboard
the infrastructure required for deployment for the monolithic
applications. This infrastructure is nothing but of VMs (virtual
machines). Thus a virtual machine (VM) is a software-based unit
of a LDC - Local data centre which runs an operating system and
applications just like a physical computer but relies on
virtualization technology to operate.
</p>
</div>
<div
className="checkbox-only-divi"
style={{ padding: "var(--space-10) var(--space-20)" }}
>
<Input
style={{}}
type="simple-checkbox"
name="dont_show_again"
label="Don't show this again"
data={{ dont_show_again: state.dontShowAgain }}
value={state.dontShowAgain}
error={state.error}
onChangeHandler={handleDontShowCheckbox}
/>
</div>
</div>
)}
<div className="right-panel-dialog bg-white">
<div
className="font-18 font-weight-600 color-white d-flex align-center space-between"
style={{ backgroundColor: "var(--color-tertiary-500)", padding: "var(--space-14) var(--space-288) var(--space-14) var(--space-16)" }}
>
<p>{dialogTitle}</p>
<button
className="btn float-cancel-button "
style={
hideInfoSection || !state.showLeftPanel
? {
position: "absolute",
top: "var(--space-0)",
width:"var(--space-55)",
height:"var(--space-55)",
left: "calc(var(--space-55) * -1)",
zIndex: 1000,
}
: {
position: "absolute",
top: "var(--space-0)",
width:"var(--space-55)",
height:"var(--space-55)",
left: "calc(var(--space-450) * -1)",
zIndex: 1000,
}
}
onClick={closeDialog}
data-testid="vmgrp-x-btn"
>
<span className="ri-close-line "></span>
</button>
</div>
<div
style={{
padding: "0 var(--space-20) var(--space-120) var(--space-20)",
overflowY: "auto",
}}
>
</div>
<div className="footer-right-panel d-flex align-center justify-end">
<Button variant="ghost" onClick={closeDialog} data-testid="vmgrp-cancel-btn">
CANCEL
</Button>
<Button
className="btn btn-primary"
data-testid="vmgrp-save-btn"
>
SAVE & CONTINUE
</Button>
</div>
</div>
</div>
</Dialog>
);
};
const useStyles = makeStyles((theme) => ({
root: {
"&.dialog-align-corner": {
"& .MuiPaper-root": {
maxWidth: "var(--space-1100)",
margin: "0",
fontFamily: "Montserrat",
},
},
"& .right-panel-dialog": {
position: "relative",
width: "var(--space-650)",
height: "100%",
display: "flex",
flexDirection: "column",
},
"& .left-panel-dialog": {
width: "var(--space-396)",
transition: "width 0.3s",
"& .left-panel-header": {
borderBottom: "var(--space-1) solid #f1f1f1",
fontSize: "var(--font-12)",
fontWeight: "var(--font-weight-600)",
color: "var(--color-tertiary-500)",
},
"& .checkbox-only-divi": {
position: "absolute",
bottom: "var(--space-10)",
backcolor: "var(--color-white)",
},
},
"& .left-panel-dialog-down": {
width: "var(--space-0)",
overflow: "hidden",
transition: "width 0.3s",
},
"& .footer-right-panel": {
backgroundColor: "var(--color-grey-000)",
padding: "var(--space-20)",
position: "absolute",
bottom: "var(--space-0)",
width: "var(--space-650)",
gap: "var(--space-13)",
borderTop: "var(--space-1) solid #e6e6e6",
},
},
}));
export default AddPolicyTemplatee;