Copy VM, first delivery

This commit is contained in:
Fabrice Marsaud
2015-11-11 17:38:13 +01:00
parent 490c224ac3
commit 441992cf37
3 changed files with 26 additions and 3 deletions

View File

@@ -71,6 +71,8 @@ module.exports = angular.module 'xoWebApp.vm', [
prepareDiskData()
)
$scope.objects = xoApi.all
$scope.currentLogPage = 1
$scope.currentSnapPage = 1
$scope.currentPCIPage = 1
@@ -589,6 +591,14 @@ module.exports = angular.module 'xoWebApp.vm', [
.then ({$getFrom: url}) ->
window.open '.' + url
$scope.copyVM = (id, srId) ->
console.log "Copy VM #{id} tp SR #{srId}"
notify.info {
title: 'VM copy'
message: 'VM copy started'
}
xo.vm.copy id, srId, $scope.VM.name_label + '_COPY'
$scope.exportOnlyMetadataVM = (id) ->
console.log "Export Metadata only for VM #{id}"
notify.info {

View File

@@ -362,9 +362,19 @@
a(xo-click="exportOnlyMetadataVM(VM.id)")
i.fa.fa-database.fa-fw
| Only Metadata
//- .grid-cell.btn-group
//- button.btn(tooltip="Export the VM", style="width: 90%", type="button", xo-click="exportOnlyMetadataVM(VM.id)")
//- i.fa.fa-download.fa-2x.fa-fw
.grid-cell.btn-group.dropdown(dropdown, ng-if="canAdmin()")
button.btn.dropdown-toggle(
dropdown-toggle
tooltip="Copy the VM"
tooltip-placement="top"
style="width: 90%"
type="button"
)
i.fa.fa-clone.fa-2x.fa-fw
span.caret
ul.dropdown-menu.left(role="menu")
li(ng-repeat = 'SR in objects | selectHighLevel | filter:{type: "SR", content_type: "!iso"} | orderBy:"($container | resolve).name_label"')
a(xo-click = 'copyVM(VM.id, SR.id)') {{ SR.name_label}} ({{(SR.$container | resolve).name_label}})
.grid-cell.btn-group(style="margin-bottom: 0.5em")
button.btn(tooltip="VM Console", tooltip-placement="top", type="button", style="width: 90%", xo-sref="consoles_view({id: VM.id})")
i.xo-icon-console.fa-2x.fa-fw

3
app/node_modules/xo/index.js generated vendored
View File

@@ -236,6 +236,9 @@ export default angular.module('xo', [
argsMapper: (vm, vdi, bootable, mode, position) => ({vm, vdi, bootable, mode, position})
}),
convert: action('Convert VM', 'vm.convert'),
copy: action('Copy a VM to another SR', 'vm.copy', {
argsMapper: (vm, sr, name = undefined) =>({vm, sr, name})
}),
clone: action('Copy VM', 'vm.clone', {
// todo : sr ref to choose target SR
argsMapper: (id, name, full_copy) => ({id, name, full_copy})