fix(xo-web/VM): show error when setting resource set fails (#2638)

Fixes #2620
This commit is contained in:
badrAZ 2018-02-20 14:44:24 +01:00 committed by Pierre Donias
parent fd2580f5da
commit 51da4a7e70
2 changed files with 8 additions and 2 deletions

View File

@ -1089,6 +1089,7 @@ const messages = {
importVmsCleanList: 'Reset', importVmsCleanList: 'Reset',
vmImportSuccess: 'VM import success', vmImportSuccess: 'VM import success',
vmImportFailed: 'VM import failed', vmImportFailed: 'VM import failed',
setVmFailed: 'Error on setting the VM: {vm}',
startVmImport: 'Import starting…', startVmImport: 'Import starting…',
startVmExport: 'Export starting…', startVmExport: 'Export starting…',
nCpus: 'N CPUs', nCpus: 'N CPUs',

View File

@ -25,7 +25,7 @@ import _ from '../intl'
import fetch, { post } from '../fetch' import fetch, { post } from '../fetch'
import invoke from '../invoke' import invoke from '../invoke'
import logError from '../log-error' import logError from '../log-error'
import renderXoItem from '../render-xo-item' import renderXoItem, { renderXoItemFromId } from '../render-xo-item'
import store from 'store' import store from 'store'
import { alert, chooseAction, confirm } from '../modal' import { alert, chooseAction, confirm } from '../modal'
import { error, info, success } from '../notification' import { error, info, success } from '../notification'
@ -1128,7 +1128,12 @@ export const revertSnapshot = vm =>
) )
export const editVm = (vm, props) => export const editVm = (vm, props) =>
_call('vm.set', { ...props, id: resolveId(vm) }) _call('vm.set', { ...props, id: resolveId(vm) }).catch(err => {
error(
_('setVmFailed', { vm: renderXoItemFromId(resolveId(vm)) }),
err.message
)
})
export const fetchVmStats = (vm, granularity) => export const fetchVmStats = (vm, granularity) =>
_call('vm.stats', { id: resolveId(vm), granularity }) _call('vm.stats', { id: resolveId(vm), granularity })