feat(xo-web/settings/remotes): ability to edit/delete a remote with an invalid URL (#3226)
Fixes #3182
This commit is contained in:
parent
114cf7ac7d
commit
ac2e490569
@ -10,6 +10,7 @@
|
||||
- [Backup NG form] Ability to edit a schedule's name [#2711](https://github.com/vatesfr/xen-orchestra/issues/2711) [#3071](https://github.com/vatesfr/xen-orchestra/issues/3071) (PR [#3143](https://github.com/vatesfr/xen-orchestra/pull/3143))
|
||||
- [Remotes] Ability to change the type of a remote [#2423](https://github.com/vatesfr/xen-orchestra/issues/2423) (PR [#3207](https://github.com/vatesfr/xen-orchestra/pull/3207))
|
||||
- [Backup NG new] Ability to set a job's timeout [#2978](https://github.com/vatesfr/xen-orchestra/issues/2978) (PR [#3222](https://github.com/vatesfr/xen-orchestra/pull/3222))
|
||||
- [Remotes] Ability to edit/delete a remote with an invalid URL [#3182](https://github.com/vatesfr/xen-orchestra/issues/3182) (PR [#3226](https://github.com/vatesfr/xen-orchestra/pull/3226))
|
||||
|
||||
### Bug fixes
|
||||
|
||||
@ -20,6 +21,7 @@
|
||||
|
||||
### Released packages
|
||||
|
||||
- xo-remote-parser v0.5.0
|
||||
- complex-matcher v0.4.0
|
||||
- xo-server-backup-reports v0.12.3
|
||||
- xo-server v5.23.0
|
||||
|
@ -19,7 +19,14 @@ export const parse = string => {
|
||||
object.path = `/${trimStart(rest, '/')}` // the leading slash has been forgotten on client side first implementation
|
||||
} else if (type === 'nfs') {
|
||||
object.type = 'nfs'
|
||||
const [, host, port, path] = NFS_RE.exec(rest)
|
||||
let host, port, path
|
||||
// Some users have a remote with a colon in the URL, which breaks the parsing since this commit: https://github.com/vatesfr/xen-orchestra/commit/fb1bf6a1e748b457f2d2b89ba02fa104554c03df
|
||||
try {
|
||||
;[, host, port, path] = NFS_RE.exec(rest)
|
||||
} catch (err) {
|
||||
;[host, path] = rest.split(':')
|
||||
object.invalidUrl = true
|
||||
}
|
||||
object.host = host
|
||||
object.port = port
|
||||
object.path = `/${trimStart(path, '/')}` // takes care of a missing leading slash coming from previous version format
|
||||
|
@ -1295,6 +1295,8 @@ const messages = {
|
||||
'Only the files of Delta Backup which are not on a SMB remote can be restored',
|
||||
remoteEnabled: 'Enabled',
|
||||
remoteError: 'Error',
|
||||
remoteErrorMessage:
|
||||
'The URL ({url}) is invalid (colon in path). Click this button to change the URL to {newUrl}.',
|
||||
noBackup: 'No backup available',
|
||||
backupVmNameColumn: 'VM Name',
|
||||
backupVmDescriptionColumn: 'VM Description',
|
||||
|
@ -705,14 +705,11 @@ export const SelectRemote = makeSubscriptionSelect(
|
||||
subscriber => {
|
||||
const unsubscribeRemotes = subscribeRemotes(remotes => {
|
||||
const xoObjects = groupBy(
|
||||
map(sortBy(remotes, 'name'), remote => {
|
||||
try {
|
||||
remote = { ...remote, ...parseRemote(remote.url) }
|
||||
return { id: remote.id, type: 'remote', value: remote }
|
||||
} catch (err) {
|
||||
console.error('Remote parsing error:', remote, '\n', err)
|
||||
}
|
||||
}).filter(r => r !== undefined),
|
||||
map(sortBy(remotes, 'name'), remote => ({
|
||||
id: remote.id,
|
||||
type: 'remote',
|
||||
value: { ...remote, ...parseRemote(remote.url) },
|
||||
})).filter(r => !r.value.invalid),
|
||||
remote => remote.value.type
|
||||
)
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import _, { messages } from 'intl'
|
||||
import ActionButton from 'action-button'
|
||||
import Icon from 'icon'
|
||||
import React from 'react'
|
||||
import SortedTable from 'sorted-table'
|
||||
@ -71,6 +72,7 @@ const COLUMN_STATE = {
|
||||
name: _('remoteState'),
|
||||
}
|
||||
|
||||
const fixRemoteUrl = remote => editRemote(remote, { url: format(remote) })
|
||||
const COLUMNS_LOCAL_REMOTE = [
|
||||
COLUMN_NAME,
|
||||
{
|
||||
@ -116,7 +118,20 @@ const COLUMNS_NFS_REMOTE = [
|
||||
onChange={_changeUrlElement}
|
||||
placeholder={formatMessage(messages.remoteNfsPlaceHolderPath)}
|
||||
value={remote.path}
|
||||
/>{' '}
|
||||
{remote.invalidUrl && (
|
||||
<ActionButton
|
||||
btnStyle='danger'
|
||||
handler={fixRemoteUrl}
|
||||
handlerParam={remote}
|
||||
icon='alarm'
|
||||
size='small'
|
||||
tooltip={_('remoteErrorMessage', {
|
||||
url: remote.url,
|
||||
newUrl: format(remote),
|
||||
})}
|
||||
/>
|
||||
)}
|
||||
</span>
|
||||
),
|
||||
|
||||
@ -247,16 +262,10 @@ export default [
|
||||
subscribeRemotes(remotes => {
|
||||
cb(
|
||||
groupBy(
|
||||
map(remotes, remote => {
|
||||
try {
|
||||
return {
|
||||
...remote,
|
||||
map(remotes, remote => ({
|
||||
...parse(remote.url),
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Remote parsing error:', remote, '\n', err)
|
||||
}
|
||||
}).filter(r => r !== undefined),
|
||||
...remote,
|
||||
})),
|
||||
'type'
|
||||
)
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user