mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
feature #3748: Add attach nic dialog
This commit is contained in:
parent
9dfb4b8496
commit
2147a074ab
@ -11,7 +11,8 @@ define(function(require) {
|
||||
require('./vms-tab/dialogs/deploy'),
|
||||
require('./vms-tab/dialogs/migrate'),
|
||||
require('./vms-tab/dialogs/resize'),
|
||||
require('./vms-tab/dialogs/attach-disk')
|
||||
require('./vms-tab/dialogs/attach-disk'),
|
||||
require('./vms-tab/dialogs/attach-nic')
|
||||
];
|
||||
|
||||
var _panels = [
|
||||
|
85
src/sunstone/public/app/tabs/vms-tab/dialogs/attach-nic.js
Normal file
85
src/sunstone/public/app/tabs/vms-tab/dialogs/attach-nic.js
Normal file
@ -0,0 +1,85 @@
|
||||
define(function(require) {
|
||||
/*
|
||||
DEPENDENCIES
|
||||
*/
|
||||
|
||||
var BaseDialog = require('utils/dialogs/dialog');
|
||||
var TemplateHTML = require('hbs!./attach-nic/html');
|
||||
var Sunstone = require('sunstone');
|
||||
var Notifier = require('utils/notifier');
|
||||
var Tips = require('utils/tips');
|
||||
var NicTab = require('tabs/templates-tab/form-panels/create/wizard-tabs/network/nic-tab');
|
||||
var WizardFields = require('utils/wizard-fields');
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
*/
|
||||
|
||||
var DIALOG_ID = require('./attach-nic/dialogId');
|
||||
var TAB_ID = require('../tabId')
|
||||
|
||||
/*
|
||||
CONSTRUCTOR
|
||||
*/
|
||||
|
||||
function Dialog() {
|
||||
this.dialogId = DIALOG_ID;
|
||||
|
||||
this.nicTab = new NicTab(DIALOG_ID + 'NickTab');
|
||||
|
||||
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,
|
||||
'nicTabHTML': this.nicTab.html()
|
||||
});
|
||||
}
|
||||
|
||||
function _setup(context) {
|
||||
var that = this;
|
||||
that.nicTab.setup();
|
||||
|
||||
Tips.setup(context);
|
||||
|
||||
$('#' + DIALOG_ID + 'Form', context).submit(function() {
|
||||
var templateJSON = that.nicTab.retrieve(context);
|
||||
var obj = {
|
||||
"NIC": templateJSON
|
||||
}
|
||||
|
||||
Sunstone.runAction('VM.attachnic', that.element.ID, obj);
|
||||
|
||||
Sunstone.getDialog(DIALOG_ID).hide();
|
||||
Sunstone.getDialog(DIALOG_ID).reset();
|
||||
return false;
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function _onShow(context) {
|
||||
this.nicTab.onShow(context);
|
||||
$("#vm_id", context).val(this.element.ID);
|
||||
return false;
|
||||
}
|
||||
|
||||
function _setElement(element) {
|
||||
this.element = element
|
||||
}
|
||||
});
|
@ -0,0 +1,3 @@
|
||||
define(function(require) {
|
||||
return 'attachNICVMDialog';
|
||||
});
|
@ -0,0 +1,24 @@
|
||||
<div id="{{dialogId}}" class="reveal-modal large" role="dialog" data-reveal >
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
<h3 class="subheader" id="">{{tr "Attach new nic"}}</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>
|
||||
{{{nicTabHTML}}}
|
||||
<div class="reveal-footer">
|
||||
<div class="form_buttons">
|
||||
<button class="button radius right success" id="attach_nic_button" type="submit" value="VM.attachdisk">{{tr "Attach"}}</button>
|
||||
</div>
|
||||
</div>
|
||||
<a class="close-reveal-modal">×</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
@ -18,7 +18,7 @@ define(function(require) {
|
||||
|
||||
var TAB_ID = require('../tabId');
|
||||
var PANEL_ID = require('./network/panelId');
|
||||
//var ATTACH_NIC_DIALOG_ID = require('../dialogs/attach-nic/dialogId');
|
||||
var ATTACH_NIC_DIALOG_ID = require('../dialogs/attach-nic/dialogId');
|
||||
var RESOURCE = "VM"
|
||||
var XML_ROOT = "VM"
|
||||
|
||||
@ -364,9 +364,9 @@ define(function(require) {
|
||||
if (Config.isTabActionEnabled("vms-tab", "VM.attachnic")) {
|
||||
context.off('click', '#attach_nic');
|
||||
context.on('click', '#attach_nic', function() {
|
||||
//TODO var dialog = Sunstone.getDialog(ATTACH_NIC_DIALOG_ID);
|
||||
//TODO dialog.setElement(that.element);
|
||||
//TODO dialog.show();
|
||||
var dialog = Sunstone.getDialog(ATTACH_NIC_DIALOG_ID);
|
||||
dialog.setElement(that.element);
|
||||
dialog.show();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user