feature #4210: Add groups panel

This commit is contained in:
Daniel Molina committed 2016-01-19 17:39:17 +01:00
1 parent 2d30994135
commit 735d456cc2
7 files changed
+114 -1

No files matched your search

@@ -50,6 +50,7 @@ tabs:
panel_tabs:
user_info_tab: true
user_quotas_tab: true
user_groups_tab: true
user_accounting_tab: true
user_showback_tab: true
table_columns:
@@ -50,6 +50,7 @@ tabs:
panel_tabs:
user_info_tab: true
user_quotas_tab: true
user_groups_tab: true
user_accounting_tab: true
user_showback_tab: true
table_columns:
@@ -51,6 +51,7 @@ tabs:
panel_tabs:
user_info_tab: true
user_quotas_tab: true
user_groups_tab: true
user_accounting_tab: true
user_showback_tab: true
table_columns:
@@ -32,6 +32,7 @@ define(function(require) {
var _panels = [
require('./users-tab/panels/info'),
require('./users-tab/panels/groups'),
require('./users-tab/panels/quotas'),
require('./users-tab/panels/accounting'),
require('./users-tab/panels/showback')
@@ -109,7 +109,7 @@ define(function(require) {
function _setParams(params) {
this.element = params.element;
if (this.element.GROUPS !== undefined && this.element.GROUPS !== undefined) {
if (this.element.GROUPS !== undefined && this.element.GROUPS.ID !== undefined) {
if ($.isArray(this.element.GROUPS.ID)) {
this.originalGroupIds = this.element.GROUPS.ID;
} else {
@@ -0,0 +1,90 @@
/* -------------------------------------------------------------------------- */
/* 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 GroupsTable = require('tabs/groups-tab/datatable');
/*
CONSTANTS
*/
var PANEL_ID = require('./groups/panelId');
var GROUPS_TABLE_ID = PANEL_ID + "GroupsTable";
var RESOURCE = "User";
var XML_ROOT = "USER";
/*
CONSTRUCTOR
*/
function Panel(info) {
this.title = Locale.tr("Groups");
this.icon = "fa-users";
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 groups;
if (this.element.GROUPS !== undefined && this.element.GROUPS.ID !== undefined) {
if ($.isArray(this.element.GROUPS.ID)) {
groups = this.element.GROUPS.ID;
} else {
groups = [this.element.GROUPS.ID];
}
} else {
groups = [];
}
var opts = {
info: true,
select: true,
selectOptions: {
read_only: true,
fixed_ids: groups
}
};
this.GroupsTable = new GroupsTable(GROUPS_TABLE_ID, opts);
return this.GroupsTable.dataTableHTML;
}
function _setup(context) {
this.GroupsTable.initialize();
this.GroupsTable.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 'user_groups_tab';
})