Skip to content

Commit

Permalink
storage: Omit "/dev/" prefix from device names everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
mvollmer committed Aug 28, 2024
1 parent b128a8e commit 9728c85
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions pkg/storaged/legacy-vdo/legacy-vdo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { Alert } from "@patternfly/react-core/dist/esm/components/Alert/index.js
import { Card, CardBody } from '@patternfly/react-core/dist/esm/components/Card/index.js';
import { DescriptionList, DescriptionListDescription, DescriptionListGroup, DescriptionListTerm } from "@patternfly/react-core/dist/esm/components/DescriptionList/index.js";

import { block_short_name, get_active_usage, teardown_active_usage, fmt_size, decode_filename, reload_systemd } from "../utils.js";
import { block_name, get_active_usage, teardown_active_usage, fmt_size, decode_filename, reload_systemd } from "../utils.js";
import {
dialog_open, SizeSlider, BlockingMessage, TeardownMessage, init_teardown_usage
} from "../dialog.jsx";
Expand Down Expand Up @@ -140,7 +140,7 @@ export function make_legacy_vdo_page(parent, vdo, backing_block, next_card) {
title: cockpit.format(_("VDO device $0"), vdo.name),
next: next_card,
page_location: ["vdo", vdo.name],
page_name: block_short_name(backing_block),
page_name: block_name(backing_block),
page_size: vdo.logical_size,
job_path: backing_block.path,
component: VDODetails,
Expand Down
4 changes: 2 additions & 2 deletions pkg/storaged/mdraid/mdraid-disk.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { CardBody } from "@patternfly/react-core/dist/esm/components/Card/index.
import { DescriptionList } from "@patternfly/react-core/dist/esm/components/DescriptionList/index.js";

import { StorageCard, StorageDescription, new_card, register_crossref } from "../pages.jsx";
import { block_short_name, fmt_size, mdraid_name } from "../utils.js";
import { block_name, fmt_size, mdraid_name } from "../utils.js";

const _ = cockpit.gettext;

Expand All @@ -37,7 +37,7 @@ export function make_mdraid_disk_card(next, backing_block, content_block) {
const disk_card = new_card({
title: _("MDRAID disk"),
next,
location: mdraid_block ? block_short_name(mdraid_block) : (mdraid ? mdraid_name(mdraid) : null),
location: mdraid_block ? block_name(mdraid_block) : (mdraid ? mdraid_name(mdraid) : null),
component: MDRaidDiskCard,
props: { backing_block, content_block, mdraid }
});
Expand Down
4 changes: 2 additions & 2 deletions pkg/storaged/mdraid/mdraid.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
} from "../pages.jsx";
import { make_block_page } from "../block/create-pages.jsx";
import {
block_short_name, mdraid_name, encode_filename, decode_filename,
block_name, mdraid_name, encode_filename, decode_filename,
fmt_size, fmt_size_long, get_active_usage, teardown_active_usage,
get_available_spaces, prepare_available_spaces,
reload_systemd, should_ignore,
Expand Down Expand Up @@ -203,7 +203,7 @@ export function make_mdraid_page(parent, mdraid) {
title: _("MDRAID device"),
next: null,
page_location: ["mdraid", mdraid.UUID],
page_name: block ? block_short_name(block) : mdraid_name(mdraid),
page_name: block ? block_name(block) : mdraid_name(mdraid),
page_icon: VolumeIcon,
page_category: PAGE_CATEGORY_VIRTUAL,
page_size: mdraid.Size,
Expand Down
4 changes: 2 additions & 2 deletions pkg/storaged/pages.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { Spinner } from "@patternfly/react-core/dist/esm/components/Spinner/inde
import { DescriptionListDescription, DescriptionListGroup, DescriptionListTerm } from "@patternfly/react-core/dist/esm/components/DescriptionList/index.js";
import { Flex, FlexItem } from "@patternfly/react-core/dist/esm/layouts/Flex/index.js";

import { decode_filename, block_short_name, fmt_size } from "./utils.js";
import { decode_filename, block_name, fmt_size } from "./utils.js";
import { StorageButton, StorageBarMenu, StorageMenuItem, StorageSize } from "./storage-controls.jsx";
import { MultipathAlert } from "./multipath.jsx";
import { JobsPanel } from "./jobs-panel.jsx";
Expand Down Expand Up @@ -228,7 +228,7 @@ export function new_card({
}) {
if (page_block) {
page_location = [block_location(page_block)];
page_name = block_short_name(page_block);
page_name = block_name(page_block);
page_size = page_block.Size;
job_path = page_block.path;
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/storaged/partitions/initialize-disk-dialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import client from "../client";

import {
dialog_open,
SelectOneRadioVertical,
SelectOneRadio,
BlockingMessage, TeardownMessage,
init_teardown_usage
} from "../dialog.jsx";
Expand All @@ -48,8 +48,9 @@ export function initialize_disk_dialog(block) {
Title: cockpit.format(_("Initialize $0 for partitions"), block_name(block)),
Teardown: TeardownMessage(usage),
Fields: [
SelectOneRadioVertical("type", _("Type"),
SelectOneRadio("type", _("Type"),
{
vertical: true,
value: "gpt",
choices: [
{ value: "gpt", title: _("Modern (GPT)") },
Expand Down
8 changes: 4 additions & 4 deletions pkg/storaged/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,12 @@ export function validate_fsys_label(label, type) {
}
}

export function block_name(block) {
export function block_long_name(block) {
return decode_filename(block.PreferredDevice);
}

export function block_short_name(block) {
return block_name(block).replace(/^\/dev\//, "");
export function block_name(block) {
return block_long_name(block).replace(/^\/dev\//, "");
}

export function mdraid_name(mdraid) {
Expand Down Expand Up @@ -340,7 +340,7 @@ export function get_block_link_parts(client, path) {
location = ["vdo", vdo.name];
link = cockpit.format(_("VDO device $0"), vdo.name);
} else {
location = [block_short_name(block)];
location = [block_name(block)];
if (client.drives[block.Drive])
link = drive_name(client.drives[block.Drive]);
else
Expand Down

0 comments on commit 9728c85

Please sign in to comment.