mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-20 10:50:08 +03:00
Feature #3748: Oneflow template roles panel
This commit is contained in:
parent
c46fcc0283
commit
fd237304d6
@ -43,6 +43,12 @@ define(function(require) {
|
||||
|
||||
this.selected_row_role_id = undefined;
|
||||
|
||||
// Controls visibility of buttons only available to OneFlow services. This
|
||||
// panel is also used by the OneFlow templates
|
||||
this.servicePanel = true;
|
||||
|
||||
this.panelId = PANEL_ID;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -77,6 +83,8 @@ define(function(require) {
|
||||
|
||||
return TemplateHTML({
|
||||
'element': this.element,
|
||||
'panelId': this.panelId,
|
||||
'servicePanel': this.servicePanel,
|
||||
'roleList': roleList
|
||||
});
|
||||
}
|
||||
@ -91,7 +99,7 @@ define(function(require) {
|
||||
var roles = this.element.TEMPLATE.BODY.roles;
|
||||
if (roles && roles.length) {
|
||||
this.servicerolesDataTable = new DomDataTable(
|
||||
'datatable_service_roles',
|
||||
'datatable_roles_'+this.panelId,
|
||||
{
|
||||
actions: true,
|
||||
info: false,
|
||||
@ -120,9 +128,6 @@ define(function(require) {
|
||||
|
||||
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) {
|
||||
@ -190,60 +195,64 @@ define(function(require) {
|
||||
|
||||
return TemplateRoleInfo({
|
||||
'role': role,
|
||||
'servicePanel': this.servicePanel,
|
||||
'panelId': this.panelId,
|
||||
'vmsTableColumns': VMsTableUtils.columns,
|
||||
'vms': vms
|
||||
});
|
||||
}
|
||||
|
||||
function _roleSetup(context, role_index) {
|
||||
var role = this.element.TEMPLATE.BODY.roles[role_index];
|
||||
if(this.servicePanel) {
|
||||
var role = this.element.TEMPLATE.BODY.roles[role_index];
|
||||
|
||||
// This table has 2 more columns to the left compared to the normal VM table
|
||||
// The visibility index array needs to be adjusted
|
||||
var visibleColumns = [0,1].concat(
|
||||
SunstoneConfig.tabTableColumns(VMS_TAB_ID).map(function(n){
|
||||
return n+2;
|
||||
}));
|
||||
// This table has 2 more columns to the left compared to the normal VM table
|
||||
// The visibility index array needs to be adjusted
|
||||
var visibleColumns = [0,1].concat(
|
||||
SunstoneConfig.tabTableColumns(VMS_TAB_ID).map(function(n){
|
||||
return n+2;
|
||||
}));
|
||||
|
||||
this.serviceroleVMsDataTable = new DomDataTable(
|
||||
'datatable_service_vms_'+role.name,
|
||||
{
|
||||
actions: true,
|
||||
info: false,
|
||||
customTabContext: $('#role_vms_actions', context),
|
||||
dataTableOptions: {
|
||||
"bAutoWidth": false,
|
||||
"bSortClasses" : false,
|
||||
"bDeferRender": true,
|
||||
"aoColumnDefs": [
|
||||
{"bSortable": false, "aTargets": [0,1,"check"]},
|
||||
{"bVisible": true, "aTargets": visibleColumns},
|
||||
{"bVisible": false, "aTargets": ['_all']}
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
// TODO: global vars, see Service.refresh
|
||||
/*
|
||||
if(last_selected_row_rolevm) {
|
||||
last_selected_row_rolevm.children().each(function(){
|
||||
$(this).removeClass('markrowchecked');
|
||||
this.serviceroleVMsDataTable = new DomDataTable(
|
||||
'datatable_vms_'+this.panelId+'_'+role.name,
|
||||
{
|
||||
actions: true,
|
||||
info: false,
|
||||
customTabContext: $('#role_vms_actions', context),
|
||||
dataTableOptions: {
|
||||
"bAutoWidth": false,
|
||||
"bSortClasses" : false,
|
||||
"bDeferRender": true,
|
||||
"aoColumnDefs": [
|
||||
{"bSortable": false, "aTargets": [0,1,"check"]},
|
||||
{"bVisible": true, "aTargets": visibleColumns},
|
||||
{"bVisible": false, "aTargets": ['_all']}
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
// TODO: global vars, see Service.refresh
|
||||
/*
|
||||
if(last_selected_row_rolevm) {
|
||||
last_selected_row_rolevm.children().each(function(){
|
||||
$(this).removeClass('markrowchecked');
|
||||
});
|
||||
}
|
||||
|
||||
last_selected_row_rolevm = $(this);
|
||||
$(this).children().each(function(){
|
||||
$(this).addClass('markrowchecked');
|
||||
});
|
||||
*/
|
||||
|
||||
this.serviceroleVMsDataTable.initialize();
|
||||
Sunstone.insertButtonsInTab(
|
||||
"oneflow-services",
|
||||
"service_roles_tab",
|
||||
roles_vm_buttons,
|
||||
$('div#role_vms_actions', context));
|
||||
}
|
||||
|
||||
last_selected_row_rolevm = $(this);
|
||||
$(this).children().each(function(){
|
||||
$(this).addClass('markrowchecked');
|
||||
});
|
||||
*/
|
||||
|
||||
this.serviceroleVMsDataTable.initialize();
|
||||
Sunstone.insertButtonsInTab(
|
||||
"oneflow-services",
|
||||
"service_roles_tab",
|
||||
roles_vm_buttons,
|
||||
$('div#role_vms_actions', context));
|
||||
|
||||
Tips.setup(context);
|
||||
}
|
||||
});
|
||||
|
@ -1,18 +1,16 @@
|
||||
<form class="custom" id="roles_form" action="">
|
||||
<div class="row">
|
||||
{{#if servicePanel}}
|
||||
<div id="role_actions">
|
||||
<div class="columns large-8">
|
||||
<h4>{{tr "Roles"}}</h4>
|
||||
</div>
|
||||
<div class="columns large-4 right">
|
||||
<div class="columns large-4 medium-6 right">
|
||||
<div class="row">
|
||||
<div class="large-6 columns">
|
||||
<div class="small-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">
|
||||
<div class="small-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>
|
||||
@ -23,15 +21,18 @@
|
||||
<div class="action_blocks columns large-12">
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
<div id="roles_info" class="columns large-12">
|
||||
<table id="datatable_service_roles" class="dataTable twelve">
|
||||
<table id="datatable_roles_{{panelId}}" class="dataTable twelve">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="check hidden">
|
||||
<input type="checkbox" class="check_all" value=""></input>
|
||||
</th>
|
||||
<th>{{tr "Name"}}</th>
|
||||
{{#if servicePanel}}
|
||||
<th>{{tr "State"}}</th>
|
||||
{{/if}}
|
||||
<th>{{tr "Cardinality"}}</th>
|
||||
<th>{{tr "VM Template"}}</th>
|
||||
<th>{{tr "Parents"}}</th>
|
||||
@ -44,7 +45,9 @@
|
||||
<input class="check_item" type="checkbox" id="role_{{name}}" name="selected_items" value="{{../element.ID}}/role/{{name}}"/>
|
||||
</td>
|
||||
<td>{{name}}</td>
|
||||
{{#if ../servicePanel}}
|
||||
<td>{{state}}</td>
|
||||
{{/if}}
|
||||
<td>{{cardinality}}</td>
|
||||
<td>{{vm_template}}</td>
|
||||
<td>{{parents}}</td>
|
||||
|
@ -22,6 +22,7 @@
|
||||
</table>
|
||||
<br>
|
||||
</div>
|
||||
{{#if servicePanel}}
|
||||
<fieldset>
|
||||
<legend>{{tr "Virtual Machines"}}</legend>
|
||||
<div id="role_vms_actions">
|
||||
@ -30,7 +31,7 @@
|
||||
</div>
|
||||
<div class="large-12 columns">
|
||||
<br>
|
||||
<table id="datatable_service_vms_{{role.name}}" class="dataTable twelve ">
|
||||
<table id="datatable_vms_{{panelId}}_{{role.name}}" class="dataTable twelve ">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
@ -55,6 +56,7 @@
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
{{/if}}
|
||||
<div class='large-12 columns'>
|
||||
<br>
|
||||
{{#if role.elasticity_policies}}
|
||||
@ -101,8 +103,12 @@
|
||||
<td>{{valOrDefault expression_evaluated this.expression}}</td>
|
||||
<td>
|
||||
{{#if period_number}}
|
||||
{{#if servicePanel}}
|
||||
{{valOrDefault true_evals "0"}}/{{period_number}}
|
||||
{{else}}
|
||||
{{period_number}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
-
|
||||
{{/if}}
|
||||
</td>
|
||||
@ -150,7 +156,7 @@
|
||||
<tr>
|
||||
<td>{{type}}</td>
|
||||
<td>{{adjust}}</td>
|
||||
<td>{{valOrDefault min_adjust_step ""}}</td>
|
||||
<td>{{valOrDefault min_adjust_step "-"}}</td>
|
||||
{{#if start_time}}
|
||||
<td>{{tr "Start time"}}</td>
|
||||
<td>{{start_time}}</td>
|
||||
|
@ -9,12 +9,11 @@ define(function(require) {
|
||||
var RESOURCE = "ServiceTemplate";
|
||||
|
||||
var _dialogs = [
|
||||
//require('./oneflow-templates-tab/dialogs/instantiate')
|
||||
];
|
||||
|
||||
var _panels = [
|
||||
require('./oneflow-templates-tab/panels/info'),
|
||||
//require('./oneflow-templates-tab/panels/roles')
|
||||
require('./oneflow-templates-tab/panels/roles')
|
||||
];
|
||||
|
||||
var _formPanels = [
|
||||
|
@ -0,0 +1,32 @@
|
||||
define(function(require) {
|
||||
/*
|
||||
DEPENDENCIES
|
||||
*/
|
||||
|
||||
var BasePanel = require('tabs/oneflow-services-tab/panels/roles');
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
*/
|
||||
|
||||
var PANEL_ID = require('./roles/panelId');
|
||||
|
||||
/*
|
||||
CONSTRUCTOR
|
||||
*/
|
||||
|
||||
function Panel(info) {
|
||||
BasePanel.call(this, info);
|
||||
|
||||
this.servicePanel = false;
|
||||
this.panelId = PANEL_ID;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
Panel.PANEL_ID = PANEL_ID;
|
||||
Panel.prototype = Object.create(BasePanel.prototype);
|
||||
Panel.prototype.constructor = Panel;
|
||||
|
||||
return Panel;
|
||||
});
|
@ -0,0 +1,3 @@
|
||||
define(function(require){
|
||||
return 'service_template_roles_tab';
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user