Skip to content

Commit

Permalink
WIP - unified overview
Browse files Browse the repository at this point in the history
  • Loading branch information
mvollmer committed Oct 2, 2023
1 parent 5a32ac9 commit 3d5224e
Show file tree
Hide file tree
Showing 19 changed files with 576 additions and 95 deletions.
37 changes: 33 additions & 4 deletions pkg/storaged/block-details.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,37 @@
import cockpit from "cockpit";
import React from "react";

import { Card, CardBody, CardTitle } from "@patternfly/react-core/dist/esm/components/Card/index.js";
import { Card, CardHeader, CardBody, CardTitle } 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 { Stack } from "@patternfly/react-core/dist/esm/layouts/Stack/index.js";

import * as utils from "./utils.js";
import { StdDetailsLayout } from "./details.jsx";
import * as Content from "./content-views.jsx";
import { create_tabs } from "./content-views.jsx";
import { StorageButton } from "./storage-controls.jsx";

const _ = cockpit.gettext;

export class BlockDetails extends React.Component {
render() {
const block = this.props.block;
const tabs = create_tabs(this.props.client, block, {});

const actions = tabs.actions;
tabs.menu_actions.forEach(a => {
if (!a.only_narrow)
actions.push(<StorageButton onClick={a.func}>{a.title}</StorageButton>);
});
tabs.menu_danger_actions.forEach(a => {
if (!a.only_narrow)
actions.push(<StorageButton kind="danger" onClick={a.func}>{a.title}</StorageButton>);
});

const header = (
<Card>
<CardTitle component="h2">{_("Block")}</CardTitle>
<CardHeader actions={{ actions: actions }}>
<CardTitle component="h2">{_("Block")}</CardTitle>
</CardHeader>
<CardBody>
<DescriptionList className="pf-m-horizontal-on-sm">
<DescriptionListGroup>
Expand All @@ -51,7 +66,21 @@ export class BlockDetails extends React.Component {
</Card>
);

const content = <Content.Block client={this.props.client} block={block} />;
function make_tab(t) {
return (
<Card>
<CardTitle component="h2">{t.name}</CardTitle>
<CardBody>
<t.renderer {...t.data} />
</CardBody>
</Card>
);
}

const content = (
<Stack hasGutter>
{tabs.renderers.map(make_tab)}
</Stack>);

return <StdDetailsLayout client={this.props.client} header={header} content={content} />;
}
Expand Down
22 changes: 21 additions & 1 deletion pkg/storaged/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ function is_multipath_master(block) {
}

function update_indices() {
let path, block, mdraid, vgroup, pvol, lvol, pool, blockdev, fsys, part, i;
let path, block, mdraid, vgroup, pvol, lvol, pool, blockdev, fsys, part, session, i;

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable session.

client.broken_multipath_present = false;
client.drives_multipath_blocks = { };
Expand Down Expand Up @@ -457,6 +457,26 @@ function update_indices() {
client.blocks_partitions[path].sort(function (a, b) { return a.Offset - b.Offset });
}

client.iscsi_sessions_drives = { };
client.drives_iscsi_session = { };
for (path in client.drives) {
const block = client.drives_block[path];
if (!block)
continue;
for (const session_path in client.iscsi_sessions) {
const session = client.iscsi_sessions[session_path];
for (i = 0; i < block.Symlinks.length; i++) {
console.log("??", block.Symlinks[i], session.data["target_name"]);
if (utils.decode_filename(block.Symlinks[i]).includes(session.data["target_name"])) {
client.drives_iscsi_session[path] = session;
if (!client.iscsi_sessions_drives[session_path])
client.iscsi_sessions_drives[session_path] = [];
client.iscsi_sessions_drives[session_path].push(client.drives[path]);
}
}
}
}

client.path_jobs = { };
function enter_job(job) {
if (!job.Objects || !job.Objects.length)
Expand Down
Loading

0 comments on commit 3d5224e

Please sign in to comment.