diff --git a/pkg/storaged/pages.jsx b/pkg/storaged/pages.jsx index 8f13b3681e3e..f0b798b7e988 100644 --- a/pkg/storaged/pages.jsx +++ b/pkg/storaged/pages.jsx @@ -453,21 +453,21 @@ export const PageContainerStackItems = ({ page }) => { const items = []; let cont = page.container; while (cont) { - items.push(<> + items.push( - + - ); + ); cont = cont.parent; } if (page.parent && page.parent.parent) { - items.push(<> + items.push( @@ -482,7 +482,7 @@ export const PageContainerStackItems = ({ page }) => { - ); + ); } return items; diff --git a/pkg/storaged/pages/other.jsx b/pkg/storaged/pages/other.jsx index 177b85441b78..eba2cca4da09 100644 --- a/pkg/storaged/pages/other.jsx +++ b/pkg/storaged/pages/other.jsx @@ -19,59 +19,42 @@ import cockpit from "cockpit"; import React from "react"; -import client from "../client"; import { DescriptionList } from "@patternfly/react-core/dist/esm/components/DescriptionList/index.js"; import { CardBody } from "@patternfly/react-core/dist/esm/components/Card/index.js"; -import { Stack, StackItem } from "@patternfly/react-core/dist/esm/layouts/Stack/index.js"; import { SCard } from "../utils/card.jsx"; import { SDesc } from "../utils/desc.jsx"; -import { PageChildrenCard, ActionButtons, new_page, page_type, block_location } from "../pages.jsx"; +import { ActionButtons, new_container, block_location } from "../pages.jsx"; import { block_name } from "../utils.js"; -import { partitionable_block_actions, make_partitionable_block_pages } from "./drive.jsx"; -import { StorageSize } from "../storage-controls.jsx"; +import { partitionable_block_actions } from "./drive.jsx"; + +import { make_block_page } from "../create-pages.jsx"; const _ = cockpit.gettext; export function make_other_page(parent, block) { - const p = new_page({ - location: ["other", block_location(block)], - parent, - name: block_location(block), - columns: [ - _("Block device"), - block_name(block), - , - ], + const container = new_container({ + parent: null, + page_location: ["other", block_location(block)], + component: OtherContainer, + props: { block }, actions: partitionable_block_actions(block), - component: OtherPage, - props: { block } }); - make_partitionable_block_pages(p, block); + make_block_page(parent, block, container); } -const OtherPage = ({ page, block }) => { +const OtherContainer = ({ container, block }) => { return ( - - - - - - - - - - - - - } - emptyCaption={_("Block device is not formatted")} - page={page} /> - - + }> + + + + + + + ); }; diff --git a/pkg/storaged/pages/stratis-pool.jsx b/pkg/storaged/pages/stratis-pool.jsx index bb1307dae104..47bb8edaf281 100644 --- a/pkg/storaged/pages/stratis-pool.jsx +++ b/pkg/storaged/pages/stratis-pool.jsx @@ -376,7 +376,19 @@ export function make_stratis_pool_page(parent, pool) { { title: _("Add block devices"), action: () => add_disks(pool), - tag: "blockdevs", + }, + ], + }); + + const pool_container = new_container({ + parent: blockdevs_container, + component: StratisPoolContainer, + props: { pool, degraded_ops, can_grow, managed_fsys_sizes, stats }, + actions: [ + { + title: _("Delete pool"), + action: () => delete_pool(pool), + danger: true, }, ], }); @@ -384,11 +396,11 @@ export function make_stratis_pool_page(parent, pool) { const p = new_page({ location: ["pool", pool.Uuid], parent, - container: blockdevs_container, + container: pool_container, name: pool.Name, columns: [ - pool.Encrypted ? _("Encrypted Stratis filesystems pool") : _("Stratis filesystems pool"), - "/dev/stratis/" + pool.Name + "/", + pool.Encrypted ? _("Encrypted Stratis filesystems") : _("Stratis filesystems"), + null, , ], has_warning: degraded_ops || can_grow, @@ -401,13 +413,6 @@ export function make_stratis_pool_page(parent, pool) { excuse: (managed_fsys_sizes && stats.pool_free < fsys_min_size ? _("Not enough space for new filesystems") : null), - tag: "pool" - }, - { - title: _("Delete pool"), - action: () => delete_pool(pool), - danger: true, - tag: "pool", }, ], }); @@ -416,14 +421,6 @@ export function make_stratis_pool_page(parent, pool) { } const StratisPoolPage = ({ page, pool, degraded_ops, can_grow, managed_fsys_sizes, stats }) => { - const key_desc = (pool.Encrypted && - pool.KeyDescription[0] && - pool.KeyDescription[1][1]); - const can_tang = (client.features.stratis_crypto_binding && - pool.Encrypted && - pool.ClevisInfo[0] && // pool has consistent clevis config - (!pool.ClevisInfo[1][0] || pool.ClevisInfo[1][1][0] == "tang")); // not bound or bound to "tang" - const tang_url = can_tang && pool.ClevisInfo[1][0] ? JSON.parse(pool.ClevisInfo[1][1][1]).url : null; const blockdevs = client.stratis_pool_blockdevs[pool.path] || []; function grow_blockdevs() { @@ -461,6 +458,33 @@ const StratisPoolPage = ({ page, pool, degraded_ops, can_grow, managed_fsys_size ); } + return ( + + {alerts} + + }> + + + + + + + + ); +}; + +const StratisPoolContainer = ({ container, pool, degraded_ops, can_grow, managed_fsys_sizes, stats }) => { + const key_desc = (pool.Encrypted && + pool.KeyDescription[0] && + pool.KeyDescription[1][1]); + const can_tang = (client.features.stratis_crypto_binding && + pool.Encrypted && + pool.ClevisInfo[0] && // pool has consistent clevis config + (!pool.ClevisInfo[1][0] || pool.ClevisInfo[1][1][0] == "tang")); // not bound or bound to "tang" + const tang_url = can_tang && pool.ClevisInfo[1][0] ? JSON.parse(pool.ClevisInfo[1][1][1]).url : null; + function add_passphrase() { dialog_open({ Title: _("Add passphrase"), @@ -598,70 +622,59 @@ const StratisPoolPage = ({ page, pool, degraded_ops, can_grow, managed_fsys_size const use = pool.TotalPhysicalUsed[0] && [Number(pool.TotalPhysicalUsed[1]), Number(pool.TotalPhysicalSize)]; return ( - - {alerts} - - }> - - - rename_pool(pool)}> - {_("edit")} - } /> - - { !managed_fsys_sizes && use && - - - - } - { pool.Encrypted && client.features.stratis_crypto_binding && - - - { !key_desc - ? {_("Add passphrase")} - : <> - {_("Change")} - - - {_("Remove")} - - - - } - - + }> + + + rename_pool(pool)}> + {_("edit")} + } /> + + { !managed_fsys_sizes && use && + + + + } + { pool.Encrypted && client.features.stratis_crypto_binding && + + + { !key_desc + ? {_("Add passphrase")} + : <> + {_("Change")} + + + {_("Remove")} + + + } - { can_tang && - - - { tang_url == null - ? {_("Add keyserver")} - : <> - { tang_url } - - - {_("Remove")} - - - - } - - + + + } + { can_tang && + + + { tang_url == null + ? {_("Add keyserver")} + : <> + { tang_url } + + + {_("Remove")} + + + } - - - - - - - - - + + + } + + + ); };