Skip to content

Commit

Permalink
fix: also hide hidden storage labels on multiple drives
Browse files Browse the repository at this point in the history
fixes #716
  • Loading branch information
MauriceNino committed Apr 29, 2023
1 parent 57848c7 commit 213b73e
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions apps/view/src/widgets/storage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,23 @@ export const StorageWidget: FC<StorageWidgetProps> = ({

const infos = useMemo(() => {
if (shownData.length > 1) {
const brandShown = config.storage_label_list.includes('brand');
const typeShown = config.storage_label_list.includes('type');
const sizeShown = config.storage_label_list.includes('size');
const raidShown = config.storage_label_list.includes('raid');

return shownData.map(s => {
const brand = s.virtual
? s.disks[0].brand
: removeDuplicates(
s.disks.map(d => `${d.brand || 'Unknown'} ${d.type}`)
s.disks.map(d =>
[
brandShown ? d.brand : undefined,
typeShown ? d.type : undefined,
]
.filter(x => x)
.join(' ')
)
);
const size = s.size;
const raidGroup = s.raidLabel;
Expand All @@ -289,9 +301,14 @@ export const StorageWidget: FC<StorageWidgetProps> = ({
label: s.virtual
? 'VIRT'
: raidGroup
? `RAID\n=> ${raidGroup}`
? `RAID${raidShown ? `\n=> ${raidGroup}` : ''}`
: 'Drive',
value: `${brand}\n=> ${bytePrettyPrint(size)}`,
value: [
brandShown || typeShown ? brand : undefined,
sizeShown ? bytePrettyPrint(size) : undefined,
]
.filter(x => x)
.join('\n=> '),
};
});
} else {
Expand Down

0 comments on commit 213b73e

Please sign in to comment.