Bug #4762: Use new ids for the settings tab panels

This commit is contained in:
Carlos Martín committed 2016-09-06 10:53:59 +02:00
1 parent 074de0cd0b
commit b440d082ab
27 files changed
+827 -407

No files matched your search

+11 -12
View File
@@ -769,24 +769,23 @@ tabs:
Support.create_dialog: true
settings-tab:
panel_tabs:
user_info_tab: true
user_config_tab: false
user_quotas_tab: true
group_quotas_tab: true
user_accounting_tab: true
user_showback_tab: true
settings_info_tab: true
settings_config_tab: false
settings_quotas_tab: true
settings_group_quotas_tab: true
settings_accounting_tab: true
settings_showback_tab: true
actions:
# The buttons inside the settings-tab panel user_info_tab are
# configured with users-tab/actions; User.update_password and
# User.login_token
#
# Buttons for user_config_tab
# Buttons for settings_info_tab
User.update_password: true
User.login_token: true
# Buttons for settings_config_tab
Settings.change_language: true
Settings.change_password: true
Settings.change_view: true
Settings.ssh_key: true
Settings.login_token: true
# Edit button in user_quotas_tab
# Edit button in settings_quotas_tab
User.quotas_dialog: false
upgrade-top-tab:
panel_tabs:
@@ -767,24 +767,23 @@ tabs:
Support.create_dialog: true
settings-tab:
panel_tabs:
user_info_tab: true
user_config_tab: false
user_quotas_tab: true
group_quotas_tab: true
user_accounting_tab: true
user_showback_tab: true
settings_info_tab: true
settings_config_tab: false
settings_quotas_tab: true
settings_group_quotas_tab: true
settings_accounting_tab: true
settings_showback_tab: true
actions:
# The buttons inside the settings-tab panel user_info_tab are
# configured with users-tab/actions; User.update_password and
# User.login_token
#
# Buttons for user_config_tab
# Buttons for settings_info_tab
User.update_password: true
User.login_token: true
# Buttons for settings_config_tab
Settings.change_language: true
Settings.change_password: true
Settings.change_view: true
Settings.ssh_key: true
Settings.login_token: true
# Edit button in user_quotas_tab
# Edit button in settings_quotas_tab
User.quotas_dialog: false
upgrade-top-tab:
panel_tabs:
+10 -15
View File
@@ -79,28 +79,23 @@ tabs:
disk_resize: true
settings-tab:
panel_tabs:
user_info_tab: false
user_config_tab: true
user_quotas_tab: true
user_accounting_tab: true
user_showback_tab: true
settings_info_tab: false
settings_config_tab: true
settings_quotas_tab: true
settings_accounting_tab: true
settings_showback_tab: true
actions:
# The buttons inside the settings-tab panel user_info_tab are
# configured with users-tab/actions; User.update_password and
# User.login_token
#
# Buttons for user_config_tab
# Buttons for settings_info_tab
User.update_password: true
User.login_token: true
# Buttons for settings_config_tab
Settings.change_language: true
Settings.change_password: true
Settings.change_view: true
Settings.ssh_key: true
Settings.login_token: true
# Edit button in user_quotas_tab
# Edit button in settings_quotas_tab
User.quotas_dialog: false
users-tab:
actions:
User.update_password: true
User.login_token: true
vms-tab:
actions: *provisionactions
images-tab:
@@ -79,23 +79,23 @@ tabs:
disk_resize: false
settings-tab:
panel_tabs:
user_info_tab: false
user_config_tab: true
user_quotas_tab: true
user_accounting_tab: true
user_showback_tab: true
settings_info_tab: false
settings_config_tab: true
settings_quotas_tab: true
settings_accounting_tab: true
settings_showback_tab: true
actions:
# The buttons inside the settings-tab panel user_info_tab are
# The buttons inside the settings-tab panel settings_info_tab are
# configured with users-tab/actions; User.update_password and
# User.login_token
#
# Buttons for user_config_tab
# Buttons for settings_config_tab
Settings.change_language: true
Settings.change_password: true
Settings.change_view: true
Settings.ssh_key: true
Settings.login_token: true
# Edit button in user_quotas_tab
# Edit button in settings_quotas_tab
User.quotas_dialog: false
users-tab:
actions:
+11 -12
View File
@@ -768,24 +768,23 @@ tabs:
Support.create_dialog: true
settings-tab:
panel_tabs:
user_info_tab: true
user_config_tab: false
user_quotas_tab: true
group_quotas_tab: true
user_accounting_tab: true
user_showback_tab: true
settings_info_tab: true
settings_config_tab: false
settings_quotas_tab: true
settings_group_quotas_tab: true
settings_accounting_tab: true
settings_showback_tab: true
actions:
# The buttons inside the settings-tab panel user_info_tab are
# configured with users-tab/actions; User.update_password and
# User.login_token
#
# Buttons for user_config_tab
# Buttons for settings_info_tab
User.update_password: true
User.login_token: true
# Buttons for settings_config_tab
Settings.change_language: true
Settings.change_password: true
Settings.change_view: true
Settings.ssh_key: true
Settings.login_token: true
# Edit button in user_quotas_tab
# Edit button in settings_quotas_tab
User.quotas_dialog: false
upgrade-top-tab:
panel_tabs:
@@ -768,24 +768,23 @@ tabs:
Support.create_dialog: true
settings-tab:
panel_tabs:
user_info_tab: true
user_config_tab: false
user_quotas_tab: true
group_quotas_tab: true
user_accounting_tab: true
user_showback_tab: true
settings_info_tab: true
settings_config_tab: false
settings_quotas_tab: true
settings_group_quotas_tab: true
settings_accounting_tab: true
settings_showback_tab: true
actions:
# The buttons inside the settings-tab panel user_info_tab are
# configured with users-tab/actions; User.update_password and
# User.login_token
#
# Buttons for user_config_tab
# Buttons for settings_info_tab
User.update_password: true
User.login_token: true
# Buttons for settings_config_tab
Settings.change_language: true
Settings.change_password: true
Settings.change_view: true
Settings.ssh_key: true
Settings.login_token: true
# Edit button in user_quotas_tab
# Edit button in settings_quotas_tab
User.quotas_dialog: false
upgrade-top-tab:
panel_tabs:
+11 -12
View File
@@ -767,24 +767,23 @@ tabs:
Support.create_dialog: true
settings-tab:
panel_tabs:
user_info_tab: true
user_config_tab: false
user_quotas_tab: true
group_quotas_tab: true
user_accounting_tab: true
user_showback_tab: true
settings_info_tab: true
settings_config_tab: false
settings_quotas_tab: true
settings_group_quotas_tab: true
settings_accounting_tab: true
settings_showback_tab: true
actions:
# The buttons inside the settings-tab panel user_info_tab are
# configured with users-tab/actions; User.update_password and
# User.login_token
#
# Buttons for user_config_tab
# Buttons for settings_info_tab
User.update_password: true
User.login_token: true
# Buttons for settings_config_tab
Settings.change_language: true
Settings.change_password: true
Settings.change_view: true
Settings.ssh_key: true
Settings.login_token: true
# Edit button in user_quotas_tab
# Edit button in settings_quotas_tab
User.quotas_dialog: false
upgrade-top-tab:
panel_tabs:
+4 -5
View File
@@ -21,7 +21,6 @@ define(function(require) {
var _actions = require('./users-tab/actions');
var TAB_ID = require('./settings-tab/tabId');
var USERS_TAB_ID = require('tabs/users-tab/tabId');
_actions["Settings.refresh"] = {
type: "custom",
@@ -34,12 +33,12 @@ define(function(require) {
];
var _panels = [
require('tabs/users-tab/panels/info'),
require('tabs/settings-tab/panels/info'),
require('tabs/settings-tab/panels/user-config'),
require('tabs/users-tab/panels/quotas'),
require('tabs/settings-tab/panels/quotas'),
require('tabs/settings-tab/panels/group-quotas'),
require('tabs/users-tab/panels/accounting'),
require('tabs/users-tab/panels/showback')
require('tabs/settings-tab/panels/accounting'),
require('tabs/settings-tab/panels/showback')
];
var _formPanels = [
@@ -0,0 +1,46 @@
/* -------------------------------------------------------------------------- */
/* 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 BasePanel = require('tabs/users-tab/panels/accounting-common');
/*
CONSTANTS
*/
var TAB_ID = require('../tabId');
var PANEL_ID = require('./accounting/panelId');
/*
CONSTRUCTOR
*/
function Panel(info) {
this.tabId = TAB_ID;
return BasePanel.call(this, info);
};
Panel.PANEL_ID = PANEL_ID;
Panel.prototype = Object.create(BasePanel.prototype);
Panel.prototype.constructor = Panel;
return Panel;
});
@@ -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 'settings_accounting_tab';
})
@@ -15,5 +15,5 @@
/* -------------------------------------------------------------------------- */
define(function(require){
return 'group_quotas_tab';
return 'settings_group_quotas_tab';
});
@@ -0,0 +1,46 @@
/* -------------------------------------------------------------------------- */
/* 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 BasePanel = require('tabs/users-tab/panels/info-common');
/*
CONSTANTS
*/
var TAB_ID = require('../tabId');
var PANEL_ID = require('./info/panelId');
/*
CONSTRUCTOR
*/
function Panel(info) {
this.tabId = TAB_ID;
return BasePanel.call(this, info);
};
Panel.PANEL_ID = PANEL_ID;
Panel.prototype = Object.create(BasePanel.prototype);
Panel.prototype.constructor = Panel;
return Panel;
});
@@ -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 'settings_info_tab';
})
@@ -0,0 +1,46 @@
/* -------------------------------------------------------------------------- */
/* 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 BasePanel = require('tabs/users-tab/panels/quotas-common');
/*
CONSTANTS
*/
var TAB_ID = require('../tabId');
var PANEL_ID = require('./quotas/panelId');
/*
CONSTRUCTOR
*/
function Panel(info) {
this.tabId = TAB_ID;
return BasePanel.call(this, info);
};
Panel.PANEL_ID = PANEL_ID;
Panel.prototype = Object.create(BasePanel.prototype);
Panel.prototype.constructor = Panel;
return Panel;
});
@@ -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 'settings_quotas_tab';
})
@@ -0,0 +1,46 @@
/* -------------------------------------------------------------------------- */
/* 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 BasePanel = require('tabs/users-tab/panels/showback-common');
/*
CONSTANTS
*/
var TAB_ID = require('../tabId');
var PANEL_ID = require('./showback/panelId');
/*
CONSTRUCTOR
*/
function Panel(info) {
this.tabId = TAB_ID;
return BasePanel.call(this, info);
};
Panel.PANEL_ID = PANEL_ID;
Panel.prototype = Object.create(BasePanel.prototype);
Panel.prototype.constructor = Panel;
return Panel;
});
@@ -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 'settings_showback_tab';
})
@@ -15,5 +15,5 @@
/* -------------------------------------------------------------------------- */
define(function(require) {
return 'user_config_tab';
return 'settings_config_tab';
});
@@ -0,0 +1,65 @@
/* -------------------------------------------------------------------------- */
/* 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 Locale = require('utils/locale');
var Accounting = require('utils/accounting');
/*
CONSTANTS
*/
var RESOURCE = "User";
var XML_ROOT = "USER";
/*
CONSTRUCTOR
*/
function Panel(info) {
this.title = Locale.tr("Accounting");
this.icon = "fa-bar-chart-o";
this.element = info[XML_ROOT];
return this;
}
Panel.prototype.html = _html;
Panel.prototype.setup = _setup;
return Panel;
/*
FUNCTION DEFINITIONS
*/
function _html() {
return Accounting.html();
}
function _setup(context) {
Accounting.setup(
context,
{ fixed_user: this.element.ID,
init_group_by: "vm"
});
}
});
@@ -19,8 +19,7 @@ define(function(require) {
DEPENDENCIES
*/
var Locale = require('utils/locale');
var Accounting = require('utils/accounting');
var BasePanel = require('tabs/users-tab/panels/accounting-common');
/*
CONSTANTS
@@ -28,41 +27,20 @@ define(function(require) {
var TAB_ID = require('../tabId');
var PANEL_ID = require('./accounting/panelId');
var RESOURCE = "User";
var XML_ROOT = "USER";
/*
CONSTRUCTOR
*/
function Panel(info) {
this.title = Locale.tr("Accounting");
this.icon = "fa-bar-chart-o";
this.tabId = TAB_ID;
this.element = info[XML_ROOT];
return this;
}
return BasePanel.call(this, info);
};
Panel.PANEL_ID = PANEL_ID;
Panel.prototype.html = _html;
Panel.prototype.setup = _setup;
Panel.prototype = Object.create(BasePanel.prototype);
Panel.prototype.constructor = Panel;
return Panel;
/*
FUNCTION DEFINITIONS
*/
function _html() {
return Accounting.html();
}
function _setup(context) {
Accounting.setup(
context,
{ fixed_user: this.element.ID,
init_group_by: "vm"
});
}
});
@@ -0,0 +1,254 @@
/* -------------------------------------------------------------------------- */
/* 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 TemplateInfo = require('hbs!./info/html');
var TemplateChgrpTr = require('hbs!./info/chgrp-tr');
var ResourceSelect = require('utils/resource-select');
var TemplateUtils = require('utils/template-utils');
var Locale = require('utils/locale');
var OpenNebulaUser = require('opennebula/user');
var Sunstone = require('sunstone');
/*
TEMPLATES
*/
var TemplateTable = require('utils/panel/template-table');
/*
CONSTANTS
*/
var RESOURCE = "User";
var XML_ROOT = "USER";
var PASSWORD_DIALOG_ID = require('tabs/users-tab/dialogs/password/dialogId');
var LOGIN_TOKEN_DIALOG_ID = require('tabs/users-tab/dialogs/login-token/dialogId');
var CONFIRM_DIALOG_ID = require('utils/dialogs/generic-confirm/dialogId');
/*
CONSTRUCTOR
*/
function Panel(info) {
this.title = Locale.tr("Info");
this.icon = "fa-info-circle";
this.element = info[XML_ROOT];
return this;
}
Panel.prototype.html = _html;
Panel.prototype.setup = _setup;
return Panel;
/*
FUNCTION DEFINITIONS
*/
function _html() {
var groupTrHTML = TemplateChgrpTr({'element': this.element});
// TODO: simplify interface?
var strippedTemplate = $.extend({}, this.element.TEMPLATE);
delete strippedTemplate["SSH_PUBLIC_KEY"];
delete strippedTemplate["SUNSTONE"];
var templateTableHTML = TemplateTable.html(strippedTemplate, RESOURCE,
Locale.tr("Attributes"));
//====
return TemplateInfo({
'element': this.element,
'sunstone_template': this.element.TEMPLATE.SUNSTONE||{},
'groupTrHTML': groupTrHTML,
'templateTableHTML': templateTableHTML,
'tabId': this.tabId
});
}
function _setup(context) {
var that = this;
// Template update
// TODO: simplify interface?
var strippedTemplate = $.extend({}, this.element.TEMPLATE);
delete strippedTemplate["SSH_PUBLIC_KEY"];
delete strippedTemplate["SUNSTONE"];
var hiddenValues = {};
if (this.element.TEMPLATE.SSH_PUBLIC_KEY != undefined) {
hiddenValues.SSH_PUBLIC_KEY = this.element.TEMPLATE.SSH_PUBLIC_KEY;
}
if (this.element.TEMPLATE.SUNSTONE != undefined) {
hiddenValues.SUNSTONE = this.element.TEMPLATE.SUNSTONE;
}
TemplateTable.setup(strippedTemplate, RESOURCE, this.element.ID, context, hiddenValues);
//===
// Chgrp
context.off("click", "#div_edit_chg_group_link");
context.on("click", "#div_edit_chg_group_link", function() {
ResourceSelect.insert({
context: $('#value_td_group', context),
resourceName: 'Group',
initValue: that.element.GID
});
});
context.off("change", "#value_td_group .resource_list_select");
context.on("change", "#value_td_group .resource_list_select", function() {
var newGroupId = $(this).val();
if (newGroupId != "") {
Sunstone.runAction(RESOURCE + ".chgrp", [that.element.ID], newGroupId);
}
});
// View password button
context.off("click", "#view_password");
context.on("click", "#view_password", function(){
Sunstone.getDialog(CONFIRM_DIALOG_ID).setParams({
header : Locale.tr("Password"),
headerTabId: that.tabId,
body: '<label>' + Locale.tr("Current password") + '</label>' +
'<pre>'+that.element.PASSWORD+'</pre>',
question : '',
buttons : [
Locale.tr("Close"),
],
submit : [
function(){
return false;
}
]
});
Sunstone.getDialog(CONFIRM_DIALOG_ID).reset();
Sunstone.getDialog(CONFIRM_DIALOG_ID).show();
});
// Edit password button
context.off("click", "#update_password");
context.on("click", "#update_password", function(){
Sunstone.getDialog(PASSWORD_DIALOG_ID).setParams(
{selectedElements: [that.element.ID]});
Sunstone.getDialog(PASSWORD_DIALOG_ID).reset();
Sunstone.getDialog(PASSWORD_DIALOG_ID).show();
});
// Login token button
context.off("click", "#login_token");
context.on("click", "#login_token", function(){
Sunstone.getDialog(LOGIN_TOKEN_DIALOG_ID).setParams({element: that.element});
Sunstone.getDialog(LOGIN_TOKEN_DIALOG_ID).reset();
Sunstone.getDialog(LOGIN_TOKEN_DIALOG_ID).show();
});
// SSH input
context.off("click", ".user_ssh_public_key_edit");
context.on("click", ".user_ssh_public_key_edit", function() {
$("#user_ssh_public_key_text", context).hide();
$("#user_ssh_public_key_textarea", context).show().focus();
});
context.off("change", "#user_ssh_public_key_textarea");
context.on("change", "#user_ssh_public_key_textarea", function() {
var template_str = 'SSH_PUBLIC_KEY = "'+TemplateUtils.escapeDoubleQuotes($(this).val())+'"';
Sunstone.runAction("User.append_template", that.element.ID, template_str);
});
context.off("focusout", "#user_ssh_public_key_textarea");
context.on("focusout", "#user_ssh_public_key_textarea", function() {
$("#user_ssh_public_key_text", context).show();
$("#user_ssh_public_key_textarea", context).hide();
});
$("#user_ssh_public_key_text", context).show();
$("#user_ssh_public_key_textarea", context).hide();
// Change table Order
context.off("click", "#div_edit_table_order")
context.on("click", "#div_edit_table_order", function() {
$(".value_td_table_order", context).html('<select id="table_order_select">' +
'<option value="asc">' + Locale.tr("ascending") + '</option>' +
'<option value="desc">' + Locale.tr("descending") + '</option>' +
'</select>');
if (that.element.TEMPLATE.SUNSTONE && that.element.TEMPLATE.SUNSTONE.TABLE_ORDER) {
$('#table_order_select', context).val(that.element.TEMPLATE.SUNSTONE.TABLE_ORDER);
}
});
context.off("change", "#table_order_select")
context.on("change", "#table_order_select", function() {
var sunstone_setting = {TABLE_ORDER : $(this).val()};
Sunstone.runAction("User.append_sunstone_setting_refresh", that.element.ID, sunstone_setting);
});
// Change language
context.off("click", "#div_edit_language")
context.on("click", "#div_edit_language", function() {
$(".value_td_language", context).html('<select id="language_select">' +
Locale.language_options +
'</select>');
if (that.element.TEMPLATE.SUNSTONE && that.element.TEMPLATE.SUNSTONE.LANG) {
$('#language_select', context).val(that.element.TEMPLATE.SUNSTONE.LANG);
}
});
context.off("change", "#language_select")
context.on("change", "#language_select", function() {
var sunstone_setting = {LANG : $(this).val()};
Sunstone.runAction("User.append_sunstone_setting_refresh", that.element.ID, sunstone_setting);
});
// Change view
context.off("click", "#div_edit_view")
context.on("click", "#div_edit_view", function() {
var options = '';
$.each( config['available_views'], function(id, view) {
options += '<option value="'+view+'">'+view+'</option>';
});
$(".value_td_view", context).html('<select id="view_select">' +
options +
'</select>');
if (that.element.TEMPLATE.SUNSTONE && that.element.TEMPLATE.SUNSTONE.DEFAULT_VIEW) {
$('#view_select', context).val(that.element.TEMPLATE.SUNSTONE.DEFAULT_VIEW);
}
});
context.off("change", "#view_select")
context.on("change", "#view_select", function() {
var sunstone_setting = {DEFAULT_VIEW : $(this).val()};
Sunstone.runAction("User.append_sunstone_setting_refresh", that.element.ID, sunstone_setting);
});
return false;
}
});
@@ -19,19 +19,7 @@ define(function(require) {
DEPENDENCIES
*/
var TemplateInfo = require('hbs!./info/html');
var TemplateChgrpTr = require('hbs!./info/chgrp-tr');
var ResourceSelect = require('utils/resource-select');
var TemplateUtils = require('utils/template-utils');
var Locale = require('utils/locale');
var OpenNebulaUser = require('opennebula/user');
var Sunstone = require('sunstone');
/*
TEMPLATES
*/
var TemplateTable = require('utils/panel/template-table');
var BasePanel = require('tabs/users-tab/panels/info-common');
/*
CONSTANTS
@@ -39,218 +27,20 @@ define(function(require) {
var TAB_ID = require('../tabId');
var PANEL_ID = require('./info/panelId');
var RESOURCE = "User";
var XML_ROOT = "USER";
var PASSWORD_DIALOG_ID = require('tabs/users-tab/dialogs/password/dialogId');
var LOGIN_TOKEN_DIALOG_ID = require('tabs/users-tab/dialogs/login-token/dialogId');
var CONFIRM_DIALOG_ID = require('utils/dialogs/generic-confirm/dialogId');
/*
CONSTRUCTOR
*/
function Panel(info) {
this.title = Locale.tr("Info");
this.icon = "fa-info-circle";
this.tabId = TAB_ID;
this.element = info[XML_ROOT];
return this;
}
return BasePanel.call(this, info);
};
Panel.PANEL_ID = PANEL_ID;
Panel.prototype.html = _html;
Panel.prototype.setup = _setup;
Panel.prototype = Object.create(BasePanel.prototype);
Panel.prototype.constructor = Panel;
return Panel;
/*
FUNCTION DEFINITIONS
*/
function _html() {
var groupTrHTML = TemplateChgrpTr({'element': this.element});
// TODO: simplify interface?
var strippedTemplate = $.extend({}, this.element.TEMPLATE);
delete strippedTemplate["SSH_PUBLIC_KEY"];
delete strippedTemplate["SUNSTONE"];
var templateTableHTML = TemplateTable.html(strippedTemplate, RESOURCE,
Locale.tr("Attributes"));
//====
return TemplateInfo({
'element': this.element,
'sunstone_template': this.element.TEMPLATE.SUNSTONE||{},
'groupTrHTML': groupTrHTML,
'templateTableHTML': templateTableHTML
});
}
function _setup(context) {
var that = this;
// Template update
// TODO: simplify interface?
var strippedTemplate = $.extend({}, this.element.TEMPLATE);
delete strippedTemplate["SSH_PUBLIC_KEY"];
delete strippedTemplate["SUNSTONE"];
var hiddenValues = {};
if (this.element.TEMPLATE.SSH_PUBLIC_KEY != undefined) {
hiddenValues.SSH_PUBLIC_KEY = this.element.TEMPLATE.SSH_PUBLIC_KEY;
}
if (this.element.TEMPLATE.SUNSTONE != undefined) {
hiddenValues.SUNSTONE = this.element.TEMPLATE.SUNSTONE;
}
TemplateTable.setup(strippedTemplate, RESOURCE, this.element.ID, context, hiddenValues);
//===
// Chgrp
context.off("click", "#div_edit_chg_group_link");
context.on("click", "#div_edit_chg_group_link", function() {
ResourceSelect.insert({
context: $('#value_td_group', context),
resourceName: 'Group',
initValue: that.element.GID
});
});
context.off("change", "#value_td_group .resource_list_select");
context.on("change", "#value_td_group .resource_list_select", function() {
var newGroupId = $(this).val();
if (newGroupId != "") {
Sunstone.runAction(RESOURCE + ".chgrp", [that.element.ID], newGroupId);
}
});
// View password button
context.off("click", "#view_password");
context.on("click", "#view_password", function(){
Sunstone.getDialog(CONFIRM_DIALOG_ID).setParams({
header : Locale.tr("Password"),
headerTabId: TAB_ID,
body: '<label>' + Locale.tr("Current password") + '</label>' +
'<pre>'+that.element.PASSWORD+'</pre>',
question : '',
buttons : [
Locale.tr("Close"),
],
submit : [
function(){
return false;
}
]
});
Sunstone.getDialog(CONFIRM_DIALOG_ID).reset();
Sunstone.getDialog(CONFIRM_DIALOG_ID).show();
});
// Edit password button
context.off("click", "#update_password");
context.on("click", "#update_password", function(){
Sunstone.getDialog(PASSWORD_DIALOG_ID).setParams(
{selectedElements: [that.element.ID]});
Sunstone.getDialog(PASSWORD_DIALOG_ID).reset();
Sunstone.getDialog(PASSWORD_DIALOG_ID).show();
});
// Login token button
context.off("click", "#login_token");
context.on("click", "#login_token", function(){
Sunstone.getDialog(LOGIN_TOKEN_DIALOG_ID).setParams({element: that.element});
Sunstone.getDialog(LOGIN_TOKEN_DIALOG_ID).reset();
Sunstone.getDialog(LOGIN_TOKEN_DIALOG_ID).show();
});
// SSH input
context.off("click", ".user_ssh_public_key_edit");
context.on("click", ".user_ssh_public_key_edit", function() {
$("#user_ssh_public_key_text", context).hide();
$("#user_ssh_public_key_textarea", context).show().focus();
});
context.off("change", "#user_ssh_public_key_textarea");
context.on("change", "#user_ssh_public_key_textarea", function() {
var template_str = 'SSH_PUBLIC_KEY = "'+TemplateUtils.escapeDoubleQuotes($(this).val())+'"';
Sunstone.runAction("User.append_template", that.element.ID, template_str);
});
context.off("focusout", "#user_ssh_public_key_textarea");
context.on("focusout", "#user_ssh_public_key_textarea", function() {
$("#user_ssh_public_key_text", context).show();
$("#user_ssh_public_key_textarea", context).hide();
});
$("#user_ssh_public_key_text", context).show();
$("#user_ssh_public_key_textarea", context).hide();
// Change table Order
context.off("click", "#div_edit_table_order")
context.on("click", "#div_edit_table_order", function() {
$(".value_td_table_order", context).html('<select id="table_order_select">' +
'<option value="asc">' + Locale.tr("ascending") + '</option>' +
'<option value="desc">' + Locale.tr("descending") + '</option>' +
'</select>');
if (that.element.TEMPLATE.SUNSTONE && that.element.TEMPLATE.SUNSTONE.TABLE_ORDER) {
$('#table_order_select', context).val(that.element.TEMPLATE.SUNSTONE.TABLE_ORDER);
}
});
context.off("change", "#table_order_select")
context.on("change", "#table_order_select", function() {
var sunstone_setting = {TABLE_ORDER : $(this).val()};
Sunstone.runAction("User.append_sunstone_setting_refresh", that.element.ID, sunstone_setting);
});
// Change language
context.off("click", "#div_edit_language")
context.on("click", "#div_edit_language", function() {
$(".value_td_language", context).html('<select id="language_select">' +
Locale.language_options +
'</select>');
if (that.element.TEMPLATE.SUNSTONE && that.element.TEMPLATE.SUNSTONE.LANG) {
$('#language_select', context).val(that.element.TEMPLATE.SUNSTONE.LANG);
}
});
context.off("change", "#language_select")
context.on("change", "#language_select", function() {
var sunstone_setting = {LANG : $(this).val()};
Sunstone.runAction("User.append_sunstone_setting_refresh", that.element.ID, sunstone_setting);
});
// Change view
context.off("click", "#div_edit_view")
context.on("click", "#div_edit_view", function() {
var options = '';
$.each( config['available_views'], function(id, view) {
options += '<option value="'+view+'">'+view+'</option>';
});
$(".value_td_view", context).html('<select id="view_select">' +
options +
'</select>');
if (that.element.TEMPLATE.SUNSTONE && that.element.TEMPLATE.SUNSTONE.DEFAULT_VIEW) {
$('#view_select', context).val(that.element.TEMPLATE.SUNSTONE.DEFAULT_VIEW);
}
});
context.off("change", "#view_select")
context.on("change", "#view_select", function() {
var sunstone_setting = {DEFAULT_VIEW : $(this).val()};
Sunstone.runAction("User.append_sunstone_setting_refresh", that.element.ID, sunstone_setting);
});
return false;
}
});
@@ -86,14 +86,14 @@
</button>
</td>
<td class="value_td">
{{#isTabActionEnabled "users-tab" "User.update_password"}}
{{#isTabActionEnabled tabId "User.update_password"}}
<div>
<a id="update_password" class="edit_e" href="#"> <i class="fa fa-pencil-square-o right"/></a>
</div>
{{/isTabActionEnabled}}
</td>
</tr>
{{#isTabActionEnabled "users-tab" "User.login_token"}}
{{#isTabActionEnabled tabId "User.login_token"}}
<tr class="login_token">
<td class="key_td">{{tr "Login token"}}</td>
<td class="value_td">
@@ -0,0 +1,72 @@
/* -------------------------------------------------------------------------- */
/* 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 Locale = require('utils/locale');
var Config = require('sunstone-config');
var QuotaDefaults = require('utils/quotas/quota-defaults');
var QuotaWidgets = require('utils/quotas/quota-widgets');
/*
CONSTANTS
*/
var RESOURCE = "User";
var XML_ROOT = "USER";
/*
CONSTRUCTOR
*/
function Panel(info, tabId) {
this.title = Locale.tr("Quotas");
this.icon = "fa-align-left";
this.element = info[XML_ROOT];
return this;
}
Panel.prototype.html = _html;
Panel.prototype.setup = _setup;
return Panel;
/*
FUNCTION DEFINITIONS
*/
function _html() {
return QuotaWidgets.initQuotasPanel(
this.element,
QuotaDefaults.getDefaultQuotas(RESOURCE),
Config.isTabActionEnabled(this.tabId, RESOURCE+".quotas_dialog"));
}
function _setup(context) {
QuotaWidgets.setupQuotasPanel(
this.element,
context,
Config.isTabActionEnabled(this.tabId, RESOURCE+".quotas_dialog"),
RESOURCE);
return false;
}
});
@@ -19,10 +19,7 @@ define(function(require) {
DEPENDENCIES
*/
var Locale = require('utils/locale');
var Config = require('sunstone-config');
var QuotaDefaults = require('utils/quotas/quota-defaults');
var QuotaWidgets = require('utils/quotas/quota-widgets');
var BasePanel = require('tabs/users-tab/panels/quotas-common');
/*
CONSTANTS
@@ -30,47 +27,20 @@ define(function(require) {
var TAB_ID = require('../tabId');
var PANEL_ID = require('./quotas/panelId');
var RESOURCE = "User";
var XML_ROOT = "USER";
/*
CONSTRUCTOR
*/
function Panel(info, tabId) {
this.tabId = tabId || TAB_ID;
this.title = Locale.tr("Quotas");
this.icon = "fa-align-left";
function Panel(info) {
this.tabId = TAB_ID;
this.element = info[XML_ROOT];
return this;
}
return BasePanel.call(this, info);
};
Panel.PANEL_ID = PANEL_ID;
Panel.prototype.html = _html;
Panel.prototype.setup = _setup;
Panel.prototype = Object.create(BasePanel.prototype);
Panel.prototype.constructor = Panel;
return Panel;
/*
FUNCTION DEFINITIONS
*/
function _html() {
return QuotaWidgets.initQuotasPanel(
this.element,
QuotaDefaults.getDefaultQuotas(RESOURCE),
Config.isTabActionEnabled(this.tabId, RESOURCE+".quotas_dialog"));
}
function _setup(context) {
QuotaWidgets.setupQuotasPanel(
this.element,
context,
Config.isTabActionEnabled(this.tabId, RESOURCE+".quotas_dialog"),
RESOURCE);
return false;
}
});
@@ -0,0 +1,70 @@
/* -------------------------------------------------------------------------- */
/* 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 Locale = require('utils/locale');
var Config = require('sunstone-config');
var Showback = require('utils/showback');
/*
CONSTANTS
*/
var RESOURCE = "User";
var XML_ROOT = "USER";
/*
CONSTRUCTOR
*/
function Panel(info) {
this.title = Locale.tr("Showback");
this.icon = "fa-money";
this.element = info[XML_ROOT];
if (!Config.isFeatureEnabled("showback")) {
throw "Showback is disabled in the configuration";
}
return this;
}
Panel.prototype.html = _html;
Panel.prototype.setup = _setup;
return Panel;
/*
FUNCTION DEFINITIONS
*/
function _html() {
return Showback.html();
}
function _setup(context) {
Showback.setup(
context,
{ fixed_user: this.element.ID,
fixed_group: ""
}
);
}
});
@@ -19,9 +19,7 @@ define(function(require) {
DEPENDENCIES
*/
var Locale = require('utils/locale');
var Config = require('sunstone-config');
var Showback = require('utils/showback');
var BasePanel = require('tabs/users-tab/panels/showback-common');
/*
CONSTANTS
@@ -29,46 +27,20 @@ define(function(require) {
var TAB_ID = require('../tabId');
var PANEL_ID = require('./showback/panelId');
var RESOURCE = "User";
var XML_ROOT = "USER";
/*
CONSTRUCTOR
*/
function Panel(info) {
this.title = Locale.tr("Showback");
this.icon = "fa-money";
this.tabId = TAB_ID;
this.element = info[XML_ROOT];
if (!Config.isFeatureEnabled("showback")) {
throw "Showback is disabled in the configuration";
}
return this;
}
return BasePanel.call(this, info);
};
Panel.PANEL_ID = PANEL_ID;
Panel.prototype.html = _html;
Panel.prototype.setup = _setup;
Panel.prototype = Object.create(BasePanel.prototype);
Panel.prototype.constructor = Panel;
return Panel;
/*
FUNCTION DEFINITIONS
*/
function _html() {
return Showback.html();
}
function _setup(context) {
Showback.setup(
context,
{ fixed_user: this.element.ID,
fixed_group: ""
}
);
}
});