1
0
Fork 0

Merge branch 'devel' of github.com:arangodb/ArangoDB into 3.3

This commit is contained in:
Wilfried Goesgens 2017-10-06 11:23:42 +02:00
commit 8f37b4dc2d
6 changed files with 82 additions and 21 deletions

View File

@ -1,6 +1,8 @@
v3.3.milestone0 (2017-10-04) v3.3.milestone0 (2017-10-04)
---------------------------- ----------------------------
* UI: added user roles
* added config option `--log.color` to toggle colorful logging to terminal * added config option `--log.color` to toggle colorful logging to terminal
* added config option `--log.thread-name` to additionally log thread names * added config option `--log.thread-name` to additionally log thread names

View File

@ -71,18 +71,21 @@
avatar = '<img src="'; avatar = '<img src="';
if (! img) { if (! img) {
avatar += 'img/default_user.png'; avatar = '<i id="' + _.escape(username) + '" class="collection-type-icon fa fa-user"></i>';
} else { } else {
avatar += 'https://s.gravatar.com/avatar/'; avatar += 'https://s.gravatar.com/avatar/';
avatar += img; avatar += img;
avatar += '?s=50'; avatar += '?s=50';
avatar += '" height="50" width="50" alt="" class="icon" id="';
avatar += _.escape(username);
avatar += '" />';
} }
avatar += '" height="50" width="50" alt="" class="icon" id="';
avatar += _.escape(username);
avatar += '" />';
if (! name) { if (! name) {
name = " "; name = " ";
} }
if (username.substring(0, 6) === ':role:') {
avatar = '<i id="' + _.escape(username) + '" class="collection-type-icon fa fa-group"></i>';
}
%> %>
<div class="tile pure-u-1-1 pure-u-sm-1-2 pure-u-md-1-3 pure-u-lg-1-4 pure-u-xl-1-6"> <div class="tile pure-u-1-1 pure-u-sm-1-2 pure-u-md-1-3 pure-u-lg-1-4 pure-u-xl-1-6">

View File

@ -75,6 +75,7 @@
NOTIFICATION: 'notification', NOTIFICATION: 'notification',
DELETE: 'danger', DELETE: 'danger',
NEUTRAL: 'neutral', NEUTRAL: 'neutral',
DISABLED: 'disabled',
CLOSE: 'close' CLOSE: 'close'
}, },
tables: { tables: {
@ -168,7 +169,7 @@
}, },
createDisabledButton: function (title) { createDisabledButton: function (title) {
var disabledButton = createButtonStub(this.buttons.NEUTRAL, title); var disabledButton = createButtonStub(this.buttons.DISABLED, title);
disabledButton.disabled = true; disabledButton.disabled = true;
return disabledButton; return disabledButton;
}, },
@ -294,7 +295,12 @@
} }
} }
_.each(buttons, function (b, i) { _.each(buttons, function (b, i) {
if (b.disabled || !b.callback) { if (b.disabled || b.type === 'disabled' || !b.callback) {
if (divID) {
$('#' + divID + ' ' + '#modalButton' + i).attr('disabled', true);
} else {
$('#modalButton' + i).attr('disabled', true);
}
return; return;
} }
if (b.type === self.buttons.DELETE && !noConfirm) { if (b.type === self.buttons.DELETE && !noConfirm) {

View File

@ -166,6 +166,12 @@
active: status, active: status,
extra: {name: name} extra: {name: name}
}; };
if (frontendConfig.isEnterprise && $('#newRole').is(':checked')) {
options.user = ':role:' + userName;
delete options.passwd;
}
this.collection.create(options, { this.collection.create(options, {
wait: true, wait: true,
error: function (data, err) { error: function (data, err) {
@ -203,7 +209,7 @@
} }
if ($(e.currentTarget).hasClass('tile')) { if ($(e.currentTarget).hasClass('tile')) {
e.currentTarget = $(e.currentTarget).find('img'); e.currentTarget = $(e.currentTarget).find('.fa');
} }
this.collection.fetch({ this.collection.fetch({
@ -255,6 +261,11 @@
tableContent.push( tableContent.push(
window.modalView.createPasswordEntry('newPassword', 'Password', '', false, '', false) window.modalView.createPasswordEntry('newPassword', 'Password', '', false, '', false)
); );
if (frontendConfig.isEnterprise) {
tableContent.push(
window.modalView.createCheckboxEntry('newRole', 'Role', false, false, false)
);
}
tableContent.push( tableContent.push(
window.modalView.createCheckboxEntry('newStatus', 'Active', 'active', false, true) window.modalView.createCheckboxEntry('newStatus', 'Active', 'active', false, true)
); );
@ -263,6 +274,16 @@
); );
window.modalView.show('modalTable.ejs', 'Create New User', buttons, tableContent); window.modalView.show('modalTable.ejs', 'Create New User', buttons, tableContent);
if (frontendConfig.isEnterprise) {
$('#newRole').on('change', function () {
if ($('#newRole').is(':checked')) {
$('#newPassword').attr('disabled', true);
} else {
$('#newPassword').attr('disabled', false);
}
});
}
}, },
evaluateUserName: function (str, substr) { evaluateUserName: function (str, substr) {

View File

@ -104,12 +104,20 @@
) )
); );
buttons.push( if (this.username.substring(0, 6) === ':role:') {
window.modalView.createNotificationButton( buttons.push(
'Change Password', window.modalView.createDisabledButton(
this.editUserPassword.bind(this) 'Change Password'
) )
); );
} else {
buttons.push(
window.modalView.createNotificationButton(
'Change Password',
this.editUserPassword.bind(this)
)
);
}
buttons.push( buttons.push(
window.modalView.createSuccessButton( window.modalView.createSuccessButton(
'Save', 'Save',
@ -161,23 +169,38 @@
id: 'editStatus' id: 'editStatus'
} }
]; ];
buttons = [ buttons = [];
buttons.push(
{ {
title: 'Delete', title: 'Delete',
type: window.modalView.buttons.DELETE, type: window.modalView.buttons.DELETE,
callback: this.submitDeleteUser.bind(this, username) callback: this.submitDeleteUser.bind(this, username)
}, }
{ );
title: 'Change Password', if (this.username.substring(0, 6) === ':role:') {
type: window.modalView.buttons.NOTIFICATION, buttons.push(
callback: this.createEditUserPasswordModal.bind(this, username) {
}, title: 'Change Password',
type: window.modalView.buttons.DISABLED,
callback: this.createEditUserPasswordModal.bind(this, username)
}
);
} else {
buttons.push(
{
title: 'Change Password',
type: window.modalView.buttons.NOTIFICATION,
callback: this.createEditUserPasswordModal.bind(this, username)
}
);
}
buttons.push(
{ {
title: 'Save', title: 'Save',
type: window.modalView.buttons.SUCCESS, type: window.modalView.buttons.SUCCESS,
callback: this.submitEditUser.bind(this, username) callback: this.submitEditUser.bind(this, username)
} }
]; );
window.modalView.show( window.modalView.show(
'modalTable.ejs', 'modalTable.ejs',

View File

@ -32,6 +32,12 @@
@extend %neutral; @extend %neutral;
} }
.button-disabled {
@extend %btn;
@extend %neutral;
cursor: not-allowed;
}
.button-header { .button-header {
@extend %bare-btn; @extend %bare-btn;
@extend %header; @extend %header;