Compare commits
56 Commits
xo-web/v5.
...
v5.10.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e83b0ffd2 | ||
|
|
451384bcdc | ||
|
|
b733164c50 | ||
|
|
72d9d8ba86 | ||
|
|
7c7646c65c | ||
|
|
b1c087451e | ||
|
|
f0f72f3bdd | ||
|
|
0ab3267541 | ||
|
|
995e76d323 | ||
|
|
62a9f805c2 | ||
|
|
84ea95a641 | ||
|
|
316de42cd9 | ||
|
|
bc2256fc86 | ||
|
|
f0d85f4c4e | ||
|
|
1801f9cb06 | ||
|
|
4be018ad15 | ||
|
|
5dcf060975 | ||
|
|
59f6b1f0c8 | ||
|
|
ae38a85b19 | ||
|
|
324dbbcfc8 | ||
|
|
9770b77df4 | ||
|
|
0f91de389a | ||
|
|
7f5a623b37 | ||
|
|
c7cf73ff05 | ||
|
|
4aab425cef | ||
|
|
0d9666639f | ||
|
|
6c26c09685 | ||
|
|
819f650b48 | ||
|
|
353eba6365 | ||
|
|
063302b91d | ||
|
|
562b51bc2f | ||
|
|
e33a6f9a05 | ||
|
|
b9db4e7704 | ||
|
|
3270d9c3a7 | ||
|
|
6d7399f96c | ||
|
|
886ef87bc5 | ||
|
|
1e5dc9efe7 | ||
|
|
28ec66bf3b | ||
|
|
9199784a23 | ||
|
|
c7e447db6f | ||
|
|
f81615f8b6 | ||
|
|
12caceb02b | ||
|
|
30f71ab444 | ||
|
|
fe04481ca3 | ||
|
|
7766e8edcd | ||
|
|
31d417c9d3 | ||
|
|
5ed29197cf | ||
|
|
ff5f3e12d3 | ||
|
|
240180405c | ||
|
|
edca6495fc | ||
|
|
8a9b753b01 | ||
|
|
445fc696c9 | ||
|
|
492e2362be | ||
|
|
1acee209be | ||
|
|
6785c48709 | ||
|
|
808e674503 |
59
CHANGELOG.md
59
CHANGELOG.md
@@ -1,5 +1,64 @@
|
||||
# ChangeLog
|
||||
|
||||
## **5.10.0** (2017-05-31)
|
||||
|
||||
### Enhancements
|
||||
|
||||
- Improve backup log display [\#2239](https://github.com/vatesfr/xo-web/issues/2239)
|
||||
- Patch SR detection improvement [\#2215](https://github.com/vatesfr/xo-web/issues/2215)
|
||||
- Less strict coalesce detection [\#2207](https://github.com/vatesfr/xo-web/issues/2207)
|
||||
- IP pool UI improvement [\#2203](https://github.com/vatesfr/xo-web/issues/2203)
|
||||
- Ability to clear "Auto power on" flag for DR-ed VM [\#2097](https://github.com/vatesfr/xo-web/issues/2097)
|
||||
- [Delta backup restoration] Choose SR for each VDIs [\#2070](https://github.com/vatesfr/xo-web/issues/2070)
|
||||
- Ability to forget an host (even if no longer present) [\#1934](https://github.com/vatesfr/xo-web/issues/1934)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
- Cross pool migrate fail [\#2248](https://github.com/vatesfr/xo-web/issues/2248)
|
||||
- ActionButtons with modals stay in pending state forever [\#2222](https://github.com/vatesfr/xo-web/issues/2222)
|
||||
- Permission issue for a user on self service VMs [\#2212](https://github.com/vatesfr/xo-web/issues/2212)
|
||||
- Self-Service resource loophole [\#2198](https://github.com/vatesfr/xo-web/issues/2198)
|
||||
- Backup log no longer shows the name of destination VM [\#2195](https://github.com/vatesfr/xo-web/issues/2195)
|
||||
- State not restored when exiting modal dialog [\#2194](https://github.com/vatesfr/xo-web/issues/2194)
|
||||
- [Xapi#exportDeltaVm] Cannot read property 'managed' of undefined [\#2189](https://github.com/vatesfr/xo-web/issues/2189)
|
||||
- VNC keyboard layout change [\#404](https://github.com/vatesfr/xo-web/issues/404)
|
||||
|
||||
## **5.9.0** (2017-05-31)
|
||||
|
||||
### Enhancements
|
||||
|
||||
- Allow DR to remove previous backup first [\#2157](https://github.com/vatesfr/xo-web/issues/2157)
|
||||
- Feature request - add amount of RAM to memory bars [\#2149](https://github.com/vatesfr/xo-web/issues/2149)
|
||||
- Make the acceptability of invalid certificates configurable [\#2138](https://github.com/vatesfr/xo-web/issues/2138)
|
||||
- label of VM names in tasks link [\#2135](https://github.com/vatesfr/xo-web/issues/2135)
|
||||
- Backup report timezone [\#2133](https://github.com/vatesfr/xo-web/issues/2133)
|
||||
- xo-server-recover-account [\#2129](https://github.com/vatesfr/xo-web/issues/2129)
|
||||
- Detect disks attached to control domain [\#2126](https://github.com/vatesfr/xo-web/issues/2126)
|
||||
- Add task description in Tasks view [\#2125](https://github.com/vatesfr/xo-web/issues/2125)
|
||||
- Host reboot warning after patching for 7.1 [\#2124](https://github.com/vatesfr/xo-web/issues/2124)
|
||||
- Continuous Replication - possibility run VM without a clone [\#2119](https://github.com/vatesfr/xo-web/issues/2119)
|
||||
- Unreachable host should be detected [\#2099](https://github.com/vatesfr/xo-web/issues/2099)
|
||||
- Orange icon when host is is disabled [\#2098](https://github.com/vatesfr/xo-web/issues/2098)
|
||||
- Enhanced backup report logs [\#2096](https://github.com/vatesfr/xo-web/issues/2096)
|
||||
- Only show failures when configured to report on failures [\#2095](https://github.com/vatesfr/xo-web/issues/2095)
|
||||
- "Add all" button in self service [\#2081](https://github.com/vatesfr/xo-web/issues/2081)
|
||||
- Patch and pack mechanism changed on Ely [\#2058](https://github.com/vatesfr/xo-web/issues/2058)
|
||||
- Tip or ask people to patch from pool view [\#2057](https://github.com/vatesfr/xo-web/issues/2057)
|
||||
- File restore - Remind compatible backup [\#1930](https://github.com/vatesfr/xo-web/issues/1930)
|
||||
- Reporting for halted vm time [\#1613](https://github.com/vatesfr/xo-web/issues/1613)
|
||||
- Add standalone XS server to a pool and patch it to the pool level [\#878](https://github.com/vatesfr/xo-web/issues/878)
|
||||
- Add Cores-per-sockets [\#130](https://github.com/vatesfr/xo-web/issues/130)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
- VM creation is broken for non-admins [\#2168](https://github.com/vatesfr/xo-web/issues/2168)
|
||||
- Can't create cloud config drive [\#2162](https://github.com/vatesfr/xo-web/issues/2162)
|
||||
- Select is "moving" [\#2142](https://github.com/vatesfr/xo-web/issues/2142)
|
||||
- Select issue for affinity host [\#2141](https://github.com/vatesfr/xo-web/issues/2141)
|
||||
- Dashboard Storage Usage incorrect [\#2123](https://github.com/vatesfr/xo-web/issues/2123)
|
||||
- Detect unmerged *base copy* and prevent too long chains [\#2047](https://github.com/vatesfr/xo-web/issues/2047)
|
||||
|
||||
|
||||
## **5.8.0** (2017-04-28)
|
||||
|
||||
### Enhancements
|
||||
|
||||
@@ -258,7 +258,7 @@ gulp.task(function buildScripts () {
|
||||
]
|
||||
}),
|
||||
require('gulp-sourcemaps').init({ loadMaps: true }),
|
||||
PRODUCTION && require('gulp-uglify')(),
|
||||
PRODUCTION && require('gulp-uglify/composer')(require('uglify-es'))(),
|
||||
dest()
|
||||
)
|
||||
})
|
||||
|
||||
21
package.json
21
package.json
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"private": false,
|
||||
"name": "xo-web",
|
||||
"version": "5.8.3",
|
||||
"version": "5.10.1",
|
||||
"license": "AGPL-3.0",
|
||||
"description": "Web interface client for Xen-Orchestra",
|
||||
"keywords": [
|
||||
@@ -31,6 +31,7 @@
|
||||
"npm": ">=3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nraynaud/novnc": "^0.6.1-1",
|
||||
"ansi_up": "^1.3.0",
|
||||
"asap": "^2.0.4",
|
||||
"babel-eslint": "^7.0.0",
|
||||
@@ -67,7 +68,7 @@
|
||||
"get-stream": "^2.3.0",
|
||||
"globby": "^6.0.0",
|
||||
"gulp": "github:gulpjs/gulp#4.0",
|
||||
"gulp-autoprefixer": "^3.1.0",
|
||||
"gulp-autoprefixer": "^4.0.0",
|
||||
"gulp-csso": "^3.0.0",
|
||||
"gulp-embedlr": "^0.5.2",
|
||||
"gulp-plumber": "^1.1.0",
|
||||
@@ -75,13 +76,13 @@
|
||||
"gulp-refresh": "^1.1.0",
|
||||
"gulp-sass": "^3.0.0",
|
||||
"gulp-sourcemaps": "^2.2.3",
|
||||
"gulp-uglify": "^2.0.0",
|
||||
"gulp-uglify": "^3.0.0",
|
||||
"gulp-watch": "^4.3.5",
|
||||
"human-format": "^0.8.0",
|
||||
"husky": "^0.13.1",
|
||||
"index-modules": "^0.3.0",
|
||||
"is-ip": "^1.0.0",
|
||||
"jest": "^19.0.2",
|
||||
"jest": "^20.0.4",
|
||||
"jsonrpc-websocket-client": "^0.1.1",
|
||||
"kindof": "^2.0.0",
|
||||
"later": "^1.2.0",
|
||||
@@ -89,20 +90,19 @@
|
||||
"loose-envify": "^1.1.0",
|
||||
"make-error": "^1.2.1",
|
||||
"marked": "^0.3.5",
|
||||
"modular-css": "^4.1.1",
|
||||
"modular-css": "^5.1.6",
|
||||
"moment": "^2.13.0",
|
||||
"moment-timezone": "^0.5.4",
|
||||
"notifyjs": "^3.0.0",
|
||||
"novnc-node": "^0.5.3",
|
||||
"promise-toolbox": "^0.8.0",
|
||||
"promise-toolbox": "^0.9.4",
|
||||
"random-password": "^0.1.2",
|
||||
"react": "^15.4.1",
|
||||
"react-addons-shallow-compare": "^15.1.0",
|
||||
"react-addons-test-utils": "^15.4.1",
|
||||
"react-bootstrap-4": "^0.29.1",
|
||||
"react-chartist": "^0.12.0",
|
||||
"react-copy-to-clipboard": "^4.0.2",
|
||||
"react-debounce-input": "^2.4.0",
|
||||
"react-copy-to-clipboard": "^5.0.0",
|
||||
"react-debounce-input": "^3.0.0",
|
||||
"react-dnd": "^2.1.4",
|
||||
"react-dnd-html5-backend": "^2.1.2",
|
||||
"react-document-title": "^2.0.2",
|
||||
@@ -127,9 +127,10 @@
|
||||
"reselect": "^2.5.4",
|
||||
"semver": "^5.3.0",
|
||||
"standard": "^10.0.0",
|
||||
"styled-components": "^1.4.4",
|
||||
"styled-components": "^2.1.0",
|
||||
"superagent": "^3.5.0",
|
||||
"tar-stream": "^1.5.2",
|
||||
"uglify-es": "^3.0.18",
|
||||
"uncontrollable-input": "^0.0.1",
|
||||
"vinyl": "^2.0.0",
|
||||
"watchify": "^3.7.0",
|
||||
|
||||
@@ -19,9 +19,9 @@ import {
|
||||
createSelector
|
||||
} from './selectors'
|
||||
import {
|
||||
getHostMissingPatches,
|
||||
installAllHostPatches,
|
||||
installAllPatchesOnPool
|
||||
installAllPatchesOnPool,
|
||||
subscribeHostMissingPatches
|
||||
} from './xo'
|
||||
|
||||
// ===================================================================
|
||||
@@ -89,11 +89,25 @@ class HostsPatchesTable extends Component {
|
||||
)
|
||||
)
|
||||
|
||||
_refreshMissingPatches = () => (
|
||||
Promise.all(
|
||||
map(this.props.hosts, this._refreshHostMissingPatches)
|
||||
_subscribeMissingPatches = (hosts = this.props.hosts) => {
|
||||
const unsubs = map(hosts, host =>
|
||||
subscribeHostMissingPatches(
|
||||
host,
|
||||
patches => this.setState({
|
||||
missingPatches: {
|
||||
...this.state.missingPatches,
|
||||
[host.id]: patches.length
|
||||
}
|
||||
})
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if (this.unsubscribeMissingPatches !== undefined) {
|
||||
this.unsubscribeMissingPatches()
|
||||
}
|
||||
|
||||
this.unsubscribeMissingPatches = () => forEach(unsubs, unsub => unsub())
|
||||
}
|
||||
|
||||
_installAllMissingPatches = () => {
|
||||
const pools = {}
|
||||
@@ -104,100 +118,69 @@ class HostsPatchesTable extends Component {
|
||||
return Promise.all(map(
|
||||
keys(pools),
|
||||
installAllPatchesOnPool
|
||||
)).then(this._refreshMissingPatches)
|
||||
}
|
||||
|
||||
_refreshHostMissingPatches = host => (
|
||||
getHostMissingPatches(host).then(patches => {
|
||||
this.setState({
|
||||
missingPatches: {
|
||||
...this.state.missingPatches,
|
||||
[host.id]: patches.length
|
||||
}
|
||||
})
|
||||
})
|
||||
)
|
||||
|
||||
_installAllHostPatches = host => (
|
||||
installAllHostPatches(host).then(() =>
|
||||
this._refreshHostMissingPatches(host)
|
||||
)
|
||||
)
|
||||
|
||||
componentWillMount () {
|
||||
this._refreshMissingPatches()
|
||||
))
|
||||
}
|
||||
|
||||
componentDidMount () {
|
||||
// Force one Portal refresh.
|
||||
// Because Portal cannot see the container reference at first rendering.
|
||||
this.forceUpdate()
|
||||
this._subscribeMissingPatches()
|
||||
}
|
||||
|
||||
componentWillReceiveProps (nextProps) {
|
||||
forEach(nextProps.hosts, host => {
|
||||
const { id } = host
|
||||
if (nextProps.hosts !== this.props.hosts) {
|
||||
this._subscribeMissingPatches(nextProps.hosts)
|
||||
}
|
||||
}
|
||||
|
||||
if (this.state.missingPatches[id] !== undefined) {
|
||||
return
|
||||
}
|
||||
|
||||
this.setState({
|
||||
missingPatches: {
|
||||
...this.state.missingPatches,
|
||||
[id]: 0
|
||||
}
|
||||
})
|
||||
|
||||
this._refreshHostMissingPatches(host)
|
||||
})
|
||||
componentWillUnmount () {
|
||||
this.unsubscribeMissingPatches()
|
||||
}
|
||||
|
||||
render () {
|
||||
const {
|
||||
buttonsGroupContainer,
|
||||
container,
|
||||
displayPools,
|
||||
pools,
|
||||
useTabButton
|
||||
} = this.props
|
||||
|
||||
const hosts = this._getHosts()
|
||||
const noPatches = isEmpty(hosts)
|
||||
const { props } = this
|
||||
|
||||
const Container = props.container || 'div'
|
||||
const Container = container || 'div'
|
||||
|
||||
const Button = this.props.useTabButton
|
||||
const Button = useTabButton
|
||||
? TabButton
|
||||
: ActionButton_
|
||||
|
||||
const Buttons = (
|
||||
<Container>
|
||||
<Button
|
||||
handler={this._refreshMissingPatches}
|
||||
icon='refresh'
|
||||
labelId='checkForUpdates'
|
||||
/>
|
||||
<Button
|
||||
btnStyle='primary'
|
||||
disabled={noPatches}
|
||||
handler={this._installAllMissingPatches}
|
||||
icon='host-patch-update'
|
||||
labelId='installPoolPatches'
|
||||
/>
|
||||
</Container>
|
||||
)
|
||||
|
||||
return (
|
||||
<div>
|
||||
{!noPatches
|
||||
? (
|
||||
<SortedTable
|
||||
collection={hosts}
|
||||
columns={props.displayPools ? POOLS_MISSING_PATCHES_COLUMNS : MISSING_PATCHES_COLUMNS}
|
||||
columns={displayPools ? POOLS_MISSING_PATCHES_COLUMNS : MISSING_PATCHES_COLUMNS}
|
||||
userData={{
|
||||
installAllHostPatches: this._installAllHostPatches,
|
||||
installAllHostPatches,
|
||||
missingPatches: this.state.missingPatches,
|
||||
pools: props.pools
|
||||
pools
|
||||
}}
|
||||
/>
|
||||
) : <p>{_('patchNothing')}</p>
|
||||
}
|
||||
<Portal container={() => props.buttonsGroupContainer()}>
|
||||
{Buttons}
|
||||
<Portal container={() => buttonsGroupContainer()}>
|
||||
<Container>
|
||||
<Button
|
||||
btnStyle='primary'
|
||||
disabled={noPatches}
|
||||
handler={this._installAllMissingPatches}
|
||||
icon='host-patch-update'
|
||||
labelId='installPoolPatches'
|
||||
/>
|
||||
</Container>
|
||||
</Portal>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -627,7 +627,7 @@ export default {
|
||||
editBackupReportTitle: undefined,
|
||||
|
||||
// Original text: 'Enable immediately after creation'
|
||||
editBackupReportEnable: undefined,
|
||||
editBackupScheduleEnabled: undefined,
|
||||
|
||||
// Original text: 'Depth'
|
||||
editBackupDepthTitle: undefined,
|
||||
|
||||
@@ -630,7 +630,7 @@ export default {
|
||||
editBackupReportTitle: 'Rapport',
|
||||
|
||||
// Original text: "Enable immediately after creation"
|
||||
editBackupReportEnable: 'Activer aussitôt après la création',
|
||||
editBackupScheduleEnabled: 'Executer en fonction de la planification',
|
||||
|
||||
// Original text: "Depth"
|
||||
editBackupDepthTitle: 'Profondeur',
|
||||
|
||||
@@ -627,7 +627,7 @@ export default {
|
||||
editBackupReportTitle: undefined,
|
||||
|
||||
// Original text: 'Enable immediately after creation'
|
||||
editBackupReportEnable: undefined,
|
||||
editBackupScheduleEnabled: undefined,
|
||||
|
||||
// Original text: 'Depth'
|
||||
editBackupDepthTitle: undefined,
|
||||
|
||||
@@ -726,7 +726,7 @@ export default {
|
||||
editBackupReportTitle: 'Riport',
|
||||
|
||||
// Original text: "Enable immediately after creation"
|
||||
editBackupReportEnable: 'Azonnal a létrehozás után',
|
||||
editBackupScheduleEnabled: 'Azonnal a létrehozás után',
|
||||
|
||||
// Original text: "Depth"
|
||||
editBackupDepthTitle: 'Mélység',
|
||||
|
||||
@@ -630,7 +630,7 @@ export default {
|
||||
editBackupReportTitle: 'Raport',
|
||||
|
||||
// Original text: "Enable immediately after creation"
|
||||
editBackupReportEnable: 'Uruchom natychamiast po utworzeniu',
|
||||
editBackupScheduleEnabled: 'Uruchom natychamiast po utworzeniu',
|
||||
|
||||
// Original text: "Depth"
|
||||
editBackupDepthTitle: 'Depth',
|
||||
|
||||
@@ -627,7 +627,7 @@ export default {
|
||||
editBackupReportTitle: undefined,
|
||||
|
||||
// Original text: 'Enable immediately after creation'
|
||||
editBackupReportEnable: undefined,
|
||||
editBackupScheduleEnabled: undefined,
|
||||
|
||||
// Original text: 'Depth'
|
||||
editBackupDepthTitle: undefined,
|
||||
|
||||
@@ -18,15 +18,16 @@ var messages = {
|
||||
// ----- Modals -----
|
||||
alertOk: 'OK',
|
||||
confirmOk: 'OK',
|
||||
confirmCancel: 'Cancel',
|
||||
genericCancel: 'Cancel',
|
||||
|
||||
// ----- Filters -----
|
||||
onError: 'On error',
|
||||
successful: 'Successful',
|
||||
filterNoSnapshots: 'Full disks only',
|
||||
filterOnlyBaseCopy: 'Base copy only',
|
||||
filterOnlyRegularDisks: 'Regular disks only',
|
||||
filterOnlySnapshots: 'Snapshots only',
|
||||
filterOnlyManaged: 'Managed disks',
|
||||
filterOnlyOrphaned: 'Orphaned disks',
|
||||
filterOnlyRegular: 'Normal disks',
|
||||
filterOnlySnapshots: 'Snapshot disks',
|
||||
filterOnlyUnmanaged: 'Unmanaged disks',
|
||||
|
||||
// ----- Copiable component -----
|
||||
copyToClipboard: 'Copy to clipboard',
|
||||
@@ -217,6 +218,11 @@ var messages = {
|
||||
cronPattern: 'Cron Pattern:',
|
||||
backupEditNotFoundTitle: 'Cannot edit backup',
|
||||
backupEditNotFoundMessage: 'Missing required info for edition',
|
||||
successfulJobCall: 'Successful',
|
||||
failedJobCall: 'Failed',
|
||||
jobCallInProgess: 'In progress',
|
||||
jobTransferredDataSize: 'size:',
|
||||
jobTransferredDataSpeed: 'speed:',
|
||||
job: 'Job',
|
||||
jobModalTitle: 'Job {job}',
|
||||
jobId: 'ID',
|
||||
@@ -275,9 +281,10 @@ var messages = {
|
||||
editBackupNot: 'Reverse',
|
||||
editBackupTagTitle: 'Tag',
|
||||
editBackupReportTitle: 'Report',
|
||||
editBackupReportEnable: 'Enable immediately after creation',
|
||||
editBackupScheduleEnabled: 'Automatically run as scheduled',
|
||||
editBackupDepthTitle: 'Depth',
|
||||
editBackupRemoteTitle: 'Remote',
|
||||
deleteOldBackupsFirst: 'Delete the old backups first',
|
||||
|
||||
// ------ New Remote -----
|
||||
remoteList: 'Remote stores for backup',
|
||||
@@ -491,6 +498,10 @@ var messages = {
|
||||
addSrLabel: 'Add SR',
|
||||
addVmLabel: 'Add VM',
|
||||
addHostLabel: 'Add Host',
|
||||
hostNeedsPatchUpdate: 'This host needs to install {patches, number} patch{patches, plural, one {} other {es}} before it can be added to the pool. This operation may be long.',
|
||||
hostNeedsPatchUpdateNoInstall: 'This host cannot be added to the pool because it\'s missing some patches.',
|
||||
addHostErrorTitle: 'Adding host failed',
|
||||
addHostNotHomogeneousErrorMessage: 'Host patches could not be homogenized.',
|
||||
disconnectServer: 'Disconnect',
|
||||
|
||||
// ----- Host actions ------
|
||||
@@ -597,10 +608,13 @@ var messages = {
|
||||
hostAppliedPatches: 'Applied patches',
|
||||
hostMissingPatches: 'Missing patches',
|
||||
hostUpToDate: 'Host up-to-date!',
|
||||
installPatchWarningTitle: 'Non-recommended patch install',
|
||||
installPatchWarningContent: 'This will install a patch only on this host. This is NOT the recommended way: please go into the Pool patch view and follow instructions there. If you are sure about this, you can continue anyway',
|
||||
installPatchWarningReject: 'Go to pool',
|
||||
installPatchWarningResolve: 'Install',
|
||||
// ----- Pool patch tabs -----
|
||||
refreshPatches: 'Refresh patches',
|
||||
installPoolPatches: 'Install pool patches',
|
||||
checkForUpdates: 'Check for updates',
|
||||
// ----- Pool storage tabs -----
|
||||
defaultSr: 'Default SR',
|
||||
setAsDefaultSr: 'Set as default SR',
|
||||
@@ -652,7 +666,6 @@ var messages = {
|
||||
copyToClipboardLabel: 'Copy',
|
||||
ctrlAltDelButtonLabel: 'Ctrl+Alt+Del',
|
||||
tipLabel: 'Tip:',
|
||||
tipConsoleLabel: 'Due to a XenServer issue, non-US keyboard layouts aren\'t well supported. Switch your own layout to US to workaround it.',
|
||||
hideHeaderTooltip: 'Hide infos',
|
||||
showHeaderTooltip: 'Show infos',
|
||||
|
||||
@@ -676,6 +689,8 @@ var messages = {
|
||||
vdiBootOrder: 'Boot order',
|
||||
vdiNameLabel: 'Name',
|
||||
vdiNameDescription: 'Description',
|
||||
vdiPool: 'Pool',
|
||||
vdiDisconnect: 'Disconnect',
|
||||
vdiTags: 'Tags',
|
||||
vdiSize: 'Size',
|
||||
vdiSr: 'SR',
|
||||
@@ -687,6 +702,7 @@ var messages = {
|
||||
vdiMigrateNoSrMessage: 'A target SR is required to migrate a VDI',
|
||||
vdiForget: 'Forget',
|
||||
vdiRemove: 'Remove VDI',
|
||||
noControlDomainVdis: 'No VDIs attached to Control Domain',
|
||||
vbdBootableStatus: 'Boot flag',
|
||||
vbdStatus: 'Status',
|
||||
vbdStatusConnected: 'Connected',
|
||||
@@ -853,6 +869,7 @@ var messages = {
|
||||
orphanedVms: 'Orphaned VMs snapshot',
|
||||
noOrphanedObject: 'No orphans',
|
||||
removeAllOrphanedObject: 'Remove all orphaned snapshot VDIs',
|
||||
vdisOnControlDomain: 'VDIs attached to Control Domain',
|
||||
vmNameLabel: 'Name',
|
||||
vmNameDescription: 'Description',
|
||||
vmContainer: 'Resident on',
|
||||
@@ -998,6 +1015,10 @@ var messages = {
|
||||
availableBackupsColumn: 'Available Backups',
|
||||
backupRestoreErrorTitle: 'Missing parameters',
|
||||
backupRestoreErrorMessage: 'Choose a SR and a backup',
|
||||
backupRestoreSelectDefaultSr: 'Select default SR…',
|
||||
backupRestoreChooseSrForEachVdis: 'Choose a SR for each VDI',
|
||||
backupRestoreVdiLabel: 'VDI',
|
||||
backupRestoreSrLabel: 'SR',
|
||||
displayBackup: 'Display backups',
|
||||
importBackupTitle: 'Import VM',
|
||||
importBackupMessage: 'Starting your backup import',
|
||||
@@ -1034,7 +1055,14 @@ var messages = {
|
||||
restartHostsModalTitle: 'Restart Host{nHosts, plural, one {} other {s}}',
|
||||
restartHostsModalMessage: 'Are you sure you want to restart {nHosts, number} Host{nHosts, plural, one {} other {s}}?',
|
||||
startVmsModalTitle: 'Start VM{vms, plural, one {} other {s}}',
|
||||
cloneAndStartVM: 'Start a copy',
|
||||
forceStartVm: 'Force start',
|
||||
forceStartVmModalTitle: 'Forbidden operation',
|
||||
blockedStartVmModalMessage: 'Start operation for this vm is blocked.',
|
||||
blockedStartVmsModalMessage: 'Forbidden operation start for {nVms, number} vm{nVms, plural, one {} other {s}}.',
|
||||
startVmsModalMessage: 'Are you sure you want to start {vms, number} VM{vms, plural, one {} other {s}}?',
|
||||
failedVmsErrorMessage: '{nVms, number} vm{nVms, plural, one {} other {s}} are failed. Please see your logs to get more information',
|
||||
failedVmsErrorTitle: 'Start failed',
|
||||
stopHostsModalTitle: 'Stop Host{nHosts, plural, one {} other {s}}',
|
||||
stopHostsModalMessage: 'Are you sure you want to stop {nHosts, number} Host{nHosts, plural, one {} other {s}}?',
|
||||
stopVmsModalTitle: 'Stop VM{vms, plural, one {} other {s}}',
|
||||
@@ -1054,18 +1082,22 @@ var messages = {
|
||||
migrateVmModalTitle: 'Migrate VM',
|
||||
migrateVmSelectHost: 'Select a destination host:',
|
||||
migrateVmSelectMigrationNetwork: 'Select a migration network:',
|
||||
migrateVmSelectSrs: 'For each VDI, select an SR:',
|
||||
migrateVmSelectNetworks: 'For each VIF, select a network:',
|
||||
migrateVmsSelectSr: 'Select a destination SR:',
|
||||
migrateVmsSelectSrIntraPool: 'Select a destination SR for local disks:',
|
||||
migrateVmsSelectNetwork: 'Select a network on which to connect each VIF:',
|
||||
migrateVmsSmartMapping: 'Smart mapping',
|
||||
migrateVmName: 'Name',
|
||||
migrateVmSr: 'SR',
|
||||
migrateVmVif: 'VIF',
|
||||
migrateVmNetwork: 'Network',
|
||||
migrateVmNoTargetHost: 'No target host',
|
||||
migrateVmNoTargetHostMessage: 'A target host is required to migrate a VM',
|
||||
migrateVmNoDefaultSrError: 'No default SR',
|
||||
migrateVmNotConnectedDefaultSrError: 'Default SR not connected to host',
|
||||
chooseSrForEachVdisModalSelectSr: 'For each VDI, select an SR:',
|
||||
chooseSrForEachVdisModalMainSr: 'Select main SR…',
|
||||
chooseSrForEachVdisModalVdiLabel: 'VDI',
|
||||
chooseSrForEachVdisModalSrLabel: 'SR*',
|
||||
chooseSrForEachVdisModalOptionalEntry: '* optional',
|
||||
deleteVdiModalTitle: 'Delete VDI',
|
||||
deleteVdiModalMessage: 'Are you sure you want to delete this disk? ALL DATA ON THIS DISK WILL BE LOST',
|
||||
revertVmModalTitle: 'Revert your VM',
|
||||
@@ -1134,6 +1166,11 @@ var messages = {
|
||||
detachHostModalMessage: 'Are you sure you want to detach {host} from its pool? THIS WILL REMOVE ALL VMs ON ITS LOCAL STORAGE AND REBOOT THE HOST.',
|
||||
detachHost: 'Detach',
|
||||
|
||||
// ----- Forget host -----
|
||||
forgetHostModalTitle: 'Forget host',
|
||||
forgetHostModalMessage: 'Are you sure you want to forget {host} from its pool? Be sure this host can\'t be back online, or use detach instead.',
|
||||
forgetHost: 'Forget',
|
||||
|
||||
// ----- Network -----
|
||||
newNetworkCreate: 'Create network',
|
||||
newBondedNetworkCreate: 'Create bonded network',
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import React from 'react'
|
||||
|
||||
import uncontrollableInput from 'uncontrollable-input'
|
||||
|
||||
import Combobox from '../combobox'
|
||||
import Component from '../base-component'
|
||||
import getEventValue from '../get-event-value'
|
||||
import propTypes from '../prop-types-decorator'
|
||||
|
||||
import { PrimitiveInputWrapper } from './helpers'
|
||||
@@ -14,23 +15,30 @@ import { PrimitiveInputWrapper } from './helpers'
|
||||
})
|
||||
@uncontrollableInput()
|
||||
export default class StringInput extends Component {
|
||||
// the value of this input is undefined not '' when empty to make
|
||||
// it homogenous with when the user has never touched this input
|
||||
_onChange = event => {
|
||||
const value = getEventValue(event)
|
||||
this.props.onChange(value !== '' ? value : undefined)
|
||||
}
|
||||
|
||||
render () {
|
||||
const { required, schema } = this.props
|
||||
const {
|
||||
disabled,
|
||||
onChange,
|
||||
password,
|
||||
placeholder = schema.default,
|
||||
value,
|
||||
...props
|
||||
} = this.props
|
||||
delete props.onChange
|
||||
|
||||
return (
|
||||
<PrimitiveInputWrapper {...props}>
|
||||
<Combobox
|
||||
value={value || ''}
|
||||
value={value !== undefined ? value : ''}
|
||||
disabled={disabled}
|
||||
onChange={onChange}
|
||||
onChange={this._onChange}
|
||||
options={schema.defaults}
|
||||
placeholder={placeholder || schema.default}
|
||||
required={required}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import isArray from 'lodash/isArray'
|
||||
import isString from 'lodash/isString'
|
||||
import map from 'lodash/map'
|
||||
import React, { Component, cloneElement } from 'react'
|
||||
import { Modal as ReactModal } from 'react-bootstrap-4/lib'
|
||||
|
||||
@@ -7,6 +8,7 @@ import _ from './intl'
|
||||
import Button from './button'
|
||||
import Icon from './icon'
|
||||
import propTypes from './prop-types-decorator'
|
||||
import Tooltip from './tooltip'
|
||||
import {
|
||||
disable as disableShortcuts,
|
||||
enable as enableShortcuts
|
||||
@@ -23,54 +25,33 @@ const modal = (content, onClose) => {
|
||||
instance.setState({ content, onClose, showModal: true }, disableShortcuts)
|
||||
}
|
||||
|
||||
export const alert = (title, body) => {
|
||||
return new Promise(resolve => {
|
||||
const { Body, Footer, Header, Title } = ReactModal
|
||||
modal(
|
||||
<div>
|
||||
<Header closeButton>
|
||||
<Title>{title}</Title>
|
||||
</Header>
|
||||
<Body>{body}</Body>
|
||||
<Footer>
|
||||
<Button bsStyle='primary' onClick={() => {
|
||||
resolve()
|
||||
instance.close()
|
||||
}}>
|
||||
{_('alertOk')}
|
||||
</Button>
|
||||
</Footer>
|
||||
</div>,
|
||||
resolve
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
const _addRef = (component, ref) => {
|
||||
if (isString(component) || isArray(component)) {
|
||||
return component
|
||||
@propTypes({
|
||||
buttons: propTypes.arrayOf(propTypes.shape({
|
||||
btnStyle: propTypes.string,
|
||||
icon: propTypes.string,
|
||||
label: propTypes.string.isRequired,
|
||||
tooltip: propTypes.node,
|
||||
value: propTypes.any
|
||||
})).isRequired,
|
||||
children: propTypes.node.isRequired,
|
||||
icon: propTypes.string,
|
||||
title: propTypes.node.isRequired
|
||||
})
|
||||
class GenericModal extends Component {
|
||||
_getBodyValue = () => {
|
||||
const { body } = this.refs
|
||||
if (body !== undefined) {
|
||||
return body.getWrappedInstance === undefined
|
||||
? body.value
|
||||
: body.getWrappedInstance().value
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
return cloneElement(component, { ref })
|
||||
} catch (_) {} // Stateless component.
|
||||
return component
|
||||
}
|
||||
|
||||
@propTypes({
|
||||
children: propTypes.node.isRequired,
|
||||
title: propTypes.node.isRequired,
|
||||
icon: propTypes.string
|
||||
})
|
||||
class Confirm extends Component {
|
||||
_resolve = () => {
|
||||
const { body } = this.refs
|
||||
this.props.resolve(body && (body.getWrappedInstance
|
||||
? body.getWrappedInstance().value
|
||||
: body.value
|
||||
))
|
||||
_resolve = (value = this._getBodyValue()) => {
|
||||
this.props.resolve(value)
|
||||
instance.close()
|
||||
}
|
||||
|
||||
_reject = () => {
|
||||
this.props.reject()
|
||||
instance.close()
|
||||
@@ -78,7 +59,12 @@ class Confirm extends Component {
|
||||
|
||||
render () {
|
||||
const { Body, Footer, Header, Title } = ReactModal
|
||||
const { title, icon } = this.props
|
||||
|
||||
const {
|
||||
buttons,
|
||||
icon,
|
||||
title
|
||||
} = this.props
|
||||
|
||||
const body = _addRef(this.props.children, 'body')
|
||||
|
||||
@@ -95,39 +81,99 @@ class Confirm extends Component {
|
||||
{body}
|
||||
</Body>
|
||||
<Footer>
|
||||
<Button
|
||||
btnStyle='primary'
|
||||
onClick={this._resolve}
|
||||
style={this._style}
|
||||
>
|
||||
{_('confirmOk')}
|
||||
</Button>
|
||||
{' '}
|
||||
<Button
|
||||
onClick={this._reject}
|
||||
>
|
||||
{_('confirmCancel')}
|
||||
</Button>
|
||||
{map(buttons, ({
|
||||
label,
|
||||
tooltip,
|
||||
value,
|
||||
icon,
|
||||
...props
|
||||
}) => {
|
||||
const button = <Button
|
||||
onClick={() => this._resolve(value)}
|
||||
key={value}
|
||||
{...props}
|
||||
>
|
||||
{icon !== undefined && <Icon icon={icon} fixedWidth />}
|
||||
{label}
|
||||
</Button>
|
||||
return <span>
|
||||
{tooltip !== undefined
|
||||
? <Tooltip content={tooltip}>{button}</Tooltip>
|
||||
: button
|
||||
}
|
||||
{' '}
|
||||
</span>
|
||||
})}
|
||||
{this.props.reject !== undefined &&
|
||||
<Button onClick={this._reject} >
|
||||
{_('genericCancel')}
|
||||
</Button>
|
||||
}
|
||||
</Footer>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
const ALERT_BUTTONS = [ { label: _('alertOk'), value: 'ok' } ]
|
||||
|
||||
export const alert = (title, body) => (
|
||||
new Promise(resolve => {
|
||||
modal(
|
||||
<GenericModal
|
||||
buttons={ALERT_BUTTONS}
|
||||
resolve={resolve}
|
||||
title={title}
|
||||
>
|
||||
{body}
|
||||
</GenericModal>,
|
||||
resolve
|
||||
)
|
||||
})
|
||||
)
|
||||
|
||||
const _addRef = (component, ref) => {
|
||||
if (isString(component) || isArray(component)) {
|
||||
return component
|
||||
}
|
||||
|
||||
try {
|
||||
return cloneElement(component, { ref })
|
||||
} catch (_) {} // Stateless component.
|
||||
return component
|
||||
}
|
||||
|
||||
const CONFIRM_BUTTONS = [ { btnStyle: 'primary', label: _('confirmOk') } ]
|
||||
|
||||
export const confirm = ({
|
||||
body,
|
||||
title,
|
||||
icon = 'alarm'
|
||||
icon = 'alarm',
|
||||
title
|
||||
}) => (
|
||||
chooseAction({
|
||||
body,
|
||||
buttons: CONFIRM_BUTTONS,
|
||||
icon,
|
||||
title
|
||||
})
|
||||
)
|
||||
|
||||
export const chooseAction = ({
|
||||
body,
|
||||
buttons,
|
||||
icon,
|
||||
title
|
||||
}) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
modal(
|
||||
<Confirm
|
||||
title={title}
|
||||
resolve={resolve}
|
||||
reject={reject}
|
||||
<GenericModal
|
||||
buttons={buttons}
|
||||
icon={icon}
|
||||
reject={reject}
|
||||
resolve={resolve}
|
||||
title={title}
|
||||
>
|
||||
{body}
|
||||
</Confirm>,
|
||||
</GenericModal>,
|
||||
reject
|
||||
)
|
||||
})
|
||||
|
||||
16
src/common/react-novnc.js
vendored
16
src/common/react-novnc.js
vendored
@@ -1,8 +1,7 @@
|
||||
import React, { Component } from 'react'
|
||||
import RFB from '@nraynaud/novnc/lib/rfb'
|
||||
import { createBackoff } from 'jsonrpc-websocket-client'
|
||||
import { RFB } from 'novnc-node'
|
||||
import {
|
||||
format as formatUrl,
|
||||
parse as parseUrl,
|
||||
resolve as resolveUrl
|
||||
} from 'url'
|
||||
@@ -91,14 +90,23 @@ export default class NoVnc extends Component {
|
||||
const rfb = this._rfb = new RFB({
|
||||
encrypt: isSecure,
|
||||
target: this.refs.canvas,
|
||||
wsProtocols: [ 'chat' ],
|
||||
onClipboard: onClipboardChange && ((_, text) => {
|
||||
onClipboardChange(text)
|
||||
}),
|
||||
onUpdateState: this._onUpdateState
|
||||
})
|
||||
|
||||
rfb.connect(formatUrl(url))
|
||||
// remove leading slashes from the path
|
||||
//
|
||||
// a leading slassh will be added by noVNC
|
||||
const clippedPath = url.path.replace(/^\/+/, '')
|
||||
|
||||
// a port is required
|
||||
//
|
||||
// if not available from the URL, use the default ones
|
||||
const { port = isSecure ? 443 : 80 } = url
|
||||
|
||||
rfb.connect(url.hostname, url, null, clippedPath)
|
||||
disableShortcuts()
|
||||
}
|
||||
|
||||
|
||||
@@ -222,7 +222,9 @@ const GenericXoItem = connectStore(() => {
|
||||
})
|
||||
})(({ xoItem, ...props }) => xoItem
|
||||
? renderXoItem(xoItem, props)
|
||||
: <span className='text-muted'>{_('errorNoSuchItem')}</span>
|
||||
: renderXoUnknownItem()
|
||||
)
|
||||
|
||||
export const renderXoItemFromId = (id, props) => <GenericXoItem {...props} id={id} />
|
||||
|
||||
export const renderXoUnknownItem = () => <span className='text-muted'>{_('errorNoSuchItem')}</span>
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
import add from 'lodash/add'
|
||||
import checkPermissions from 'xo-acl-resolver'
|
||||
import filter from 'lodash/filter'
|
||||
import find from 'lodash/find'
|
||||
import forEach from 'lodash/forEach'
|
||||
import groupBy from 'lodash/groupBy'
|
||||
import isArray from 'lodash/isArray'
|
||||
import isArrayLike from 'lodash/isArrayLike'
|
||||
import isFunction from 'lodash/isFunction'
|
||||
import keys from 'lodash/keys'
|
||||
import map from 'lodash/map'
|
||||
import orderBy from 'lodash/orderBy'
|
||||
import pickBy from 'lodash/pickBy'
|
||||
import size from 'lodash/size'
|
||||
import slice from 'lodash/slice'
|
||||
import { createSelector as create } from 'reselect'
|
||||
import {
|
||||
filter,
|
||||
find,
|
||||
forEach,
|
||||
groupBy,
|
||||
isArray,
|
||||
isArrayLike,
|
||||
isFunction,
|
||||
keys,
|
||||
map,
|
||||
orderBy,
|
||||
pickBy,
|
||||
size,
|
||||
slice
|
||||
} from 'lodash'
|
||||
|
||||
import invoke from './invoke'
|
||||
import shallowEqual from './shallow-equal'
|
||||
@@ -126,9 +129,9 @@ export const createCounter = (collection, predicate) =>
|
||||
//
|
||||
// Should only be used with a reasonable number of properties.
|
||||
export const createPicker = (object, props) =>
|
||||
_createCollectionWrapper(
|
||||
_create2(
|
||||
object, props,
|
||||
_create2(
|
||||
object, props,
|
||||
_createCollectionWrapper(
|
||||
(object, props) => {
|
||||
const values = {}
|
||||
forEach(props, prop => {
|
||||
@@ -191,6 +194,13 @@ export const createSort = (
|
||||
order = 'asc'
|
||||
) => _create2(collection, getter, order, orderBy)
|
||||
|
||||
export const createSumBy = (itemsSelector, iterateeSelector) =>
|
||||
_create2(
|
||||
itemsSelector,
|
||||
iterateeSelector,
|
||||
(items, iteratee) => map(items, iteratee).reduce(add, 0)
|
||||
)
|
||||
|
||||
export const createTop = (collection, iteratee, n) =>
|
||||
_create2(
|
||||
collection,
|
||||
@@ -481,9 +491,10 @@ export const createGetObjectMessages = objectSelector =>
|
||||
export const getObject = createGetObject((_, id) => id)
|
||||
|
||||
export const createDoesHostNeedRestart = hostSelector => {
|
||||
// Returns the first patch of the host which requires it to be
|
||||
// restarted.
|
||||
const restartPoolPatch = createGetObjectsOfType('pool_patch').pick(
|
||||
// XS < 7.1
|
||||
const patchRequiresReboot = createGetObjectsOfType('pool_patch').pick(
|
||||
// Returns the first patch of the host which requires it to be
|
||||
// restarted.
|
||||
create(
|
||||
createGetObjectsOfType('host_patch').pick(
|
||||
(state, props) => {
|
||||
@@ -503,7 +514,11 @@ export const createDoesHostNeedRestart = hostSelector => {
|
||||
action === 'restartHost' || action === 'restartXapi'
|
||||
) ])
|
||||
|
||||
return (state, props) => restartPoolPatch(state, props) !== undefined
|
||||
return create(
|
||||
hostSelector,
|
||||
(...args) => args,
|
||||
(host, args) => host.rebootRequired || !!patchRequiresReboot(...args)
|
||||
)
|
||||
}
|
||||
|
||||
export const createGetHostMetrics = hostSelector =>
|
||||
@@ -527,3 +542,17 @@ export const createGetHostMetrics = hostSelector =>
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
export const createGetVmDisks = vmSelector =>
|
||||
createGetObjectsOfType('VDI').pick(
|
||||
create(
|
||||
createGetObjectsOfType('VBD').pick(
|
||||
(state, props) => vmSelector(state, props).$VBDs
|
||||
),
|
||||
_createCollectionWrapper(vbds => map(vbds, vbd =>
|
||||
vbd.is_cd_drive
|
||||
? undefined
|
||||
: vbd.VDI
|
||||
))
|
||||
)
|
||||
)
|
||||
|
||||
@@ -33,6 +33,7 @@ import styles from './index.css'
|
||||
// ===================================================================
|
||||
|
||||
@propTypes({
|
||||
defaultFilter: propTypes.string,
|
||||
filters: propTypes.object,
|
||||
nFilteredItems: propTypes.number.isRequired,
|
||||
nItems: propTypes.number.isRequired,
|
||||
@@ -75,10 +76,10 @@ class TableFilter extends Component {
|
||||
</Dropdown>
|
||||
</div>}
|
||||
<input
|
||||
type='text'
|
||||
ref='filter'
|
||||
onChange={this._onChange}
|
||||
className='form-control'
|
||||
defaultValue={props.defaultFilter}
|
||||
onChange={this._onChange}
|
||||
ref='filter'
|
||||
/>
|
||||
<div className='input-group-btn'>
|
||||
<Button onClick={this._cleanFilter}>
|
||||
@@ -137,14 +138,16 @@ const DEFAULT_ITEMS_PER_PAGE = 10
|
||||
|
||||
@propTypes({
|
||||
defaultColumn: propTypes.number,
|
||||
defaultFilter: propTypes.string,
|
||||
collection: propTypes.oneOfType([
|
||||
propTypes.array,
|
||||
propTypes.object
|
||||
]).isRequired,
|
||||
columns: propTypes.arrayOf(propTypes.shape({
|
||||
component: propTypes.func,
|
||||
default: propTypes.bool,
|
||||
name: propTypes.node,
|
||||
itemRenderer: propTypes.func.isRequired,
|
||||
itemRenderer: propTypes.func,
|
||||
sortCriteria: propTypes.oneOfType([
|
||||
propTypes.func,
|
||||
propTypes.string
|
||||
@@ -176,7 +179,10 @@ export default class SortedTable extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
const { defaultFilter } = props
|
||||
|
||||
this.state = {
|
||||
filter: defaultFilter !== undefined ? props.filters[defaultFilter] : undefined,
|
||||
selectedColumn,
|
||||
itemsPerPage: props.itemsPerPage || DEFAULT_ITEMS_PER_PAGE
|
||||
}
|
||||
@@ -192,7 +198,7 @@ export default class SortedTable extends Component {
|
||||
createFilter(
|
||||
() => this.props.collection,
|
||||
createSelector(
|
||||
() => this.state.filter || '',
|
||||
() => this.state.filter,
|
||||
createMatcher
|
||||
)
|
||||
),
|
||||
@@ -291,6 +297,7 @@ export default class SortedTable extends Component {
|
||||
|
||||
const filterInstance = (
|
||||
<TableFilter
|
||||
defaultFilter={state.filter}
|
||||
filters={filters}
|
||||
nFilteredItems={nFilteredItems}
|
||||
nItems={this._getTotalNumberOfItems()}
|
||||
@@ -318,11 +325,21 @@ export default class SortedTable extends Component {
|
||||
</thead>
|
||||
<tbody>
|
||||
{map(this._getVisibleItems(), (item, i) => {
|
||||
const columns = map(props.columns, (column, key) => (
|
||||
<td key={key} className={column.textAlign && `text-xs-${column.textAlign}`}>
|
||||
{column.itemRenderer(item, userData)}
|
||||
const columns = map(props.columns, ({
|
||||
component: Component,
|
||||
itemRenderer,
|
||||
textAlign
|
||||
}, key) =>
|
||||
<td
|
||||
className={textAlign && `text-xs-${textAlign}`}
|
||||
key={key}
|
||||
>
|
||||
{Component !== undefined
|
||||
? <Component item={item} userData={userData} />
|
||||
: itemRenderer(item, userData)
|
||||
}
|
||||
</td>
|
||||
))
|
||||
)
|
||||
|
||||
const { id = i } = item
|
||||
|
||||
|
||||
@@ -5,25 +5,28 @@ import ActionButton from './action-button'
|
||||
import propTypes from './prop-types-decorator'
|
||||
|
||||
const Button = styled(ActionButton)`
|
||||
background-color: ${p => p.theme[`${p.state ? 'enabled' : 'disabled'}StateBg`]}
|
||||
border: 2px solid ${p => p.theme[`${p.state ? 'enabled' : 'disabled'}StateColor`]}
|
||||
color: ${p => p.theme[`${p.state ? 'enabled' : 'disabled'}StateColor`]}
|
||||
background-color: ${p => p.theme[`${p.state ? 'enabled' : 'disabled'}StateBg`]};
|
||||
border: 2px solid ${p => p.theme[`${p.state ? 'enabled' : 'disabled'}StateColor`]};
|
||||
color: ${p => p.theme[`${p.state ? 'enabled' : 'disabled'}StateColor`]};
|
||||
`
|
||||
|
||||
const StateButton = ({
|
||||
disabledHandler,
|
||||
disabledHandlerParam,
|
||||
disabledLabel,
|
||||
disabledTooltip,
|
||||
|
||||
enabledLabel,
|
||||
enabledTooltip,
|
||||
enabledHandler,
|
||||
enabledHandlerParam,
|
||||
|
||||
state,
|
||||
...props
|
||||
}) =>
|
||||
<Button
|
||||
handler={state ? enabledHandler : disabledHandler}
|
||||
handlerParam={state ? enabledHandlerParam : disabledHandlerParam}
|
||||
tooltip={state ? enabledTooltip : disabledTooltip}
|
||||
{...props}
|
||||
icon={state ? 'running' : 'halted'}
|
||||
|
||||
@@ -190,7 +190,7 @@ export { default as Debug } from './debug'
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// Returns the first defined (non-null, non-undefined) value.
|
||||
// Returns the first defined (non-undefined) value.
|
||||
export const firstDefined = function () {
|
||||
const n = arguments.length
|
||||
for (let i = 0; i < n; ++i) {
|
||||
@@ -268,6 +268,11 @@ export const formatSize = bytes => humanFormat(bytes, { scale: 'binary', unit: '
|
||||
|
||||
export const formatSizeRaw = bytes => humanFormat.raw(bytes, { scale: 'binary', unit: 'B' })
|
||||
|
||||
export const formatSpeed = (bytes, milliseconds) => humanFormat(
|
||||
bytes * 1e3 / milliseconds,
|
||||
{ scale: 'binary', unit: 'B/s' }
|
||||
)
|
||||
|
||||
export const parseSize = size => {
|
||||
let bytes = humanFormat.parse.raw(size, { scale: 'binary' })
|
||||
if (bytes.unit && bytes.unit !== 'B') {
|
||||
@@ -359,20 +364,6 @@ export const throwFn = error => () => {
|
||||
)
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
export function tap (cb) {
|
||||
return this.then(value =>
|
||||
Promise.resolve(cb(value)).then(() => value)
|
||||
)
|
||||
}
|
||||
|
||||
export function rethrow (cb) {
|
||||
return this.catch(error =>
|
||||
Promise.resolve(cb(error)).then(() => { throw error })
|
||||
)
|
||||
}
|
||||
|
||||
// ===================================================================
|
||||
|
||||
export const resolveResourceSet = resourceSet => {
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
import _ from 'intl'
|
||||
import BaseComponent from 'base-component'
|
||||
import Icon from 'icon'
|
||||
import React from 'react'
|
||||
import SingleLineRow from 'single-line-row'
|
||||
import { Col } from 'grid'
|
||||
import { connectStore } from 'utils'
|
||||
import { createCollectionWrapper, createGetObjectsOfType, createSelector } from 'selectors'
|
||||
import { forEach } from 'lodash'
|
||||
import { createCollectionWrapper, createGetObjectsOfType, createSelector, createGetObject } from 'selectors'
|
||||
import { SelectHost } from 'select-objects'
|
||||
import {
|
||||
differenceBy,
|
||||
forEach
|
||||
} from 'lodash'
|
||||
|
||||
@connectStore(() => ({
|
||||
singleHosts: createSelector(
|
||||
@@ -30,10 +34,20 @@ import { SelectHost } from 'select-objects'
|
||||
})
|
||||
return singleHosts
|
||||
})
|
||||
),
|
||||
poolMasterPatches: createSelector(
|
||||
createGetObject(
|
||||
(_, props) => props.pool.master
|
||||
),
|
||||
({ patches }) => patches
|
||||
)
|
||||
}), { withRef: true })
|
||||
export default class AddHostModal extends BaseComponent {
|
||||
get value () {
|
||||
if (process.env.XOA_PLAN < 2 && this.state.nMissingPatches) {
|
||||
return {}
|
||||
}
|
||||
|
||||
return this.state
|
||||
}
|
||||
|
||||
@@ -42,18 +56,40 @@ export default class AddHostModal extends BaseComponent {
|
||||
singleHosts => host => singleHosts[host.id]
|
||||
)
|
||||
|
||||
_onChangeHost = host => {
|
||||
this.setState({
|
||||
host,
|
||||
nMissingPatches: host
|
||||
? differenceBy(this.props.poolMasterPatches, host.patches, 'name').length
|
||||
: undefined
|
||||
})
|
||||
}
|
||||
|
||||
render () {
|
||||
const { nMissingPatches } = this.state
|
||||
|
||||
return <div>
|
||||
<SingleLineRow>
|
||||
<Col size={6}>{_('addHostSelectHost')}</Col>
|
||||
<Col size={6}>
|
||||
<SelectHost
|
||||
onChange={this.linkState('host')}
|
||||
onChange={this._onChangeHost}
|
||||
predicate={this._getHostPredicate()}
|
||||
value={this.state.host}
|
||||
/>
|
||||
</Col>
|
||||
</SingleLineRow>
|
||||
<br />
|
||||
{nMissingPatches > 0 && <SingleLineRow>
|
||||
<Col>
|
||||
<span className='text-danger'>
|
||||
<Icon icon='error' /> {process.env.XOA_PLAN > 1
|
||||
? _('hostNeedsPatchUpdate', { patches: nMissingPatches })
|
||||
: _('hostNeedsPatchUpdateNoInstall')
|
||||
}
|
||||
</span>
|
||||
</Col>
|
||||
</SingleLineRow>}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
139
src/common/xo/choose-sr-for-each-vdis-modal/index.js
Normal file
139
src/common/xo/choose-sr-for-each-vdis-modal/index.js
Normal file
@@ -0,0 +1,139 @@
|
||||
import Collapse from 'collapse'
|
||||
import Component from 'base-component'
|
||||
import React from 'react'
|
||||
import { every, forEach, map } from 'lodash'
|
||||
|
||||
import _ from '../../intl'
|
||||
import propTypes from '../../prop-types-decorator'
|
||||
import SingleLineRow from '../../single-line-row'
|
||||
import { createSelector } from '../../selectors'
|
||||
import { SelectSr } from '../../select-objects'
|
||||
import { isSrWritable } from 'xo'
|
||||
import {
|
||||
Container,
|
||||
Col
|
||||
} from 'grid'
|
||||
|
||||
// Can 2 SRs on the same pool have 2 VDIs used by the same VM
|
||||
const areSrsCompatible = (sr1, sr2) =>
|
||||
sr1.shared || sr2.shared || sr1.$container === sr2.$container
|
||||
|
||||
const Collapsible = ({collapsible, children, ...props}) => collapsible
|
||||
? <Collapse {...props}>{children}</Collapse>
|
||||
: <div>
|
||||
<span>{props.buttonText}</span>
|
||||
<br />
|
||||
{children}
|
||||
</div>
|
||||
|
||||
Collapsible.propTypes = {
|
||||
collapsible: propTypes.bool.isRequired,
|
||||
children: propTypes.node.isRequired
|
||||
}
|
||||
|
||||
@propTypes({
|
||||
vdis: propTypes.array.isRequired,
|
||||
predicate: propTypes.func
|
||||
})
|
||||
export default class ChooseSrForEachVdisModal extends Component {
|
||||
state = {
|
||||
mapVdisSrs: {}
|
||||
}
|
||||
|
||||
componentWillReceiveProps (newProps) {
|
||||
if (
|
||||
this.props.predicate !== undefined &&
|
||||
newProps.predicate !== this.props.predicate
|
||||
) {
|
||||
this.state = {
|
||||
mainSr: undefined,
|
||||
mapVdisSrs: {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_onChange = props => {
|
||||
this.setState(props)
|
||||
this.props.onChange(props)
|
||||
}
|
||||
|
||||
_onChangeMainSr = newSr => {
|
||||
const oldSr = this.state.mainSr
|
||||
|
||||
if (oldSr == null || newSr == null || oldSr.$pool !== newSr.$pool) {
|
||||
this.setState({
|
||||
mapVdisSrs: {}
|
||||
})
|
||||
} else if (!newSr.shared) {
|
||||
const mapVdisSrs = {...this.state.mapVdisSrs}
|
||||
forEach(mapVdisSrs, (sr, vdi) => {
|
||||
if (sr != null && newSr !== sr && sr.$container !== newSr.$container && !sr.shared) {
|
||||
delete mapVdisSrs[vdi]
|
||||
}
|
||||
})
|
||||
this._onChange({mapVdisSrs})
|
||||
}
|
||||
|
||||
this._onChange({
|
||||
mainSr: newSr
|
||||
})
|
||||
}
|
||||
|
||||
_getSrPredicate = createSelector(
|
||||
() => this.state.mainSr,
|
||||
() => this.state.mapVdisSrs,
|
||||
(mainSr, mapVdisSrs) => sr =>
|
||||
isSrWritable(sr) &&
|
||||
mainSr.$pool === sr.$pool &&
|
||||
areSrsCompatible(mainSr, sr) &&
|
||||
every(mapVdisSrs, selectedSr => selectedSr == null || areSrsCompatible(selectedSr, sr))
|
||||
)
|
||||
|
||||
render () {
|
||||
const { props, state } = this
|
||||
const { vdis } = props
|
||||
const {
|
||||
mainSr,
|
||||
mapVdisSrs
|
||||
} = state
|
||||
|
||||
const srPredicate = props.predicate || this._getSrPredicate()
|
||||
|
||||
return <div>
|
||||
<SelectSr
|
||||
onChange={mainSr => props.predicate !== undefined
|
||||
? this._onChange({mainSr})
|
||||
: this._onChangeMainSr(mainSr)
|
||||
}
|
||||
predicate={props.predicate || isSrWritable}
|
||||
placeholder={_('chooseSrForEachVdisModalMainSr')}
|
||||
value={mainSr}
|
||||
/>
|
||||
<br />
|
||||
{vdis != null && mainSr != null &&
|
||||
<Collapsible collapsible={vdis.length >= 3} buttonText={_('chooseSrForEachVdisModalSelectSr')}>
|
||||
<br />
|
||||
<Container>
|
||||
<SingleLineRow>
|
||||
<Col size={6}><strong>{_('chooseSrForEachVdisModalVdiLabel')}</strong></Col>
|
||||
<Col size={6}><strong>{_('chooseSrForEachVdisModalSrLabel')}</strong></Col>
|
||||
</SingleLineRow>
|
||||
{map(vdis, vdi =>
|
||||
<SingleLineRow key={vdi.uuid}>
|
||||
<Col size={6}>{ vdi.name_label || vdi.name }</Col>
|
||||
<Col size={6}>
|
||||
<SelectSr
|
||||
onChange={sr => this._onChange({ mapVdisSrs: { ...mapVdisSrs, [vdi.uuid]: sr } })}
|
||||
value={mapVdisSrs[vdi.uuid]}
|
||||
predicate={srPredicate}
|
||||
/>
|
||||
</Col>
|
||||
</SingleLineRow>
|
||||
)}
|
||||
<i>{_('chooseSrForEachVdisModalOptionalEntry')}</i>
|
||||
</Container>
|
||||
</Collapsible>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
@@ -15,16 +15,18 @@ import sortBy from 'lodash/sortBy'
|
||||
import throttle from 'lodash/throttle'
|
||||
import Xo from 'xo-lib'
|
||||
import { createBackoff } from 'jsonrpc-websocket-client'
|
||||
import { lastly, reflect } from 'promise-toolbox'
|
||||
import { noHostsAvailable } from 'xo-common/api-errors'
|
||||
import { lastly, reflect, tap } from 'promise-toolbox'
|
||||
import { forbiddenOperation, noHostsAvailable } from 'xo-common/api-errors'
|
||||
import { resolve } from 'url'
|
||||
|
||||
import _ from '../intl'
|
||||
import invoke from '../invoke'
|
||||
import logError from '../log-error'
|
||||
import { alert, confirm } from '../modal'
|
||||
import store from 'store'
|
||||
import { getObject } from 'selectors'
|
||||
import { alert, chooseAction, confirm } from '../modal'
|
||||
import { error, info, success } from '../notification'
|
||||
import { noop, rethrow, tap, resolveId, resolveIds } from '../utils'
|
||||
import { noop, resolveId, resolveIds } from '../utils'
|
||||
import {
|
||||
connected,
|
||||
disconnected,
|
||||
@@ -46,7 +48,7 @@ export const XEN_VIDEORAM_VALUES = [1, 2, 4, 8, 16]
|
||||
// ===================================================================
|
||||
|
||||
export const isSrWritable = sr => sr && sr.content_type !== 'iso' && sr.size > 0
|
||||
export const isSrShared = sr => sr && sr.$PBDs.length > 1
|
||||
export const isSrShared = sr => sr && sr.shared
|
||||
export const isVmRunning = vm => vm && vm.power_state === 'Running'
|
||||
|
||||
// ===================================================================
|
||||
@@ -90,7 +92,7 @@ const _call = (method, params) => {
|
||||
let promise = _signIn.then(() => xo.call(method, params))
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
promise = promise::rethrow(error => {
|
||||
promise = promise::tap(null, error => {
|
||||
console.error('XO error', {
|
||||
method,
|
||||
params,
|
||||
@@ -284,6 +286,28 @@ export const subscribeIsInstallingXosan = (pool, cb) => {
|
||||
return xosanSubscriptions[poolId](cb)
|
||||
}
|
||||
|
||||
const missingPatchesByHost = {}
|
||||
export const subscribeHostMissingPatches = (host, cb) => {
|
||||
const hostId = resolveId(host)
|
||||
|
||||
if (missingPatchesByHost[hostId] == null) {
|
||||
missingPatchesByHost[hostId] = createSubscription(() => _call('host.listMissingPatches', { host: hostId }))
|
||||
}
|
||||
|
||||
return missingPatchesByHost[hostId](cb)
|
||||
}
|
||||
subscribeHostMissingPatches.forceRefresh = host => {
|
||||
if (host === undefined) {
|
||||
forEach(missingPatchesByHost, subscription => subscription.forceRefresh())
|
||||
return
|
||||
}
|
||||
|
||||
const subscription = missingPatchesByHost[resolveId(host)]
|
||||
if (subscription !== undefined) {
|
||||
subscription.forceRefresh()
|
||||
}
|
||||
}
|
||||
|
||||
// System ============================================================
|
||||
|
||||
export const apiMethods = _call('system.getMethodsInfo')
|
||||
@@ -312,8 +336,9 @@ export const exportConfig = () => (
|
||||
|
||||
export const addServer = (host, username, password, label) => (
|
||||
_call('server.add', { host, label, password, username })::tap(
|
||||
subscribeServers.forceRefresh
|
||||
)::rethrow(() => error(_('serverError'), _('serverAddFailed')))
|
||||
subscribeServers.forceRefresh,
|
||||
() => error(_('serverError'), _('serverAddFailed'))
|
||||
)
|
||||
)
|
||||
|
||||
export const editServer = (server, props) => (
|
||||
@@ -350,6 +375,7 @@ import AddHostModalBody from './add-host-modal' // eslint-disable-line import/fi
|
||||
export const addHostToPool = (pool, host) => {
|
||||
if (host) {
|
||||
return confirm({
|
||||
icon: 'add',
|
||||
title: _('addHostModalTitle'),
|
||||
body: _('addHostModalMessage', { pool: pool.name_label, host: host.name_label })
|
||||
}).then(() =>
|
||||
@@ -358,6 +384,7 @@ export const addHostToPool = (pool, host) => {
|
||||
}
|
||||
|
||||
return confirm({
|
||||
icon: 'add',
|
||||
title: _('addHostModalTitle'),
|
||||
body: <AddHostModalBody pool={pool} />
|
||||
}).then(
|
||||
@@ -366,7 +393,13 @@ export const addHostToPool = (pool, host) => {
|
||||
error(_('addHostNoHost'), _('addHostNoHostMessage'))
|
||||
return
|
||||
}
|
||||
_call('pool.mergeInto', { source: params.host.$pool, target: pool.id, force: true })
|
||||
return _call('pool.mergeInto', { source: params.host.$pool, target: pool.id, force: true }).catch(error => {
|
||||
if (error.code !== 'HOSTS_NOT_HOMOGENEOUS') {
|
||||
throw error
|
||||
}
|
||||
|
||||
error(_('addHostErrorTitle'), _('addHostNotHomogeneousErrorMessage'))
|
||||
})
|
||||
},
|
||||
noop
|
||||
)
|
||||
@@ -382,6 +415,16 @@ export const detachHost = host => (
|
||||
)
|
||||
)
|
||||
|
||||
export const forgetHost = host => (
|
||||
confirm({
|
||||
icon: 'host-forget',
|
||||
title: _('forgetHostModalTitle'),
|
||||
body: _('forgetHostModalMessage', { host: <strong>{host.name_label}</strong> })
|
||||
}).then(
|
||||
() => _call('host.forget', { host: resolveId(host) })
|
||||
)
|
||||
)
|
||||
|
||||
export const setDefaultSr = sr => (
|
||||
_call('pool.setDefaultSr', { sr: resolveId(sr) })
|
||||
)
|
||||
@@ -498,15 +541,21 @@ export const emergencyShutdownHosts = hosts => {
|
||||
}
|
||||
|
||||
export const installHostPatch = (host, { uuid }) => (
|
||||
_call('host.installPatch', { host: resolveId(host), patch: uuid })
|
||||
_call('host.installPatch', { host: resolveId(host), patch: uuid })::tap(
|
||||
() => subscribeHostMissingPatches.forceRefresh(host)
|
||||
)
|
||||
)
|
||||
|
||||
export const installAllHostPatches = host => (
|
||||
_call('host.installAllPatches', { host: resolveId(host) })
|
||||
_call('host.installAllPatches', { host: resolveId(host) })::tap(
|
||||
() => subscribeHostMissingPatches.forceRefresh(host)
|
||||
)
|
||||
)
|
||||
|
||||
export const installAllPatchesOnPool = pool => (
|
||||
_call('pool.installAllPatches', { pool: resolveId(pool) })
|
||||
_call('pool.installAllPatches', { pool: resolveId(pool) })::tap(
|
||||
() => subscribeHostMissingPatches.forceRefresh()
|
||||
)
|
||||
)
|
||||
|
||||
export const installSupplementalPack = (host, file) => {
|
||||
@@ -571,8 +620,38 @@ export const unpauseContainer = (vm, container) => (
|
||||
|
||||
// VM ----------------------------------------------------------------
|
||||
|
||||
const chooseActionToUnblockForbiddenStartVm = props => (
|
||||
chooseAction({
|
||||
icon: 'alarm',
|
||||
buttons: [
|
||||
{ label: _('cloneAndStartVM'), value: 'clone', btnStyle: 'success' },
|
||||
{ label: _('forceStartVm'), value: 'force', btnStyle: 'danger' }
|
||||
],
|
||||
...props
|
||||
})
|
||||
)
|
||||
|
||||
const cloneAndStartVM = async vm => (
|
||||
_call('vm.start', { id: await cloneVm(vm) })
|
||||
)
|
||||
|
||||
export const startVm = vm => (
|
||||
_call('vm.start', { id: resolveId(vm) })
|
||||
_call('vm.start', { id: resolveId(vm) }).catch(async reason => {
|
||||
if (!forbiddenOperation.is(reason)) {
|
||||
throw reason
|
||||
}
|
||||
|
||||
const choice = await chooseActionToUnblockForbiddenStartVm({
|
||||
body: _('blockedStartVmModalMessage'),
|
||||
title: _('forceStartVmModalTitle')
|
||||
})
|
||||
|
||||
if (choice === 'clone') {
|
||||
return cloneAndStartVM(vm)
|
||||
}
|
||||
|
||||
return _call('vm.start', { id: resolveId(vm), force: true })
|
||||
})
|
||||
)
|
||||
|
||||
export const startVms = vms => (
|
||||
@@ -580,7 +659,52 @@ export const startVms = vms => (
|
||||
title: _('startVmsModalTitle', { vms: vms.length }),
|
||||
body: _('startVmsModalMessage', { vms: vms.length })
|
||||
}).then(
|
||||
() => map(vms, vmId => startVm({ id: vmId })),
|
||||
async () => {
|
||||
const forbiddenStart = []
|
||||
let nErrors = 0
|
||||
|
||||
await Promise.all(map(
|
||||
vms,
|
||||
id => _call('vm.start', { id }).catch(reason => {
|
||||
if (forbiddenOperation.is(reason)) {
|
||||
forbiddenStart.push(id)
|
||||
} else {
|
||||
nErrors++
|
||||
}
|
||||
})
|
||||
))
|
||||
|
||||
if (forbiddenStart.length === 0) {
|
||||
if (nErrors === 0) {
|
||||
return
|
||||
}
|
||||
|
||||
return error(_('failedVmsErrorTitle'), _('failedVmsErrorMessage', {nVms: nErrors}))
|
||||
}
|
||||
|
||||
const choice = await chooseActionToUnblockForbiddenStartVm({
|
||||
body: _('blockedStartVmsModalMessage', {nVms: forbiddenStart.length}),
|
||||
title: _('forceStartVmModalTitle')
|
||||
}).catch(noop)
|
||||
|
||||
if (nErrors !== 0) {
|
||||
error(_('failedVmsErrorTitle'), _('failedVmsErrorMessage', {nVms: nErrors}))
|
||||
}
|
||||
|
||||
if (choice === 'clone') {
|
||||
return Promise.all(map(
|
||||
forbiddenStart,
|
||||
async id => cloneAndStartVM(getObject(store.getState(), id))
|
||||
))
|
||||
}
|
||||
|
||||
if (choice === 'force') {
|
||||
return Promise.all(map(
|
||||
forbiddenStart,
|
||||
id => _call('vm.start', { id, force: true })
|
||||
))
|
||||
}
|
||||
},
|
||||
noop
|
||||
)
|
||||
)
|
||||
@@ -838,8 +962,13 @@ export const importBackup = ({ remote, file, sr }) => (
|
||||
_call('vm.importBackup', resolveIds({ remote, file, sr }))
|
||||
)
|
||||
|
||||
export const importDeltaBackup = ({ remote, file, sr }) => (
|
||||
_call('vm.importDeltaBackup', resolveIds({ remote, filePath: file, sr }))
|
||||
export const importDeltaBackup = ({ remote, file, sr, mapVdisSrs }) => (
|
||||
_call('vm.importDeltaBackup', resolveIds({
|
||||
remote,
|
||||
filePath: file,
|
||||
sr,
|
||||
mapVdisSrs: resolveIds(mapVdisSrs)
|
||||
}))
|
||||
)
|
||||
|
||||
import RevertSnapshotModalBody from './revert-snapshot-modal' // eslint-disable-line import/first
|
||||
@@ -1323,16 +1452,14 @@ export const getSchedule = id => (
|
||||
|
||||
export const loadPlugin = async id => (
|
||||
_call('plugin.load', { id })::tap(
|
||||
subscribePlugins.forceRefresh
|
||||
)::rethrow(
|
||||
subscribePlugins.forceRefresh,
|
||||
err => error(_('pluginError'), (err && err.message) || _('unknownPluginError'))
|
||||
)
|
||||
)
|
||||
|
||||
export const unloadPlugin = id => (
|
||||
_call('plugin.unload', { id })::tap(
|
||||
subscribePlugins.forceRefresh
|
||||
)::rethrow(
|
||||
subscribePlugins.forceRefresh,
|
||||
err => error(_('pluginError'), (err && err.message) || _('unknownPluginError'))
|
||||
)
|
||||
)
|
||||
@@ -1354,8 +1481,7 @@ export const configurePlugin = (id, configuration) =>
|
||||
() => {
|
||||
info(_('pluginConfigurationSuccess'), _('pluginConfigurationChanges'))
|
||||
subscribePlugins.forceRefresh()
|
||||
}
|
||||
)::rethrow(
|
||||
},
|
||||
err => error(_('pluginError'), JSON.stringify(err.data) || _('unknownPluginError'))
|
||||
)
|
||||
|
||||
@@ -1403,7 +1529,8 @@ export const recomputeResourceSetsLimits = () => (
|
||||
// Remote ------------------------------------------------------------
|
||||
|
||||
export const getRemote = remote => (
|
||||
_call('remote.get', resolveIds({ id: remote }))::rethrow(
|
||||
_call('remote.get', resolveIds({ id: remote }))::tap(
|
||||
null,
|
||||
err => error(_('getRemote'), err.message || String(err))
|
||||
)
|
||||
)
|
||||
@@ -1440,20 +1567,21 @@ export const editRemote = (remote, { name, url }) => (
|
||||
|
||||
export const listRemote = remote => (
|
||||
_call('remote.list', resolveIds({ id: remote }))::tap(
|
||||
subscribeRemotes.forceRefresh
|
||||
)::rethrow(
|
||||
subscribeRemotes.forceRefresh,
|
||||
err => error(_('listRemote'), err.message || String(err))
|
||||
)
|
||||
)
|
||||
|
||||
export const listRemoteBackups = remote => (
|
||||
_call('backup.list', resolveIds({ remote }))::rethrow(
|
||||
_call('backup.list', resolveIds({ remote }))::tap(
|
||||
null,
|
||||
err => error(_('listRemote'), err.message || String(err))
|
||||
)
|
||||
)
|
||||
|
||||
export const testRemote = remote => (
|
||||
_call('remote.test', resolveIds({ id: remote }))::rethrow(
|
||||
_call('remote.test', resolveIds({ id: remote }))::tap(
|
||||
null,
|
||||
err => error(_('testRemote'), err.message || String(err))
|
||||
)
|
||||
)
|
||||
@@ -1560,16 +1688,14 @@ export const deleteApiLog = id => (
|
||||
|
||||
export const addAcl = ({ subject, object, action }) => (
|
||||
_call('acl.add', resolveIds({ subject, object, action }))::tap(
|
||||
subscribeAcls.forceRefresh
|
||||
)::rethrow(
|
||||
subscribeAcls.forceRefresh,
|
||||
err => error('Add ACL', err.message || String(err))
|
||||
)
|
||||
)
|
||||
|
||||
export const removeAcl = ({ subject, object, action }) => (
|
||||
_call('acl.remove', resolveIds({ subject, object, action }))::tap(
|
||||
subscribeAcls.forceRefresh
|
||||
)::rethrow(
|
||||
subscribeAcls.forceRefresh,
|
||||
err => error('Remove ACL', err.message || String(err))
|
||||
)
|
||||
)
|
||||
@@ -1584,14 +1710,15 @@ export const editAcl = (
|
||||
) => (
|
||||
_call('acl.remove', resolveIds({ subject, object, action }))
|
||||
.then(() => _call('acl.add', resolveIds({ subject: newSubject, object: newObject, action: newAction })))
|
||||
::tap(subscribeAcls.forceRefresh)
|
||||
::rethrow(err => error('Edit ACL', err.message || String(err)))
|
||||
::tap(
|
||||
subscribeAcls.forceRefresh,
|
||||
err => error('Edit ACL', err.message || String(err))
|
||||
)
|
||||
)
|
||||
|
||||
export const createGroup = name => (
|
||||
_call('group.create', { name })::tap(
|
||||
subscribeGroups.forceRefresh
|
||||
):: rethrow(
|
||||
subscribeGroups.forceRefresh,
|
||||
err => error(_('createGroup'), err.message || String(err))
|
||||
)
|
||||
)
|
||||
@@ -1602,35 +1729,35 @@ export const setGroupName = (group, name) => (
|
||||
)
|
||||
)
|
||||
|
||||
export const deleteGroup = group => (
|
||||
export const deleteGroup = group =>
|
||||
confirm({
|
||||
title: _('deleteGroup'),
|
||||
body: <p>{_('deleteGroupConfirm')}</p>
|
||||
}).then(() => _call('group.delete', resolveIds({ id: group })))
|
||||
::tap(subscribeGroups.forceRefresh)
|
||||
::rethrow(err => error(_('deleteGroup'), err.message || String(err)))
|
||||
)
|
||||
}).then(() =>
|
||||
_call('group.delete', resolveIds({ id: group }))::tap(
|
||||
subscribeGroups.forceRefresh,
|
||||
err => error(_('deleteGroup'), err.message || String(err))
|
||||
),
|
||||
noop
|
||||
)
|
||||
|
||||
export const removeUserFromGroup = (user, group) => (
|
||||
_call('group.removeUser', resolveIds({ id: group, userId: user }))::tap(
|
||||
subscribeGroups.forceRefresh
|
||||
)::rethrow(
|
||||
subscribeGroups.forceRefresh,
|
||||
err => error(_('removeUserFromGroup'), err.message || String(err))
|
||||
)
|
||||
)
|
||||
|
||||
export const addUserToGroup = (user, group) => (
|
||||
_call('group.addUser', resolveIds({ id: group, userId: user }))::tap(
|
||||
subscribeGroups.forceRefresh
|
||||
)::rethrow(
|
||||
subscribeGroups.forceRefresh,
|
||||
err => error('Add User', err.message || String(err))
|
||||
)
|
||||
)
|
||||
|
||||
export const createUser = (email, password, permission) => (
|
||||
_call('user.create', { email, password, permission })::tap(
|
||||
subscribeUsers.forceRefresh
|
||||
)::rethrow(
|
||||
subscribeUsers.forceRefresh,
|
||||
err => error('Create user', err.message || String(err))
|
||||
)
|
||||
)
|
||||
@@ -1640,9 +1767,10 @@ export const deleteUser = user => (
|
||||
title: _('deleteUser'),
|
||||
body: <p>{_('deleteUserConfirm')}</p>
|
||||
}).then(() =>
|
||||
_call('user.delete', { id: resolveId(user) })
|
||||
::tap(subscribeUsers.forceRefresh)
|
||||
::rethrow(err => error(_('deleteUser'), err.message || String(err)))
|
||||
_call('user.delete', { id: resolveId(user) })::tap(
|
||||
subscribeUsers.forceRefresh,
|
||||
err => error(_('deleteUser'), err.message || String(err))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -3,23 +3,23 @@ import every from 'lodash/every'
|
||||
import forEach from 'lodash/forEach'
|
||||
import find from 'lodash/find'
|
||||
import map from 'lodash/map'
|
||||
import mapValues from 'lodash/mapValues'
|
||||
import React from 'react'
|
||||
import store from 'store'
|
||||
|
||||
import _ from '../../intl'
|
||||
import ChooseSrForEachVdisModal from '../choose-sr-for-each-vdis-modal'
|
||||
import invoke from '../../invoke'
|
||||
import SingleLineRow from '../../single-line-row'
|
||||
import { Col } from '../../grid'
|
||||
import { getDefaultNetworkForVif } from '../utils'
|
||||
import {
|
||||
SelectHost,
|
||||
SelectNetwork,
|
||||
SelectSr
|
||||
SelectNetwork
|
||||
} from '../../select-objects'
|
||||
import {
|
||||
connectStore,
|
||||
mapPlus
|
||||
mapPlus,
|
||||
resolveIds
|
||||
} from '../../utils'
|
||||
import {
|
||||
createGetObjectsOfType,
|
||||
@@ -138,7 +138,8 @@ export default class MigrateVmModalBody extends BaseComponent {
|
||||
get value () {
|
||||
return {
|
||||
targetHost: this.state.host && this.state.host.id,
|
||||
mapVdisSrs: this.state.mapVdisSrs,
|
||||
sr: this.state.mainSr && this.state.mainSr.id,
|
||||
mapVdisSrs: resolveIds(this.state.mapVdisSrs),
|
||||
mapVifsNetworks: this.state.mapVifsNetworks,
|
||||
migrationNetwork: this.state.migrationNetworkId
|
||||
}
|
||||
@@ -158,11 +159,10 @@ export default class MigrateVmModalBody extends BaseComponent {
|
||||
return
|
||||
}
|
||||
|
||||
const { pools, vbds, vdis, vm } = this.props
|
||||
const { vbds, vm } = this.props
|
||||
const intraPool = vm.$pool === host.$pool
|
||||
|
||||
// Intra-pool
|
||||
const defaultSr = pools[host.$pool].default_SR
|
||||
if (intraPool) {
|
||||
let doNotMigrateVdis
|
||||
if (vm.$container === host.id) {
|
||||
@@ -181,7 +181,6 @@ export default class MigrateVmModalBody extends BaseComponent {
|
||||
doNotMigrateVdis,
|
||||
host,
|
||||
intraPool,
|
||||
mapVdisSrs: doNotMigrateVdis ? undefined : mapValues(vdis, vdi => defaultSr),
|
||||
mapVifsNetworks: undefined,
|
||||
migrationNetwork: undefined
|
||||
})
|
||||
@@ -212,7 +211,6 @@ export default class MigrateVmModalBody extends BaseComponent {
|
||||
doNotMigrateVdis: false,
|
||||
host,
|
||||
intraPool,
|
||||
mapVdisSrs: mapValues(vdis, vdi => defaultSr),
|
||||
mapVifsNetworks: defaultNetworksForVif,
|
||||
migrationNetworkId: defaultMigrationNetworkId
|
||||
})
|
||||
@@ -226,7 +224,6 @@ export default class MigrateVmModalBody extends BaseComponent {
|
||||
doNotMigrateVdis,
|
||||
host,
|
||||
intraPool,
|
||||
mapVdisSrs,
|
||||
mapVifsNetworks,
|
||||
migrationNetworkId
|
||||
} = this.state
|
||||
@@ -245,25 +242,14 @@ export default class MigrateVmModalBody extends BaseComponent {
|
||||
</div>
|
||||
{host && !doNotMigrateVdis && <div className={styles.groupBlock}>
|
||||
<SingleLineRow>
|
||||
<Col>{_('migrateVmSelectSrs')}</Col>
|
||||
<Col size={12}>
|
||||
<ChooseSrForEachVdisModal
|
||||
onChange={props => this.setState(props)}
|
||||
predicate={this._getSrPredicate()}
|
||||
vdis={vdis}
|
||||
/>
|
||||
</Col>
|
||||
</SingleLineRow>
|
||||
<br />
|
||||
<SingleLineRow>
|
||||
<Col size={6}><span className={styles.listTitle}>{_('migrateVmName')}</span></Col>
|
||||
<Col size={6}><span className={styles.listTitle}>{_('migrateVmSr')}</span></Col>
|
||||
</SingleLineRow>
|
||||
{map(vdis, vdi => <div className={styles.listItem} key={vdi.id}>
|
||||
<SingleLineRow>
|
||||
<Col size={6}>{vdi.name_label}</Col>
|
||||
<Col size={6}>
|
||||
<SelectSr
|
||||
onChange={sr => this.setState({ mapVdisSrs: { ...mapVdisSrs, [vdi.id]: sr.id } })}
|
||||
predicate={this._getSrPredicate()}
|
||||
value={mapVdisSrs[vdi.id]}
|
||||
/>
|
||||
</Col>
|
||||
</SingleLineRow>
|
||||
</div>)}
|
||||
</div>}
|
||||
{intraPool !== undefined &&
|
||||
(!intraPool &&
|
||||
|
||||
@@ -12,8 +12,10 @@ import some from 'lodash/some'
|
||||
import store from 'store'
|
||||
|
||||
import _ from '../../intl'
|
||||
import Icon from 'icon'
|
||||
import invoke from '../../invoke'
|
||||
import SingleLineRow from '../../single-line-row'
|
||||
import Tooltip from '../../tooltip'
|
||||
import { Col } from '../../grid'
|
||||
import { getDefaultNetworkForVif } from '../utils'
|
||||
import {
|
||||
@@ -217,6 +219,7 @@ export default class MigrateVmsModalBody extends BaseComponent {
|
||||
const { pools, pifs } = this.props
|
||||
const defaultMigrationNetworkId = find(pifs, pif => pif.$host === host.id && pif.management).$network
|
||||
const defaultSrId = pools[host.$pool].default_SR
|
||||
const defaultSrConnectedToHost = some(host.$PBDs, pbd => this._getObject(pbd).SR === defaultSrId)
|
||||
const doNotMigrateVmVdis = {}
|
||||
const doNotMigrateVdi = {}
|
||||
forEach(this.props.vbdsByVm, (vbds, vm) => {
|
||||
@@ -234,6 +237,8 @@ export default class MigrateVmsModalBody extends BaseComponent {
|
||||
})
|
||||
const noVdisMigration = every(doNotMigrateVmVdis)
|
||||
this.setState({
|
||||
defaultSrConnectedToHost,
|
||||
defaultSrId,
|
||||
host,
|
||||
intraPool: every(this.props.vms, vm => vm.$pool === host.$pool),
|
||||
doNotMigrateVdi,
|
||||
@@ -242,7 +247,7 @@ export default class MigrateVmsModalBody extends BaseComponent {
|
||||
networkId: defaultMigrationNetworkId,
|
||||
noVdisMigration,
|
||||
smartVifMapping: true,
|
||||
srId: defaultSrId
|
||||
srId: defaultSrConnectedToHost ? defaultSrId : undefined
|
||||
})
|
||||
}
|
||||
_selectMigrationNetwork = migrationNetwork => this.setState({ migrationNetworkId: migrationNetwork.id })
|
||||
@@ -252,6 +257,8 @@ export default class MigrateVmsModalBody extends BaseComponent {
|
||||
|
||||
render () {
|
||||
const {
|
||||
defaultSrConnectedToHost,
|
||||
defaultSrId,
|
||||
host,
|
||||
intraPool,
|
||||
migrationNetworkId,
|
||||
@@ -290,7 +297,24 @@ export default class MigrateVmsModalBody extends BaseComponent {
|
||||
{host && (!intraPool || !noVdisMigration) &&
|
||||
<div key='sr' style={LINE_STYLE}>
|
||||
<SingleLineRow>
|
||||
<Col size={6}>{!intraPool ? _('migrateVmsSelectSr') : _('migrateVmsSelectSrIntraPool')}</Col>
|
||||
<Col size={6}>
|
||||
{!intraPool ? _('migrateVmsSelectSr') : _('migrateVmsSelectSrIntraPool')}
|
||||
{' '}
|
||||
{(defaultSrId === undefined || !defaultSrConnectedToHost) &&
|
||||
<Tooltip
|
||||
content={defaultSrId !== undefined
|
||||
? _('migrateVmNotConnectedDefaultSrError')
|
||||
: _('migrateVmNoDefaultSrError')
|
||||
}
|
||||
>
|
||||
<Icon
|
||||
icon={defaultSrId !== undefined ? 'alarm' : 'info'}
|
||||
className={defaultSrId !== undefined ? 'text-warning' : 'text-info'}
|
||||
size='lg'
|
||||
/>
|
||||
</Tooltip>
|
||||
}
|
||||
</Col>
|
||||
<Col size={6}>
|
||||
<SelectSr
|
||||
onChange={this._selectSr}
|
||||
|
||||
@@ -452,6 +452,10 @@
|
||||
@extend .fa-server;
|
||||
@extend .text-warning;
|
||||
}
|
||||
&-forget {
|
||||
@extend .fa;
|
||||
@extend .fa-ban;
|
||||
}
|
||||
&-working {
|
||||
@extend .fa;
|
||||
@extend .fa-circle;
|
||||
|
||||
@@ -132,7 +132,7 @@ const COMMON_SCHEMA = {
|
||||
},
|
||||
enabled: {
|
||||
type: 'boolean',
|
||||
title: _('editBackupReportEnable')
|
||||
title: _('editBackupScheduleEnabled')
|
||||
}
|
||||
},
|
||||
required: [ 'tag', 'vms', '_reportWhen' ]
|
||||
@@ -190,6 +190,15 @@ const DISASTER_RECOVERY_SCHEMA = {
|
||||
properties: {
|
||||
...COMMON_SCHEMA.properties,
|
||||
depth: DEPTH_PROPERTY,
|
||||
deleteOldBackupsFirst: {
|
||||
type: 'boolean',
|
||||
title: _('deleteOldBackupsFirst'),
|
||||
description: [
|
||||
'Delete the old backups before copy the vms.',
|
||||
'',
|
||||
'If the backup fails, you will lose your old backups.'
|
||||
].join('\n')
|
||||
},
|
||||
sr: {
|
||||
type: 'string',
|
||||
'xo:type': 'sr',
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import _, { messages } from 'intl'
|
||||
import ChooseSrForEachVdisModal from 'xo/choose-sr-for-each-vdis-modal'
|
||||
import Component from 'base-component'
|
||||
import every from 'lodash/every'
|
||||
import filter from 'lodash/filter'
|
||||
import find from 'lodash/find'
|
||||
import forEach from 'lodash/forEach'
|
||||
import getEventValue from 'get-event-value'
|
||||
import groupBy from 'lodash/groupBy'
|
||||
import Icon from 'icon'
|
||||
import isEmpty from 'lodash/isEmpty'
|
||||
@@ -15,22 +18,27 @@ import SortedTable from 'sorted-table'
|
||||
import uniq from 'lodash/uniq'
|
||||
import Upgrade from 'xoa-upgrade'
|
||||
import { confirm } from 'modal'
|
||||
import { createSelector } from 'selectors'
|
||||
import { addSubscriptions, noop } from 'utils'
|
||||
import { Container, Row, Col } from 'grid'
|
||||
import { FormattedDate, injectIntl } from 'react-intl'
|
||||
import { info, error } from 'notification'
|
||||
import { SelectPlainObject, Toggle } from 'form'
|
||||
import { SelectSr } from 'select-objects'
|
||||
|
||||
import {
|
||||
importBackup,
|
||||
importDeltaBackup,
|
||||
isSrWritable,
|
||||
listRemote,
|
||||
listRemoteBackups,
|
||||
startVm,
|
||||
subscribeRemotes
|
||||
} from 'xo'
|
||||
|
||||
// Can 2 SRs on the same pool have 2 VDIs used by the same VM
|
||||
const areSrsCompatible = (sr1, sr2) =>
|
||||
sr1.shared || sr2.shared || sr1.$container === sr2.$container
|
||||
|
||||
const parseDate = date => +moment(date, 'YYYYMMDDTHHmmssZ').format('x')
|
||||
|
||||
const backupOptionRenderer = backup => <span>
|
||||
@@ -76,8 +84,8 @@ const openImportModal = ({ backups }) => confirm({
|
||||
body: <ImportModalBody vmName={backups[0].name} backups={backups} />
|
||||
}).then(doImport)
|
||||
|
||||
const doImport = ({ backup, sr, start }) => {
|
||||
if (!sr || !backup) {
|
||||
const doImport = ({ backup, mainSr, start, mapVdisSrs }) => {
|
||||
if (!mainSr || !backup) {
|
||||
error(_('backupRestoreErrorTitle'), _('backupRestoreErrorMessage'))
|
||||
return
|
||||
}
|
||||
@@ -87,7 +95,7 @@ const doImport = ({ backup, sr, start }) => {
|
||||
}
|
||||
info(_('importBackupTitle'), _('importBackupMessage'))
|
||||
try {
|
||||
const importPromise = importMethods[backup.type]({remote: backup.remoteId, sr, file: backup.path}).then(id => {
|
||||
const importPromise = importMethods[backup.type]({remote: backup.remoteId, sr: mainSr, file: backup.path, mapVdisSrs}).then(id => {
|
||||
return id
|
||||
})
|
||||
if (start) {
|
||||
@@ -99,16 +107,59 @@ const doImport = ({ backup, sr, start }) => {
|
||||
}
|
||||
|
||||
class _ModalBody extends Component {
|
||||
constructor () {
|
||||
super()
|
||||
|
||||
this.state = {
|
||||
mapVdisSrs: {}
|
||||
}
|
||||
}
|
||||
|
||||
get value () {
|
||||
return this.state
|
||||
}
|
||||
|
||||
_getSrPredicate = createSelector(
|
||||
() => this.state.sr,
|
||||
() => this.state.mapVdisSrs,
|
||||
(defaultSr, mapVdisSrs) => sr =>
|
||||
sr !== defaultSr &&
|
||||
isSrWritable(sr) &&
|
||||
defaultSr.$pool === sr.$pool &&
|
||||
areSrsCompatible(defaultSr, sr) &&
|
||||
every(mapVdisSrs, selectedSr => selectedSr == null || areSrsCompatible(selectedSr, sr))
|
||||
)
|
||||
|
||||
_onChangeDefaultSr = event => {
|
||||
const oldSr = this.state.sr
|
||||
const newSr = getEventValue(event)
|
||||
|
||||
if (oldSr == null || newSr == null || oldSr.$pool !== newSr.$pool) {
|
||||
this.setState({
|
||||
mapVdisSrs: {}
|
||||
})
|
||||
} else if (!newSr.shared) {
|
||||
const mapVdisSrs = {...this.state.mapVdisSrs}
|
||||
forEach(mapVdisSrs, (sr, vdi) => {
|
||||
if (sr != null && newSr !== sr && sr.$container !== newSr.$container && !sr.shared) {
|
||||
delete mapVdisSrs[vdi]
|
||||
}
|
||||
})
|
||||
this.setState({
|
||||
mapVdisSrs
|
||||
})
|
||||
}
|
||||
|
||||
this.setState({
|
||||
sr: newSr
|
||||
})
|
||||
}
|
||||
|
||||
render () {
|
||||
const { backups, intl } = this.props
|
||||
const vdis = this.state.backup && this.state.backup.vdis
|
||||
|
||||
return <div>
|
||||
<SelectSr onChange={this.linkState('sr')} predicate={isSrWritable} />
|
||||
<br />
|
||||
<SelectPlainObject
|
||||
onChange={this.linkState('backup')}
|
||||
optionKey='path'
|
||||
@@ -117,6 +168,11 @@ class _ModalBody extends Component {
|
||||
placeholder={intl.formatMessage(messages.importBackupModalSelectBackup)}
|
||||
/>
|
||||
<br />
|
||||
<ChooseSrForEachVdisModal
|
||||
vdis={vdis}
|
||||
onChange={props => this.setState(props)}
|
||||
/>
|
||||
<br />
|
||||
<Toggle onChange={this.linkState('start')} /> {_('importBackupModalStart')}
|
||||
</div>
|
||||
}
|
||||
@@ -136,16 +192,26 @@ export default class Restore extends Component {
|
||||
}
|
||||
|
||||
_listAll = async remotes => {
|
||||
const remotesFiles = await Promise.all(map(remotes, remote => listRemote(remote.id)))
|
||||
const remotesInfo = await Promise.all(map(remotes, async remote => ({
|
||||
files: await listRemote(remote.id),
|
||||
backupsInfo: await listRemoteBackups(remote.id)
|
||||
})))
|
||||
|
||||
const backupInfoByVm = {}
|
||||
forEach(remotesFiles, (remoteFiles, index) => {
|
||||
|
||||
forEach(remotesInfo, (remoteInfo, index) => {
|
||||
const remote = remotes[index]
|
||||
|
||||
forEach(remoteFiles, file => {
|
||||
forEach(remoteInfo.files, file => {
|
||||
let backup
|
||||
const deltaInfo = /^vm_delta_(.*)_([^/]+)\/([^_]+)_(.*)$/.exec(file)
|
||||
|
||||
if (deltaInfo) {
|
||||
const [ , tag, id, date, name ] = deltaInfo
|
||||
const vdis = find(remoteInfo.backupsInfo, {
|
||||
id: `${file}.json`
|
||||
}).disks
|
||||
|
||||
backup = {
|
||||
type: 'delta',
|
||||
date: parseDate(date),
|
||||
@@ -154,7 +220,8 @@ export default class Restore extends Component {
|
||||
path: file,
|
||||
tag,
|
||||
remoteId: remote.id,
|
||||
remoteName: remote.name
|
||||
remoteName: remote.name,
|
||||
vdis
|
||||
}
|
||||
} else {
|
||||
const backupInfo = /^([^_]+)_([^_]+)_(.*)\.xva$/.exec(file)
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
import _ from 'intl'
|
||||
import ActionRowButton from 'action-row-button'
|
||||
import Component from 'base-component'
|
||||
import get from 'lodash/get'
|
||||
import Icon from 'icon'
|
||||
import isEmpty from 'lodash/isEmpty'
|
||||
import Link from 'link'
|
||||
import map from 'lodash/map'
|
||||
import mapValues from 'lodash/mapValues'
|
||||
import SortedTable from 'sorted-table'
|
||||
import TabButton from 'tab-button'
|
||||
import Tooltip from 'tooltip'
|
||||
@@ -15,11 +11,26 @@ import React from 'react'
|
||||
import xml2js from 'xml2js'
|
||||
import { Card, CardHeader, CardBlock } from 'card'
|
||||
import { confirm } from 'modal'
|
||||
import { deleteMessage, deleteVdi, deleteOrphanedVdis, deleteVm, isSrWritable } from 'xo'
|
||||
import { FormattedRelative, FormattedTime } from 'react-intl'
|
||||
import { fromCallback } from 'promise-toolbox'
|
||||
import { Container, Row, Col } from 'grid'
|
||||
import {
|
||||
deleteMessage,
|
||||
deleteOrphanedVdis,
|
||||
deleteVbd,
|
||||
deleteVdi,
|
||||
deleteVm,
|
||||
isSrWritable
|
||||
} from 'xo'
|
||||
import {
|
||||
flatten,
|
||||
get,
|
||||
isEmpty,
|
||||
map,
|
||||
mapValues
|
||||
} from 'lodash'
|
||||
import {
|
||||
createCollectionWrapper,
|
||||
createGetObject,
|
||||
createGetObjectsOfType,
|
||||
createSelector
|
||||
@@ -27,6 +38,7 @@ import {
|
||||
import {
|
||||
connectStore,
|
||||
formatSize,
|
||||
mapPlus,
|
||||
noop
|
||||
} from 'utils'
|
||||
|
||||
@@ -102,10 +114,21 @@ const SR_COLUMNS = [
|
||||
}
|
||||
]
|
||||
|
||||
const VDI_COLUMNS = [
|
||||
const ORPHANED_VDI_COLUMNS = [
|
||||
{
|
||||
name: _('snapshotDate'),
|
||||
itemRenderer: vdi => <span><FormattedTime value={vdi.snapshot_time * 1000} minute='numeric' hour='numeric' day='numeric' month='long' year='numeric' /> (<FormattedRelative value={vdi.snapshot_time * 1000} />)</span>,
|
||||
itemRenderer: vdi => <span>
|
||||
<FormattedTime
|
||||
day='numeric'
|
||||
hour='numeric'
|
||||
minute='numeric'
|
||||
month='long'
|
||||
value={vdi.snapshot_time * 1000}
|
||||
year='numeric'
|
||||
/>
|
||||
{' '}
|
||||
(<FormattedRelative value={vdi.snapshot_time * 1000} />)
|
||||
</span>,
|
||||
sortCriteria: vdi => vdi.snapshot_time,
|
||||
sortOrder: 'desc'
|
||||
},
|
||||
@@ -141,10 +164,58 @@ const VDI_COLUMNS = [
|
||||
}
|
||||
]
|
||||
|
||||
const CONTROL_DOMAIN_VDI_COLUMNS = [
|
||||
{
|
||||
name: _('vdiNameLabel'),
|
||||
itemRenderer: vdi => vdi && vdi.name_label,
|
||||
sortCriteria: vdi => vdi && vdi.name_label
|
||||
},
|
||||
{
|
||||
name: _('vdiNameDescription'),
|
||||
itemRenderer: vdi => vdi && vdi.name_description,
|
||||
sortCriteria: vdi => vdi && vdi.name_description
|
||||
},
|
||||
{
|
||||
name: _('vdiPool'),
|
||||
itemRenderer: vdi => vdi && vdi.pool && <Link to={`pools/${vdi.pool.id}`}>{vdi.pool.name_label}</Link>,
|
||||
sortCriteria: vdi => vdi && vdi.pool && vdi.pool.name_label
|
||||
},
|
||||
{
|
||||
name: _('vdiSize'),
|
||||
itemRenderer: vdi => vdi && formatSize(vdi.size),
|
||||
sortCriteria: vdi => vdi && vdi.size
|
||||
},
|
||||
{
|
||||
name: _('vdiSr'),
|
||||
itemRenderer: vdi => vdi && vdi.sr && <Link to={`srs/${vdi.sr.id}`}>{vdi.sr.name_label}</Link>,
|
||||
sortCriteria: vdi => vdi && vdi.sr && vdi.sr.name_label
|
||||
},
|
||||
{
|
||||
name: _('vdiAction'),
|
||||
itemRenderer: vdi => vdi && vdi.vbd && <ActionRowButton
|
||||
btnStyle='danger'
|
||||
handler={deleteVbd}
|
||||
handlerParam={vdi.vbd}
|
||||
icon='delete'
|
||||
/>
|
||||
}
|
||||
]
|
||||
|
||||
const VM_COLUMNS = [
|
||||
{
|
||||
name: _('snapshotDate'),
|
||||
itemRenderer: vm => <span><FormattedTime value={vm.snapshot_time * 1000} minute='numeric' hour='numeric' day='numeric' month='long' year='numeric' /> (<FormattedRelative value={vm.snapshot_time * 1000} />)</span>,
|
||||
itemRenderer: vm => <span>
|
||||
<FormattedTime
|
||||
day='numeric'
|
||||
hour='numeric'
|
||||
minute='numeric'
|
||||
month='long'
|
||||
value={vm.snapshot_time * 1000}
|
||||
year='numeric'
|
||||
/>
|
||||
{' '}
|
||||
(<FormattedRelative value={vm.snapshot_time * 1000} />)
|
||||
</span>,
|
||||
sortCriteria: vm => vm.snapshot_time,
|
||||
sortOrder: 'desc'
|
||||
},
|
||||
@@ -178,9 +249,18 @@ const VM_COLUMNS = [
|
||||
const ALARM_COLUMNS = [
|
||||
{
|
||||
name: _('alarmDate'),
|
||||
itemRenderer: message => (
|
||||
<span><FormattedTime value={message.time * 1000} minute='numeric' hour='numeric' day='numeric' month='long' year='numeric' /> (<FormattedRelative value={message.time * 1000} />)</span>
|
||||
),
|
||||
itemRenderer: message => <span>
|
||||
<FormattedTime
|
||||
day='numeric'
|
||||
hour='numeric'
|
||||
minute='numeric'
|
||||
month='long'
|
||||
value={message.time * 1000}
|
||||
year='numeric'
|
||||
/>
|
||||
{' '}
|
||||
(<FormattedRelative value={message.time * 1000} />)
|
||||
</span>,
|
||||
sortCriteria: message => message.time,
|
||||
sortOrder: 'desc'
|
||||
},
|
||||
@@ -224,8 +304,40 @@ const ALARM_COLUMNS = [
|
||||
|
||||
@connectStore(() => {
|
||||
const getOrphanVdiSnapshots = createGetObjectsOfType('VDI-snapshot')
|
||||
.filter([ snapshot => !snapshot.$snapshot_of ])
|
||||
.filter([ _ => !_.$snapshot_of && _.$VBDs.length === 0 ])
|
||||
.sort()
|
||||
const getControlDomainVbds = createGetObjectsOfType('VBD')
|
||||
.pick(
|
||||
createSelector(
|
||||
createGetObjectsOfType('VM-controller'),
|
||||
createCollectionWrapper(
|
||||
vmControllers => flatten(map(vmControllers, '$VBDs'))
|
||||
)
|
||||
)
|
||||
)
|
||||
.sort()
|
||||
const getControlDomainVdis = createSelector(
|
||||
getControlDomainVbds,
|
||||
createGetObjectsOfType('VDI'),
|
||||
createGetObjectsOfType('pool'),
|
||||
createGetObjectsOfType('SR'),
|
||||
(vbds, vdis, pools, srs) =>
|
||||
mapPlus(vbds, (vbd, push) => {
|
||||
const vdi = vdis[vbd.VDI]
|
||||
|
||||
if (vdi == null) {
|
||||
return
|
||||
}
|
||||
|
||||
push({
|
||||
...vdi,
|
||||
pool: pools[vbd.$pool],
|
||||
sr: srs[vdi.$SR],
|
||||
vbd
|
||||
})
|
||||
}
|
||||
)
|
||||
)
|
||||
const getOrphanVmSnapshots = createGetObjectsOfType('VM-snapshot')
|
||||
.filter([ snapshot => !snapshot.$snapshot_of ])
|
||||
.sort()
|
||||
@@ -241,6 +353,7 @@ const ALARM_COLUMNS = [
|
||||
|
||||
return {
|
||||
alertMessages: getAlertMessages,
|
||||
controlDomainVdis: getControlDomainVdis,
|
||||
userSrs: getUserSrs,
|
||||
vdiOrphaned: getOrphanVdiSnapshots,
|
||||
vdiSr: getVdiSrs,
|
||||
@@ -362,7 +475,7 @@ export default class Health extends Component {
|
||||
</Row>
|
||||
<Row>
|
||||
<Col>
|
||||
<SortedTable collection={this.props.vdiOrphaned} columns={VDI_COLUMNS} />
|
||||
<SortedTable collection={this.props.vdiOrphaned} columns={ORPHANED_VDI_COLUMNS} />
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
@@ -371,6 +484,21 @@ export default class Health extends Component {
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row>
|
||||
<Col>
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<Icon icon='disk' /> {_('vdisOnControlDomain')}
|
||||
</CardHeader>
|
||||
<CardBlock>
|
||||
{isEmpty(this.props.controlDomainVdis)
|
||||
? <p className='text-xs-center'>{_('noControlDomainVdis')}</p>
|
||||
: <SortedTable collection={this.props.controlDomainVdis} columns={CONTROL_DOMAIN_VDI_COLUMNS} />
|
||||
}
|
||||
</CardBlock>
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row>
|
||||
<Col>
|
||||
<Card>
|
||||
|
||||
@@ -31,7 +31,9 @@ import {
|
||||
import {
|
||||
createFinder,
|
||||
createGetObject,
|
||||
createSelector
|
||||
createGetVmDisks,
|
||||
createSelector,
|
||||
createSumBy
|
||||
} from 'selectors'
|
||||
|
||||
import styles from './index.css'
|
||||
@@ -39,20 +41,19 @@ import styles from './index.css'
|
||||
@addSubscriptions({
|
||||
resourceSets: subscribeResourceSets
|
||||
})
|
||||
@connectStore({
|
||||
container: createGetObject((_, props) => props.item.$container)
|
||||
})
|
||||
@connectStore(() => ({
|
||||
container: createGetObject((_, props) => props.item.$container),
|
||||
totalDiskSize: createSumBy(
|
||||
createGetVmDisks((_, props) => props.item),
|
||||
'size'
|
||||
)
|
||||
}))
|
||||
export default class VmItem extends Component {
|
||||
get _isRunning () {
|
||||
const vm = this.props.item
|
||||
return vm && vm.power_state === 'Running'
|
||||
}
|
||||
|
||||
_getMigrationPredicate = createSelector(
|
||||
() => this.props.container,
|
||||
container => host => host.id !== container.id
|
||||
)
|
||||
|
||||
_getResourceSet = createFinder(
|
||||
() => this.props.resourceSets,
|
||||
createSelector(
|
||||
@@ -138,7 +139,6 @@ export default class VmItem extends Component {
|
||||
labelProp='name_label'
|
||||
onChange={this._migrateVm}
|
||||
placeholder={_('homeMigrateTo')}
|
||||
predicate={this._getMigrationPredicate()}
|
||||
useLongClick
|
||||
value={container}
|
||||
xoType='host'
|
||||
@@ -164,6 +164,8 @@ export default class VmItem extends Component {
|
||||
{' '} {' '}
|
||||
{formatSize(vm.memory.size)} <Icon icon='memory' />
|
||||
{' '} {' '}
|
||||
{formatSize(this.props.totalDiskSize)} <Icon icon='disk' />
|
||||
{' '} {' '}
|
||||
{isEmpty(vm.snapshots)
|
||||
? null
|
||||
: <span>{vm.snapshots.length}x <Icon icon='vm-snapshot' /></span>
|
||||
|
||||
@@ -7,8 +7,14 @@ import Page from '../page'
|
||||
import React, { cloneElement, Component } from 'react'
|
||||
import Tooltip from 'tooltip'
|
||||
import { Text } from 'editable'
|
||||
import { editHost, fetchHostStats, getHostMissingPatches, installAllHostPatches, installHostPatch } from 'xo'
|
||||
import { Container, Row, Col } from 'grid'
|
||||
import {
|
||||
editHost,
|
||||
fetchHostStats,
|
||||
installAllHostPatches,
|
||||
installHostPatch,
|
||||
subscribeHostMissingPatches
|
||||
} from 'xo'
|
||||
import {
|
||||
connectStore,
|
||||
routes
|
||||
@@ -139,6 +145,10 @@ export default class Host extends Component {
|
||||
}
|
||||
|
||||
loop (host = this.props.host) {
|
||||
if (host == null) {
|
||||
return
|
||||
}
|
||||
|
||||
if (this.cancel) {
|
||||
this.cancel()
|
||||
}
|
||||
@@ -166,22 +176,19 @@ export default class Host extends Component {
|
||||
}
|
||||
loop = ::this.loop
|
||||
|
||||
_getMissingPatches (host) {
|
||||
getHostMissingPatches(host).then(missingPatches => {
|
||||
this.setState({ missingPatches: sortBy(missingPatches, (patch) => -patch.time) })
|
||||
})
|
||||
}
|
||||
|
||||
componentWillMount () {
|
||||
if (!this.props.host) {
|
||||
return
|
||||
}
|
||||
componentDidMount () {
|
||||
this.loop()
|
||||
this._getMissingPatches(this.props.host)
|
||||
this.unsubscribeHostMissingPatches = subscribeHostMissingPatches(
|
||||
this.props.routeParams.id,
|
||||
missingPatches => this.setState({
|
||||
missingPatches: sortBy(missingPatches, patch => -patch.time)
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
componentWillUnmount () {
|
||||
clearTimeout(this.timeout)
|
||||
this.unsubscribeHostMissingPatches()
|
||||
}
|
||||
|
||||
componentWillReceiveProps (props) {
|
||||
@@ -195,10 +202,6 @@ export default class Host extends Component {
|
||||
this.context.router.push('/')
|
||||
}
|
||||
|
||||
if (!hostCur) {
|
||||
this._getMissingPatches(hostNext)
|
||||
}
|
||||
|
||||
if (!isRunning(hostCur) && isRunning(hostNext)) {
|
||||
this.loop(hostNext)
|
||||
} else if (isRunning(hostCur) && !isRunning(hostNext)) {
|
||||
@@ -210,16 +213,12 @@ export default class Host extends Component {
|
||||
|
||||
_installAllPatches = () => {
|
||||
const { host } = this.props
|
||||
return installAllHostPatches(host).then(() => {
|
||||
this._getMissingPatches(host)
|
||||
})
|
||||
return installAllHostPatches(host)
|
||||
}
|
||||
|
||||
_installPatch = patch => {
|
||||
const { host } = this.props
|
||||
return installHostPatch(host, patch).then(() => {
|
||||
this._getMissingPatches(host)
|
||||
})
|
||||
return installHostPatch(host, patch)
|
||||
}
|
||||
|
||||
_setNameDescription = nameDescription => editHost(this.props.host, { name_description: nameDescription })
|
||||
|
||||
@@ -5,7 +5,7 @@ import TabButton from 'tab-button'
|
||||
import SelectFiles from 'select-files'
|
||||
import Upgrade from 'xoa-upgrade'
|
||||
import { Toggle } from 'form'
|
||||
import { enableHost, detachHost, disableHost, restartHost, installSupplementalPack } from 'xo'
|
||||
import { enableHost, detachHost, disableHost, forgetHost, restartHost, installSupplementalPack } from 'xo'
|
||||
import { FormattedRelative, FormattedTime } from 'react-intl'
|
||||
import { Container, Row, Col } from 'grid'
|
||||
import {
|
||||
@@ -59,6 +59,15 @@ export default ({
|
||||
icon='host-eject'
|
||||
labelId='detachHost'
|
||||
/>
|
||||
{host.power_state !== 'Running' &&
|
||||
<TabButton
|
||||
btnStyle='danger'
|
||||
handler={forgetHost}
|
||||
handlerParam={host}
|
||||
icon='host-forget'
|
||||
labelId='forgetHost'
|
||||
/>
|
||||
}
|
||||
</Col>
|
||||
</Row>
|
||||
<Row>
|
||||
|
||||
@@ -92,7 +92,6 @@ export default class extends Component {
|
||||
<Row className='console'>
|
||||
<Col>
|
||||
<NoVnc ref='noVnc' url={resolveUrl(`consoles/${vmController.id}`)} onClipboardChange={this._getRemoteClipboard} />
|
||||
<p><em><Icon icon='info' /> {_('tipLabel')} {_('tipConsoleLabel')}</em></p>
|
||||
</Col>
|
||||
</Row>
|
||||
</Container>
|
||||
|
||||
@@ -4,6 +4,7 @@ import React, { Component } from 'react'
|
||||
import SortedTable from 'sorted-table'
|
||||
import TabButton from 'tab-button'
|
||||
import Upgrade from 'xoa-upgrade'
|
||||
import { chooseAction } from 'modal'
|
||||
import { connectStore, formatSize } from 'utils'
|
||||
import { Container, Row, Col } from 'grid'
|
||||
import { createDoesHostNeedRestart, createSelector } from 'selectors'
|
||||
@@ -42,11 +43,10 @@ const MISSING_PATCH_COLUMNS = [
|
||||
},
|
||||
{
|
||||
name: _('patchAction'),
|
||||
itemRenderer: (patch, installPatch) => (
|
||||
itemRenderer: (patch, {installPatch, _installPatchWarning}) => (
|
||||
<ActionRowButton
|
||||
btnStyle='primary'
|
||||
handler={installPatch}
|
||||
handlerParam={patch}
|
||||
handler={() => _installPatchWarning(patch, installPatch)}
|
||||
icon='host-patch-update'
|
||||
/>
|
||||
)
|
||||
@@ -111,6 +111,29 @@ const INSTALLED_PATCH_COLUMNS_2 = [
|
||||
needsRestart: createDoesHostNeedRestart((_, props) => props.host)
|
||||
}))
|
||||
export default class HostPatches extends Component {
|
||||
static contextTypes = {
|
||||
router: React.PropTypes.object
|
||||
}
|
||||
|
||||
_chooseActionPatch = async doInstall => {
|
||||
const choice = await chooseAction({
|
||||
body: <p>{_('installPatchWarningContent')}</p>,
|
||||
buttons: [
|
||||
{ label: _('installPatchWarningResolve'), value: 'install', btnStyle: 'primary' },
|
||||
{ label: _('installPatchWarningReject'), value: 'goToPool' }
|
||||
],
|
||||
title: _('installPatchWarningTitle')
|
||||
})
|
||||
|
||||
return choice === 'install'
|
||||
? doInstall()
|
||||
: this.context.router.push(`/pools/${this.props.host.$pool}/patches`)
|
||||
}
|
||||
|
||||
_installPatchWarning = (patch, installPatch) => this._chooseActionPatch(() => installPatch(patch))
|
||||
|
||||
_installAllPatchesWarning = installAllPatches => this._chooseActionPatch(installAllPatches)
|
||||
|
||||
_getPatches = createSelector(
|
||||
() => this.props.host,
|
||||
() => this.props.hostPatches,
|
||||
@@ -136,7 +159,7 @@ export default class HostPatches extends Component {
|
||||
render () {
|
||||
const { host, missingPatches, installAllPatches, installPatch } = this.props
|
||||
const { patches, columns } = this._getPatches()
|
||||
|
||||
const hasMissingPatches = !isEmpty(missingPatches)
|
||||
return process.env.XOA_PLAN > 1
|
||||
? <Container>
|
||||
<Row>
|
||||
@@ -148,26 +171,20 @@ export default class HostPatches extends Component {
|
||||
icon='host-reboot'
|
||||
labelId='rebootUpdateHostLabel'
|
||||
/>}
|
||||
{isEmpty(missingPatches)
|
||||
? <TabButton
|
||||
disabled
|
||||
handler={installAllPatches}
|
||||
icon='success'
|
||||
labelId='hostUpToDate'
|
||||
/>
|
||||
: <TabButton
|
||||
btnStyle='primary'
|
||||
handler={installAllPatches}
|
||||
icon='host-patch-update'
|
||||
labelId='patchUpdateButton'
|
||||
/>
|
||||
}
|
||||
<TabButton
|
||||
disabled={!hasMissingPatches}
|
||||
btnStyle={hasMissingPatches ? 'primary' : undefined}
|
||||
handler={this._installAllPatchesWarning}
|
||||
handlerParam={installAllPatches}
|
||||
icon={hasMissingPatches ? 'host-patch-update' : 'success'}
|
||||
labelId={hasMissingPatches ? 'patchUpdateButton' : 'hostUpToDate'}
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
{!isEmpty(missingPatches) && <Row>
|
||||
{hasMissingPatches && <Row>
|
||||
<Col>
|
||||
<h3>{_('hostMissingPatches')}</h3>
|
||||
<SortedTable collection={missingPatches} userData={installPatch} columns={MISSING_PATCH_COLUMNS} />
|
||||
<SortedTable collection={missingPatches} userData={{installPatch, _installPatchWarning: this._installPatchWarning}} columns={MISSING_PATCH_COLUMNS} />
|
||||
</Col>
|
||||
</Row>}
|
||||
<Row>
|
||||
|
||||
@@ -15,10 +15,13 @@ import renderXoItem from 'render-xo-item'
|
||||
import SortedTable from 'sorted-table'
|
||||
import Tooltip from 'tooltip'
|
||||
import { alert, confirm } from 'modal'
|
||||
import { connectStore } from 'utils'
|
||||
import { createGetObject } from 'selectors'
|
||||
import { FormattedDate } from 'react-intl'
|
||||
|
||||
import {
|
||||
connectStore,
|
||||
formatSize,
|
||||
formatSpeed
|
||||
} from 'utils'
|
||||
import {
|
||||
Card,
|
||||
CardHeader,
|
||||
@@ -70,21 +73,57 @@ class JobReturn extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
const JobCallStateInfos = ({ end, error }) => {
|
||||
const [ icon, tooltip ] = error !== undefined
|
||||
? ['halted', 'failedJobCall']
|
||||
: end !== undefined
|
||||
? ['running', 'successfulJobCall']
|
||||
: ['busy', 'jobCallInProgess']
|
||||
|
||||
return <Tooltip content={_(tooltip)}>
|
||||
<Icon icon={icon} />
|
||||
</Tooltip>
|
||||
}
|
||||
|
||||
const JobTransferredDataInfos = ({ start, end, size }) => <div>
|
||||
<span><strong>{_('jobTransferredDataSize')}</strong> {formatSize(size)}</span>
|
||||
<br />
|
||||
<span><strong>{_('jobTransferredDataSpeed')}</strong> {formatSpeed(size, end - start)}</span>
|
||||
</div>
|
||||
|
||||
const Log = props => <ul className='list-group'>
|
||||
{map(props.log.calls, call => <li key={call.callKey} className='list-group-item'>
|
||||
<strong className='text-info'>{call.method}: </strong><br />
|
||||
{map(call.params, (value, key) => [ <JobParam id={value} paramKey={key} key={key} />, <br /> ])}
|
||||
{call.returnedValue && <span>{' '}<JobReturn id={call.returnedValue} /></span>}
|
||||
{call.error &&
|
||||
<span className='text-danger'>
|
||||
<Icon icon='error' />
|
||||
{' '}
|
||||
{call.error.message
|
||||
? <strong>{call.error.message}</strong>
|
||||
: JSON.stringify(call.error)
|
||||
}
|
||||
</span>}
|
||||
</li>)}
|
||||
{map(props.log.calls, call => {
|
||||
const {
|
||||
end,
|
||||
error,
|
||||
returnedValue,
|
||||
start
|
||||
} = call
|
||||
|
||||
let id
|
||||
if (returnedValue != null) {
|
||||
id = returnedValue.id
|
||||
if (id === undefined && typeof returnedValue === 'string') {
|
||||
id = returnedValue
|
||||
}
|
||||
}
|
||||
|
||||
return <li key={call.callKey} className='list-group-item'>
|
||||
<strong className='text-info'>{call.method}: </strong><JobCallStateInfos end={end} error={error} /><br />
|
||||
{map(call.params, (value, key) => [ <JobParam id={value} paramKey={key} key={key} />, <br /> ])}
|
||||
{returnedValue != null && returnedValue.size !== undefined && <JobTransferredDataInfos start={start} end={end} size={returnedValue.size} />}
|
||||
{id !== undefined && <span>{' '}<JobReturn id={id} /></span>}
|
||||
{call.error &&
|
||||
<span className='text-danger'>
|
||||
<Icon icon='error' />
|
||||
{' '}
|
||||
{call.error.message
|
||||
? <strong>{call.error.message}</strong>
|
||||
: JSON.stringify(call.error)
|
||||
}
|
||||
</span>}
|
||||
</li>
|
||||
})}
|
||||
</ul>
|
||||
|
||||
const showCalls = log => alert(_('jobModalTitle', { job: log.jobId }), <Log log={log} />)
|
||||
@@ -197,6 +236,7 @@ export default class LogList extends Component {
|
||||
callKey: logKey,
|
||||
params: data.params,
|
||||
method: data.method,
|
||||
start: time,
|
||||
time
|
||||
}
|
||||
} else if (data.event === 'jobCall.end') {
|
||||
@@ -208,6 +248,7 @@ export default class LogList extends Component {
|
||||
entry.meta = 'error'
|
||||
} else {
|
||||
call.returnedValue = data.returnedValue
|
||||
call.end = time
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ export default class Menu extends Component {
|
||||
)}
|
||||
<li> </li>
|
||||
<li> </li>
|
||||
<li className='nav-item xo-menu-item'>
|
||||
{ (isAdmin || +process.env.XOA_PLAN === 5) && <li className='nav-item xo-menu-item'>
|
||||
<Link className='nav-link' style={{display: 'flex'}} to={'/about'}>
|
||||
{+process.env.XOA_PLAN === 5
|
||||
? <span>
|
||||
@@ -227,7 +227,7 @@ export default class Menu extends Component {
|
||||
</span>
|
||||
}
|
||||
</Link>
|
||||
</li>
|
||||
</li>}
|
||||
<li> </li>
|
||||
<li> </li>
|
||||
<li className='nav-item xo-menu-item'>
|
||||
|
||||
@@ -312,15 +312,15 @@ export class Edit extends Component {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
_addIpPool = () => {
|
||||
const { ipPools, newIpPool, newIpPoolQuantity } = this.state
|
||||
_onChangeIpPool = newIpPool => {
|
||||
const { ipPools, newIpPoolQuantity } = this.state
|
||||
|
||||
this.setState({
|
||||
ipPools: [ ...ipPools, { id: newIpPool.id, quantity: newIpPoolQuantity } ],
|
||||
newIpPool: undefined,
|
||||
newIpPoolQuantity: ''
|
||||
})
|
||||
}
|
||||
|
||||
_removeIpPool = index => {
|
||||
const ipPools = [ ...this.state.ipPools ]
|
||||
remove(ipPools, (_, i) => index === i)
|
||||
@@ -357,6 +357,7 @@ export class Edit extends Component {
|
||||
</Col>
|
||||
<Col mediumSize={4}>
|
||||
<SelectSubject
|
||||
hasSelectAll
|
||||
multi
|
||||
onChange={this.linkState('subjects')}
|
||||
required
|
||||
@@ -365,6 +366,7 @@ export class Edit extends Component {
|
||||
</Col>
|
||||
<Col mediumSize={4}>
|
||||
<SelectPool
|
||||
hasSelectAll
|
||||
multi
|
||||
onChange={this._updateSelectedPools}
|
||||
required
|
||||
@@ -378,6 +380,7 @@ export class Edit extends Component {
|
||||
<Col mediumSize={4}>
|
||||
<SelectVmTemplate
|
||||
disabled={!state.nPools}
|
||||
hasSelectAll
|
||||
multi
|
||||
onChange={this.linkState('templates')}
|
||||
predicate={state.vmTemplatePredicate}
|
||||
@@ -388,6 +391,7 @@ export class Edit extends Component {
|
||||
<Col mediumSize={4}>
|
||||
<SelectSr
|
||||
disabled={!state.nPools}
|
||||
hasSelectAll
|
||||
multi
|
||||
onChange={this._updateSelectedSrs}
|
||||
predicate={state.srPredicate}
|
||||
@@ -398,6 +402,7 @@ export class Edit extends Component {
|
||||
<Col mediumSize={4}>
|
||||
<SelectNetwork
|
||||
disabled={!state.nSrs}
|
||||
hasSelectAll
|
||||
multi
|
||||
onChange={this._updateSelectedNetworks}
|
||||
predicate={state.networkPredicate}
|
||||
@@ -439,33 +444,30 @@ export class Edit extends Component {
|
||||
<Row>
|
||||
<Col mediumSize={4}>
|
||||
<Row>
|
||||
<Col mediumSize={7}>
|
||||
<strong>{_('ipPool')}</strong>
|
||||
</Col>
|
||||
<Col mediumSize={3}>
|
||||
<strong>{_('quantity')}</strong>
|
||||
</Col>
|
||||
<Col mediumSize={7}>
|
||||
<strong>{_('ipPool')}</strong>
|
||||
</Col>
|
||||
</Row>
|
||||
{map(state.ipPools, (ipPool, index) => <Row className='mb-1' key={index}>
|
||||
<Col mediumSize={7}>
|
||||
<SelectIpPool onChange={this.linkState(`ipPools.${index}.id`, 'id')} value={ipPool.id} />
|
||||
</Col>
|
||||
<Col mediumSize={3}>
|
||||
<input className='form-control' type='number' min={0} onChange={this.linkState(`ipPools.${index}.quantity`)} value={firstDefined(ipPool.quantity, '')} placeholder='∞' />
|
||||
</Col>
|
||||
<Col mediumSize={7}>
|
||||
<SelectIpPool onChange={this.linkState(`ipPools.${index}.id`, 'id')} value={ipPool.id} />
|
||||
</Col>
|
||||
<Col mediumSize={2}>
|
||||
<ActionButton icon='delete' handler={this._removeIpPool} handlerParam={index} />
|
||||
</Col>
|
||||
</Row>)}
|
||||
<Row>
|
||||
<Col mediumSize={7}>
|
||||
<SelectIpPool onChange={this.linkState('newIpPool')} value={state.newIpPool} predicate={this._getIpPoolPredicate()} />
|
||||
</Col>
|
||||
<Col mediumSize={3}>
|
||||
<input className='form-control' type='number' min={0} onChange={this.linkState('newIpPoolQuantity')} value={state.newIpPoolQuantity || ''} placeholder='∞' />
|
||||
</Col>
|
||||
<Col mediumSize={2}>
|
||||
<ActionButton icon='add' handler={this._addIpPool} />
|
||||
<Col mediumSize={7}>
|
||||
<SelectIpPool onChange={this._onChangeIpPool} value='' predicate={this._getIpPoolPredicate()} />
|
||||
</Col>
|
||||
</Row>
|
||||
</Col>
|
||||
|
||||
@@ -122,6 +122,7 @@ class Plugin extends Component {
|
||||
const { editedConfig, expanded } = state
|
||||
const {
|
||||
configurationPresets,
|
||||
configurationSchema,
|
||||
loaded
|
||||
} = props
|
||||
|
||||
@@ -148,15 +149,13 @@ class Plugin extends Component {
|
||||
</div>
|
||||
</h5>
|
||||
</Col>
|
||||
<Col mediumSize={4}>
|
||||
<div className='form-group pull-right small'>
|
||||
<Button btnStyle='primary' onClick={this._updateExpanded}>
|
||||
<Icon icon={expanded ? 'minus' : 'plus'} />
|
||||
</Button>
|
||||
</div>
|
||||
</Col>
|
||||
{configurationSchema !== undefined && <Col className='text-xs-right' mediumSize={4}>
|
||||
<Button btnStyle='primary' onClick={this._updateExpanded}>
|
||||
<Icon icon={expanded ? 'minus' : 'plus'} />
|
||||
</Button>
|
||||
</Col>}
|
||||
</Row>
|
||||
{expanded && props.configurationSchema &&
|
||||
{expanded &&
|
||||
<form id={this.configFormId} onReset={this._stopEditing}>
|
||||
{size(configurationPresets) > 0 && (
|
||||
<div>
|
||||
@@ -188,25 +187,39 @@ class Plugin extends Component {
|
||||
<GenericInput
|
||||
label='Configuration'
|
||||
required
|
||||
schema={props.configurationSchema}
|
||||
schema={configurationSchema}
|
||||
uiSchema={this._getUiSchema()}
|
||||
onChange={this.linkState('editedConfig')}
|
||||
value={editedConfig || this.props.configuration}
|
||||
value={editedConfig || props.configuration}
|
||||
/>
|
||||
<div className='form-group pull-right'>
|
||||
<div className='btn-toolbar'>
|
||||
<div className='btn-group'>
|
||||
<ActionButton btnStyle='danger' disabled={!props.configuration} icon='delete' handler={this._deleteConfiguration}>
|
||||
<ActionButton
|
||||
btnStyle='danger'
|
||||
disabled={!props.configuration}
|
||||
handler={this._deleteConfiguration}
|
||||
icon='delete'
|
||||
>
|
||||
{_('deletePluginConfiguration')}
|
||||
</ActionButton>
|
||||
</div>
|
||||
<div className='btn-group'>
|
||||
<Button disabled={!editedConfig} type='reset'>
|
||||
<Button
|
||||
disabled={!editedConfig}
|
||||
type='reset'
|
||||
>
|
||||
{_('cancelPluginEdition')}
|
||||
</Button>
|
||||
</div>
|
||||
<div className='btn-group'>
|
||||
<ActionButton disabled={!editedConfig} form={this.configFormId} icon='save' className='btn-primary' handler={this._saveConfiguration}>
|
||||
<ActionButton
|
||||
btnStyle='primary'
|
||||
disabled={!editedConfig}
|
||||
form={this.configFormId}
|
||||
handler={this._saveConfiguration}
|
||||
icon='save'
|
||||
>
|
||||
{_('savePluginConfiguration')}
|
||||
</ActionButton>
|
||||
</div>
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
import _ from 'intl'
|
||||
import assign from 'lodash/assign'
|
||||
import Component from 'base-component'
|
||||
import find from 'lodash/find'
|
||||
import flatten from 'lodash/flatten'
|
||||
import forEach from 'lodash/forEach'
|
||||
import Icon from 'icon'
|
||||
import Link from 'link'
|
||||
import map from 'lodash/map'
|
||||
import mapValues from 'lodash/mapValues'
|
||||
import Page from '../page'
|
||||
import pick from 'lodash/pick'
|
||||
import React, { cloneElement } from 'react'
|
||||
import SrActionBar from './action-bar'
|
||||
import { Container, Row, Col } from 'grid'
|
||||
import { editSr } from 'xo'
|
||||
import { NavLink, NavTabs } from 'nav'
|
||||
import { Text } from 'editable'
|
||||
import {
|
||||
assign,
|
||||
map,
|
||||
pick
|
||||
} from 'lodash'
|
||||
import {
|
||||
connectStore,
|
||||
routes
|
||||
@@ -62,73 +60,25 @@ import TabXosan from './tab-xosan'
|
||||
)
|
||||
)
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
const getVdis = createGetObjectsOfType('VDI').pick(
|
||||
createSelector(getSr, sr => sr.VDIs)
|
||||
).sort()
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
const getLogs = createGetObjectMessages(getSr)
|
||||
|
||||
const getVbdsByVdi = createGetObjectsOfType('VBD').pick(
|
||||
createSelector(
|
||||
getVdis,
|
||||
vdis => flatten(map(vdis, vdi => vdi.$VBDs))
|
||||
)
|
||||
).groupBy('VDI')
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
const getVdiIds = (state, props) => getSr(state, props).VDIs
|
||||
|
||||
const getVdisUnmanaged = createGetObjectsOfType('VDI-unmanaged').pick(
|
||||
createSelector(getSr, sr => sr.VDIs)
|
||||
const getVdis = createGetObjectsOfType('VDI').pick(
|
||||
getVdiIds
|
||||
).sort()
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
const getVdiSnapshots = createGetObjectsOfType('VDI-snapshot').pick(
|
||||
getVdiIds
|
||||
).sort()
|
||||
const getUnmanagedVdis = createGetObjectsOfType('VDI-unmanaged').pick(
|
||||
createSelector(getSr, sr => sr.VDIs)
|
||||
).sort()
|
||||
|
||||
const getVdiSnapshotToVdi = createSelector(
|
||||
getVdis,
|
||||
getVdiSnapshots,
|
||||
(vdis, vdiSnapshots) => {
|
||||
const vdiSnapshotToVdi = {}
|
||||
forEach(vdiSnapshots, vdiSnapshot => {
|
||||
vdiSnapshotToVdi[vdiSnapshot.id] = vdiSnapshot.$snapshot_of && find(vdis, vdi => vdi.id === vdiSnapshot.$snapshot_of)
|
||||
})
|
||||
|
||||
return vdiSnapshotToVdi
|
||||
}
|
||||
)
|
||||
|
||||
const getVbdsByVdiSnapshot = createSelector(
|
||||
getVbdsByVdi,
|
||||
getVdiSnapshots,
|
||||
getVdiSnapshotToVdi,
|
||||
(vbdsByVdi, vdiSnapshots, vdiSnapshotToVdi) => {
|
||||
const vbdsByVdiSnapshot = {}
|
||||
forEach(vdiSnapshots, vdiSnapshot => {
|
||||
const vdi = vdiSnapshotToVdi[vdiSnapshot.id]
|
||||
vbdsByVdiSnapshot[vdiSnapshot.id] = vdi && vbdsByVdi[vdi.id]
|
||||
})
|
||||
|
||||
return vbdsByVdiSnapshot
|
||||
}
|
||||
)
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
const getVdisToVmIds = createSelector(
|
||||
getVbdsByVdi,
|
||||
getVbdsByVdiSnapshot,
|
||||
(vbdsByVdi, vbdsByVdiSnapshot) => mapValues({ ...vbdsByVdi, ...vbdsByVdiSnapshot }, vbds => {
|
||||
const vbd = find(vbds, 'VM')
|
||||
if (vbd) {
|
||||
return vbd.VM
|
||||
}
|
||||
})
|
||||
)
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
return (state, props) => {
|
||||
const sr = getSr(state, props)
|
||||
@@ -142,9 +92,8 @@ import TabXosan from './tab-xosan'
|
||||
pbds: getPbds(state, props),
|
||||
logs: getLogs(state, props),
|
||||
vdis: getVdis(state, props),
|
||||
vdisUnmanaged: getVdisUnmanaged(state, props),
|
||||
unmanagedVdis: getUnmanagedVdis(state, props),
|
||||
vdiSnapshots: getVdiSnapshots(state, props),
|
||||
vdisToVmIds: getVdisToVmIds(state, props),
|
||||
sr
|
||||
}
|
||||
}
|
||||
@@ -223,9 +172,8 @@ export default class Sr extends Component {
|
||||
'pbds',
|
||||
'sr',
|
||||
'vdis',
|
||||
'vdisUnmanaged',
|
||||
'vdiSnapshots',
|
||||
'vdisToVmIds'
|
||||
'unmanagedVdis',
|
||||
'vdiSnapshots'
|
||||
]))
|
||||
return <Page header={this.header()} title={`${sr.name_label}${container ? ` (${container.name_label})` : ''}`}>
|
||||
{cloneElement(this.props.children, childProps)}
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
import _ from 'intl'
|
||||
import ActionRow from 'action-row-button'
|
||||
import Component from 'base-component'
|
||||
import Icon from 'icon'
|
||||
import isEmpty from 'lodash/isEmpty'
|
||||
import Link from 'link'
|
||||
import React from 'react'
|
||||
import renderXoItem, { renderXoUnknownItem } from 'render-xo-item'
|
||||
import SortedTable from 'sorted-table'
|
||||
import { formatSize } from 'utils'
|
||||
import { concat, isEmpty } from 'lodash'
|
||||
import { connectStore, formatSize } from 'utils'
|
||||
import { Container, Row, Col } from 'grid'
|
||||
import { createGetObject, createSelector } from 'selectors'
|
||||
import { deleteVdi, editVdi } from 'xo'
|
||||
import { renderXoItemFromId } from 'render-xo-item'
|
||||
import { Text } from 'editable'
|
||||
|
||||
// ===================================================================
|
||||
@@ -37,20 +39,38 @@ const COLUMNS = [
|
||||
},
|
||||
{
|
||||
name: _('vdiVm'),
|
||||
itemRenderer: (vdi, vdisToVmIds) => {
|
||||
const id = vdisToVmIds[vdi.id]
|
||||
const Item = renderXoItemFromId(id)
|
||||
component: connectStore(() => {
|
||||
const getObject = createGetObject((_, id) => id)
|
||||
|
||||
if (id) {
|
||||
return (
|
||||
<Link to={`/vms/${id}${vdi.type === 'VDI-snapshot' ? '/snapshots' : ''}`}>
|
||||
{Item}
|
||||
</Link>
|
||||
)
|
||||
return {
|
||||
vm: (state, { item: { $VBDs: [ vbdId ] } }) => {
|
||||
if (vbdId === undefined) {
|
||||
return null
|
||||
}
|
||||
|
||||
const vbd = getObject(state, vbdId)
|
||||
if (vbd != null) {
|
||||
return getObject(state, vbd.VM)
|
||||
}
|
||||
}
|
||||
}
|
||||
})(({ vm }) => {
|
||||
if (vm === null) {
|
||||
return null // no attached VM
|
||||
}
|
||||
|
||||
return Item
|
||||
}
|
||||
if (vm === undefined) {
|
||||
return renderXoUnknownItem()
|
||||
}
|
||||
|
||||
return <Link to={`/vms/${
|
||||
vm.type === 'VM-snapshot'
|
||||
? `${vm.$snapshot_of}/snapshots`
|
||||
: vm.id
|
||||
}`}>
|
||||
{renderXoItem(vm)}
|
||||
</Link>
|
||||
})
|
||||
},
|
||||
{
|
||||
name: _('vdiTags'),
|
||||
@@ -75,23 +95,39 @@ const COLUMNS = [
|
||||
]
|
||||
|
||||
const FILTERS = {
|
||||
filterNoSnapshots: 'type:!VDI-snapshot',
|
||||
filterOnlyBaseCopy: 'type:VDI-unmanaged',
|
||||
filterOnlyRegularDisks: 'type:!VDI-unmanaged type:!VDI-snapshot',
|
||||
filterOnlySnapshots: 'type:VDI-snapshot'
|
||||
filterOnlyManaged: 'type:!VDI-unmanaged',
|
||||
filterOnlyRegular: '!type:|(VDI-snapshot VDI-unmanaged)',
|
||||
filterOnlySnapshots: 'type:VDI-snapshot',
|
||||
filterOnlyOrphaned: 'type:!VDI-unmanaged $VBDs:!""',
|
||||
filterOnlyUnmanaged: 'type:VDI-unmanaged'
|
||||
}
|
||||
|
||||
// ===================================================================
|
||||
|
||||
export default ({ vdis, vdisUnmanaged, vdiSnapshots, vdisToVmIds }) => (
|
||||
<Container>
|
||||
<Row>
|
||||
<Col>
|
||||
{!isEmpty(vdis)
|
||||
? <SortedTable collection={vdis.concat(vdiSnapshots, vdisUnmanaged)} userData={vdisToVmIds} columns={COLUMNS} filters={FILTERS} />
|
||||
: <h4 className='text-xs-center'>{_('srNoVdis')}</h4>
|
||||
}
|
||||
</Col>
|
||||
</Row>
|
||||
</Container>
|
||||
)
|
||||
export default class SrDisks extends Component {
|
||||
_getAllVdis = createSelector(
|
||||
() => this.props.vdis,
|
||||
() => this.props.vdiSnapshots,
|
||||
() => this.props.unmanagedVdis,
|
||||
concat
|
||||
)
|
||||
|
||||
render () {
|
||||
const vdis = this._getAllVdis()
|
||||
return <Container>
|
||||
<Row>
|
||||
<Col>
|
||||
{!isEmpty(vdis)
|
||||
? <SortedTable
|
||||
collection={vdis}
|
||||
columns={COLUMNS}
|
||||
defaultFilter='filterOnlyManaged'
|
||||
filters={FILTERS}
|
||||
/>
|
||||
: <h4 className='text-xs-center'>{_('srNoVdis')}</h4>
|
||||
}
|
||||
</Col>
|
||||
</Row>
|
||||
</Container>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,30 @@
|
||||
import _ from 'intl'
|
||||
import HomeTags from 'home-tags'
|
||||
import Icon from 'icon'
|
||||
import map from 'lodash/map'
|
||||
import React from 'react'
|
||||
import HomeTags from 'home-tags'
|
||||
import { addTag, removeTag } from 'xo'
|
||||
import { Container, Row, Col } from 'grid'
|
||||
import { formatSize } from 'utils'
|
||||
import { renderXoItemFromId } from 'render-xo-item'
|
||||
import Usage, { UsageElement } from 'usage'
|
||||
import { addTag, removeTag } from 'xo'
|
||||
import { connectStore, formatSize } from 'utils'
|
||||
import { Container, Row, Col } from 'grid'
|
||||
import { createGetObject } from 'selectors'
|
||||
import { renderXoItemFromId } from 'render-xo-item'
|
||||
|
||||
const UsageTooltip = connectStore(() => ({
|
||||
vbd: createGetObject((_, { vdi }) => vdi.$VBDs[0])
|
||||
}))(({ vbd, vdi }) =>
|
||||
<span>
|
||||
{vdi.name_label} − {formatSize(vdi.usage)}
|
||||
{vbd != null && <br />}
|
||||
{vbd != null && renderXoItemFromId(vbd.VM)}
|
||||
</span>
|
||||
)
|
||||
|
||||
export default ({
|
||||
sr,
|
||||
vdis,
|
||||
vdisUnmanaged,
|
||||
vdisToVmIds
|
||||
vdiSnapshots,
|
||||
unmanagedVdis
|
||||
}) => <Container>
|
||||
<Row className='text-xs-center'>
|
||||
<Col mediumSize={4}>
|
||||
@@ -35,23 +46,21 @@ export default ({
|
||||
<Row>
|
||||
<Col smallOffset={1} mediumSize={10}>
|
||||
<Usage total={sr.size}>
|
||||
{map(vdisUnmanaged, vdi => <UsageElement
|
||||
{map(unmanagedVdis, vdi => <UsageElement
|
||||
highlight
|
||||
key={vdi.id}
|
||||
tooltip={<span>
|
||||
{vdi.name_label}
|
||||
<br />
|
||||
{vdisToVmIds[vdi.id] && renderXoItemFromId(vdisToVmIds[vdi.id])}
|
||||
</span>}
|
||||
tooltip={<UsageTooltip vdi={vdi} />}
|
||||
value={vdi.usage}
|
||||
/>)}
|
||||
{map(vdis, vdi => <UsageElement
|
||||
key={vdi.id}
|
||||
tooltip={<span>
|
||||
{vdi.name_label}
|
||||
<br />
|
||||
{vdisToVmIds[vdi.id] && renderXoItemFromId(vdisToVmIds[vdi.id])}
|
||||
</span>}
|
||||
tooltip={<UsageTooltip vdi={vdi} />}
|
||||
value={vdi.usage}
|
||||
/>)}
|
||||
{map(vdiSnapshots, vdi => <UsageElement
|
||||
highlight
|
||||
key={vdi.id}
|
||||
tooltip={<UsageTooltip vdi={vdi} />}
|
||||
value={vdi.usage}
|
||||
/>)}
|
||||
</Usage>
|
||||
|
||||
@@ -42,7 +42,7 @@ export const TaskItem = connectStore(() => ({
|
||||
host: createGetObject((_, props) => props.task.$host)
|
||||
}))(({ task, host }) => <SingleLineRow className='mb-1'>
|
||||
<Col mediumSize={6}>
|
||||
{task.name_label} (on {host
|
||||
{task.name_label} ({task.name_description && `${task.name_description} `}on {host
|
||||
? <Link to={`/hosts/${host.id}`}>{host.name_label}</Link>
|
||||
: `unknown host − ${task.$host}`
|
||||
})
|
||||
|
||||
@@ -31,7 +31,7 @@ const vmActionBarByState = {
|
||||
handler: restartVm,
|
||||
pending: includes(vm.current_operations, 'clean_reboot')
|
||||
},
|
||||
(isAdmin || !vm.resourceSet) && {
|
||||
{
|
||||
icon: 'vm-migrate',
|
||||
label: 'migrateVmLabel',
|
||||
handler: migrateVm,
|
||||
@@ -77,7 +77,7 @@ const vmActionBarByState = {
|
||||
handler: cloneVm,
|
||||
pending: includes(vm.current_operations, 'clone')
|
||||
},
|
||||
(isAdmin || !vm.resourceSet) && {
|
||||
{
|
||||
icon: 'vm-migrate',
|
||||
label: 'migrateVmLabel',
|
||||
handler: migrateVm,
|
||||
|
||||
@@ -9,7 +9,6 @@ import VmActionBar from './action-bar'
|
||||
import { Select, Text } from 'editable'
|
||||
import {
|
||||
assign,
|
||||
forEach,
|
||||
isEmpty,
|
||||
map,
|
||||
pick
|
||||
@@ -23,13 +22,14 @@ import {
|
||||
import { Container, Row, Col } from 'grid'
|
||||
import {
|
||||
connectStore,
|
||||
mapPlus,
|
||||
routes
|
||||
} from 'utils'
|
||||
import {
|
||||
createGetObject,
|
||||
createGetObjectsOfType,
|
||||
createGetVmDisks,
|
||||
createSelector,
|
||||
createSumBy,
|
||||
getCheckPermissions,
|
||||
isAdmin
|
||||
} from 'selectors'
|
||||
@@ -71,16 +71,7 @@ import TabAdvanced from './tab-advanced'
|
||||
const getVbds = createGetObjectsOfType('VBD').pick(
|
||||
(state, props) => getVm(state, props).$VBDs
|
||||
).sort()
|
||||
const getVdis = createGetObjectsOfType('VDI').pick(
|
||||
createSelector(
|
||||
getVbds,
|
||||
vbds => mapPlus(vbds, (vbd, push) => {
|
||||
if (!vbd.is_cd_drive && vbd.VDI) {
|
||||
push(vbd.VDI)
|
||||
}
|
||||
})
|
||||
)
|
||||
)
|
||||
const getVdis = createGetVmDisks(getVm)
|
||||
const getSrs = createGetObjectsOfType('SR').pick(
|
||||
createSelector(
|
||||
getVdis,
|
||||
@@ -88,15 +79,9 @@ import TabAdvanced from './tab-advanced'
|
||||
)
|
||||
)
|
||||
|
||||
const getVmTotalDiskSpace = createSelector(
|
||||
getVdis,
|
||||
vdis => {
|
||||
let vmTotalDiskSpace = 0
|
||||
forEach(vdis, vdi => {
|
||||
vmTotalDiskSpace += vdi.size
|
||||
})
|
||||
return vmTotalDiskSpace
|
||||
}
|
||||
const getVmTotalDiskSpace = createSumBy(
|
||||
createGetVmDisks(getVm),
|
||||
'size'
|
||||
)
|
||||
|
||||
const getHosts = createGetObjectsOfType('host')
|
||||
|
||||
@@ -150,7 +150,6 @@ export default class TabConsole extends Component {
|
||||
scale={scale}
|
||||
url={resolveUrl(`consoles/${vm.id}`)}
|
||||
/>
|
||||
{!minimalLayout && <p><em><Icon icon='info' /> <a href='https://bugs.xenserver.org/browse/XSO-650' target='_blank'>{_('tipLabel')} {_('tipConsoleLabel')}</a></em></p>}
|
||||
</Col>
|
||||
</Row>
|
||||
</Container>
|
||||
|
||||
Reference in New Issue
Block a user