Skip to content

Commit

Permalink
WIP - little bit of code cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
mvollmer committed Nov 13, 2023
1 parent ffbd553 commit 1f69d3d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 21 deletions.
27 changes: 12 additions & 15 deletions pkg/storaged/pages.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ export function page_type(page, for_table) {
return type;
}

export function page_stored_on(page) {
function page_stored_on(page) {
function apply_container_format(cont, text) {
if (cont) {
if (cont.id_extra) {
Expand Down Expand Up @@ -282,23 +282,20 @@ export const PageTable = ({ emptyCaption, aria_label, pages, crossrefs }) => {
info = <>{"\n"}<ExclamationCircleIcon className="ct-icon-times-circle" /></>;
else if (page.has_warning || container_has_warning(page.container))
info = <>{"\n"}<ExclamationTriangleIcon className="ct-icon-exclamation-triangle" /></>;

const name = crossref ? page.name : page_display_name(page);
const type = crossref ? page_stored_on(page) : page_type(page, true);
const loc = crossref ? crossref.extra : page.columns[1];
const type_colspan = loc ? 1 : 2;
const size = crossref ? crossref.size : page.columns[2];
const actions = crossref ? make_actions_kebab(crossref.actions) : make_page_kebab(page);

const cols = [
<Td key="1"><span>{crossref ? page.name : page_display_name(page)}{info}</span></Td>,
<Td key="2" colSpan={type_colspan}>{crossref ? page_stored_on(page) : page_type(page, true)}</Td>,
<Td key="1"><span>{name}{info}</span></Td>,
<Td key="2">{type}</Td>,
<Td key="3">{loc}</Td>,
<Td key="4" className="pf-v5-u-text-align-right">{size}</Td>,
<Td key="5" className="pf-v5-c-table__action content-action">{actions || <div /> }</Td>,
];
if (type_colspan == 1)
cols.push(<Td key="3">{loc}</Td>);
cols.push(
<Td key="4" className="pf-v5-u-text-align-right">
{crossref ? crossref.size : page.columns[2]}
</Td>);
const actions = crossref ? make_actions_kebab(crossref.actions) : make_page_kebab(page);
cols.push(
<Td key="5" className="pf-v5-c-table__action content-action">
{actions || <div /> }
</Td>);

function onRowClick(event) {
if (!event || event.button !== 0)
Expand Down
4 changes: 2 additions & 2 deletions pkg/storaged/pages/stratis-pool.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,8 @@ export function make_stratis_pool_page(parent, pool) {
_("Stratis filesystems"),
null,
((!managed_fsys_sizes && use)
? <StorageUsageBar key="s" stats={use} short />
: <StorageSize key="s" size={pool.TotalPhysicalSize} />),
? <StorageUsageBar key="s" stats={use} short />
: <StorageSize key="s" size={pool.TotalPhysicalSize} />),
],
has_warning: degraded_ops || can_grow,
component: StratisPoolPage,
Expand Down
2 changes: 0 additions & 2 deletions test/verify/check-storage-hidden
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.

import os

import storagelib
import testlib

Expand Down
2 changes: 1 addition & 1 deletion test/verify/check-storage-used
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ ExecStart=/usr/bin/sleep infinity
self.dialog_cancel()
self.dialog_wait_close()
b.click('button:contains(Create partition table)')
self.dialog({"type":"empty"})
self.dialog({"type": "empty"})
else:
raise

Expand Down
1 change: 0 additions & 1 deletion test/verify/check-storage-vdo
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ class TestStorageLegacyVDO(storagelib.StorageCase):
b.wait_visible(self.card("Unformatted data"))
b.wait_visible(self.card("LVM2 logical volume"))


def testBrokenVdo(self):
m = self.machine
b = self.browser
Expand Down

0 comments on commit 1f69d3d

Please sign in to comment.