From 27926c9a41d9d9c6ac87b761c424b0addb03689b Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Tue, 20 Jun 2023 16:09:30 +0300 Subject: [PATCH] storage: Tell people that big mdraids really should have a bitmap --- pkg/storaged/mdraid-details.jsx | 39 +++++++++++++++------------------ 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/pkg/storaged/mdraid-details.jsx b/pkg/storaged/mdraid-details.jsx index 009b08538786..44aec92f805c 100644 --- a/pkg/storaged/mdraid-details.jsx +++ b/pkg/storaged/mdraid-details.jsx @@ -180,23 +180,6 @@ export class MDRaidDetails extends React.Component { if (mdraid.ChunkSize > 0) level += ", " + cockpit.format(_("$0 chunk size"), utils.fmt_size(mdraid.ChunkSize)); - function toggle_bitmap(val) { - return mdraid.SetBitmapLocation(utils.encode_filename(val ? 'internal' : 'none'), {}); - } - - let bitmap = null; - if (mdraid.BitmapLocation) { - const value = utils.decode_filename(mdraid.BitmapLocation) != "none"; - bitmap = ( - - {_("storage", "Bitmap")} - - - - - ); - } - let degraded_message = null; if (mdraid.Degraded > 0) { const text = cockpit.format( @@ -208,6 +191,23 @@ export class MDRaidDetails extends React.Component { ); } + function fix_bitmap() { + return mdraid.SetBitmapLocation(utils.encode_filename("internal"), { }); + } + + let bitmap_message = null; + if (mdraid.Size > 100 * 1024 * 1024 * 1024 && + mdraid.BitmapLocation && utils.decode_filename(mdraid.BitmapLocation) == "none") { + bitmap_message = ( + +
+ {_("Add a bitmap")} +
+
+ ); + } + /* Older versions of Udisks/storaged don't have a Running property */ let running = mdraid.Running; if (running === undefined) @@ -338,9 +338,6 @@ export class MDRaidDetails extends React.Component { {_("storage", "RAID level")} { level } - - { bitmap } - {_("storage", "State")} { running ? _("Running") : _("Not running") } @@ -354,7 +351,7 @@ export class MDRaidDetails extends React.Component { const content = ; - return {degraded_message}{bitmap_message}} header={ header } sidebar={ sidebar } content={ content }