1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

F #1269: show resource pool inside cards (#4108)

- first step to resource tab
- verify hypervisor
- add it to kvm views
- adding new view and table
- show resource pool inside cards

Signed-off-by: Carlos Herrera <cherrera@opennebula.systems>
This commit is contained in:
Carlos J. Herrera 2020-01-22 11:56:47 -05:00 committed by Tino Vázquez
parent 530d962b29
commit bb62e1cdbe
14 changed files with 232 additions and 0 deletions

View File

@ -529,6 +529,7 @@ tabs:
panel_tabs:
host_info_tab: true
host_monitoring_tab: true
host_pool_tab: true
host_vms_tab: true
host_wilds_tab: true
host_zombies_tab: true

View File

@ -531,6 +531,7 @@ tabs:
panel_tabs:
host_info_tab: true
host_monitoring_tab: true
host_pool_tab: true
host_vms_tab: true
host_wilds_tab: true
host_zombies_tab: true

View File

@ -530,6 +530,7 @@ tabs:
panel_tabs:
host_info_tab: true
host_monitoring_tab: true
host_pool_tab: true
host_vms_tab: true
host_wilds_tab: true
host_zombies_tab: true

View File

@ -523,6 +523,7 @@ tabs:
panel_tabs:
host_info_tab: true
host_monitoring_tab: true
host_pool_tab: true
host_vms_tab: true
host_wilds_tab: true
host_zombies_tab: true

View File

@ -529,6 +529,7 @@ tabs:
panel_tabs:
host_info_tab: true
host_monitoring_tab: true
host_pool_tab: true
host_vms_tab: true
host_wilds_tab: true
host_zombies_tab: true

View File

@ -530,6 +530,7 @@ tabs:
panel_tabs:
host_info_tab: true
host_monitoring_tab: true
host_pool_tab: true
host_vms_tab: true
host_wilds_tab: true
host_zombies_tab: true

View File

@ -523,6 +523,7 @@ tabs:
panel_tabs:
host_info_tab: true
host_monitoring_tab: true
host_pool_tab: true
host_vms_tab: true
host_wilds_tab: true
host_zombies_tab: true

View File

@ -37,6 +37,7 @@ define(function(require) {
require('./hosts-tab/panels/esx'),
require('./hosts-tab/panels/pci'),
require('./hosts-tab/panels/numa'),
require('./hosts-tab/panels/pool'),
require('./hosts-tab/panels/nsx')
];
var _panelsHooks = [

View File

@ -0,0 +1,65 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2019, 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 ResourcePoolCards = require("../utils/cards");
/*
TEMPLATES
*/
var TemplatePool = require('hbs!./pool/html');
/*
CONSTANTS
*/
var PANEL_ID = require('./pool/panelId');
var RESOURCE = "Host"
/*
CONSTRUCTOR
*/
function Panel(info) {
var self = this;
this.title = Locale.tr("POOL");
this.icon = "fa-server";
this.element = info[RESOURCE.toUpperCase()];
// Do not create an instance of this panel if no vcenter hypervisor
// porque el hypervisor proviene de la monitorizacion de por si no esta en el template
if(this.element && this.element.TEMPLATE && this.element.TEMPLATE.HYPERVISOR){
if(this.element.TEMPLATE.HYPERVISOR != "vcenter"){
throw "Panel not available for this element";
}
}else{
throw "Panel not available for this element";
}
return this;
};
Panel.PANEL_ID = PANEL_ID;
Panel.prototype.html = _html;
Panel.prototype.setup = _setup;
return Panel;
/*
FUNCTION DEFINITIONS
*/
function _html() {
return TemplatePool({
"resourcePoolCards": ResourcePoolCards.html(this.element)
});
}
function _setup(context) {
}
})

View File

@ -0,0 +1,23 @@
{{! -------------------------------------------------------------------------- }}
{{! Copyright 2002-2019, 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. }}
{{! -------------------------------------------------------------------------- }}
<div class="row">
<div class="large-12 columns">
<div class="provision_vms_ul large-up-2 medium-up-2 small-up-1">
{{{resourcePoolCards}}}
</div>
</div>
</div>

View File

@ -0,0 +1,19 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2019, 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 'host_pool_tab';
})

View File

@ -0,0 +1,65 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2019, 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) {
/*
TEMPLATES
*/
var TemplateResourcePoolTable = require('hbs!./resource-pool-table/html');
var TemplateResourcePoolCard = require('hbs!./resource-pool-cards/html');
/*
FUNCTION DEFINITIONS
*/
var _html = function(element) {
var vCenterResourcePoolInfo = element.TEMPLATE['VCENTER_RESOURCE_POOL_INFO']
if (Array.isArray(vCenterResourcePoolInfo))
this.resourcePoolItems = vCenterResourcePoolInfo;
else if (!$.isEmptyObject(vCenterResourcePoolInfo))
this.resourcePoolItems = [vCenterResourcePoolInfo];
else
return "";
var resourcePoolCards = [];
this.resourcePoolItems.forEach(function(value){
var propertyArray = [];
for (var key in value) {
if (key !== "NAME" && value.hasOwnProperty(key)) {
propertyArray.push({
'key': key,
'value': value[key]
})
}
}
resourcePoolCards.push({
'resourcePoolName': value["NAME"],
'resourcePoolTable': TemplateResourcePoolTable({
'resourcePool': propertyArray
})
});
});
return TemplateResourcePoolCard({'resourcePools': resourcePoolCards});
}
return {
'html': _html
}
})

View File

@ -0,0 +1,27 @@
{{! -------------------------------------------------------------------------- }}
{{! Copyright 2002-2019, 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 resourcePools}}
<div class="column">
<ul class="provision-pricing-table menu vertical">
<li class="">
<a class="top_button button">
{{resourcePoolName}}
</a>
</li>
{{{resourcePoolTable}}}
</ul>
</div>
{{/each}}

View File

@ -0,0 +1,25 @@
{{! -------------------------------------------------------------------------- }}
{{! Copyright 2002-2019, 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. }}
{{! -------------------------------------------------------------------------- }}
<table class="dataTable">
<tbody>
{{#each resourcePool}}
<tr>
<td class="key_td">{{key}}</td>
<td class="value_td" colspan="2">{{{value}}}</td>
</tr>
{{/each}}
</tbody>
</table>