feat(xo-web): log Invalid XML-RPC message error as an unexpected response (#5138)

See xoa-support#2588
This commit is contained in:
Rajaa.BARHTAOUI 2020-07-21 15:11:57 +02:00 committed by GitHub
parent 0d398f867f
commit c9244b2b13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 6 deletions

View File

@ -7,6 +7,8 @@
> Users must be able to say: “Nice enhancement, I'm eager to test it”
- Log the `Invalid XML-RPC message` error as an unexpected response (PR [#5138](https://github.com/vatesfr/xen-orchestra/pull/5138))
### Bug fixes
> Users must be able to say: “I had this issue, happy to know it's fixed”

View File

@ -1770,6 +1770,9 @@ const messages = {
optionalEntry: '* optional',
// ----- Servers -----
enableServerErrorTitle: 'Enable server',
enableServerErrorMessage:
'Unexpected response. Please check your server address.',
serverLabel: 'Label',
serverHost: 'Host',
serverUsername: 'Username',

View File

@ -1,14 +1,12 @@
import asap from 'asap'
import cookies from 'cookies-js'
import fpSortBy from 'lodash/fp/sortBy'
import pFinally from 'promise-toolbox/finally'
import React from 'react'
import reflect from 'promise-toolbox/reflect'
import tap from 'promise-toolbox/tap'
import updater from 'xoa-updater'
import URL from 'url-parse'
import Xo from 'xo-lib'
import { createBackoff } from 'jsonrpc-websocket-client'
import { pFinally, reflect, tap, tapCatch } from 'promise-toolbox'
import { SelectHost } from 'select-objects'
import {
filter,
@ -567,9 +565,13 @@ export const editServer = (server, props) =>
)
export const enableServer = server =>
_call('server.enable', { id: resolveId(server) })::pFinally(
subscribeServers.forceRefresh
)
_call('server.enable', { id: resolveId(server) })
::tapCatch(error => {
if (error.message === 'Invalid XML-RPC message') {
error(_('enableServerErrorTitle'), _('enableServerErrorMessage'))
}
})
::pFinally(subscribeServers.forceRefresh)
export const disableServer = server =>
_call('server.disable', { id: resolveId(server) })::tap(