mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-30 22:50:10 +03:00
Feature #4215: Show list of VR in vnet output, cli & sunstone
This commit is contained in:
parent
4b6aaa8b19
commit
35f28651fa
src
cli/one_helper
oca/ruby/opennebula
sunstone
etc/sunstone-views
public/app/tabs
@ -324,6 +324,13 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
|
||||
end
|
||||
end.show(leases, {})
|
||||
|
||||
puts
|
||||
|
||||
CLIHelper.print_header("%-15s" % "VIRTUAL ROUTERS")
|
||||
vn.vrouter_ids.each do |id|
|
||||
puts "%-15s" % [id]
|
||||
end
|
||||
|
||||
if options[:show_ar]
|
||||
ar_list.each do |ar_id|
|
||||
puts
|
||||
|
@ -324,6 +324,17 @@ module OpenNebula
|
||||
end
|
||||
end
|
||||
|
||||
# Returns an array with the numeric virtual router ids
|
||||
def vrouter_ids
|
||||
array = Array.new
|
||||
|
||||
self.each("VROUTERS/ID") do |id|
|
||||
array << id.text.to_i
|
||||
end
|
||||
|
||||
return array
|
||||
end
|
||||
|
||||
private
|
||||
def set_publish(published)
|
||||
group_u = published ? 1 : 0
|
||||
|
@ -381,6 +381,7 @@ tabs:
|
||||
vnet_ar_list_tab: true
|
||||
vnet_leases_tab: true
|
||||
vnet_sg_list_tab: true
|
||||
vnet_vr_list_tab: true
|
||||
table_columns:
|
||||
- 0 # Checkbox
|
||||
- 1 # ID
|
||||
|
@ -381,6 +381,7 @@ tabs:
|
||||
vnet_ar_list_tab: true
|
||||
vnet_leases_tab: true
|
||||
vnet_sg_list_tab: true
|
||||
vnet_vr_list_tab: true
|
||||
table_columns:
|
||||
- 0 # Checkbox
|
||||
- 1 # ID
|
||||
|
@ -382,6 +382,7 @@ tabs:
|
||||
vnet_ar_list_tab: true
|
||||
vnet_leases_tab: true
|
||||
vnet_sg_list_tab: true
|
||||
vnet_vr_list_tab: true
|
||||
table_columns:
|
||||
- 0 # Checkbox
|
||||
- 1 # ID
|
||||
|
@ -33,7 +33,8 @@ define(function(require) {
|
||||
require('./vnets-tab/panels/info'),
|
||||
require('./vnets-tab/panels/ar'),
|
||||
require('./vnets-tab/panels/leases'),
|
||||
require('./vnets-tab/panels/secgroups')
|
||||
require('./vnets-tab/panels/secgroups'),
|
||||
require('./vnets-tab/panels/vrouters')
|
||||
];
|
||||
|
||||
var _panelsHooks = [
|
||||
|
88
src/sunstone/public/app/tabs/vnets-tab/panels/vrouters.js
Normal file
88
src/sunstone/public/app/tabs/vnets-tab/panels/vrouters.js
Normal file
@ -0,0 +1,88 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Copyright 2002-2015, 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 Locale = require('utils/locale');
|
||||
var VirtualRoutersTable = require('tabs/vrouters-tab/datatable');
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
*/
|
||||
|
||||
var PANEL_ID = require('./vrouters/panelId');
|
||||
var VR_TABLE_ID = PANEL_ID + "VirtualRoutersTable";
|
||||
var RESOURCE = "Network";
|
||||
var XML_ROOT = "VNET";
|
||||
|
||||
/*
|
||||
CONSTRUCTOR
|
||||
*/
|
||||
|
||||
function Panel(info) {
|
||||
this.title = Locale.tr("V. Routers");
|
||||
this.icon = "fa-random";
|
||||
|
||||
this.element = info[XML_ROOT];
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
Panel.PANEL_ID = PANEL_ID;
|
||||
Panel.prototype.html = _html;
|
||||
Panel.prototype.setup = _setup;
|
||||
|
||||
return Panel;
|
||||
|
||||
/*
|
||||
FUNCTION DEFINITIONS
|
||||
*/
|
||||
|
||||
function _html() {
|
||||
var vrs = [];
|
||||
|
||||
if (this.element.VROUTERS.ID != undefined){
|
||||
vrs = this.element.VROUTERS.ID;
|
||||
|
||||
if (!$.isArray(vrs)){
|
||||
vrs = [vrs];
|
||||
}
|
||||
}
|
||||
|
||||
var opts = {
|
||||
info: true,
|
||||
select: true,
|
||||
selectOptions: {
|
||||
read_only: true,
|
||||
fixed_ids: vrs
|
||||
}
|
||||
};
|
||||
|
||||
this.vroutersTable = new VirtualRoutersTable(VR_TABLE_ID, opts);
|
||||
|
||||
return this.vroutersTable.dataTableHTML;
|
||||
}
|
||||
|
||||
function _setup(context) {
|
||||
this.vroutersTable.initialize();
|
||||
this.vroutersTable.refreshResourceTableSelect();
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Copyright 2002-2015, 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 'vnet_vr_list_tab';
|
||||
})
|
Loading…
x
Reference in New Issue
Block a user