1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

feature #3748: Add take snapshot dialog

This commit is contained in:
Daniel Molina 2015-06-09 16:12:23 +02:00
parent 858678fd4a
commit c15c0912bc
4 changed files with 110 additions and 1 deletions

View File

@ -12,7 +12,8 @@ define(function(require) {
require('./vms-tab/dialogs/migrate'),
require('./vms-tab/dialogs/resize'),
require('./vms-tab/dialogs/attach-disk'),
require('./vms-tab/dialogs/attach-nic')
require('./vms-tab/dialogs/attach-nic'),
require('./vms-tab/dialogs/snapshot')
];
var _panels = [

View File

@ -0,0 +1,78 @@
define(function(require) {
/*
DEPENDENCIES
*/
var BaseDialog = require('utils/dialogs/dialog');
var TemplateHTML = require('hbs!./snapshot/html');
var Sunstone = require('sunstone');
var Tips = require('utils/tips');
/*
CONSTANTS
*/
var DIALOG_ID = require('./snapshot/dialogId');
var TAB_ID = require('../tabId')
/*
CONSTRUCTOR
*/
function Dialog() {
this.dialogId = DIALOG_ID;
BaseDialog.call(this);
};
Dialog.DIALOG_ID = DIALOG_ID;
Dialog.prototype = Object.create(BaseDialog.prototype);
Dialog.prototype.constructor = Dialog;
Dialog.prototype.html = _html;
Dialog.prototype.onShow = _onShow;
Dialog.prototype.setup = _setup;
Dialog.prototype.setElement = _setElement;
return Dialog;
/*
FUNCTION DEFINITIONS
*/
function _html() {
return TemplateHTML({
'dialogId': this.dialogId
});
}
function _setup(context) {
var that = this;
Tips.setup(context);
$('#' + DIALOG_ID + 'Form', context).submit(function() {
var snapshot_name = $('#snapshot_name', this).val();
var obj = {
"snapshot_name": snapshot_name
}
Sunstone.runAction('VM.snapshot_create', that.element.ID, obj);
Sunstone.getDialog(DIALOG_ID).hide();
Sunstone.getDialog(DIALOG_ID).reset();
return false;
});
return false;
}
function _onShow(context) {
$("#vm_id", context).val(this.element.ID);
$("#snapshot_name", context).focus();
return false;
}
function _setElement(element) {
this.element = element
}
});

View File

@ -0,0 +1,3 @@
define(function(require) {
return 'snapshotVMDialog';
});

View File

@ -0,0 +1,27 @@
<div id="{{dialogId}}" class="reveal-modal small" role="dialog" data-reveal >
<div class="row">
<div class="large-12 columns">
<h3 class="subheader" id="">{{tr "Snapshot"}}</h3>
</div>
</div>
<div class="reveal-body">
<form id="{{dialogId}}Form" action="">
<div class="row">
<div class="large-6 columns">
<label for="vm_id">{{tr "Virtual Machine ID"}}:</label>
<input style="border-style: inset; background-color: lightgrey" type="text" name="vm_id" id="vm_id" disabled/>
</div>
</div>
<div class="row">
<div class="large-12 columns">
<label for="snapshot_name">{{tr "Snapshot name"}}:</label>
<input type="text" name="snapshot_name" id="snapshot_name" />
</div>
</div>
<div class="form_buttons">
<button class="button radius right success" id="snapshot_live_button" type="submit" value="VM.saveas">{{tr "Take snapshot"}}</button>
</div>
<a class="close-reveal-modal">&#215;</a>
</form>
</div>
</div>