fix(dashboard/health): filter correctly unhealthyVdis (#6519)

See zammad#10720
This commit is contained in:
Mathieu 2022-11-10 15:35:05 +01:00 committed by GitHub
parent f44f5199c6
commit 7a4cec5093
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -11,6 +11,8 @@
> Users must be able to say: “I had this issue, happy to know it's fixed”
- [Dashboard/Health] Fix `Unknown SR` and `Unknown VDI` in Unhealthy VDIs (PR [#6519](https://github.com/vatesfr/xen-orchestra/pull/6519))
### Packages to release
> When modifying a package, add it here with its release type.
@ -26,4 +28,7 @@
> Keep this list alphabetically ordered to avoid merge conflicts
<!--packages-start-->
- xo-web minor
<!--packages-end-->

View File

@ -7,7 +7,9 @@ import SingleLineRow from 'single-line-row'
import SortedTable from 'sorted-table'
import Tooltip from 'tooltip'
import { Card, CardHeader, CardBlock } from 'card'
import { connectStore } from 'utils'
import { Col, Row } from 'grid'
import { createGetObjectsOfType } from 'selectors'
import { injectState, provideState } from 'reaclette'
import { forEach, isEmpty, map, size } from 'lodash'
import { Sr, Vdi } from 'render-xo-item'
@ -60,15 +62,18 @@ const COLUMNS = [
]
const UnhealthyVdis = decorate([
connectStore({
srs: createGetObjectsOfType('SR'),
}),
addSubscriptions({
vdisHealthBySr: subscribeSrsUnhealthyVdiChainsLength,
}),
provideState({
computed: {
srIds: (_, { vdisHealthBySr = {} }) => {
srIds: (_, { srs, vdisHealthBySr = {} }) => {
const srIds = []
forEach(vdisHealthBySr, ({ unhealthyVdis, vdisWithUnknownVhdParent }, srId) => {
if (!isEmpty(unhealthyVdis) || vdisWithUnknownVhdParent.length > 0) {
if ((srs[srId] !== undefined && !isEmpty(unhealthyVdis)) || vdisWithUnknownVhdParent.length > 0) {
srIds.push(srId)
}
})