mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
Feature 2347 (#205)
* F #2347 Added label VM Group * F #2347 Added new column to show the number of vms * F #2347 changed notifier string error * F #2347 Added the new column to the .yamls * F #2347 Added panel vms for show the vms of a role
This commit is contained in:
parent
34ea719974
commit
add0ca1bc3
@ -808,11 +808,12 @@ tabs:
|
||||
table_columns:
|
||||
- 0 # Checkbox
|
||||
- 1 # ID
|
||||
- 2 # Owner
|
||||
- 2 # Name
|
||||
- 3 # Group
|
||||
- 4 # Name
|
||||
#- 5 # Labels
|
||||
#- 6 # Search data
|
||||
- 4 # Owner
|
||||
- 5 # Vms
|
||||
#- 6 # Labels
|
||||
#- 7 # Search data
|
||||
actions:
|
||||
VMGroup.create_dialog: true
|
||||
VMGroup.update_dialog: true
|
||||
|
@ -805,11 +805,12 @@ tabs:
|
||||
table_columns:
|
||||
- 0 # Checkbox
|
||||
- 1 # ID
|
||||
- 2 # Owner
|
||||
- 2 # Name
|
||||
- 3 # Group
|
||||
- 4 # Name
|
||||
#- 5 # Labels
|
||||
#- 6 # Search data
|
||||
- 4 # Owner
|
||||
- 5 # Vms
|
||||
#- 6 # Labels
|
||||
#- 7 # Search data
|
||||
actions:
|
||||
VMGroup.create_dialog: true
|
||||
VMGroup.update_dialog: true
|
||||
|
@ -142,8 +142,9 @@ tabs:
|
||||
table_columns:
|
||||
- 0 # Checkbox
|
||||
- 1 # ID
|
||||
- 2 # Owner
|
||||
- 2 # Name
|
||||
- 3 # Group
|
||||
- 4 # Name
|
||||
#- 5 # Labels
|
||||
#- 6 # Search data
|
||||
- 4 # Owner
|
||||
- 5 # Vms
|
||||
#- 6 # Labels
|
||||
#- 7 # Search data
|
@ -806,11 +806,12 @@ tabs:
|
||||
table_columns:
|
||||
- 0 # Checkbox
|
||||
- 1 # ID
|
||||
- 2 # Owner
|
||||
- 2 # Name
|
||||
- 3 # Group
|
||||
- 4 # Name
|
||||
#- 5 # Labels
|
||||
#- 6 # Search data
|
||||
- 4 # Owner
|
||||
- 5 # Vms
|
||||
#- 6 # Labels
|
||||
#- 7 # Search data
|
||||
actions:
|
||||
VMGroup.create_dialog: true
|
||||
VMGroup.update_dialog: true
|
||||
|
@ -806,11 +806,12 @@ tabs:
|
||||
table_columns:
|
||||
- 0 # Checkbox
|
||||
- 1 # ID
|
||||
- 2 # Owner
|
||||
- 2 # Name
|
||||
- 3 # Group
|
||||
- 4 # Name
|
||||
#- 5 # Labels
|
||||
#- 6 # Search data
|
||||
- 4 # Owner
|
||||
- 5 # Vms
|
||||
#- 6 # Labels
|
||||
#- 7 # Search data
|
||||
actions:
|
||||
VMGroup.create_dialog: true
|
||||
VMGroup.update_dialog: true
|
@ -805,11 +805,12 @@ tabs:
|
||||
table_columns:
|
||||
- 0 # Checkbox
|
||||
- 1 # ID
|
||||
- 2 # Owner
|
||||
- 2 # Name
|
||||
- 3 # Group
|
||||
- 4 # Name
|
||||
#- 5 # Labels
|
||||
#- 6 # Search data
|
||||
- 4 # Owner
|
||||
- 5 # Vms
|
||||
#- 6 # Labels
|
||||
#- 7 # Search data
|
||||
actions:
|
||||
VMGroup.create_dialog: true
|
||||
VMGroup.update_dialog: true
|
@ -180,6 +180,9 @@ define(function(require) {
|
||||
case "MARKETPLACEAPP":
|
||||
resources_str+=Locale.tr("Marketplace Apps")+", ";
|
||||
break;
|
||||
case "VMGROUP":
|
||||
resources_str+=Locale.tr("VM Groups")+", ";
|
||||
break;
|
||||
}
|
||||
}
|
||||
//remove ", " from end
|
||||
|
@ -25,6 +25,7 @@ define(function(require) {
|
||||
|
||||
var _panels = [
|
||||
require('./vmgroup-tab/panels/info'),
|
||||
require('./vmgroup-tab/panels/vms')
|
||||
];
|
||||
|
||||
var _formPanels = [
|
||||
|
@ -33,8 +33,8 @@ define(function(require) {
|
||||
var RESOURCE = "VMGroup";
|
||||
var XML_ROOT = "VM_GROUP";
|
||||
var TAB_NAME = require('./tabId');
|
||||
var LABELS_COLUMN = 5;
|
||||
var SEARCH_COLUMN = 6;
|
||||
var LABELS_COLUMN = 6;
|
||||
var SEARCH_COLUMN = 7;
|
||||
var TEMPLATE_ATTR = 'TEMPLATE';
|
||||
|
||||
/*
|
||||
@ -66,6 +66,7 @@ define(function(require) {
|
||||
Locale.tr("Name"),
|
||||
Locale.tr("Owner"),
|
||||
Locale.tr("Group"),
|
||||
Locale.tr("VMs"),
|
||||
Locale.tr("Labels"),
|
||||
"search_data"
|
||||
];
|
||||
@ -98,6 +99,15 @@ define(function(require) {
|
||||
|
||||
function _elementArray(element_json) {
|
||||
var element = element_json[XML_ROOT];
|
||||
var numVms = 0;
|
||||
|
||||
for(role_index in element.ROLES.ROLE){
|
||||
if(element.ROLES.ROLE[role_index].VMS){
|
||||
var vms = element.ROLES.ROLE[role_index].VMS;
|
||||
var vms = vms.split(",");
|
||||
numVms += vms.length;
|
||||
}
|
||||
}
|
||||
|
||||
var search = {
|
||||
NAME: element.NAME,
|
||||
@ -113,6 +123,7 @@ define(function(require) {
|
||||
element.NAME,
|
||||
element.UNAME,
|
||||
element.GNAME,
|
||||
numVms,
|
||||
(LabelsUtils.labelsStr(element[TEMPLATE_ATTR])||''),
|
||||
btoa(unescape(encodeURIComponent(JSON.stringify(search))))
|
||||
];
|
||||
|
138
src/sunstone/public/app/tabs/vmgroup-tab/panels/vms.js
Normal file
138
src/sunstone/public/app/tabs/vmgroup-tab/panels/vms.js
Normal file
@ -0,0 +1,138 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Copyright 2002-2016, OpenNebula Project, OpenNebula Systems */
|
||||
/* */
|
||||
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
|
||||
/* not use this file except in compliance with the License. You may obtain */
|
||||
/* a copy of the License at */
|
||||
/* */
|
||||
/* http://www.apache.org/licenses/LICENSE-2.0 */
|
||||
/* */
|
||||
/* Unless required by applicable law or agreed to in writing, software */
|
||||
/* distributed under the License is distributed on an "AS IS" BASIS, */
|
||||
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
|
||||
/* See the License for the specific language governing permissions and */
|
||||
/* limitations under the License. */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
define(function(require){
|
||||
|
||||
/*
|
||||
DEPENDENCIES
|
||||
*/
|
||||
var TemplateVms = require('hbs!./vms/html');
|
||||
var Locale = require('utils/locale');
|
||||
var VMsTable = require('tabs/vms-tab/datatable');
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
*/
|
||||
var PANEL_ID = require('./vms/panelId');
|
||||
var VMS_TABLE_ID = PANEL_ID + "VMsTable";
|
||||
var RESOURCE = "VMGroup";
|
||||
var XML_ROOT = "VM_GROUP";
|
||||
var indexTable=0;
|
||||
|
||||
/*
|
||||
CONSTRUCTOR
|
||||
*/
|
||||
function Panel(info) {
|
||||
this.title = Locale.tr("VMs");
|
||||
this.icon = "fa-cloud";
|
||||
this.element = info[XML_ROOT].ROLES.ROLE;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
Panel.PANEL_ID = PANEL_ID;
|
||||
Panel.prototype.html = _html;
|
||||
Panel.prototype.setup = _setup;
|
||||
|
||||
return Panel;
|
||||
|
||||
/*
|
||||
FUNCTION DEFINITIONS
|
||||
*/
|
||||
function _html(){
|
||||
var vms = [];
|
||||
this.vmsTable = [];
|
||||
this.vmsTableHTML = [];
|
||||
var that = this;
|
||||
|
||||
if (this.element != undefined){
|
||||
if(Array.isArray(this.element)){
|
||||
$.each(this.element, function(){
|
||||
if(this.VMS){
|
||||
vms = this.VMS.split(",");
|
||||
var opts = {
|
||||
info: true,
|
||||
select: true,
|
||||
selectOptions: {
|
||||
read_only: true,
|
||||
fixed_ids: vms
|
||||
}
|
||||
};
|
||||
var table = new VMsTable(VMS_TABLE_ID + indexTable, opts);
|
||||
that.vmsTable.push(table);
|
||||
var html={}
|
||||
html.name = this.NAME;
|
||||
html.table = table.dataTableHTML;
|
||||
that.vmsTableHTML.push(html);
|
||||
indexTable++;
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
if(this.VMS){
|
||||
vms = this.VMS.split(",");
|
||||
var opts = {
|
||||
info: true,
|
||||
select: true,
|
||||
selectOptions: {
|
||||
read_only: true,
|
||||
fixed_ids: vms
|
||||
}
|
||||
};
|
||||
|
||||
var table = new VMsTable(VMS_TABLE_ID + indexTable, opts);
|
||||
that.vmsTable.push(table);
|
||||
var html={}
|
||||
html.name = Locale.tr(this.NAME);
|
||||
html.table = table.dataTableHTML;
|
||||
that.vmsTableHTML.push(html);
|
||||
indexTable++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(that.vmsTable.length == 0){
|
||||
vms = [];
|
||||
var opts = {
|
||||
info: true,
|
||||
select: true,
|
||||
selectOptions: {
|
||||
read_only: true,
|
||||
fixed_ids: vms
|
||||
}
|
||||
};
|
||||
var table = new VMsTable(VMS_TABLE_ID + indexTable, opts);
|
||||
that.vmsTable.push(table);
|
||||
var html={}
|
||||
html.name = Locale.tr("Role");
|
||||
html.table = table.dataTableHTML;
|
||||
that.vmsTableHTML.push(html);
|
||||
}
|
||||
|
||||
return TemplateVms({
|
||||
'arrayDataTable': this.vmsTableHTML
|
||||
});
|
||||
}
|
||||
|
||||
function _setup(context) {
|
||||
|
||||
$.each(this.vmsTable, function(){
|
||||
this.initialize();
|
||||
this.refreshResourceTableSelect();
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
32
src/sunstone/public/app/tabs/vmgroup-tab/panels/vms/html.hbs
Normal file
32
src/sunstone/public/app/tabs/vmgroup-tab/panels/vms/html.hbs
Normal file
@ -0,0 +1,32 @@
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
{{! Copyright 2002-2016, OpenNebula Project, OpenNebula Systems }}
|
||||
{{! }}
|
||||
{{! Licensed under the Apache License, Version 2.0 (the "License"); you may }}
|
||||
{{! not use this file except in compliance with the License. You may obtain }}
|
||||
{{! a copy of the License at }}
|
||||
{{! }}
|
||||
{{! http://www.apache.org/licenses/LICENSE-2.0 }}
|
||||
{{! }}
|
||||
{{! Unless required by applicable law or agreed to in writing, software }}
|
||||
{{! distributed under the License is distributed on an "AS IS" BASIS, }}
|
||||
{{! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }}
|
||||
{{! See the License for the specific language governing permissions and }}
|
||||
{{! limitations under the License. }}
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
|
||||
{{#each arrayDataTable}}
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
<fieldset>
|
||||
<legend>
|
||||
<h5 style="padding-bottom:0; margin-bottom:0;">
|
||||
{{this.name}}
|
||||
</h5>
|
||||
</legend>
|
||||
<div>
|
||||
{{{this.table}}}
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
{{/each}}
|
@ -0,0 +1,19 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Copyright 2002-2016, OpenNebula Project, OpenNebula Systems */
|
||||
/* */
|
||||
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
|
||||
/* not use this file except in compliance with the License. You may obtain */
|
||||
/* a copy of the License at */
|
||||
/* */
|
||||
/* http://www.apache.org/licenses/LICENSE-2.0 */
|
||||
/* */
|
||||
/* Unless required by applicable law or agreed to in writing, software */
|
||||
/* distributed under the License is distributed on an "AS IS" BASIS, */
|
||||
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
|
||||
/* See the License for the specific language governing permissions and */
|
||||
/* limitations under the License. */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
define(function(require){
|
||||
return 'vm_group_vms_tab';
|
||||
})
|
@ -187,7 +187,7 @@ define(function(require) {
|
||||
function _add_group_affinity_box(rolesSt, context, group_roles_index, group_roles_affinity, affinity){
|
||||
for(group in group_roles_affinity){
|
||||
if(group_roles_affinity[group].retrieve(context) == rolesSt){
|
||||
Notifier.notifyError(Locale.tr("Already exist a group role with this vaues."));
|
||||
Notifier.notifyError(Locale.tr("Already exists a group role with these values."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user