Skip to content

Commit

Permalink
feat(xoweb): show coalesing status in host sr tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
fbeauchamp committed Nov 22, 2023
1 parent b82e0e9 commit 18557e4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/xo-web/src/xo-app/host/tab-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const SR_COLUMNS = [
name: _('srName'),
itemRenderer: storage => (
<Link to={`/srs/${storage.id}`}>
{storage.garbageCollectionProgress !== undefined && `[coalescing ${storage.garbageCollectionProgress * 100}%]`}
<Text onChange={nameLabel => editSr(storage.id, { nameLabel })} useLongClick value={storage.nameLabel} />
</Link>
),
Expand Down Expand Up @@ -113,14 +114,14 @@ const SR_ACTIONS = [
export default connectStore(() => {
const pbds = createGetObjectsOfType('PBD').pick((_, props) => props.host.$PBDs)
const srs = createGetObjectsOfType('SR').pick(createSelector(pbds, pbds => map(pbds, pbd => pbd.SR)))
const tasks = createGetObjectsOfType('task').filter(task => task.applies_to)

const storages = createSelector(pbds, srs, (pbds, srs) =>
const storages = createSelector(pbds, srs, tasks, (pbds, srs, tasks) =>
map(
filter(pbds, pbd => srs[pbd.SR] !== undefined),
pbd => {
const sr = srs[pbd.SR]
const { physical_usage: usage, size } = sr

return {
attached: pbd.attached,
pbdDeviceConfig: pbd.device_config,
Expand All @@ -132,6 +133,7 @@ export default connectStore(() => {
shared: isSrShared(sr),
size: size > 0 ? size : 0,
usagePercentage: size > 0 && Math.round((100 * usage) / size),
garbageCollectionProgress: Object.values(tasks).find(({ applies_to }) => applies_to === sr.id)?.progress,
}
}
)
Expand Down

0 comments on commit 18557e4

Please sign in to comment.