Initial commit
This commit is contained in:
commit
880e39de2e
511 files changed
+38363
No files matched your search
@@ -0,0 +1,12 @@
|
||||
<div layout="row" layout-align="end center">
|
||||
<md-button class="md-icon-button" has-permission="{{grid.appScope.Constants.Permissions.ADD_USERS}}" ng-click="grid.appScope.edit(row.entity)">
|
||||
<md-icon class="md-16">edit</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="left">Edit User</md-tooltip>
|
||||
</md-button>
|
||||
|
||||
<md-button class="md-icon-button" has-permission="{{grid.appScope.Constants.Permissions.DELETE_USERS}}" ng-click="grid.appScope.delete(row.entity)">
|
||||
<md-icon class="md-16">delete</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="left">Delete User</md-tooltip>
|
||||
</md-button>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,21 @@
|
||||
<div class="portal-repo-bank-selector fill-height" ng-if="tab.active" ng-cloak layout="column" flex="100" ng-controller="UserBankCtrl" >
|
||||
<md-content layout-xs="column" layout="row" layout-fill>
|
||||
<md-card class="md-padding" flex="100">
|
||||
<md-toolbar class="md-portal">
|
||||
<div class="md-toolbar-tools">
|
||||
<span style="padding-bottom=30px;">Users</span>
|
||||
<span flex></span>
|
||||
<md-button class="md-icon-button" ng-click="toggleFiltering()">
|
||||
<md-icon >filter</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="bottom">Filter Users</md-tooltip>
|
||||
</md-button>
|
||||
<md-button class="md-icon-button" ng-click="addUser()" has-permission="{{Constants.Permissions.ADD_USERS}}">
|
||||
<md-icon >person_add</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="bottom">Add User</md-tooltip>
|
||||
</md-button>
|
||||
</div>
|
||||
</md-toolbar>
|
||||
<div class="panel-body padding-none" ui-grid="userGrid" ng-if="tab.active" ui-grid-pagination ui-grid-selection ui-grid-save-state ui-grid-auto-resize ui-grid-resize-columns style="height:95%"></div>
|
||||
</md-card>
|
||||
</md-content>
|
||||
</div>
|
||||
@@ -0,0 +1,126 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* MODULE DESCRIPTION:
|
||||
*
|
||||
* TODO: Write description here.
|
||||
*/
|
||||
angular.module('portal.dashboard.userBank', ['ui.router'])
|
||||
.controller('UserBankCtrl', UserBankCtrlController);
|
||||
|
||||
function UserBankCtrlController($scope, cache, accountStores, accountProvider, $mdDialog, uiGridConstants, portalUtils, Constants) {
|
||||
|
||||
$scope.confirmQuestionBox = true;
|
||||
$scope.Constants = Constants;
|
||||
$scope.users = [];
|
||||
|
||||
$scope.mCache = cache.request([new accountStores.Account(), new accountStores.UserPool()]).then(function(){
|
||||
$scope.userRole = $scope.mCache.account.data.role;
|
||||
$scope.users = $scope.mCache.userPool.data.values;
|
||||
});
|
||||
|
||||
$scope.userGrid = {
|
||||
data: 'users',
|
||||
paginationPageSizes: [28, 56, 84, 102],
|
||||
paginationPageSize: 28,
|
||||
enableHorizontalScrollbar: uiGridConstants.scrollbars.NEVER,
|
||||
toggleModifierKeysToMultiSelect : true,
|
||||
enableRowHeaderSelection: true,
|
||||
enableColumnMenus: true,
|
||||
enableGridMenu: true,
|
||||
exporterCsvFilename: 'Files.csv',
|
||||
exporterMenuCsv: true,
|
||||
multiSelect: true,
|
||||
noUnselect: false,
|
||||
onRegisterApi: function (gridApi) {
|
||||
gridApi.selection.setModifierKeysToMultiSelect(true);
|
||||
$scope.userGridApi = gridApi;
|
||||
},
|
||||
columnDefs: [
|
||||
{field: 'username', displayName: 'User Name', width: '*'},
|
||||
{field: 'firstName', displayName: 'First Name', width: '*', },
|
||||
{field: 'lastName', displayName: 'Last Name', width: '**'},
|
||||
{field: 'role', displayName: 'Role', width: '**' },
|
||||
{field: 'id', displayName: 'Actions', width: '100', enableColumnMenu: false, enableFiltering: false, enableHiding: false,
|
||||
cellTemplate: 'main/user-bank/cell-templates/user-actions.html'}
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
$scope.$on('$destroy', function () {
|
||||
$scope.mCache.unlisten();
|
||||
});
|
||||
|
||||
$scope.toggleFiltering = function() {
|
||||
$scope.userGrid.enableFiltering = !$scope.userGrid.enableFiltering;
|
||||
$scope.userGridApi.core.notifyDataChange( uiGridConstants.dataChange.COLUMN );
|
||||
};
|
||||
|
||||
var originatorEv;
|
||||
$scope.openMenu = function($mdOpenMenu, ev) {
|
||||
originatorEv = ev;
|
||||
$mdOpenMenu(ev);
|
||||
};
|
||||
|
||||
$scope.delete = function(entity) {
|
||||
if ($scope.confirmQuestionBox) {
|
||||
portalUtils.confirmBox('deleteUser', 'Delete User', ['Are you sure you want to delete the user', entity.email],
|
||||
true, function(value) {
|
||||
if (value.confirm) {
|
||||
$scope.confirmQuestionBox = !value.checkbox;
|
||||
$scope.deleteUser(entity);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$scope.deleteUser(entity);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
$scope.deleteUser = function(entity) {
|
||||
accountProvider.deleteUser(entity).then(function() {
|
||||
portalUtils.toast('User deleted successfully', ['top', 'left'], 2000);
|
||||
new accountStores.UserPool().refresh();
|
||||
}).catch(function(err){
|
||||
portalUtils.toast('Unable to delete user: ' + err.message, ['top', 'left'], 4000);
|
||||
new accountStores.UserPool().refresh();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.edit = function(entity) {
|
||||
$mdDialog.show({
|
||||
templateUrl: 'common/partials/add-user/add-user.html',
|
||||
controller: 'AddUserCtrl',
|
||||
escapeToClose: false,
|
||||
locals: {
|
||||
modalInstance: {
|
||||
header: 'Edit User',
|
||||
account: entity,
|
||||
requirePassword: false,
|
||||
}
|
||||
}
|
||||
}).then(function(){
|
||||
new accountStores.UserPool().refresh();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.addUser = function() {
|
||||
$mdDialog.show({
|
||||
templateUrl: 'common/partials/add-user/add-user.html',
|
||||
controller: 'AddUserCtrl',
|
||||
escapeToClose: false,
|
||||
locals: {
|
||||
modalInstance: {
|
||||
header: 'Add User',
|
||||
requirePassword: true
|
||||
}
|
||||
}
|
||||
}).then(function(){
|
||||
new accountStores.UserPool().refresh();
|
||||
});
|
||||
};
|
||||
|
||||
} //end RepoBankCtrlController function
|
||||
|
||||
})();
|
||||
Reference in new issue
Block a user