Skip to content

Commit

Permalink
storaged: utilize PF4 table classes for sidebar tables
Browse files Browse the repository at this point in the history
So that it looks consistent with the rest of the tables in the storage
page.

Closes cockpit-project#14617
  • Loading branch information
KKoukiou authored and marusak committed Oct 21, 2020
1 parent d1c503d commit 27381f0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
14 changes: 9 additions & 5 deletions pkg/storaged/side-panel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import React from "react";
import { OptionalPanel } from "./optional-panel.jsx";
import { get_block_link_parts, block_name } from "./utils.js";

import { Spinner } from '@patternfly/react-core';

const _ = cockpit.gettext;

export class SidePanel extends React.Component {
Expand Down Expand Up @@ -56,12 +58,13 @@ export class SidePanel extends React.Component {
not_installed_text={this.props.not_installed_text}
install_title={this.props.install_title}>
{ this.props.children.length > 0
? <table className={"table" + (this.props.hover !== false ? " table-hover" : "")}>
? <table className={"pf-c-table pf-m-compact" + (this.props.hover !== false ? " table-hover" : "")}>
<tbody>
{ children }
{ show_all_button }
</tbody>
</table>

: <div className="empty-panel-text">{this.props.empty_text}</div>
}
</OptionalPanel>
Expand Down Expand Up @@ -97,16 +100,15 @@ export class SidePanelRow extends React.Component {
let decoration = null;
if (this.props.actions)
decoration = (
<div className="sidepanel-row-decoration"
role="presentation"
<div role="presentation"
onClick={eat_event}
onKeyPress={eat_event}>
{this.props.actions}
</div>);
else if (client.path_jobs[job_path])
decoration = <div className="sidepanel-row-decoration spinner spinner-sm" />;
decoration = <Spinner size="sm" />;
else if (client.path_warnings[job_path])
decoration = <div className="sidepanel-row-decoration pficon pficon-warning-triangle-o" />;
decoration = <div className="pficon pficon-warning-triangle-o" />;

return (
<tr data-testkey={this.props.testkey}
Expand All @@ -121,6 +123,8 @@ export class SidePanelRow extends React.Component {
<div className="sidepanel-row-devname">{this.props.devname}</div>
</div>
</div>
</td>
<td className="sidepanel-row-decoration">
{decoration}
</td>
</tr>
Expand Down
17 changes: 8 additions & 9 deletions pkg/storaged/storage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@
text-overflow: ellipsis;
}

#storage .storage-sidebar .table {
#storage .storage-sidebar table {
table-layout:fixed;
}

#storage .ct-table th {
font-weight: var(--pf-global--FontWeight--bold);
}

#storage .storage-sidebar .table td {
#storage .storage-sidebar table td {
overflow: hidden;
text-overflow: ellipsis;
vertical-align: top;
Expand Down Expand Up @@ -653,7 +653,7 @@ td.storage-action {

/* Overview side panels */

#storage .storage-sidebar .table {
#storage .storage-sidebar table {
table-layout: fixed;
}

Expand All @@ -666,8 +666,8 @@ td.storage-action {
margin-right: 0.5em;
}

.sidepanel-row-body {
flex: auto;
.sidepanel-row-name {
font-size: var(--pf-global--FontSize--md);
}

.sidepanel-row-info {
Expand All @@ -677,10 +677,9 @@ td.storage-action {
justify-content: space-between;
}

.sidepanel-row-decoration {
align-self: center;
white-space: nowrap;
margin-left: 1em;
.pf-c-table tbody > tr > td.sidepanel-row-decoration {
--pf-c-table--cell--Width: 10%;
width: var(--pf-c-table--cell--Width);
}

.sidepanel-row .spinner {
Expand Down
2 changes: 1 addition & 1 deletion test/verify/check-storage-msdos
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class TestStorageMsDOS(StorageCase):
self.content_dropdown_action(2, "Delete")
self.confirm()

self.content_row_wait_in_col(2, 0, "Free space")
self.content_row_wait_in_col(2, 1, "Free space")


if __name__ == '__main__':
Expand Down

0 comments on commit 27381f0

Please sign in to comment.