refactor: use semantic metric types instead of conditional logic in HostsOverview
Changed MetricBar type prop from conditional (value > 80 ? 'danger' : 'primary')
to semantic types ('cpu', 'memory', 'disk') for better maintainability and
consistency with the component's design system.
This allows MetricBar to handle threshold logic internally based on metric
type, rather than duplicating threshold conditions at each call site.
This commit is contained in:
parent
8fb9ef2e8f
commit
9925a0d78f
1 changed files with 3 additions and 3 deletions
|
|
@ -261,7 +261,7 @@ export const HostsOverview: Component<HostsOverviewProps> = (props) => {
|
|||
<MetricBar
|
||||
label={`${cpuPercent().toFixed(1)}%`}
|
||||
value={cpuPercent()}
|
||||
type={cpuPercent() > 80 ? 'danger' : 'primary'}
|
||||
type="cpu"
|
||||
/>
|
||||
</Show>
|
||||
</td>
|
||||
|
|
@ -273,7 +273,7 @@ export const HostsOverview: Component<HostsOverviewProps> = (props) => {
|
|||
<MetricBar
|
||||
label={`${memUsed()} / ${memTotal()}`}
|
||||
value={memPercent()}
|
||||
type={memPercent() > 80 ? 'danger' : 'primary'}
|
||||
type="memory"
|
||||
/>
|
||||
</Show>
|
||||
</td>
|
||||
|
|
@ -379,7 +379,7 @@ export const HostsOverview: Component<HostsOverviewProps> = (props) => {
|
|||
<MetricBar
|
||||
value={diskPercent()}
|
||||
label={`${diskPercent().toFixed(1)}%`}
|
||||
type={diskPercent() > 80 ? 'danger' : 'primary'}
|
||||
type="disk"
|
||||
/>
|
||||
</div>
|
||||
</Show>
|
||||
|
|
|
|||
Loading…
Reference in a new issue