mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
parent
8596c4e502
commit
79a19041c4
@ -12,7 +12,8 @@ define(function(require) {
|
||||
];
|
||||
|
||||
var _panels = [
|
||||
require('./oneflow-services-tab/panels/info')
|
||||
require('./oneflow-services-tab/panels/info'),
|
||||
require('./oneflow-services-tab/panels/roles')
|
||||
];
|
||||
|
||||
var _formPanels = [
|
||||
|
@ -3,14 +3,39 @@ define(function(require) {
|
||||
var Notifier = require('utils/notifier');
|
||||
var Locale = require('utils/locale');
|
||||
var OpenNebulaResource = require('opennebula/service');
|
||||
var OpenNebulaRole = require('opennebula/role');
|
||||
var OpenNebulaVM = require('opennebula/vm');
|
||||
var CommonActions = require('utils/common-actions');
|
||||
|
||||
var TAB_ID = require('./tabId');
|
||||
var XML_ROOT = "DOCUMENT";
|
||||
var RESOURCE = "Service";
|
||||
|
||||
var ROLES_PANEL_ID = require('./panels/roles/panelId');
|
||||
|
||||
var _commonActions = new CommonActions(OpenNebulaResource, RESOURCE, TAB_ID);
|
||||
|
||||
function roleElements() {
|
||||
var selected_nodes = [];
|
||||
|
||||
var dataTable = $('#datatable_service_roles', '#'+TAB_ID+' #'+ROLES_PANEL_ID);
|
||||
var nodes = $('tbody input.check_item:checked', dataTable);
|
||||
$.each(nodes, function() {
|
||||
selected_nodes.push($(this).val());
|
||||
});
|
||||
|
||||
return selected_nodes;
|
||||
}
|
||||
|
||||
function roleVMElements() {
|
||||
// TODO
|
||||
//return getSelectedNodes(serviceroleVMsDataTable, true);
|
||||
}
|
||||
|
||||
function roleCallback() {
|
||||
return Sunstone.runAction('Service.refresh');
|
||||
}
|
||||
|
||||
var _actions = {
|
||||
"Service.show" : _commonActions.show(),
|
||||
"Service.refresh" : _commonActions.refresh(),
|
||||
@ -37,7 +62,7 @@ define(function(require) {
|
||||
type: "multiple",
|
||||
call: OpenNebula.Service.shutdown,
|
||||
elements: serviceElements,
|
||||
error: onError,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
@ -45,11 +70,390 @@ define(function(require) {
|
||||
type: "multiple",
|
||||
call: OpenNebula.Service.recover,
|
||||
elements: serviceElements,
|
||||
error: onError,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
/* TODO
|
||||
"Role.update_dialog" : {
|
||||
type: "custom",
|
||||
call: popUpScaleDialog
|
||||
},
|
||||
|
||||
"Role.update" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaRole.update,
|
||||
callback: roleCallback,
|
||||
elements: roleElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
*/
|
||||
|
||||
"Role.hold" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaRole.hold,
|
||||
callback: roleCallback,
|
||||
elements: roleElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"Role.release" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaRole.release,
|
||||
callback: roleCallback,
|
||||
elements: roleElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"Role.suspend" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaRole.suspend,
|
||||
callback: roleCallback,
|
||||
elements: roleElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"Role.resume" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaRole.resume,
|
||||
callback: roleCallback,
|
||||
elements: roleElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"Role.stop" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaRole.stop,
|
||||
callback: roleCallback,
|
||||
elements: roleElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"Role.reboot_hard" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaRole.reboot_hard,
|
||||
callback: roleCallback,
|
||||
elements: roleElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"Role.delete_recreate" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaRole.delete_recreate,
|
||||
callback: roleCallback,
|
||||
elements: roleElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"Role.reboot" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaRole.reboot,
|
||||
callback: roleCallback,
|
||||
elements: roleElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"Role.poweroff" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaRole.poweroff,
|
||||
callback: roleCallback,
|
||||
elements: roleElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"Role.poweroff_hard" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaRole.poweroff_hard,
|
||||
callback: roleCallback,
|
||||
elements: roleElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"Role.undeploy" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaRole.undeploy,
|
||||
callback: roleCallback,
|
||||
elements: roleElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"Role.undeploy_hard" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaRole.undeploy_hard,
|
||||
callback: roleCallback,
|
||||
elements: roleElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"Role.snapshot_create" : {
|
||||
type: "single",
|
||||
call: OpenNebulaRole.snapshot_create,
|
||||
callback: roleCallback,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"Role.shutdown" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaRole.shutdown,
|
||||
callback: roleCallback,
|
||||
elements: roleElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"Role.shutdown_hard" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaRole.cancel,
|
||||
callback: roleCallback,
|
||||
elements: roleElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"Role.delete" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaRole.del,
|
||||
callback: roleCallback,
|
||||
elements: roleElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"Role.recover" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaRole.recover,
|
||||
callback: roleCallback,
|
||||
elements: roleElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
"RoleVM.deploy" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaVM.deploy,
|
||||
callback: roleCallback,
|
||||
elements: roleVMElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"RoleVM.migrate" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaVM.migrate,
|
||||
callback: roleCallback,
|
||||
elements: roleVMElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"RoleVM.migrate_live" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaVM.livemigrate,
|
||||
callback: roleCallback,
|
||||
elements: roleVMElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"RoleVM.hold" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaVM.hold,
|
||||
callback: roleCallback,
|
||||
elements: roleVMElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"RoleVM.release" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaVM.release,
|
||||
callback: roleCallback,
|
||||
elements: roleVMElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"RoleVM.suspend" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaVM.suspend,
|
||||
callback: roleCallback,
|
||||
elements: roleVMElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"RoleVM.resume" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaVM.resume,
|
||||
callback: roleCallback,
|
||||
elements: roleVMElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"RoleVM.stop" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaVM.stop,
|
||||
callback: roleCallback,
|
||||
elements: roleVMElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"RoleVM.reboot_hard" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaVM.reset,
|
||||
callback: roleCallback,
|
||||
elements: roleVMElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"RoleVM.delete_recreate" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaVM.resubmit,
|
||||
callback: roleCallback,
|
||||
elements: roleVMElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"RoleVM.reboot" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaVM.reboot,
|
||||
callback: roleCallback,
|
||||
elements: roleVMElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"RoleVM.poweroff" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaVM.poweroff,
|
||||
callback: roleCallback,
|
||||
elements: roleVMElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"RoleVM.poweroff_hard" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaVM.poweroff_hard,
|
||||
callback: roleCallback,
|
||||
elements: roleVMElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"RoleVM.undeploy" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaVM.undeploy,
|
||||
callback: roleCallback,
|
||||
elements: roleVMElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"RoleVM.undeploy_hard" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaVM.undeploy_hard,
|
||||
callback: roleCallback,
|
||||
elements: roleVMElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"RoleVM.shutdown" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaVM.shutdown,
|
||||
callback: roleCallback,
|
||||
elements: roleVMElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"RoleVM.shutdown_hard" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaVM.cancel,
|
||||
callback: roleCallback,
|
||||
elements: roleVMElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"RoleVM.delete" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaVM.del,
|
||||
callback: roleCallback,
|
||||
elements: roleVMElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"RoleVM.recover" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaVM.recover,
|
||||
callback: roleCallback,
|
||||
elements: roleVMElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"RoleVM.resched" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaVM.resched,
|
||||
callback: roleCallback,
|
||||
elements: roleVMElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"RoleVM.unresched" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaVM.unresched,
|
||||
callback: roleCallback,
|
||||
elements: roleVMElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"RoleVM.chown" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaVM.chown,
|
||||
callback: roleCallback,
|
||||
elements: roleVMElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
},
|
||||
"RoleVM.chgrp" : {
|
||||
type: "multiple",
|
||||
call: OpenNebulaVM.chgrp,
|
||||
callback: roleCallback,
|
||||
elements: roleVMElements,
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
return _actions;
|
||||
|
@ -0,0 +1,161 @@
|
||||
define(function(require) {
|
||||
/*
|
||||
DEPENDENCIES
|
||||
*/
|
||||
|
||||
var Locale = require('utils/locale');
|
||||
var Tips = require('utils/tips');
|
||||
var OpenNebulaRole = require('opennebula/role');
|
||||
var roles_buttons = require('./roles/roles-buttons');
|
||||
var Sunstone = require('sunstone');
|
||||
var RolesDataTable = require('./roles/roles-datatable');
|
||||
|
||||
/*
|
||||
TEMPLATES
|
||||
*/
|
||||
|
||||
var TemplateHTML = require('hbs!./roles/html');
|
||||
var TemplateRoleInfo = require('hbs!./roles/roleInfo');
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
*/
|
||||
|
||||
var TAB_ID = require('../tabId');
|
||||
var PANEL_ID = require('./roles/panelId');
|
||||
var XML_ROOT = "DOCUMENT";
|
||||
var RESOURCE = "Service";
|
||||
|
||||
/*
|
||||
CONSTRUCTOR
|
||||
*/
|
||||
|
||||
function Panel(info) {
|
||||
this.title = Locale.tr("Roles");
|
||||
this.icon = "fa-wrench";
|
||||
|
||||
this.element = info[XML_ROOT];
|
||||
|
||||
this.selected_row_role_id = undefined;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
Panel.PANEL_ID = PANEL_ID;
|
||||
Panel.prototype.html = _html;
|
||||
Panel.prototype.setup = _setup;
|
||||
Panel.prototype.roleHTML = _roleHTML;
|
||||
Panel.prototype.roleSetup = _roleSetup;
|
||||
|
||||
return Panel;
|
||||
|
||||
/*
|
||||
FUNCTION DEFINITIONS
|
||||
*/
|
||||
|
||||
function _html() {
|
||||
var roleList = [];
|
||||
|
||||
var roles = this.element.TEMPLATE.BODY.roles;
|
||||
if (roles && roles.length) {
|
||||
$.each(roles, function(){
|
||||
roleList.push(
|
||||
{
|
||||
'name': this.name,
|
||||
'state': OpenNebulaRole.state(this.state),
|
||||
'cardinality': this.cardinality,
|
||||
'vm_template': this.vm_template,
|
||||
'parents': this.parents ? this.parents.join(', ') : '-'
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return TemplateHTML({
|
||||
'element': this.element,
|
||||
'roleList': roleList
|
||||
});
|
||||
}
|
||||
|
||||
function _setup(context) {
|
||||
var that = this;
|
||||
|
||||
Tips.setup(context);
|
||||
|
||||
that.last_selected_row_role = undefined;
|
||||
|
||||
var roles = this.element.TEMPLATE.BODY.roles;
|
||||
if (roles && roles.length) {
|
||||
this.servicerolesDataTable = new RolesDataTable(
|
||||
'datatable_service_roles',
|
||||
{
|
||||
actions: true,
|
||||
info: false,
|
||||
oneSelection: true,
|
||||
customTabContext: $('#role_actions', context),
|
||||
customTrListener: function(tableObj, tr){
|
||||
var aData = tableObj.dataTable.fnGetData(tr);
|
||||
var role_name = $(aData[0]).val();
|
||||
|
||||
var role_index = tableObj.dataTable.fnGetPosition(tr);
|
||||
|
||||
$("#roles_extended_info", context).html(that.roleHTML(role_index));
|
||||
that.roleSetup($("#roles_extended_info", context), role_index);
|
||||
|
||||
// The info listener is triggered instead of
|
||||
// the row selection. So we click the check input to select
|
||||
// the row also
|
||||
var check = $('.check_item', tr);
|
||||
if (!check.is(":checked")) {
|
||||
check.trigger('click');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.servicerolesDataTable.initialize();
|
||||
|
||||
Sunstone.insertButtonsInTab("oneflow-services", "service_roles_tab", roles_buttons, $('#role_actions', context));
|
||||
|
||||
// TODO
|
||||
//setupScaleDialog();
|
||||
|
||||
// TODO: global var, see Service.refresh
|
||||
/*
|
||||
if(selected_row_role_id) {
|
||||
$.each($(this.servicerolesDataTable.dataTable.fnGetNodes()),function(){
|
||||
if($($('td',this)[1]).html()==selected_row_role_id) {
|
||||
$('td',this)[2].click();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(checked_row_rolevm_ids.length!=0) {
|
||||
$.each($(serviceroleVMsDataTable.fnGetNodes()),function(){
|
||||
var current_id = $($('td',this)[1]).html();
|
||||
if (current_id) {
|
||||
if(jQuery.inArray(current_id, checked_row_rolevm_ids)!=-1) {
|
||||
$('input.check_item',this).first().click();
|
||||
$('td',this).addClass('markrowchecked');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function _roleHTML(role_index) {
|
||||
var role = this.element.TEMPLATE.BODY.roles[role_index];
|
||||
|
||||
// TODO: role VMs table
|
||||
|
||||
return TemplateRoleInfo({
|
||||
'role': role,
|
||||
'vmsTableHTML': "<p>TODO</p>"
|
||||
});
|
||||
}
|
||||
|
||||
function _roleSetup(context, role_index) {
|
||||
Tips.setup(context);
|
||||
}
|
||||
});
|
@ -0,0 +1,71 @@
|
||||
<form class="custom" id="roles_form" action="">
|
||||
<div class="row">
|
||||
<div id="role_actions">
|
||||
<div class="columns large-8">
|
||||
<h4>{{tr "Roles"}}</h4>
|
||||
</div>
|
||||
<div class="columns large-4 right">
|
||||
<div class="row">
|
||||
<div class="large-6 columns">
|
||||
<label for="batch_action_period">{{tr "Period"}}:
|
||||
<span class="tip">{{tr "Seconds between each group of actions"}}</span>
|
||||
</label>
|
||||
<input type="text" id="batch_action_period" name="batch_action_period"/>
|
||||
</div>
|
||||
<div class="large-6 columns">
|
||||
<label for="batch_action_number">{{tr "Number"}}:
|
||||
<span class="tip">{{tr "Number of VMs to apply the action to each period"}}</span>
|
||||
</label>
|
||||
<input type="text" id="batch_action_number" name="batch_action_number"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="action_blocks columns large-12">
|
||||
</div>
|
||||
</div>
|
||||
<div id="roles_info" class="columns large-12">
|
||||
<table id="datatable_service_roles" class="dataTable twelve">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="check hidden">
|
||||
<input type="checkbox" class="check_all" value=""></input>
|
||||
</th>
|
||||
<th>{{tr "Name"}}</th>
|
||||
<th>{{tr "State"}}</th>
|
||||
<th>{{tr "Cardinality"}}</th>
|
||||
<th>{{tr "VM Template"}}</th>
|
||||
<th>{{tr "Parents"}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each roleList}}
|
||||
<tr>
|
||||
<td class="hidden">
|
||||
<input class="check_item" type="checkbox" id="role_{{name}}" name="selected_items" value="{{../element.ID}}/role/{{name}}"/>
|
||||
</td>
|
||||
<td>{{name}}</td>
|
||||
<td>{{state}}</td>
|
||||
<td>{{cardinality}}</td>
|
||||
<td>{{vm_template}}</td>
|
||||
<td>{{parents}}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="roles_extended_info" class="columns twelve">
|
||||
<div class="text-center">
|
||||
<span class="fa-stack fa-5x" style="color: #dfdfdf">
|
||||
<i class="fa fa-cloud fa-stack-2x"></i>
|
||||
<i class="fa fa-info-circle fa-stack-1x fa-inverse"></i>
|
||||
</span>
|
||||
<br>
|
||||
<br>
|
||||
<span style="font-size: 18px; color: #999">
|
||||
{{tr "Select a role in the table for more information"}}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,3 @@
|
||||
define(function(require){
|
||||
return 'service_roles_tab';
|
||||
});
|
@ -0,0 +1,146 @@
|
||||
<form>
|
||||
<h4>{{tr "Role"}} - {{role.name}}</h4>
|
||||
<div class='large-12 columns'>
|
||||
<table class='dataTable extended_table policies_table'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan='8'>{{tr "Information"}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class='key_td'>{{tr "Shutdown action"}}</td>
|
||||
<td class='value_td'>{{valOrDefault role.shutdown_action "-"}}</td>
|
||||
<td class='key_td'>{{tr "Cooldown"}}</td>
|
||||
<td class='value_td'>{{valOrDefault role.cooldown "-"}}</td>
|
||||
<td class='key_td'>{{tr "Min VMs"}}</td>
|
||||
<td class='value_td'>{{valOrDefault role.min_vms "-"}}</td>
|
||||
<td class='key_td'>{{tr "Max VMs"}}</td>
|
||||
<td class='value_td'>{{valOrDefault role.max_vms "-"}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
</div>
|
||||
<fieldset>
|
||||
<legend>{{tr "Virtual Machines"}}</legend>
|
||||
<div id="role_vms_actions">
|
||||
<div class="action_blocks columns twelve">
|
||||
</div>
|
||||
</div>
|
||||
<div class="large-12 columns">
|
||||
{{{vmsTableHTML}}}
|
||||
</div>
|
||||
</fieldset>
|
||||
<div class='large-12 columns'>
|
||||
<br>
|
||||
{{#if role.elasticity_policies}}
|
||||
<table class="dataTable extended_table policies_table">
|
||||
<thead style="background:#dfdfdf">
|
||||
<tr>
|
||||
<th colspan="7">{{tr "Elasticity policies"}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="has-tip" data-tooltip title="{{tr "Type of adjustment."}}<br><br>
|
||||
{{tr "CHANGE: Add/substract the given number of VMs."}}<br>
|
||||
{{tr "CARDINALITY: Set the cardinality to the given number."}}<br>
|
||||
{{tr "PERCENTAGE_CHANGE: Add/substract the given percentage to the current cardinality."}}
|
||||
" style="width:14%">{{tr "Type"}}
|
||||
</th>
|
||||
<th class="has-tip" data-tooltip title="{{tr "Positive or negative adjustment. Its meaning depends on 'type'"}}<br><br>
|
||||
{{tr "CHANGE: -2, will substract 2 VMs from the role"}}<br>
|
||||
{{tr "CARDINALITY: 8, will set carditanilty to 8"}}<br>
|
||||
{{tr "PERCENTAGE_CHANGE: 20, will increment cardinality by 20%"}}" style="width:12%">{{tr "Adjust"}}
|
||||
</th>
|
||||
<th class="has-tip" data-tooltip title="{{tr "Optional parameter for PERCENTAGE_CHANGE adjustment type."}}<br>
|
||||
{{tr " If present, the policy will change the cardinality by at least the number of VMs set in this attribute."}}" style="width:9%">{{tr "Min"}}
|
||||
</th>
|
||||
<th class="has-tip" data-tooltip title="{{tr "Expression to trigger the elasticity"}}<br><br>
|
||||
{{tr "Example: ATT < 20"}}" style="width:30%">{{tr "Expression"}}
|
||||
</th>
|
||||
<th class="has-tip" data-tooltip title="{{tr "Number of periods that the expression must be true before the elasticity is triggered"}}" style="width:8%">#
|
||||
</th>
|
||||
<th class="has-tip" data-tooltip title="{{tr "Duration, in seconds, of each period in '# Periods'"}}" style="width:9%">{{tr "Period"}}
|
||||
</th>
|
||||
<th class="has-tip" data-tooltip title="{{tr "Cooldown period duration after a scale operation, in seconds"}}" style="width:15%">{{tr "Cooldown"}}
|
||||
</th>
|
||||
<th style="width:3%"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each role.elasticity_policies}}
|
||||
<tr>
|
||||
<td>{{type}}</td>
|
||||
<td>{{adjust}}</td>
|
||||
<td>{{valOrDefault min_adjust_step "-"}}</td>
|
||||
<td>{{valOrDefault expression_evaluated this.expression}}</td>
|
||||
<td>
|
||||
{{#if period_number}}
|
||||
{{valOrDefault true_evals "0"}}/{{period_number}}
|
||||
{{else}}
|
||||
-
|
||||
{{/if}}
|
||||
</td>
|
||||
<td>{{valOrDefault period "-"}}</td>
|
||||
<td>{{valOrDefault cooldown "-"}}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{/if}}
|
||||
<br>
|
||||
{{#if role.scheduled_policies}}
|
||||
<table class="dataTable extended_table policies_table">
|
||||
<thead style="background:#dfdfdf">
|
||||
<tr>
|
||||
<th colspan="5">{{tr "Scheduled policies"}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="has-tip" data-tooltip title="{{tr "Type of adjustment."}}<br><br>
|
||||
{{tr "CHANGE: Add/substract the given number of VMs."}}<br>
|
||||
{{tr "CARDINALITY: Set the cardinality to the given number."}}<br>
|
||||
{{tr "PERCENTAGE_CHANGE: Add/substract the given percentage to the current cardinality."}}" style="width:14%">{{tr "Type"}}
|
||||
</th>
|
||||
<th class="has-tip" data-tooltip title="{{tr "Positive or negative adjustment. Its meaning depends on 'type'"}}<br><br>
|
||||
{{tr "CHANGE: -2, will substract 2 VMs from the role"}}<br>
|
||||
{{tr "CARDINALITY: 8, will set carditanilty to 8"}}<br>
|
||||
{{tr "PERCENTAGE_CHANGE: 20, will increment cardinality by 20%"}}" style="width:12%">{{tr "Adjust"}}
|
||||
</th>
|
||||
<th class="has-tip" data-tooltip title="{{tr "Optional parameter for PERCENTAGE_CHANGE adjustment type. If present, the policy will change the cardinality by at least the number of VMs set in this attribute."}}" style="width:9%">{{tr "Min"}}
|
||||
</th>
|
||||
<th class="has-tip" data-tooltip title="{{tr "Recurrence: Time for recurring adjustements. Time is specified with the Unix cron syntax"}}<br><br>
|
||||
{{tr "Start time: Exact time for the adjustement"}}" style="width:28%">{{tr "Time format"}}
|
||||
</th>
|
||||
<th class="has-tip" data-tooltip title="{{tr "Time expression depends on the the time formar selected"}}<br><br>
|
||||
{{tr "Recurrence: Time for recurring adjustements. Time is specified with the Unix cron syntax"}}<br>
|
||||
{{tr "Start time: Exact time for the adjustement"}}" style="width:33%">{{tr "Time expression"}}
|
||||
</th>
|
||||
<th style="width:3%"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each role.scheduled_policies}}
|
||||
<tr>
|
||||
<td>{{type}}</td>
|
||||
<td>{{adjust}}</td>
|
||||
<td>{{valOrDefault min_adjust_step ""}}</td>
|
||||
{{#if start_time}}
|
||||
<td>{{tr "Start time"}}</td>
|
||||
<td>{{start_time}}</td>
|
||||
{{else}}
|
||||
{{#if recurrence}}
|
||||
<td>{{tr "Recurrence"}}</td>
|
||||
<td>{{recurrence}}</td>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{/if}}
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,104 @@
|
||||
define(function(require) {
|
||||
var Locale = require('utils/locale');
|
||||
|
||||
var Buttons = {
|
||||
"Role.update_dialog" : {
|
||||
type: "action",
|
||||
text: Locale.tr("Scale"),
|
||||
tip: Locale.tr("This will hold selected pending VMs from being deployed"),
|
||||
layout: "create"
|
||||
},
|
||||
"Role.hold" : {
|
||||
type: "action",
|
||||
text: Locale.tr("Hold"),
|
||||
tip: Locale.tr("This will hold selected pending VMs from being deployed"),
|
||||
layout: "vmsplanification_buttons"
|
||||
},
|
||||
"Role.release" : {
|
||||
type: "action",
|
||||
text: Locale.tr("Release"),
|
||||
layout: "vmsplanification_buttons",
|
||||
tip: Locale.tr("This will release held machines")
|
||||
},
|
||||
"Role.suspend" : {
|
||||
type: "action",
|
||||
text: Locale.tr("Suspend"),
|
||||
layout: "vmspause_buttons",
|
||||
tip: Locale.tr("This will suspend selected machines")
|
||||
},
|
||||
"Role.resume" : {
|
||||
type: "action",
|
||||
text: '<i class="fa fa-play"/>',
|
||||
layout: "vmsplay_buttons",
|
||||
tip: Locale.tr("This will resume selected VMs")
|
||||
},
|
||||
"Role.stop" : {
|
||||
type: "action",
|
||||
text: Locale.tr("Stop"),
|
||||
layout: "vmsstop_buttons",
|
||||
tip: Locale.tr("This will stop selected VMs")
|
||||
},
|
||||
"Role.reboot" : {
|
||||
type: "action",
|
||||
text: Locale.tr("Reboot"),
|
||||
layout: "vmsrepeat_buttons",
|
||||
tip: Locale.tr("This will send a reboot action to running VMs")
|
||||
},
|
||||
"Role.reboot_hard" : {
|
||||
type: "action",
|
||||
text: Locale.tr("Reboot") + ' <span class="label secondary radius">hard</span>',
|
||||
layout: "vmsrepeat_buttons",
|
||||
tip: Locale.tr("This will perform a hard reboot on selected VMs")
|
||||
},
|
||||
"Role.poweroff" : {
|
||||
type: "action",
|
||||
text: Locale.tr("Power Off"),
|
||||
layout: "vmspause_buttons",
|
||||
tip: Locale.tr("This will send a power off signal to running VMs. They can be resumed later.")
|
||||
},
|
||||
"Role.poweroff_hard" : {
|
||||
type: "action",
|
||||
text: Locale.tr("Power Off") + ' <span class="label secondary radius">hard</span>',
|
||||
layout: "vmspause_buttons",
|
||||
tip: Locale.tr("This will send a forced power off signal to running VMs. They can be resumed later.")
|
||||
},
|
||||
"Role.undeploy" : {
|
||||
type: "action",
|
||||
text: Locale.tr("Undeploy"),
|
||||
layout: "vmsstop_buttons",
|
||||
tip: Locale.tr("Shuts down the given VM. The VM is saved in the system Datastore.")
|
||||
},
|
||||
"Role.undeploy_hard" : {
|
||||
type: "action",
|
||||
text: Locale.tr("Undeploy") + ' <span class="label secondary radius">hard</span>',
|
||||
layout: "vmsstop_buttons",
|
||||
tip: Locale.tr("Shuts down the given VM. The VM is saved in the system Datastore.")
|
||||
},
|
||||
"Role.shutdown" : {
|
||||
type: "action",
|
||||
text: Locale.tr("Shutdown"),
|
||||
layout: "vmsdelete_buttons",
|
||||
tip: Locale.tr("This will initiate the shutdown process in the selected VMs")
|
||||
},
|
||||
"Role.shutdown_hard" : {
|
||||
type: "action",
|
||||
text: Locale.tr("Shutdown") + ' <span class="label secondary radius">hard</span>',
|
||||
layout: "vmsdelete_buttons",
|
||||
tip: Locale.tr("This will initiate the shutdown-hard (forced) process in the selected VMs")
|
||||
},
|
||||
"Role.delete" : {
|
||||
type: "action",
|
||||
text: Locale.tr("Delete"),
|
||||
layout: "vmsdelete_buttons",
|
||||
tip: Locale.tr("This will delete the selected VMs from the database")
|
||||
},
|
||||
"Role.delete_recreate" : {
|
||||
type: "action",
|
||||
text: Locale.tr("Delete") + ' <span class="label secondary radius">recreate</span>',
|
||||
layout: "vmsrepeat_buttons",
|
||||
tip: Locale.tr("This will delete and recreate VMs to PENDING state")
|
||||
}
|
||||
};
|
||||
|
||||
return Buttons;
|
||||
});
|
@ -0,0 +1,53 @@
|
||||
define(function(require) {
|
||||
/*
|
||||
DEPENDENCIES
|
||||
*/
|
||||
|
||||
var TabDataTable = require('utils/tab-datatable');
|
||||
var SunstoneConfig = require('sunstone-config');
|
||||
var Locale = require('utils/locale');
|
||||
|
||||
/*
|
||||
CONSTRUCTOR
|
||||
*/
|
||||
|
||||
function Table(dataTableId, conf) {
|
||||
this.conf = conf || {};
|
||||
//this.tabId = TAB_NAME;
|
||||
this.dataTableId = dataTableId;
|
||||
//this.resource = RESOURCE;
|
||||
//this.xmlRoot = XML_ROOT;
|
||||
|
||||
// TODO: hide checkbox column
|
||||
|
||||
|
||||
this.dataTableOptions = {
|
||||
"bAutoWidth": false,
|
||||
"bSortClasses" : false,
|
||||
"bDeferRender": true,
|
||||
"aoColumnDefs": [
|
||||
{"bSortable": false, "aTargets": ["check"]},
|
||||
//{"bVisible": false, "aTargets": [0]}
|
||||
//{"bVisible": true, "aTargets": [1,2,3,4,5]},
|
||||
//{"bVisible": false, "aTargets": ['_all']}
|
||||
]
|
||||
};
|
||||
|
||||
//this.columns = [];
|
||||
//this.selectOptions = {};
|
||||
|
||||
TabDataTable.call(this);
|
||||
}
|
||||
|
||||
Table.prototype = Object.create(TabDataTable.prototype);
|
||||
Table.prototype.constructor = Table;
|
||||
//Table.prototype.elementArray = _elementArray;
|
||||
|
||||
return Table;
|
||||
|
||||
/*
|
||||
FUNCTION DEFINITIONS
|
||||
*/
|
||||
|
||||
//function _elementArray(element_json) {}
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user