mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-28 14:50:08 +03:00
Feature 4359 (#172)
* F #4359 changed color of edit button * F #4359 possibility to change primary and secondary groups in groups panel * F #4359 removed possibility to change primary group and add possibility to change Auth driver * F #4359 changed .yaml for add new panel to users tab * F #4359 Added underline to the view * F #4359 Added new panel Auth for user tab - change password - change authentication driver - token view - change ssh key * F #4359 expanded panel to 12 columns
This commit is contained in:
parent
b75ae46c81
commit
40e43b0147
@ -83,6 +83,7 @@ tabs:
|
||||
user_groups_tab: true
|
||||
user_accounting_tab: true
|
||||
user_showback_tab: true
|
||||
user_auth_tab: true
|
||||
table_columns:
|
||||
- 0 # Checkbox
|
||||
- 1 # ID
|
||||
|
@ -80,6 +80,7 @@ tabs:
|
||||
user_groups_tab: true
|
||||
user_accounting_tab: true
|
||||
user_showback_tab: true
|
||||
user_auth_tab: true
|
||||
table_columns:
|
||||
- 0 # Checkbox
|
||||
- 1 # ID
|
||||
|
@ -82,6 +82,7 @@ tabs:
|
||||
user_groups_tab: true
|
||||
user_accounting_tab: true
|
||||
user_showback_tab: true
|
||||
user_auth_tab: true
|
||||
table_columns:
|
||||
- 0 # Checkbox
|
||||
- 1 # ID
|
||||
|
@ -81,6 +81,7 @@ tabs:
|
||||
user_groups_tab: true
|
||||
user_accounting_tab: true
|
||||
user_showback_tab: true
|
||||
user_auth_tab: true
|
||||
table_columns:
|
||||
- 0 # Checkbox
|
||||
- 1 # ID
|
||||
|
@ -80,6 +80,7 @@ tabs:
|
||||
user_groups_tab: true
|
||||
user_accounting_tab: true
|
||||
user_showback_tab: true
|
||||
user_auth_tab: true
|
||||
table_columns:
|
||||
- 0 # Checkbox
|
||||
- 1 # ID
|
||||
|
@ -36,7 +36,8 @@ define(function(require) {
|
||||
require('./users-tab/panels/groups'),
|
||||
require('./users-tab/panels/quotas'),
|
||||
require('./users-tab/panels/accounting'),
|
||||
require('./users-tab/panels/showback')
|
||||
require('./users-tab/panels/showback'),
|
||||
require('./users-tab/panels/auth')
|
||||
];
|
||||
|
||||
var _panelsHooks = [
|
||||
|
193
src/sunstone/public/app/tabs/users-tab/panels/auth-common.js
Normal file
193
src/sunstone/public/app/tabs/users-tab/panels/auth-common.js
Normal file
@ -0,0 +1,193 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* 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!./auth/html');
|
||||
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');
|
||||
var UserCreation = require('tabs/users-tab/utils/user-creation');
|
||||
|
||||
/*
|
||||
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("Auth");
|
||||
this.icon = "fa-key";
|
||||
|
||||
this.element = info[XML_ROOT];
|
||||
this.userCreation = new UserCreation(this.tabId, {name: false, password: false, group_select: false});
|
||||
return this;
|
||||
}
|
||||
|
||||
Panel.prototype.html = _html;
|
||||
Panel.prototype.setup = _setup;
|
||||
|
||||
return Panel;
|
||||
|
||||
/*
|
||||
FUNCTION DEFINITIONS
|
||||
*/
|
||||
|
||||
function _html() {
|
||||
|
||||
// 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,
|
||||
'tabId': this.tabId,
|
||||
'templateTableHTML': templateTableHTML,
|
||||
'userCreationHTML': this.userCreation.html()
|
||||
});
|
||||
}
|
||||
|
||||
function _setup(context) {
|
||||
var that = this;
|
||||
this.userCreation.setup(context);
|
||||
// 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);
|
||||
//===
|
||||
|
||||
// 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();
|
||||
});
|
||||
|
||||
context.off("click", "#div_edit_auth_driver_link");
|
||||
context.on("click", "#div_edit_auth_driver_link", function() {
|
||||
$("#show_auth_driver").hide();
|
||||
$("#label_auth").hide();
|
||||
$("#change_auth_driver").show();
|
||||
$("#users-tab_driver").val(that.element.AUTH_DRIVER);
|
||||
});
|
||||
|
||||
context.off("change", "#users-tab_driver");
|
||||
context.on("change", "#users-tab_driver", function() {
|
||||
var newAuthDriver= $(this).val();
|
||||
if (newAuthDriver != "") {
|
||||
Sunstone.runAction(RESOURCE + ".chauth", [that.element.ID], newAuthDriver);
|
||||
$("#change_auth_driver").hide();
|
||||
$("#show_auth_driver").show();
|
||||
Sunstone.runAction(RESOURCE + ".refresh");
|
||||
}
|
||||
});
|
||||
|
||||
// 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();
|
||||
return false;
|
||||
}
|
||||
});
|
46
src/sunstone/public/app/tabs/users-tab/panels/auth.js
Normal file
46
src/sunstone/public/app/tabs/users-tab/panels/auth.js
Normal file
@ -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/auth-common');
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
*/
|
||||
|
||||
var TAB_ID = require('../tabId');
|
||||
var PANEL_ID = require('./auth/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;
|
||||
});
|
89
src/sunstone/public/app/tabs/users-tab/panels/auth/html.hbs
Normal file
89
src/sunstone/public/app/tabs/users-tab/panels/auth/html.hbs
Normal file
@ -0,0 +1,89 @@
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
{{! 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. }}
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
<table class="dataTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2">{{tr "Authentication"}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="key_td">{{tr "Authentication driver"}}</td>
|
||||
<td class="value_td" id="change_auth_driver" colspan="2" hidden = "true">{{{userCreationHTML}}}</td>
|
||||
<td class="value_td" colspan="2" id="show_auth_driver">{{element.AUTH_DRIVER}}</td>
|
||||
<td><a id="div_edit_auth_driver_link" class="edit_e" href="#"> <i class="fa fa-pencil-square-o right"/></a></td>
|
||||
</tr>
|
||||
<tr class="passsword_edit">
|
||||
<td class="key_td">{{tr "Password"}}</td>
|
||||
<td class="value_td" colspan="2" id ="show_btn_password">
|
||||
<button id="view_password" type="button" class="button small radius secondary" style="min-width:80%">
|
||||
{{tr "View"}}
|
||||
</button>
|
||||
</td>
|
||||
<td>
|
||||
{{#isTabActionEnabled tabId "User.update_password"}}
|
||||
<a id="update_password" class="edit_e" href="#"> <i class="fa fa-pencil-square-o right"/></a>
|
||||
{{/isTabActionEnabled}}
|
||||
</td>
|
||||
</tr>
|
||||
{{#isTabActionEnabled tabId "User.login_token"}}
|
||||
<tr class="login_token">
|
||||
<td class="key_td">{{tr "Login token"}}</td>
|
||||
<td class="value_td" colspan="2">
|
||||
<button id="login_token" type="button" class="button small radius secondary" style="min-width:80%">
|
||||
{{tr "Manage login tokens"}}
|
||||
</button>
|
||||
</td>
|
||||
<td/>
|
||||
</tr>
|
||||
{{/isTabActionEnabled}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
<table class="dataTable" cellpadding="0" cellspacing="0" border="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{tr "Public SSH Key"}}</th>
|
||||
<th>
|
||||
<a class="user_ssh_public_key_edit right" href="#"><i class="fa fa-pencil-square-o"></i></a>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<td>
|
||||
<textarea rows="6" type="text" id="user_ssh_public_key_textarea" name="ssh_public_key" hidden>
|
||||
{{~element.TEMPLATE.SSH_PUBLIC_KEY~}}
|
||||
</textarea>
|
||||
<p id="user_ssh_public_key_text" class="ellipsis" name="ssh_public_key">
|
||||
{{#if element.TEMPLATE.SSH_PUBLIC_KEY}}
|
||||
{{element.TEMPLATE.SSH_PUBLIC_KEY}}
|
||||
{{else}}
|
||||
{{tr "You can provide a SSH Key for this User clicking on the edit button"}}
|
||||
{{/if}}
|
||||
</p>
|
||||
</td>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -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 'user_auth_tab';
|
||||
})
|
@ -21,6 +21,15 @@ define(function(require) {
|
||||
|
||||
var Locale = require('utils/locale');
|
||||
var GroupsTable = require('tabs/groups-tab/datatable');
|
||||
var TemplateChgrpTr = require('hbs!./info/chgrp-tr');
|
||||
var ResourceSelect = require('utils/resource-select');
|
||||
var Sunstone = require('sunstone');
|
||||
|
||||
/*
|
||||
TEMPLATES
|
||||
*/
|
||||
|
||||
var TemplateHTML = require('hbs!./groups/html');
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
@ -40,13 +49,13 @@ define(function(require) {
|
||||
this.icon = "fa-users";
|
||||
|
||||
this.element = info[XML_ROOT];
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
Panel.PANEL_ID = PANEL_ID;
|
||||
Panel.prototype.html = _html;
|
||||
Panel.prototype.setup = _setup;
|
||||
Panel.prototype.onShow = _onShow;
|
||||
|
||||
return Panel;
|
||||
|
||||
@ -56,7 +65,7 @@ define(function(require) {
|
||||
|
||||
function _html() {
|
||||
var groups;
|
||||
|
||||
var groupTrHTML = TemplateChgrpTr({'element': this.element});
|
||||
if (this.element.GROUPS !== undefined && this.element.GROUPS.ID !== undefined) {
|
||||
if ($.isArray(this.element.GROUPS.ID)) {
|
||||
groups = this.element.GROUPS.ID;
|
||||
@ -66,25 +75,91 @@ define(function(require) {
|
||||
} else {
|
||||
groups = [];
|
||||
}
|
||||
|
||||
this.groups = groups;
|
||||
var opts = {
|
||||
info: true,
|
||||
select: true,
|
||||
selectOptions: {
|
||||
read_only: true,
|
||||
fixed_ids: groups
|
||||
}
|
||||
fixed_ids: this.groups
|
||||
}
|
||||
};
|
||||
this.groupsTable = new GroupsTable(GROUPS_TABLE_ID, opts);
|
||||
this.groupsTableEdit = new GroupsTable('user_groups_edit', {
|
||||
info: false,
|
||||
select: true,
|
||||
selectOptions: {
|
||||
'multiple_choice': true
|
||||
}
|
||||
});
|
||||
|
||||
this.GroupsTable = new GroupsTable(GROUPS_TABLE_ID, opts);
|
||||
|
||||
return this.GroupsTable.dataTableHTML;
|
||||
return TemplateHTML({
|
||||
'groupsTableHTML': this.groupsTable.dataTableHTML,
|
||||
'groupsTableEditHTML': this.groupsTableEdit.dataTableHTML,
|
||||
'element': this.element
|
||||
});
|
||||
}
|
||||
|
||||
function _setup(context) {
|
||||
this.GroupsTable.initialize();
|
||||
this.GroupsTable.refreshResourceTableSelect();
|
||||
this.groupsTable.initialize();
|
||||
this.groupsTable.refreshResourceTableSelect();
|
||||
this.groupsTableEdit.initialize();
|
||||
this.groupsTableEdit.refreshResourceTableSelect();
|
||||
this.groupsTableEdit.selectResourceTableSelect({ids: this.groups});
|
||||
|
||||
$("#cancel_update_group").hide();
|
||||
that = this;
|
||||
context.off("click", "#update_group");
|
||||
context.on("click", "#update_group", function() {
|
||||
ResourceSelect.insert({
|
||||
context: $('#choose_primary_grp', context),
|
||||
resourceName: 'Group',
|
||||
callback : function(response){
|
||||
$("#choose_primary_grp").html(response[0].outerHTML);
|
||||
}
|
||||
});
|
||||
$(".show_labels").hide();
|
||||
$(".select_labels").show();
|
||||
});
|
||||
|
||||
context.off("click", "#cancel_update_group");
|
||||
context.on("click", "#cancel_update_group", function() {
|
||||
$(".select_labels").hide();
|
||||
$(".show_labels").show();
|
||||
|
||||
});
|
||||
|
||||
|
||||
$('#Form_change_second_grp').submit(function() {
|
||||
var selectPrimaryGrp = $("#choose_primary_grp .resource_list_select").val();
|
||||
var selectedGroupsList = that.groupsTableEdit.retrieveResourceTableSelect();
|
||||
$.each(selectedGroupsList, function(index, groupId) {
|
||||
if ($.inArray(groupId, that.groups) === -1) {
|
||||
Sunstone.runAction('User.addgroup', [that.element.ID], groupId);
|
||||
}
|
||||
});
|
||||
|
||||
$.each(that.groups, function(index, groupId) {
|
||||
if ($.inArray(groupId, selectedGroupsList) === -1) {
|
||||
Sunstone.runAction('User.delgroup', [that.element.ID], groupId);
|
||||
}
|
||||
});
|
||||
|
||||
if (selectPrimaryGrp != -1 && selectPrimaryGrp != that.element.GID) {
|
||||
Sunstone.runAction("User.chgrp", [that.element.ID], selectPrimaryGrp);
|
||||
}
|
||||
$(".select_labels").hide();
|
||||
$(".show_labels").show();
|
||||
setTimeout(function() {
|
||||
Sunstone.runAction('User.refresh');
|
||||
}, 1500);
|
||||
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
function _onShow() {
|
||||
this.groupsTableEdit.refreshResourceTableSelect();
|
||||
this.groupsTableEdit.selectResourceTableSelect({ids: this.groups});
|
||||
}
|
||||
});
|
||||
|
@ -0,0 +1,54 @@
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
{{! 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. }}
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
<div class="row">
|
||||
<button type="submit" class="button primary small radius right show_labels" id="update_group">
|
||||
<span class= "fa fa-pencil-square-o"></span>
|
||||
{{tr "Edit"}}
|
||||
</button>
|
||||
<button type="submit" class="button secondary small radius right select_labels" id="cancel_update_group" hidden="true">
|
||||
<span class= "fa fa-times-circle"></span>
|
||||
</button>
|
||||
</div>
|
||||
<form data-abide novalidate id="Form_change_second_grp">
|
||||
<div class="row">
|
||||
<fieldset style="margin-bottom: 0rem;">
|
||||
<legend>{{tr "Primary Group"}}</legend>
|
||||
<h6 class="show_labels">{{navigate element.GNAME "groups-tab" element.GID}}</h6>
|
||||
<div id="choose_primary_grp" hidden="true" class="select_labels"></div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="row">
|
||||
<fieldset>
|
||||
<legend>{{tr "Secondary Group"}}</legend>
|
||||
<div class="show_labels">
|
||||
<div class="large-12 columns show_labels">
|
||||
{{{groupsTableHTML}}}
|
||||
</div>
|
||||
</div>
|
||||
<div hidden="true" class="select_labels">
|
||||
<div class="large-12 columns">
|
||||
{{{groupsTableEditHTML}}}
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="confirm-resources-header"></div>
|
||||
<div class="form_buttons row">
|
||||
<button type="submit" class="button success radius right" >
|
||||
{{tr "Apply changes"}}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
@ -20,12 +20,12 @@ define(function(require) {
|
||||
*/
|
||||
|
||||
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');
|
||||
var UserCreation = require('tabs/users-tab/utils/user-creation');
|
||||
|
||||
/*
|
||||
TEMPLATES
|
||||
@ -52,7 +52,7 @@ define(function(require) {
|
||||
this.icon = "fa-info-circle";
|
||||
|
||||
this.element = info[XML_ROOT];
|
||||
|
||||
this.userCreation = new UserCreation(this.tabId, {name: false, password: false, group_select: false});
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -66,7 +66,6 @@ define(function(require) {
|
||||
*/
|
||||
|
||||
function _html() {
|
||||
var groupTrHTML = TemplateChgrpTr({'element': this.element});
|
||||
|
||||
// TODO: simplify interface?
|
||||
var strippedTemplate = $.extend({}, this.element.TEMPLATE);
|
||||
@ -80,15 +79,15 @@ define(function(require) {
|
||||
return TemplateInfo({
|
||||
'element': this.element,
|
||||
'sunstone_template': this.element.TEMPLATE.SUNSTONE||{},
|
||||
'groupTrHTML': groupTrHTML,
|
||||
'templateTableHTML': templateTableHTML,
|
||||
'tabId': this.tabId
|
||||
'tabId': this.tabId,
|
||||
'userCreationHTML': this.userCreation.html()
|
||||
});
|
||||
}
|
||||
|
||||
function _setup(context) {
|
||||
var that = this;
|
||||
|
||||
this.userCreation.setup(context);
|
||||
// Template update
|
||||
// TODO: simplify interface?
|
||||
var strippedTemplate = $.extend({}, this.element.TEMPLATE);
|
||||
@ -106,88 +105,6 @@ define(function(require) {
|
||||
|
||||
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")
|
||||
|
@ -15,7 +15,7 @@
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
|
||||
<div class="row">
|
||||
<div class="large-6 columns">
|
||||
<div class="large-12 columns">
|
||||
<table class="dataTable" cellpadding="0" cellspacing="0" border="0">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -33,7 +33,6 @@
|
||||
<td class="value_td">{{element.NAME}}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
{{{groupTrHTML}}}
|
||||
<tr>
|
||||
<td class="key_td">{{tr "Table Order"}}</td>
|
||||
<td class="value_td_table_order">{{valOrDefault sunstone_template.TABLE_ORDER "-"}}</td>
|
||||
@ -64,77 +63,6 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="large-6 columns">
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
<table class="dataTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2">{{tr "Authentication"}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="key_td">{{tr "Authentication driver"}}</td>
|
||||
<td class="value_td" colspan="2">{{element.AUTH_DRIVER}}</td>
|
||||
</tr>
|
||||
<tr class="passsword_edit">
|
||||
<td class="key_td">{{tr "Password"}}</td>
|
||||
<td class="value_td">
|
||||
<button id="view_password" type="button" class="button small radius secondary" style="min-width:80%">
|
||||
{{tr "View"}}
|
||||
</button>
|
||||
</td>
|
||||
<td class="value_td">
|
||||
{{#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 tabId "User.login_token"}}
|
||||
<tr class="login_token">
|
||||
<td class="key_td">{{tr "Login token"}}</td>
|
||||
<td class="value_td">
|
||||
<button id="login_token" type="button" class="button small radius secondary" style="min-width:80%">
|
||||
{{tr "Manage login tokens"}}
|
||||
</button>
|
||||
</td>
|
||||
<td/>
|
||||
</tr>
|
||||
{{/isTabActionEnabled}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
<table class="dataTable" cellpadding="0" cellspacing="0" border="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{tr "Public SSH Key"}}</th>
|
||||
<th>
|
||||
<a class="user_ssh_public_key_edit right" href="#"><i class="fa fa-pencil-square-o"></i></a>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<td>
|
||||
<textarea rows="6" type="text" id="user_ssh_public_key_textarea" name="ssh_public_key" hidden>
|
||||
{{~element.TEMPLATE.SSH_PUBLIC_KEY~}}
|
||||
</textarea>
|
||||
<p id="user_ssh_public_key_text" class="ellipsis" name="ssh_public_key">
|
||||
{{#if element.TEMPLATE.SSH_PUBLIC_KEY}}
|
||||
{{element.TEMPLATE.SSH_PUBLIC_KEY}}
|
||||
{{else}}
|
||||
{{tr "You can provide a SSH Key for this User clicking on the edit button"}}
|
||||
{{/if}}
|
||||
</p>
|
||||
</td>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="large-9 columns">
|
||||
|
@ -33,7 +33,7 @@
|
||||
</div>
|
||||
<div class="row auth_driver_row">
|
||||
<div class="large-12 columns">
|
||||
<label for="driver">{{tr "Authentication"}}</label>
|
||||
<label id="label_auth" for="driver">{{tr "Authentication"}}</label>
|
||||
<select name="driver" id="{{idPrefix}}_driver">
|
||||
<option value="core" selected="selected">{{tr "core"}}</option>
|
||||
<option value="public">{{tr "public"}}</option>
|
||||
|
@ -727,7 +727,7 @@ define(function(require) {
|
||||
'<div class="row">\
|
||||
<div class="large-12 columns">\
|
||||
<span class="right">\
|
||||
<button class="button secondary small radius" id="edit_quotas_button">\
|
||||
<button class="button primary small radius" id="edit_quotas_button">\
|
||||
<span class="fa fa-pencil-square-o"></span> '+Locale.tr("Edit")+'\
|
||||
</button>\
|
||||
<button class="button alert small radius" id="cancel_quotas_button" style="display: none">\
|
||||
|
Loading…
x
Reference in New Issue
Block a user