mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-21 12:22:38 +09:00
Feature #3204: Show updated/updating secgroup VMs in sunstone
This commit is contained in:
1 parent
a2eda5b43f
commit
8cbe0f3b34
10 files changed
+198
-2
No files matched your search
@@ -616,6 +616,7 @@ tabs:
|
||||
secgroups-tab:
|
||||
panel_tabs:
|
||||
security_group_info_tab: true
|
||||
security_group_vms_tab: true
|
||||
table_columns:
|
||||
- 0 # Checkbox
|
||||
- 1 # ID
|
||||
|
||||
@@ -615,6 +615,7 @@ tabs:
|
||||
secgroups-tab:
|
||||
panel_tabs:
|
||||
security_group_info_tab: true
|
||||
security_group_vms_tab: true
|
||||
table_columns:
|
||||
- 0 # Checkbox
|
||||
- 1 # ID
|
||||
|
||||
@@ -615,6 +615,7 @@ tabs:
|
||||
secgroups-tab:
|
||||
panel_tabs:
|
||||
security_group_info_tab: true
|
||||
security_group_vms_tab: true
|
||||
table_columns:
|
||||
- 0 # Checkbox
|
||||
- 1 # ID
|
||||
|
||||
@@ -615,6 +615,7 @@ tabs:
|
||||
secgroups-tab:
|
||||
panel_tabs:
|
||||
security_group_info_tab: true
|
||||
security_group_vms_tab: true
|
||||
table_columns:
|
||||
- 0 # Checkbox
|
||||
- 1 # ID
|
||||
|
||||
@@ -619,6 +619,7 @@ tabs:
|
||||
secgroups-tab:
|
||||
panel_tabs:
|
||||
security_group_info_tab: true
|
||||
security_group_vms_tab: true
|
||||
table_columns:
|
||||
- 0 # Checkbox
|
||||
- 1 # ID
|
||||
|
||||
@@ -28,7 +28,8 @@ define(function(require) {
|
||||
];
|
||||
|
||||
var _panels = [
|
||||
require('./secgroups-tab/panels/info')
|
||||
require('./secgroups-tab/panels/info'),
|
||||
require('./secgroups-tab/panels/vms')
|
||||
];
|
||||
|
||||
var _panelsHooks = [
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* 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 VMsTable = require('tabs/vms-tab/datatable');
|
||||
var Template = require('hbs!./vms/html');
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
*/
|
||||
|
||||
var PANEL_ID = require('./vms/panelId');
|
||||
var VMS_TABLE_ID = PANEL_ID + "VMsTable"
|
||||
|
||||
var RESOURCE = "SecurityGroup";
|
||||
var XML_ROOT = "SECURITY_GROUP";
|
||||
|
||||
/*
|
||||
CONSTRUCTOR
|
||||
*/
|
||||
|
||||
function Panel(info) {
|
||||
this.title = Locale.tr("VMs");
|
||||
this.icon = "fa-th";
|
||||
|
||||
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 ids;
|
||||
|
||||
var updatingIds = _getIds(this.element.UPDATING_VMS.ID);
|
||||
updatingIds = updatingIds.concat( _getIds(this.element.OUTDATED_VMS.ID) );
|
||||
|
||||
var ids = _getIds(this.element.UPDATED_VMS.ID);
|
||||
ids = ids.concat( updatingIds );
|
||||
|
||||
var opt = {
|
||||
info: true,
|
||||
select: true,
|
||||
selectOptions: {
|
||||
read_only: true,
|
||||
fixed_ids: ids,
|
||||
starred_ids: updatingIds,
|
||||
starred_icon: '<i class="fa fa-warning fa-fw"></i>'
|
||||
}
|
||||
};
|
||||
|
||||
this.vmsDataTable = new VMsTable(PANEL_ID + '_UPDATED', opt);
|
||||
|
||||
ids = _getIds(this.element.ERROR_VMS.ID);
|
||||
this.errorDataTable = new VMsTable(PANEL_ID + '_ERROR', _buildOpts(ids));
|
||||
|
||||
var allUpdated = (this.element.UPDATING_VMS.ID == undefined &&
|
||||
this.element.OUTDATED_VMS.ID == undefined &&
|
||||
this.element.ERROR_VMS.ID == undefined);
|
||||
|
||||
return Template({
|
||||
'allUpdated': allUpdated,
|
||||
'vmsTableHTML': this.vmsDataTable.dataTableHTML,
|
||||
'errorTableHTML': this.errorDataTable.dataTableHTML
|
||||
});
|
||||
}
|
||||
|
||||
function _getIds(attr){
|
||||
var ids = [];
|
||||
|
||||
if (attr != undefined){
|
||||
ids = attr;
|
||||
|
||||
if (!$.isArray(ids)){
|
||||
ids = [ids];
|
||||
}
|
||||
}
|
||||
|
||||
return ids;
|
||||
}
|
||||
|
||||
function _buildOpts(ids){
|
||||
return {
|
||||
info: true,
|
||||
select: true,
|
||||
selectOptions: {
|
||||
read_only: true,
|
||||
fixed_ids: ids
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function _setup(context) {
|
||||
this.vmsDataTable.initialize();
|
||||
this.vmsDataTable.refreshResourceTableSelect();
|
||||
|
||||
this.errorDataTable.initialize();
|
||||
this.errorDataTable.refreshResourceTableSelect();
|
||||
|
||||
return false;
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,38 @@
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
{{! 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. }}
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
|
||||
{{#unless allUpdated}}
|
||||
<div class="row">
|
||||
<p>{{{tr "VMs marked with <i class='fa fa-warning'></i> are waiting to be updated with the latest rules:"}}}
|
||||
</div>
|
||||
{{/unless}}
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
{{{vmsTableHTML}}}
|
||||
</div>
|
||||
</div>
|
||||
{{#unless allUpdated}}
|
||||
<div class="row">
|
||||
<br/>
|
||||
<hr/>
|
||||
<p>{{tr "VMs in error. The update to the latest rules failed:"}}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
{{{errorTableHTML}}}
|
||||
</div>
|
||||
</div>
|
||||
{{/unless}}
|
||||
@@ -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 'security_group_vms_tab';
|
||||
})
|
||||
@@ -127,6 +127,10 @@ define(function(require) {
|
||||
$.each(that.selectOptions.starred_ids, function() {
|
||||
that.selectOptions.starred_ids_map[this] = true;
|
||||
});
|
||||
|
||||
if (that.selectOptions.starred_icon == undefined) {
|
||||
that.selectOptions.starred_icon = '<i class="fa fa-star fa-fw"></i>';
|
||||
}
|
||||
}
|
||||
|
||||
if (that.selectOptions.multiple_choice == undefined) {
|
||||
@@ -970,7 +974,7 @@ define(function(require) {
|
||||
if (that.selectOptions.starred_ids != undefined){
|
||||
if (that.selectOptions.starred_ids_map[this[that.xmlRoot].ID]){
|
||||
elementArray[that.selectOptions.name_index] =
|
||||
('<i class="fa fa-star fa-fw"></i> ' +
|
||||
(that.selectOptions.starred_icon + ' ' +
|
||||
elementArray[that.selectOptions.name_index]);
|
||||
} else {
|
||||
elementArray[that.selectOptions.name_index] =
|
||||
|
||||
Reference in new issue
Block a user