Skip to content

Commit 7c9a677

Browse files
Merge pull request #924 from dappnode/pablo/lvm-disclaimers
Added disclaimer to LVM
2 parents 330851c + 0a17e14 commit 7c9a677

File tree

1 file changed

+44
-23
lines changed
  • packages/admin-ui/src/pages/system/components/Hardware

1 file changed

+44
-23
lines changed

packages/admin-ui/src/pages/system/components/Hardware/Lvm.tsx

Lines changed: 44 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import Select from "components/Select";
1313
import Card from "components/Card";
1414
import { dappnodeVolumeGroup, dappnodeLogicalVolume, forumUrl } from "params";
1515
import LinkDocs from "components/LinkDocs";
16+
import { confirm } from "components/ConfirmDialog";
1617

1718
export default function Lvm() {
1819
const [manual, setManual] = useState(false);
@@ -124,6 +125,40 @@ export default function Lvm() {
124125
setExpandDiskReq({});
125126
}
126127

128+
async function disclaimer(automatic: boolean) {
129+
await new Promise<void>(resolve =>
130+
confirm({
131+
title: `Are you sure you want to extend the host filesystem with another storage device?`,
132+
text: `Extending the filesystem is a dangerous operation that cannot be undone. You must very well know what you are doing.
133+
134+
You must read the DAppNode documentation about extending the filesystem with LVM. Contact support if you have any doubt about the process.`,
135+
label: "Extend filesystem",
136+
buttons: [
137+
{
138+
variant: "dappnode",
139+
label: "Cancel",
140+
onClick: () => resolve
141+
},
142+
{
143+
variant: "danger",
144+
label: "I understand, I want to extend the host filesystem",
145+
onClick: () => {
146+
if (automatic) {
147+
setAutomatic(true);
148+
setManual(false);
149+
} else {
150+
setAutomatic(false);
151+
setManual(true);
152+
}
153+
154+
cleanValues();
155+
}
156+
}
157+
]
158+
})
159+
);
160+
}
161+
127162
return (
128163
<Card spacing>
129164
<div>
@@ -135,36 +170,22 @@ export default function Lvm() {
135170
</LinkDocs>
136171
</p>
137172
<div style={{ display: "flex", justifyContent: "space-around" }}>
138-
<Button
139-
onClick={() => {
140-
setAutomatic(true);
141-
setManual(false);
142-
cleanValues();
143-
}}
144-
variant="dappnode"
145-
>
173+
<Button onClick={() => disclaimer(true)} variant="dappnode">
146174
Automatic expansion
147175
</Button>
148-
<Button
149-
onClick={() => {
150-
setAutomatic(false);
151-
setManual(true);
152-
cleanValues();
153-
}}
154-
variant="outline-secondary"
155-
>
176+
<Button onClick={() => disclaimer(false)} variant="outline-secondary">
156177
Manual expansion
157178
</Button>
158179
</div>
159180
</div>
160181

161-
{/** FIRST STEP: select hard disk */}
182+
{/** FIRST STEP: select storage device */}
162183
{(automatic || manual) && (
163184
<>
164185
<hr />
165-
<div className="subtle-header">Select hard disk</div>
166-
<p>Check and select the hard disk to be added.</p>
167-
<Button onClick={getDisks}>Get hard disks</Button>
186+
<div className="subtle-header">Select storage device</div>
187+
<p>Check and select the storage device to be added.</p>
188+
<Button onClick={getDisks}>Get storage devices</Button>
168189
{diskReq.result ? (
169190
<Select
170191
value={undefined}
@@ -174,7 +195,7 @@ export default function Lvm() {
174195
onValueChange={(value: string) => setDisk(value.split(/\s+/)[0])}
175196
/>
176197
) : diskReq.loading ? (
177-
<Ok msg="Getting hard disks" loading={true} />
198+
<Ok msg="Getting storage devices" loading={true} />
178199
) : diskReq.error ? (
179200
<ErrorView error={diskReq.error} red hideIcon />
180201
) : null}
@@ -258,15 +279,15 @@ export default function Lvm() {
258279
<p>
259280
Options selected:
260281
<ul>
261-
<li key={disk}>Hard disk: {disk}</li>
282+
<li key={disk}>Storage device: {disk}</li>
262283
<li key={logicalVolume}>Volume Group: {volumeGroup}</li>
263284
<li key={volumeGroup}>Logical Volume: {logicalVolume}</li>
264285
</ul>
265286
</p>
266287
<Button
267288
onClick={() => expandDisk(disk, volumeGroup, logicalVolume)}
268289
>
269-
Expand disk
290+
Expand host filesystem
270291
</Button>
271292
</>
272293
) : null}

0 commit comments

Comments
 (0)