You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ni...@apache.org on 2019/04/10 06:08:12 UTC
[ranger] 01/02: RANGER-2399: User's listing page hits users API
call twice from UI
This is an automated email from the ASF dual-hosted git repository.
ni3galave pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ranger.git
commit 767d69e335a70bdb96fed39623facd4319397980
Author: Nitin Galave <ni...@apache.org>
AuthorDate: Mon Apr 8 16:17:42 2019 +0530
RANGER-2399: User's listing page hits users API call twice from UI
---
.../main/webapp/scripts/controllers/Controller.js | 27 ++++++-------
.../scripts/views/security_zone/SecurityZone.js | 8 ++--
.../main/webapp/scripts/views/users/GroupCreate.js | 24 +-----------
.../main/webapp/scripts/views/users/UserCreate.js | 30 +--------------
.../webapp/scripts/views/users/UserTableLayout.js | 44 +++++++++++++++++++---
security-admin/src/main/webapp/styles/xa.css | 6 +++
.../main/webapp/templates/common/breadcrumbs.html | 13 +++----
.../templates/security_zone/SecurityZone_tmpl.html | 2 +-
8 files changed, 70 insertions(+), 84 deletions(-)
diff --git a/security-admin/src/main/webapp/scripts/controllers/Controller.js b/security-admin/src/main/webapp/scripts/controllers/Controller.js
index 934a1a2..29740f4 100755
--- a/security-admin/src/main/webapp/scripts/controllers/Controller.js
+++ b/security-admin/src/main/webapp/scripts/controllers/Controller.js
@@ -108,24 +108,19 @@ define(function(require) {
},
/************** UserORGroups Related *********************/
- userManagerAction :function(tab){
- MAppState.set({
+ userManagerAction :function(tab){
+ MAppState.set({
'currentTab' : XAGlobals.AppTabs.Settings.value
});
- var XAUtil = require('utils/XAUtils');
- var view = require('views/users/UserTableLayout');
- var VXUserList = require('collections/VXUserList');
- var userList = new VXUserList();
-
- App.rContent.show(new view({
- collection : userList,
- tab :tab
- }));
- _.extend(userList.queryParams, XAUtil.getUserDataParams())
- userList.fetch({
- cache:false,
- });
- },
+ var XAUtil = require('utils/XAUtils');
+ var view = require('views/users/UserTableLayout');
+ var VXUserList = require('collections/VXUserList');
+ var userList = new VXUserList();
+ App.rContent.show(new view({
+ collection : userList,
+ tab :tab
+ }));
+ },
userCreateAction : function(){
MAppState.set({
'currentTab' : XAGlobals.AppTabs.Settings.value
diff --git a/security-admin/src/main/webapp/scripts/views/security_zone/SecurityZone.js b/security-admin/src/main/webapp/scripts/views/security_zone/SecurityZone.js
index a1e9716..2a07020 100644
--- a/security-admin/src/main/webapp/scripts/views/security_zone/SecurityZone.js
+++ b/security-admin/src/main/webapp/scripts/views/security_zone/SecurityZone.js
@@ -132,7 +132,7 @@ define(function(require) {
that.zoneResourcesColl.reset(resources);
that.renderTable();
that.zoneAdministrationView();
- that.ui.zoneName.html(_.escape(that.zoneModel.get('name')));
+ that.ui.zoneName.html(_.escape(that.zoneModel.get('name'))).attr('title', _.escape(that.zoneModel.get('name')));
App.appRouter.navigate("#!/zones/zone/"+zoneModel.id);
that.ui.editZone.attr('href', '#!/zones/edit/' + zoneModel.get('id'));
}else{
@@ -147,9 +147,11 @@ define(function(require) {
_.each(zoneArray,
function(zone) {
if(that.zoneModel.attributes.name == zone) {
- that.ui.zoneUlList.append('<li class="selected" data-action="zoneListing" data-id="' + _.escape(zone) + '">' + _.escape(zone) + '</li>');
+ that.ui.zoneUlList.append('<li class="selected trim-containt" title="'+_.escape(zone)+
+ '" data-action="zoneListing" data-id="' + _.escape(zone) + '">' + _.escape(zone) + '</li>');
} else {
- that.ui.zoneUlList.append('<li data-action="zoneListing" data-id="' + _.escape(zone) + '">' + _.escape(zone) + '</li>');
+ that.ui.zoneUlList.append('<li class="trim-containt" data-action="zoneListing" title="'
+ +_.escape(zone)+'" data-id="' + _.escape(zone) + '">' + _.escape(zone) + '</li>');
}
}
);
diff --git a/security-admin/src/main/webapp/scripts/views/users/GroupCreate.js b/security-admin/src/main/webapp/scripts/views/users/GroupCreate.js
index a764387..4087d09 100644
--- a/security-admin/src/main/webapp/scripts/views/users/GroupCreate.js
+++ b/security-admin/src/main/webapp/scripts/views/users/GroupCreate.js
@@ -129,30 +129,8 @@ define(function(require){
App.appRouter.navigate("#!/users/grouptab",{trigger: true});
return;
}
+ App.usersGroupsListing = {'showLastPage' : true}
App.appRouter.navigate("#!/users/grouptab",{trigger: true});
-
- var groupList = new VXGroupList();
- _.extend(groupList.queryParams, XAUtil.getUserDataParams());
- groupList.fetch({
- cache:false
- }).done(function(){
- var newColl;
- groupList.getLastPage({
- cache : false,
- success : function(collection, response, options){
- App.rContent.show(new UserTableLayout({
- groupList : collection,
- tab : 'grouptab'
- }));
- newColl = collection;
- }
- }).done(function(){
- var model = newColl.get(that.model.id);
- if(model){
- model.trigger("model:highlightBackgridRow1");
- }
- });
- });
},
error : function (model, response, options) {
XAUtil.blockUI('unblock');
diff --git a/security-admin/src/main/webapp/scripts/views/users/UserCreate.js b/security-admin/src/main/webapp/scripts/views/users/UserCreate.js
index e1afff1..e8a2e8d 100644
--- a/security-admin/src/main/webapp/scripts/views/users/UserCreate.js
+++ b/security-admin/src/main/webapp/scripts/views/users/UserCreate.js
@@ -161,35 +161,9 @@ define(function(require){
App.appRouter.navigate("#!/users/usertab",{trigger: true});
return;
}
+ App.usersGroupsListing = {'showLastPage' : true}
App.appRouter.navigate("#!/users/usertab",{trigger: true});
-
- var userList = new VXUserList();
- _.extend(userList.queryParams, XAUtil.getUserDataParams())
- userList.fetch({
- cache:false
- }).done(function(){
- var newColl = userList;
- userList.getLastPage({
- cache : false,
- success : function(collection, response, options){
- App.rContent.show(new UserTableLayout({
- collection : collection,
- tab : 'usertab'
- }));
- newColl = collection;
- }
- }).done(function(){
- var model = newColl.get(that.model.id);
- if(model){
- model.trigger("model:highlightBackgridRow");
- }
- });
-
- App.rContent.show(new UserTableLayout({
- collection : userList
- }));
- });
- } ,
+ },
error : function(model,resp){
XAUtil.blockUI('unblock');
if(!_.isUndefined(resp.responseJSON) && !_.isUndefined(resp.responseJSON.msgDesc)){
diff --git a/security-admin/src/main/webapp/scripts/views/users/UserTableLayout.js b/security-admin/src/main/webapp/scripts/views/users/UserTableLayout.js
index 94afd75..529958d 100755
--- a/security-admin/src/main/webapp/scripts/views/users/UserTableLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/users/UserTableLayout.js
@@ -28,6 +28,7 @@ define(function(require){
var XABackgrid = require('views/common/XABackgrid');
var localization = require('utils/XALangSupport');
var SessionMgr = require('mgrs/SessionMgr');
+ var App = require('App');
var VXGroupList = require('collections/VXGroupList');
var VXGroup = require('models/VXGroup');
@@ -127,6 +128,14 @@ define(function(require){
coll.deselect(model);
}, this);
}, this);
+ this.listenTo(coll, 'model:highlightUserGroupTableRow', function(){
+ this.$el.find('.table tr:last').addClass("alert");
+ var self = this;
+ setTimeout(function () {
+ self.$el.find('.table tr:last').removeClass("alert");
+ }, 6000);
+ XAUtil.scrollToField(this.$el.find('.table tr:last'));
+ })
},
onTabChange : function(e){
var that = this;
@@ -219,11 +228,21 @@ define(function(require){
this.renderUserListTable();
_.extend(this.collection.queryParams, XAUtil.getUserDataParams())
this.collection.fetch({
- //cache:true,
reset: true,
cache: false
-// data : XAUtil.getUserDataParams(),
- }).done(function(){
+ }).done(function(userList){
+ if(App.usersGroupsListing && !_.isEmpty(App.usersGroupsListing) && App.usersGroupsListing.showLastPage){
+ if(userList.state.totalRecords > userList.state.pageSize){
+ that.collection.getLastPage({
+ cache : false,
+ }).done(function(m){
+ App.usersGroupsListing={};
+ (_.last(m.models)).trigger("model:highlightUserGroupTableRow");
+ });
+ }else{
+ _.last(userList.models).trigger("model:highlightUserGroupTableRow");
+ }
+ }
if(!_.isString(that.ui.addNewGroup)){
that.ui.addNewGroup.hide();
that.ui.addNewUser.show();
@@ -240,10 +259,21 @@ define(function(require){
this.groupList.selectNone();
this.renderGroupListTable();
this.groupList.fetch({
- //cache:true,
reset:true,
- cache: false
- }).done(function(){
+ cache: false,
+ }).done(function(groupList){
+ if(App.usersGroupsListing && !_.isEmpty(App.usersGroupsListing) && App.usersGroupsListing.showLastPage){
+ if(groupList.state.totalRecords > groupList.state.pageSize){
+ that.groupList.getLastPage({
+ cache : false,
+ }).done(function(m){
+ (_.last(m.models)).trigger("model:highlightUserGroupTableRow");
+ });
+ }else{
+ (_.last(groupList.models)).trigger("model:highlightUserGroupTableRow");
+ }
+ App.usersGroupsListing={};
+ }
that.ui.addNewUser.hide();
that.ui.addNewGroup.show();
that.$('.wrap-header').text('Group List');
@@ -667,6 +697,7 @@ define(function(require){
error:function(response,options){
count += 1;
notDeletedUserName += m.value + ", ";
+ that.collection.find(function(model){return model.get('name') === m.value}).selected = false
that.userCollection(jsonUsers.vXStrings.length, count, notDeletedUserName)
}
});
@@ -683,6 +714,7 @@ define(function(require){
error:function(response,options){
count += 1;
notDeletedGroupName += m.value + ", ";
+ that.groupList.find(function(model){return model.get('name') === m.value}).selected = false
that.groupCollection(jsonUsers.vXStrings.length,count, notDeletedGroupName)
}
})
diff --git a/security-admin/src/main/webapp/styles/xa.css b/security-admin/src/main/webapp/styles/xa.css
index f90f21b..60e045c 100644
--- a/security-admin/src/main/webapp/styles/xa.css
+++ b/security-admin/src/main/webapp/styles/xa.css
@@ -2693,4 +2693,10 @@ textarea:read-only{
max-height: 400px;
overflow: auto;
display: block;
+}
+.trim-containt-breadcrumb {
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ max-width: 300px;
}
\ No newline at end of file
diff --git a/security-admin/src/main/webapp/templates/common/breadcrumbs.html b/security-admin/src/main/webapp/templates/common/breadcrumbs.html
index 8de0ad3..85ac195 100644
--- a/security-admin/src/main/webapp/templates/common/breadcrumbs.html
+++ b/security-admin/src/main/webapp/templates/common/breadcrumbs.html
@@ -20,11 +20,10 @@
}
}}
- <ul class="breadcrumb-flat">
- {{#each breadcrumb}}
- <li>
- <a href="{{./this.href}}"> {{tt ./this.text}} </a>
- </li>
- {{/each}}
+<ul class="breadcrumb-flat">
+ {{#each breadcrumb}}
+ <li>
+ <a href="{{./this.href}}"><p class="trim-containt-breadcrumb" title="{{tt ./this.text}}"> {{tt ./this.text}}</p></a>
+ </li>
+ {{/each}}
</ul>
-
diff --git a/security-admin/src/main/webapp/templates/security_zone/SecurityZone_tmpl.html b/security-admin/src/main/webapp/templates/security_zone/SecurityZone_tmpl.html
index f0b2572..a2f1374 100644
--- a/security-admin/src/main/webapp/templates/security_zone/SecurityZone_tmpl.html
+++ b/security-admin/src/main/webapp/templates/security_zone/SecurityZone_tmpl.html
@@ -60,7 +60,7 @@
<button class="btn btn-default btn-small btn-slide-toggle" data-id="sideBarBtn"><i class="icon-reorder"></i><span></span></button>
</div>
<div class="span7">
- <h2 data-id="zoneName">{{{zoneModelName}}}</h2>
+ <h2 data-id="zoneName" class="trim-containt" title="{{{zoneModelName}}}">{{{zoneModelName}}}</h2>
</div>
{{#if isZoneAdministration}}
<div class="span4">