Skip to content

Commit

Permalink
fix(xo-web): do not subscribe to unhealthy vdi chains if no permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierFL committed Dec 27, 2023
1 parent 579f0b9 commit cf981e3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/xo-web/src/common/xo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import store from 'store'
import WarmMigrationModal from './warm-migration-modal'
import { alert, chooseAction, confirm } from '../modal'
import { error, info, success } from '../notification'
import { getObject } from 'selectors'
import { getObject, isAdmin } from 'selectors'
import { getXoaPlan, SOURCES } from '../xoa-plans'
import { noop, resolveId, resolveIds } from '../utils'
import {
Expand Down Expand Up @@ -564,7 +564,11 @@ subscribeVolumeInfo.forceRefresh = (() => {
}
})()

export const subscribeSrsUnhealthyVdiChainsLength = createSubscription(() => _call('sr.getAllUnhealthyVdiChainsLength'))
export const subscribeSrsUnhealthyVdiChainsLength = createSubscription(async () => {
const _isAdmin = isAdmin(store.getState())

return _isAdmin ? await _call('sr.getAllUnhealthyVdiChainsLength') : undefined
})

const unhealthyVdiChainsLengthSubscriptionsBySr = {}
export const createSrUnhealthyVdiChainsLengthSubscription = sr => {
Expand Down

0 comments on commit cf981e3

Please sign in to comment.