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" ng-click="grid.appScope.edit(row.entity)" has-permission="{{grid.appScope.Permissions.ADD_CREDENTIALS}}">
|
||||
<md-icon class="md-16">edit</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="left">Edit Credential</md-tooltip>
|
||||
</md-button>
|
||||
|
||||
<md-button class="md-icon-button" ng-click="grid.appScope.delete(row.entity)" has-permission="{{grid.appScope.Permissions.DELETE_CREDENTIALS}}">
|
||||
<md-icon class="md-16">delete</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="left">Delete Credential</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="CredBankCtrl" >
|
||||
<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;">Credentials</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 Credentials</md-tooltip>
|
||||
</md-button>
|
||||
<md-button class="md-icon-button" ng-click="addCredentials()" has-permission="{{Permissions.ADD_CREDENTIALS}}">
|
||||
<md-icon >add</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="bottom">Add Credentials</md-tooltip>
|
||||
</md-button>
|
||||
</div>
|
||||
</md-toolbar>
|
||||
<div class="panel-body padding-none" ui-grid="credsGrid" 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,115 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* MODULE DESCRIPTION:
|
||||
*
|
||||
* TODO: Write description here.
|
||||
*/
|
||||
angular.module('portal.dashboard.credBank', ['ui.router'])
|
||||
.controller('CredBankCtrl', credBankCtrlController);
|
||||
|
||||
function credBankCtrlController($scope, cache, credentialProvider, credentialStores, $mdDialog, uiGridConstants, portalUtils, Constants) {
|
||||
|
||||
$scope.Permissions = Constants.Permissions;
|
||||
$scope.confirmQuestionBox = true;
|
||||
|
||||
$scope.mCache = cache.request([new credentialStores.Credentials()]).then(function(){
|
||||
$scope.credentials = $scope.mCache.credentials.data.values;
|
||||
});
|
||||
|
||||
$scope.credsGrid = {
|
||||
data: 'credentials',
|
||||
paginationPageSizes: [28, 56, 84, 102],
|
||||
paginationPageSize: 28,
|
||||
enableHorizontalScrollbar: uiGridConstants.scrollbars.NEVER,
|
||||
toggleModifierKeysToMultiSelect : true,
|
||||
enableRowHeaderSelection: true,
|
||||
multiSelect: true,
|
||||
noUnselect: false,
|
||||
onRegisterApi: function (gridApi) {
|
||||
gridApi.selection.setModifierKeysToMultiSelect(true);
|
||||
$scope.credsGridApi = gridApi;
|
||||
},
|
||||
columnDefs: [
|
||||
{field: 'name', displayName: 'Credential Name', width: '*'},
|
||||
{field: 'useSSH', displayName: 'Credential Type', width: '*',
|
||||
cellTemplate: '<div class="ui-grid-cell-contents">{{row.entity.credentialType === "SSH" ? "SSH Key" : "Username/Password"}}</div>'},
|
||||
{field: 'uid', displayName: 'Actions', width: '100', enableColumnMenu: false, enableFiltering: false, enableHiding: false,
|
||||
cellTemplate: 'main/cred-bank/cell-templates/cred-actions.html'}
|
||||
],
|
||||
};
|
||||
|
||||
$scope.$on('$destroy', function () {
|
||||
$scope.mCache.unlisten();
|
||||
});
|
||||
|
||||
$scope.toggleFiltering = function() {
|
||||
$scope.credsGridApi.enableFiltering = !$scope.credsGridApi.enableFiltering;
|
||||
$scope.credsGridApi.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('deleteCreds', 'Delete Credentials', ['Are you sure you want to delete the credential', entity.name],
|
||||
true, function(value) {
|
||||
if (value.confirm) {
|
||||
$scope.confirmQuestionBox = !value.checkbox;
|
||||
$scope.deleteCreds(entity);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$scope.deleteCreds(entity);
|
||||
}
|
||||
};
|
||||
|
||||
$scope.deleteCreds = function(entity) {
|
||||
credentialProvider.deleteCredentials(entity).then(function() {
|
||||
portalUtils.toast('Credentials deleted successfully', ['top', 'left'], 2000);
|
||||
new credentialStores.Credentials().refresh();
|
||||
}).catch(function(err){
|
||||
portalUtils.toast('Unable to delete credentials: ' + err.message, ['top', 'left'], 4000);
|
||||
new credentialStores.Credentials().refresh();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.edit = function(entity) {
|
||||
$mdDialog.show({
|
||||
templateUrl: 'common/partials/add-creds/add-creds.html',
|
||||
controller: 'AddCredsCtrl',
|
||||
escapeToClose: false,
|
||||
locals: {
|
||||
modalInstance: {
|
||||
header: 'Edit Credentials',
|
||||
credentials: entity
|
||||
}
|
||||
}
|
||||
}).then(function(){
|
||||
new credentialStores.Credentials().refresh();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.addCredentials = function() {
|
||||
$mdDialog.show({
|
||||
templateUrl: 'common/partials/add-creds/add-creds.html',
|
||||
controller: 'AddCredsCtrl',
|
||||
escapeToClose: false,
|
||||
locals: {
|
||||
modalInstance: {
|
||||
header: 'Add Credentials',
|
||||
}
|
||||
}
|
||||
}).then(function(){
|
||||
new credentialStores.Credentials().refresh();
|
||||
});
|
||||
};
|
||||
|
||||
} //end UserBankCtrlController function
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,21 @@
|
||||
#portal-logo {
|
||||
width: 75px;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.account-md-menu{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#accountMenu {
|
||||
margin-top: 7px;
|
||||
}
|
||||
/* Centers icon in ripple container */
|
||||
#iconAccountMenu {
|
||||
margin-right: 11px;
|
||||
margin-bottom: 13px;
|
||||
}
|
||||
|
||||
.username-banner {
|
||||
margin-top: 10px;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<div class="portal-dashboard" layout="column" layout-fill ng-controller="DashboardCtrl">
|
||||
<md-content layout="column" flex="100">
|
||||
<md-toolbar class="md-portal-grey">
|
||||
<div layout="row">
|
||||
<div class="logo" flex="5">
|
||||
<img id="portal-logo" src="images/portal.png"></img>
|
||||
</div>
|
||||
<span flex></span>
|
||||
<div layout="column" layout-align="center center"><b>Welcome {{ mCache.account.data.firstName }} {{mCache.account.data.lastName}} </b></div>
|
||||
<span flex></span>
|
||||
<md-menu-bar class="pull-right fill-height">
|
||||
<md-menu id="accountMenu" class="account-md-menu">
|
||||
<!-- Workaround to make button stop throwing console errors -->
|
||||
<a>
|
||||
<md-button aria-label="Open Account Menu" class="md-icon" ng-click="openMenu($mdMenu, $event)">
|
||||
<md-icon id="iconAccountMenu" md-menu-origin class="md-36">menu</md-icon>
|
||||
</md-button>
|
||||
</a>
|
||||
<md-menu-content width="4">
|
||||
|
||||
<md-menu-item has-permission="{{Constants.Permissions.VIEW_CONFIG}}">
|
||||
<md-button ng-click="openConfiguration()">
|
||||
<md-icon md-menu-align-target="">settings</md-icon>
|
||||
Configuration
|
||||
</md-button>
|
||||
</md-menu-item>
|
||||
<md-menu-item has-permission="{{Constants.Permissions.VIEW_LOG_LEVELS}}">
|
||||
<md-button ng-click="openLogLevel()">
|
||||
<md-icon md-menu-align-target="">feedback</md-icon>
|
||||
Log Levels
|
||||
</md-button>
|
||||
</md-menu-item>
|
||||
<md-menu-item has-permission="{{Constants.Permissions.UPDATE_SEED_VALUE}}">
|
||||
<md-button ng-click="openSeed()">
|
||||
<md-icon md-menu-align-target="">fiber_pin</md-icon>
|
||||
AES Seed
|
||||
</md-button>
|
||||
</md-menu-item>
|
||||
<md-menu-item has-permission="{{Constants.Permissions.VIEW_SMTP_CONFIG}}">
|
||||
<md-button ng-click="openSMTPConfig()">
|
||||
<md-icon md-menu-align-target="">mail</md-icon>
|
||||
SMTP Configuration
|
||||
</md-button>
|
||||
</md-menu-item>
|
||||
<md-divider></md-divider>
|
||||
<md-menu-item>
|
||||
<md-button ng-click="logout()">
|
||||
<md-icon>exit_to_app</md-icon>
|
||||
Logout
|
||||
</md-button>
|
||||
</md-menu-item>
|
||||
|
||||
</md-menu-content>
|
||||
</md-menu>
|
||||
</md-menu-bar>
|
||||
</div>
|
||||
</md-toolbar>
|
||||
<portal-tab-set tabs="tabs" style="height:100%"></portal-tab-set>
|
||||
</md-content>
|
||||
</div>
|
||||
@@ -0,0 +1,215 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
/**
|
||||
* MODULE DESCRIPTION:
|
||||
*
|
||||
* TODO: Write description here.
|
||||
*/
|
||||
angular.module('portal.dashboard', ['ui.router', 'portal.common.constants']).config(DashboardConfig)
|
||||
.controller('DashboardCtrl', DashboardCtrlController);
|
||||
|
||||
function DashboardConfig($stateProvider, Constants) {
|
||||
$stateProvider.state('dashboard', {
|
||||
url: '/dashboard',
|
||||
pageTitle: 'Dashboard',
|
||||
templateUrl: 'main/dashboard.html',
|
||||
resolve: {
|
||||
authorize: ['authorize',
|
||||
function (authorize) {
|
||||
return authorize.validate({
|
||||
authorities: {
|
||||
permission: [
|
||||
Constants.Permissions.VIEW_SCRIPT_TAB,
|
||||
Constants.Permissions.VIEW_GIT_TAB,
|
||||
Constants.Permissions.VIEW_USER_TAB,
|
||||
Constants.Permissions.VIEW_CREDS_TAB,
|
||||
Constants.Permissions.VIEW_LOG_TAB,
|
||||
]
|
||||
},
|
||||
redirect: 'login'
|
||||
});
|
||||
}
|
||||
]
|
||||
}
|
||||
}).state('dashboard.scripts', {
|
||||
url: '/scripts',
|
||||
pageTitle: 'Scripts',
|
||||
templateUrl: 'main/script-bank/script-bank.html'
|
||||
}).state('dashboard.repos', {
|
||||
url: '/repos',
|
||||
pageTitle: 'Git Repositories',
|
||||
templateUrl: 'main/git-bank/git-bank.html'
|
||||
}).state('dashboard.credentials', {
|
||||
url: '/credentials',
|
||||
pageTitle: 'Credentials',
|
||||
templateUrl: 'main/cred-bank/cred-bank.html'
|
||||
}).state('dashboard.emails', {
|
||||
url: '/emails',
|
||||
pageTitle: 'Emails',
|
||||
templateUrl: 'main/email-bank/email-bank.html'
|
||||
}).state('dashboard.users', {
|
||||
url: '/users',
|
||||
pageTitle: 'Users',
|
||||
templateUrl: 'main/user-bank/user-bank.html'
|
||||
}).state('dashboard.permissions', {
|
||||
url: '/permissions',
|
||||
pageTitle: 'Permissions',
|
||||
templateUrl: 'main/permission-bank/permission-bank.html'
|
||||
}).state('dashboard.envars', {
|
||||
url: '/envars',
|
||||
pageTitle: 'Environment Variables',
|
||||
templateUrl: 'main/env-bank/env-bank.html'
|
||||
}).state('dashboard.syslogs', {
|
||||
url: '/syslogs',
|
||||
pageTitle: 'System Logs',
|
||||
templateUrl: 'main/log-bank/log-bank.html'
|
||||
});
|
||||
}
|
||||
|
||||
function DashboardCtrlController($state, $scope, cache, accountStores, accountProvider,
|
||||
$window, $mdDialog, Constants) {
|
||||
|
||||
var originatorEv;
|
||||
$scope.openMenu = function($mdMenu, ev) {
|
||||
originatorEv = ev;
|
||||
$mdMenu.open(ev);
|
||||
};
|
||||
|
||||
$scope.Constants = Constants;
|
||||
|
||||
$scope.loadingBlock = false;
|
||||
|
||||
$scope.userRole = '';
|
||||
$scope.tabs = [{
|
||||
title: 'Scripts',
|
||||
source: 'main/script-bank/script-bank.html',
|
||||
state: 'dashboard.scripts',
|
||||
leftItem: '<i class="material-icons">description</i>',
|
||||
active: true,
|
||||
default: false,
|
||||
canView: Constants.Permissions.VIEW_SCRIPT_TAB
|
||||
},{
|
||||
title: 'Git Repositories',
|
||||
source: 'main/git-bank/git-bank.html',
|
||||
state: 'dashboard.repos',
|
||||
leftItem: '<i class="material-icons">computer</i>',
|
||||
active: true,
|
||||
default: true,
|
||||
canView: Constants.Permissions.VIEW_GIT_TAB
|
||||
},{
|
||||
title: 'Credentials',
|
||||
source: 'main/cred-bank/cred-bank.html',
|
||||
state: 'dashboard.credentials',
|
||||
leftItem: '<i class="material-icons">vpn_key</i>',
|
||||
active: false,
|
||||
default: false,
|
||||
canView: Constants.Permissions.VIEW_CREDS_TAB
|
||||
},{
|
||||
title: 'Email Templates',
|
||||
source: 'main/email-bank/email-bank.html',
|
||||
state: 'dashboard.emails',
|
||||
leftItem: '<i class="material-icons">email</i>',
|
||||
active: false,
|
||||
default: false,
|
||||
canView: Constants.Permissions.VIEW_EMAIL_TAB
|
||||
},{
|
||||
title: 'Users',
|
||||
source: 'main/user-bank/user-bank.html',
|
||||
state: 'dashboard.users',
|
||||
leftItem: '<i class="material-icons">people</i>',
|
||||
active: false,
|
||||
default: false,
|
||||
canView: Constants.Permissions.VIEW_USER_TAB
|
||||
},{
|
||||
title: 'Permissions',
|
||||
source: 'main/permission-bank/permission-bank.html',
|
||||
state: 'dashboard.permissions',
|
||||
leftItem: '<i class="material-icons">lock_open</i>',
|
||||
active: false,
|
||||
default: false,
|
||||
canView: Constants.Permissions.VIEW_PERMISSION_TAB
|
||||
},{
|
||||
title: 'Environment Variables',
|
||||
source: 'main/env-bank/env-bank.html',
|
||||
state: 'dashboard.envars',
|
||||
leftItem: '<i class="material-icons">storage</i>',
|
||||
active: false,
|
||||
default: false,
|
||||
canView: Constants.Permissions.VIEW_ENV_VARS_TAB
|
||||
},{
|
||||
title: 'System Logs',
|
||||
source: 'main/log-bank/log-bank.html',
|
||||
state: 'dashboard.syslogs',
|
||||
leftItem: '<i class="material-icons">description</i>',
|
||||
active: false,
|
||||
default: false,
|
||||
canView: Constants.Permissions.VIEW_LOG_TAB
|
||||
}];
|
||||
|
||||
$scope.mCache = cache.request([new accountStores.Account()]).then(function(){
|
||||
$scope.allowedTabs = [];
|
||||
$.each($scope.tabs, function(i, tab){
|
||||
if ($scope.mCache.account.data.hasPermission(tab.canView)) {
|
||||
$scope.allowedTabs.push(tab);
|
||||
}
|
||||
});
|
||||
$scope.$broadcast('tabsetDidChange', $scope.allowedTabs);
|
||||
}).catch(function(err){ });
|
||||
|
||||
$scope.$on('$destroy', function () {
|
||||
$scope.mCache.unlisten();
|
||||
});
|
||||
|
||||
$scope.logout = function() {
|
||||
accountProvider.logout().then(function (data) {
|
||||
cache.flush();
|
||||
$state.go('login');
|
||||
$window.location.href = '#/login';
|
||||
$window.location.reload();
|
||||
}).catch(function (data) {
|
||||
$state.go('login');
|
||||
});
|
||||
};
|
||||
|
||||
$scope.openConfiguration = function() {
|
||||
$mdDialog.show({
|
||||
controller: 'ConfigurationCtrl',
|
||||
templateUrl: 'common/partials/configuration/configuration.html',
|
||||
clickOutsideToClose: false,
|
||||
escapeToClose: false,
|
||||
locals: {
|
||||
account: $scope.mCache.account
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.openSeed = function() {
|
||||
$mdDialog.show({
|
||||
controller: 'SeedInfoCtrl',
|
||||
templateUrl: 'common/partials/seed-info/seed-info.html',
|
||||
clickOutsideToClose: false,
|
||||
escapeToClose: false,
|
||||
});
|
||||
};
|
||||
|
||||
$scope.openLogLevel = function() {
|
||||
$mdDialog.show({
|
||||
controller: 'LoggerInfoCtrl',
|
||||
templateUrl: 'common/partials/logger-info/logger-info.html',
|
||||
clickOutsideToClose: false,
|
||||
escapeToClose: false,
|
||||
});
|
||||
};
|
||||
|
||||
$scope.openSMTPConfig = function() {
|
||||
$mdDialog.show({
|
||||
controller: 'SMTPInfoCtrl',
|
||||
templateUrl: 'common/partials/smtp-info/smtp-info.html',
|
||||
clickOutsideToClose: false,
|
||||
escapeToClose: false,
|
||||
});
|
||||
};
|
||||
|
||||
} //end DashboardCtrlController function
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,12 @@
|
||||
<div layout="row" layout-align="end center">
|
||||
<md-button class="md-icon-button" ng-click="grid.appScope.edit(row.entity)" has-permission="{{grid.appScope.Constants.Permissions.ADD_EMAIL}}">
|
||||
<md-icon class="md-16">edit</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="left">Edit Email Template</md-tooltip>
|
||||
</md-button>
|
||||
|
||||
<md-button class="md-icon-button" ng-click="grid.appScope.delete(row.entity)" has-permission="{{grid.appScope.Constants.Permissions.DELETE_EMAIL}}">
|
||||
<md-icon class="md-16">delete</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="left">Delete Email Template</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="EmailBankCtrl">
|
||||
<md-content layout-xs="column" layout="row" layout-fill>
|
||||
<md-card class="md-padding" flex>
|
||||
<md-toolbar class="md-portal">
|
||||
<div class="md-toolbar-tools">
|
||||
<span style="padding-bottom=30px;">Available Email Templates</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</md-tooltip>
|
||||
</md-button>
|
||||
<md-button class="md-icon-button" ng-click="addEmail()" has-permission="{{Constants.Permissions.ADD_EMAIL}}">
|
||||
<md-icon >add</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="bottom">Add New Email Template</md-tooltip>
|
||||
</md-button>
|
||||
</div>
|
||||
</md-toolbar>
|
||||
<div class="panel-body padding-none" ui-grid="emailGrid" ng-if="tab.active" ui-grid-pagination ui-grid-save-state ui-grid-auto-resize ui-grid-resize-columns ui-grid-pinning style="height:95%"></div>
|
||||
</md-card>
|
||||
</md-content>
|
||||
</div>
|
||||
@@ -0,0 +1,111 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* MODULE DESCRIPTION:
|
||||
*
|
||||
* TODO: Write description here.
|
||||
*/
|
||||
angular.module('portal.dashboard.emailBank', ['ui.router'])
|
||||
.controller('EmailBankCtrl', EmailBankCtrlController);
|
||||
|
||||
function EmailBankCtrlController($scope, cache, systemProvider, systemStores, $mdDialog,
|
||||
uiGridConstants, portalUtils, Constants) {
|
||||
|
||||
$scope.confirmQuestionBox = true;
|
||||
|
||||
$scope.scripts = [];
|
||||
|
||||
$scope.userRole = '';
|
||||
|
||||
$scope.Constants = Constants;
|
||||
|
||||
$scope.mCache = cache.request([
|
||||
new systemStores.EmailTemplates()
|
||||
]).then(function(){
|
||||
$scope.emailTemplates = $scope.mCache.emailTmpls.data.values;
|
||||
});
|
||||
|
||||
$scope.emailGrid = {
|
||||
data: 'emailTemplates',
|
||||
paginationPageSizes: [25, 50, 75, 100, 125, 150, 175, 200],
|
||||
paginationPageSize: 25,
|
||||
enableHorizontalScrollbar: uiGridConstants.scrollbars.NEVER,
|
||||
toggleModifierKeysToMultiSelect : true,
|
||||
enableRowHeaderSelection: true,
|
||||
multiSelect: false,
|
||||
noUnselect: false,
|
||||
onRegisterApi: function (gridApi) {
|
||||
$scope.emailTmplGridApi = gridApi;
|
||||
},
|
||||
columnDefs: [
|
||||
{field: 'emailName', displayName: 'Name', width: '*'},
|
||||
{field: 'emailSubject', displayName: 'Subject', width: '**' },
|
||||
{field: 'id', displayName: 'Actions', width: '125', enableColumnMenu: false, enableFiltering: false, enableHiding: false,
|
||||
cellTemplate: 'main/email-bank/cell-templates/email-actions.html'
|
||||
}
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
$scope.edit = function(entity) {
|
||||
$mdDialog.show({
|
||||
templateUrl: 'common/partials/add-email-tmpl/add-email-tmpl.html',
|
||||
controller: 'AddEmailTmplCtrl',
|
||||
escapeToClose: false,
|
||||
locals: {
|
||||
modalInstance: {
|
||||
header: 'Edit Email Template',
|
||||
template: entity
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.addEmail = function() {
|
||||
$mdDialog.show({
|
||||
templateUrl: 'common/partials/add-email-tmpl/add-email-tmpl.html',
|
||||
controller: 'AddEmailTmplCtrl',
|
||||
escapeToClose: false,
|
||||
locals: {
|
||||
modalInstance: {
|
||||
header: 'Add New Email Template',
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.delete = function(entity) {
|
||||
if ($scope.confirmQuestionBox) {
|
||||
portalUtils.confirmBox('deleteTmpl', 'Delete Email Template', ['Are you sure you want to delete the template', entity.emailName],
|
||||
true, function(value) {
|
||||
if (value.confirm) {
|
||||
$scope.confirmQuestionBox = !value.checkbox;
|
||||
$scope.deleteTmpl(entity);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$scope.deleteTmpl(entity);
|
||||
}
|
||||
};
|
||||
|
||||
$scope.deleteTmpl = function(entity) {
|
||||
systemProvider.deleteEmailTemplates(entity).then(function() {
|
||||
portalUtils.toast('Email Template deleted successfully', ['top', 'left'], 2000);
|
||||
},function(err){
|
||||
portalUtils.toast('Unable to delete email Template: ' + err.message, ['top', 'left'], 4000);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.toggleFiltering = function() {
|
||||
$scope.scriptGrid.enableFiltering = !$scope.scriptGrid.enableFiltering;
|
||||
$scope.emailTmplGridApi.core.notifyDataChange( uiGridConstants.dataChange.COLUMN );
|
||||
};
|
||||
|
||||
/* $scope.$on('$destroy', function () {
|
||||
$scope.mCache.unlisten();
|
||||
});*/
|
||||
|
||||
} //end EmailBankCtrlController function
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,29 @@
|
||||
<div class="portal-repo-bank-selector fill-height" ng-if="tab.active" ng-cloak layout="column" flex="100" ng-controller="EnvBankCtrl" >
|
||||
<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;">Available Environment Variables</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</md-tooltip>
|
||||
</md-button>
|
||||
<md-button class="md-icon-button" ng-click="addEnvVar()" has-permission="{{Constants.Permissions.ADD_ENV_VARS}}">
|
||||
<md-icon >add</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="bottom">Add New Environment Variable</md-tooltip>
|
||||
</md-button>
|
||||
<md-button class="md-icon-button" ng-click="edit()" ng-disabled="selectedCount() === 0" has-permission="{{Constants.Permissions.ADD_ENV_VARS}}">
|
||||
<md-icon >edit</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="bottom">Edit Selected Environment Variable</md-tooltip>
|
||||
</md-button>
|
||||
<md-button class="md-icon-button" ng-click="delete()" ng-disabled="selectedCount() === 0" has-permission="{{Constants.Permissions.DELETE_ENV_VARS}}">
|
||||
<md-icon >delete</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="bottom">Delete Selected Environment Variable</md-tooltip>
|
||||
</md-button>
|
||||
</div>
|
||||
</md-toolbar>
|
||||
<div class="panel-body padding-none" ui-grid="envarGrid" 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,117 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* MODULE DESCRIPTION:
|
||||
*
|
||||
* TODO: Write description here.
|
||||
*/
|
||||
angular.module('portal.dashboard.envBank', ['ui.router'])
|
||||
.controller('EnvBankCtrl', EnvBankCtrlController);
|
||||
|
||||
function EnvBankCtrlController($scope, cache, systemStores, systemProvider, uiGridConstants, $timeout, $mdDialog, portalUtils, Constants) {
|
||||
|
||||
$scope.envars = [];
|
||||
$scope.Constants = Constants;
|
||||
$scope.mCache = cache.request([new systemStores.EnvironmentVariables()]).then(function(){
|
||||
$scope.envars = $scope.mCache.envvars.data.values;
|
||||
});
|
||||
|
||||
$scope.envarGrid = {
|
||||
data: 'envars',
|
||||
paginationPageSizes: [25, 50, 75, 100, 125, 150, 175, 200],
|
||||
paginationPageSize: 25,
|
||||
enableHorizontalScrollbar: uiGridConstants.scrollbars.NEVER,
|
||||
toggleModifierKeysToMultiSelect : true,
|
||||
enableRowHeaderSelection: true,
|
||||
enableColumnMenus: true,
|
||||
enableGridMenu: true,
|
||||
multiSelect: true,
|
||||
noUnselect: false,
|
||||
onRegisterApi: function (gridApi) {
|
||||
gridApi.selection.setModifierKeysToMultiSelect(true);
|
||||
$scope.envGridApi = gridApi;
|
||||
},
|
||||
columnDefs: [
|
||||
{field: 'name', displayName: 'Environment Name'},
|
||||
{field: 'value', displayName: 'Environment Value'},
|
||||
],
|
||||
};
|
||||
|
||||
$scope.$on('$destroy', function () {
|
||||
$scope.mCache.unlisten();
|
||||
});
|
||||
|
||||
$scope.toggleFiltering = function() {
|
||||
$scope.envGridApi.enableFiltering = !$scope.envGridApi.enableFiltering;
|
||||
$scope.envGridApi.core.notifyDataChange( uiGridConstants.dataChange.COLUMN );
|
||||
};
|
||||
|
||||
var originatorEv;
|
||||
$scope.openMenu = function($mdOpenMenu, ev) {
|
||||
originatorEv = ev;
|
||||
$mdOpenMenu(ev);
|
||||
};
|
||||
|
||||
$scope.delete = function() {
|
||||
var messages = ['Are you sure you want to delete the following environment variables?'];
|
||||
|
||||
var selectedEnvVars = $scope.envGridApi.selection.getSelectedRows();
|
||||
for (var i = 0; i < selectedEnvVars.length; i++) {
|
||||
messages.push(selectedEnvVars[i].name);
|
||||
}
|
||||
|
||||
portalUtils.confirmBox('deleteEnVars', 'Delete Environment Variables', messages, false, function(value) {
|
||||
if (value.confirm) {
|
||||
$scope.deleteEnvVars(selectedEnvVars);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.deleteEnvVars = function(selectedEnvVars) {
|
||||
systemProvider.deleteEnvVar(selectedEnvVars).then(function() {
|
||||
portalUtils.toast('Environment Variables deleted successfully', ['top', 'left'], 2000);
|
||||
}).catch(function(err){
|
||||
portalUtils.toast('Unable to delete environment variables: ' + err.message, ['top', 'left'], 4000);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.edit = function() {
|
||||
$mdDialog.show({
|
||||
templateUrl: 'common/partials/add-env/add-env.html',
|
||||
controller: 'AddEnvVarCtrl',
|
||||
escapeToClose: false,
|
||||
locals: {
|
||||
modalInstance: {
|
||||
header: 'Edit Environment Variables',
|
||||
envVars: $scope.envGridApi.selection.getSelectedRows()
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.addEnvVar = function() {
|
||||
$mdDialog.show({
|
||||
templateUrl: 'common/partials/add-env/add-env.html',
|
||||
controller: 'AddEnvVarCtrl',
|
||||
escapeToClose: false,
|
||||
locals: {
|
||||
modalInstance: {
|
||||
header: 'Add New Environment Variables',
|
||||
envVars: []
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.selectedCount = function() {
|
||||
try {
|
||||
return $scope.envGridApi.selection.getSelectedRows().length;
|
||||
} catch(err) {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
} //end EnvBankCtrlController function
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,17 @@
|
||||
<div layout="row" layout-align="end center">
|
||||
<md-button class="md-icon-button" ng-click="grid.appScope.edit(row.entity)" has-permission="{{grid.appScope.Permissions.ADD_GIT_REPO}}">
|
||||
<md-icon class="md-16">edit</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="left">Edit</md-tooltip>
|
||||
</md-button>
|
||||
|
||||
<md-button class="md-icon-button" ng-click="grid.appScope.pull(row.entity)" has-permission="{{grid.appScope.Permissions.PULL_GIT_REPO}}">
|
||||
<md-icon class="md-16">play_arrow</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="left">Issue pull request</md-tooltip>
|
||||
</md-button>
|
||||
|
||||
<md-button class="md-icon-button" ng-click="grid.appScope.delete(row.entity)" has-permission="{{grid.appScope.Permissions.DELETE_GIT_REPO}}">
|
||||
<md-icon class="md-16">delete</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="left">Delete Repository</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="GitBankCtrl">
|
||||
<md-content layout-xs="column" layout="row" layout-fill>
|
||||
<md-card class="md-padding" flex>
|
||||
<md-toolbar class="md-portal">
|
||||
<div class="md-toolbar-tools">
|
||||
<span style="padding-bottom=30px;">Available Git Repositories</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</md-tooltip>
|
||||
</md-button>
|
||||
<md-button class="md-icon-button" ng-click="addRepo()" has-permission="{{Permissions.ADD_GIT_REPO}}">
|
||||
<md-icon >add</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="bottom">Add Git Repository</md-tooltip>
|
||||
</md-button>
|
||||
</div>
|
||||
</md-toolbar>
|
||||
<div class="panel-body padding-none" ui-grid="repoGrid" ng-if="tab.active" ui-grid-pagination ui-grid-save-state ui-grid-auto-resize ui-grid-resize-columns style="height:95%"></div>
|
||||
</md-card>
|
||||
</md-content>
|
||||
</div>
|
||||
@@ -0,0 +1,151 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* MODULE DESCRIPTION:
|
||||
*
|
||||
* TODO: Write description here.
|
||||
*/
|
||||
angular.module('portal.dashboard.gitBank', ['ui.router'])
|
||||
.controller('GitBankCtrl', GitBankCtrlController);
|
||||
|
||||
function GitBankCtrlController($scope, cache, gitProvider, gitStores, Constants,
|
||||
accountStores, $mdDialog, uiGridConstants, portalUtils) {
|
||||
|
||||
$scope.confirmQuestionBox = true;
|
||||
$scope.Permissions = Constants.Permissions;
|
||||
$scope.repos = [];
|
||||
|
||||
$scope.userRole = '';
|
||||
|
||||
$scope.dirs = {};
|
||||
|
||||
$scope.mCache = cache.request([
|
||||
new accountStores.Account(),
|
||||
new gitStores.Repos()
|
||||
]).then(function(){
|
||||
$scope.userRole = $scope.mCache.account.data.role;
|
||||
$scope.repos = $scope.mCache.repos.data.values;
|
||||
});
|
||||
|
||||
$scope.repoGrid = {
|
||||
data: 'repos',
|
||||
paginationPageSizes: [25, 50, 75, 100, 125, 150, 175, 200],
|
||||
paginationPageSize: 25,
|
||||
enableHorizontalScrollbar: uiGridConstants.scrollbars.NEVER,
|
||||
toggleModifierKeysToMultiSelect : true,
|
||||
enableRowHeaderSelection: true,
|
||||
enableColumnMenus: true,
|
||||
enableGridMenu: true,
|
||||
exporterMenuCsv: true,
|
||||
multiSelect: false,
|
||||
noUnselect: false,
|
||||
onRegisterApi: function (gridApi) {
|
||||
$scope.repoGridApi = gridApi;
|
||||
},
|
||||
columnDefs: [
|
||||
{field: 'name', displayName: 'Name', width: '*'},
|
||||
{field: 'scm', displayName: 'SCM', width: '**' },
|
||||
{field: 'branch', displayName: 'Branch', width: '**' },
|
||||
{field: 'directory', displayName: 'Directory', width: '**' },
|
||||
{field: 'lastUpdated', displayName: 'Last Updated', width: '**',
|
||||
cellTemplate: '<div class="ui-grid-cell-contents" >{{grid.appScope.formatTimeLong(row.entity.lastUpdated)}}</div>'},
|
||||
{field: 'createDate', displayName: 'Create Date', width: '*',
|
||||
cellTemplate: '<div class="ui-grid-cell-contents" >{{grid.appScope.formatTimeShort(row.entity.createDate)}}</div>'},
|
||||
{field: 'id', displayName: 'Actions', width: '125', enableColumnMenu: false, enableFiltering: false, enableHiding: false,
|
||||
cellTemplate: 'main/git-bank/cell-templates/git-actions.html'
|
||||
}
|
||||
],
|
||||
};
|
||||
|
||||
$scope.formatTimeLong = function(value) {
|
||||
return moment(value).format('MM/DD/Y HH:mm:ss');
|
||||
};
|
||||
|
||||
$scope.formatTimeShort = function(value) {
|
||||
return moment(value).format('MM/DD/Y');
|
||||
};
|
||||
|
||||
$scope.$on('$destroy', function () {
|
||||
$scope.mCache.unlisten();
|
||||
});
|
||||
|
||||
$scope.toggleFiltering = function() {
|
||||
$scope.repoGrid.enableFiltering = !$scope.repoGrid.enableFiltering;
|
||||
$scope.repoGridApi.core.notifyDataChange( uiGridConstants.dataChange.COLUMN );
|
||||
};
|
||||
|
||||
$scope.pull = function(entity) {
|
||||
portalUtils.confirmBox('updateRepo', 'Update Repository', ['Issue a pull request for', entity.name],
|
||||
true, function(value) {
|
||||
if (value.confirm) {
|
||||
gitProvider.pullRepo(entity).then(function() {
|
||||
portalUtils.toast('Repository updated successfully', ['top', 'left'], 2000);
|
||||
new gitStores.Repos().refresh();
|
||||
}).catch(function(err){
|
||||
portalUtils.toast('Unable to update repository: ' + err.message, ['top', 'left'], 4000);
|
||||
new gitStores.Repos().refresh();
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.delete = function(entity) {
|
||||
if ($scope.confirmQuestionBox) {
|
||||
portalUtils.confirmBox('deleteRepo', 'Delete Repository', ['Are you sure you want to delete the repository', entity.name],
|
||||
true, function(value) {
|
||||
if (value.confirm) {
|
||||
$scope.confirmQuestionBox = !value.checkbox;
|
||||
$scope.deleteRepo(entity);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$scope.deleteRepo(entity);
|
||||
}
|
||||
};
|
||||
|
||||
$scope.deleteRepo = function(entity) {
|
||||
gitProvider.deleteRepo(entity).then(function() {
|
||||
portalUtils.toast('Repository deleted successfully', ['top', 'left'], 2000);
|
||||
new gitStores.Repos().refresh();
|
||||
}).catch(function(err){
|
||||
portalUtils.toast('Unable to delete repository: ' + err.message, ['top', 'left'], 4000);
|
||||
new gitStores.Repos().refresh();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.edit = function(entity) {
|
||||
$mdDialog.show({
|
||||
templateUrl: 'common/partials/add-git/add-git.html',
|
||||
controller: 'AddGitCtrl',
|
||||
escapeToClose: false,
|
||||
locals: {
|
||||
modalInstance: {
|
||||
header: 'Edit Git Repository',
|
||||
gitInfo: entity
|
||||
}
|
||||
}
|
||||
}).then(function() {
|
||||
new gitStores.Repos().refresh();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.addRepo = function() {
|
||||
$mdDialog.show({
|
||||
templateUrl: 'common/partials/add-git/add-git.html',
|
||||
controller: 'AddGitCtrl',
|
||||
escapeToClose: false,
|
||||
locals: {
|
||||
modalInstance: {
|
||||
header: 'Add Git Repository',
|
||||
}
|
||||
}
|
||||
}).then(function() {
|
||||
new gitStores.Repos().refresh();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
} //end GitBankCtrlController function
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,22 @@
|
||||
<div class="portal-repo-bank-selector fill-height" ng-if="tab.active" ng-cloak layout="column" flex="100" ng-controller="LogBankCtrl">
|
||||
<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;">System Logs</span>
|
||||
<span flex></span>
|
||||
<md-button class="md-icon-button" ng-click="purge()" has-permission="{{Constants.Permissions.PURGE_LOGS}}">
|
||||
<md-icon >delete_sweep</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="bottom">Purge Logs</md-tooltip>
|
||||
</md-button>
|
||||
<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 Logs</md-tooltip>
|
||||
</md-button>
|
||||
</div>
|
||||
</md-toolbar>
|
||||
<div class="panel-body padding-none" ui-grid="logGrid" 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.logBank', ['ui.router'])
|
||||
.controller('LogBankCtrl', LogBankCtrlController);
|
||||
|
||||
function LogBankCtrlController($scope, cache, appLogStores, uiGridConstants, $timeout, $mdDialog, Constants) {
|
||||
|
||||
$scope.logs = [];
|
||||
|
||||
$scope.Constants = Constants;
|
||||
|
||||
$scope.mCache = cache.request([new appLogStores.Logs()]).then(function(){
|
||||
$scope.logs = $scope.mCache.logs.data.values;
|
||||
for (var i = 0; i < $scope.logs.length; i++) {
|
||||
$scope.logs[i].formattedTime = moment($scope.logs[i].timestamp).format('MM/DD/Y HH:mm:ss');
|
||||
}
|
||||
});
|
||||
|
||||
$scope.logGrid = {
|
||||
data: 'logs',
|
||||
paginationPageSizes: [25, 50, 75, 100, 125, 150, 175, 200],
|
||||
paginationPageSize: 25,
|
||||
enableHorizontalScrollbar: uiGridConstants.scrollbars.NEVER,
|
||||
toggleModifierKeysToMultiSelect : true,
|
||||
enableRowHeaderSelection: true,
|
||||
enableColumnMenus: true,
|
||||
enableGridMenu: true,
|
||||
exporterCsvFilename: 'RepoLogs.csv',
|
||||
exporterMenuCsv: true,
|
||||
multiSelect: true,
|
||||
noUnselect: false,
|
||||
onRegisterApi: function (gridApi) {
|
||||
gridApi.selection.setModifierKeysToMultiSelect(true);
|
||||
$scope.logGridApi = gridApi;
|
||||
},
|
||||
columnDefs: [
|
||||
{field: 'loggedBy', displayName: 'Logged By', width: '*'},
|
||||
{field: 'eventName', displayName: 'Event Type'},
|
||||
{field: 'event', displayName: 'Event', width: '*****'},
|
||||
{field: 'severity', displayName: 'Severity'},
|
||||
{field: 'ipAddress', displayName: 'IP Address', width: '*' },
|
||||
{field: 'formattedTime', displayName: 'Timestamp', width: '*' },
|
||||
],
|
||||
};
|
||||
|
||||
$scope.$on('$destroy', function () {
|
||||
$scope.mCache.unlisten();
|
||||
});
|
||||
|
||||
$scope.toggleFiltering = function() {
|
||||
$scope.logGridApi.enableFiltering = !$scope.logGridApi.enableFiltering;
|
||||
$scope.logGridApi.core.notifyDataChange( uiGridConstants.dataChange.COLUMN );
|
||||
};
|
||||
|
||||
var originatorEv;
|
||||
$scope.openMenu = function($mdOpenMenu, ev) {
|
||||
originatorEv = ev;
|
||||
$mdOpenMenu(ev);
|
||||
};
|
||||
|
||||
$scope.purge = function() {
|
||||
$mdDialog.show({
|
||||
templateUrl: 'common/partials/templates/purge-logs.tmpl.html',
|
||||
multipe: true,
|
||||
skipHide: true,
|
||||
locals: {
|
||||
modalInstance: {
|
||||
'title': 'Purge Logs',
|
||||
'message': 'Select the date to purge logs before'
|
||||
}
|
||||
},
|
||||
controller: ['$scope', 'modalInstance', '$mdDialog', 'portalUtils', 'appLogProvider',
|
||||
function($scope, modalInstance, $mdDialog, portalUtils, appLogProvider) {
|
||||
$scope.title = modalInstance.title;
|
||||
$scope.message = modalInstance.message;
|
||||
$scope.loadingBlock = false;
|
||||
|
||||
$scope.model = {};
|
||||
|
||||
$scope.confirm = function() {
|
||||
$scope.error = '';
|
||||
if ($scope.model.purgeStartDate === undefined) {
|
||||
$scope.error = 'Purge start date is required';
|
||||
return;
|
||||
}
|
||||
if ($scope.model.purgeEndDate === undefined) {
|
||||
$scope.error = 'Purge end date is required';
|
||||
return;
|
||||
}
|
||||
portalUtils.confirmBox('purgeConfirm', 'Confirm Purge',
|
||||
['Are you sure you want to purge files between',
|
||||
moment($scope.model.purgeStartDate).format('MMMM Do, Y')
|
||||
+ ' and ' + moment($scope.model.purgeEndDate).format('MMMM Do, Y')], false,
|
||||
function(value) {
|
||||
if (value.confirm) {
|
||||
$scope.loadingBlock = true;
|
||||
appLogProvider.purgeLogs($scope.model).then(function(value) {
|
||||
$scope.loadingBlock = false;
|
||||
portalUtils.toast('Successfully purged ' + value + ' logs', ['top', 'left'], 2000);
|
||||
$mdDialog.hide();
|
||||
}).catch(function(err) {
|
||||
$scope.loadingBlock = false;
|
||||
portalUtils.toast('Unable to purge logs: ' + err.message, ['top', 'left'], 4000);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.cancel = function() {
|
||||
$mdDialog.cancel();
|
||||
};
|
||||
}]
|
||||
}).then(function() {
|
||||
new appLogStores.Logs().refresh();
|
||||
});
|
||||
};
|
||||
|
||||
} //end LogBankCtrlController function
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,12 @@
|
||||
<div layout="row" layout-align="end center">
|
||||
<md-button class="md-icon-button" ng-click="grid.appScope.edit(row.entity)" has-permission="{{grid.appScope.Constants.Permissions.ADD_PERMS}}">
|
||||
<md-icon class="md-16">edit</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="left">Edit Permission</md-tooltip>
|
||||
</md-button>
|
||||
|
||||
<md-button class="md-icon-button" ng-click="grid.appScope.delete(row.entity)" has-permission="{{grid.appScope.Constants.Permissions.DELETE_PERMS}}">
|
||||
<md-icon class="md-16">delete</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="left">Delete Permission</md-tooltip>
|
||||
</md-button>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,21 @@
|
||||
<div class="portal-repo-bank-selector" ng-cloak layout="column" flex="100" style="height:100%" ng-controller="PermissionBankCtrl" ng-if="tab.active">
|
||||
<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;">Permissions</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 Permissions</md-tooltip>
|
||||
</md-button>
|
||||
<md-button class="md-icon-button" ng-click="addPermissions()" has-permission="{{Constants.Permissions.ADD_PERMS}}">
|
||||
<md-icon >add_circle</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="bottom">Add Permissions</md-tooltip>
|
||||
</md-button>
|
||||
</div>
|
||||
</md-toolbar>
|
||||
<div class="panel-body padding-none" ui-grid="permGrid" 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,132 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* MODULE DESCRIPTION:
|
||||
*
|
||||
* TODO: Write description here.
|
||||
*/
|
||||
angular.module('portal.dashboard.permissionBank', ['ui.router'])
|
||||
.controller('PermissionBankCtrl', PermissionBankCtrlController);
|
||||
|
||||
function PermissionBankCtrlController($scope, cache, permissionStores, permissionProvider, $mdDialog,
|
||||
uiGridConstants, portalUtils, Constants) {
|
||||
|
||||
$scope.confirmQuestionBox = true;
|
||||
$scope.permissions = [];
|
||||
$scope.Constants = Constants;
|
||||
|
||||
$scope.mCache = cache.request([new permissionStores.PermissionGroups()]).then(function(){
|
||||
$scope.permissions = $scope.mCache.permissionGroups.data.values;
|
||||
});
|
||||
|
||||
portalUtils.setScopeValue($scope, 'loadingBlock', false, true);
|
||||
|
||||
$scope.permGrid = {
|
||||
data: 'permissions',
|
||||
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.permGridApi = gridApi;
|
||||
},
|
||||
columnDefs: [
|
||||
{field: 'displayName', displayName: 'Permission Group', width: '*'},
|
||||
{field: 'enabled', displayName: 'Enabled', width: '*'},
|
||||
{field: 'permissions', displayName: 'Allowed Permissions', width: '***',
|
||||
cellTemplate: '<div class="ui-grid-cell-contents">{{grid.appScope.formatPermissions(row.entity.permissions)}}</div>'},
|
||||
{field: 'id', displayName: 'Actions', width: '100', enableColumnMenu: false, enableFiltering: false, enableHiding: false,
|
||||
cellTemplate: 'main/permission-bank/cell-templates/permission-actions.html'}
|
||||
],
|
||||
};
|
||||
|
||||
$scope.formatPermissions = function(perms) {
|
||||
var p = [];
|
||||
for (var i = 0; i < perms.length; i++) {
|
||||
var perm = perms[i];
|
||||
if (perm.allowed) {
|
||||
p.push(perm.displayName);
|
||||
}
|
||||
}
|
||||
return p.join(', ');
|
||||
};
|
||||
|
||||
$scope.$on('$destroy', function () {
|
||||
$scope.mCache.unlisten();
|
||||
});
|
||||
|
||||
$scope.toggleFiltering = function() {
|
||||
$scope.permGrid.enableFiltering = !$scope.permGrid.enableFiltering;
|
||||
$scope.permGridApi.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('deletePermissionGroup', 'Delete Permission Group', ['Are you sure you want to delete the permission group', entity.displayName],
|
||||
true, function(value) {
|
||||
if (value.confirm) {
|
||||
$scope.confirmQuestionBox = !value.checkbox;
|
||||
$scope.deletePermission(entity);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$scope.deletePermission(entity);
|
||||
}
|
||||
};
|
||||
|
||||
$scope.deletePermission = function(entity) {
|
||||
portalUtils.setScopeValue($scope, 'loadingBlock', true, true);
|
||||
permissionProvider.deletePermissionGroup(entity).then(function(data) {
|
||||
portalUtils.toast('Successfully deleted permission group ' + entity.displayName, ['top', 'left'], 2000);
|
||||
portalUtils.setScopeValue($scope, 'loadingBlock', false, true);
|
||||
}).catch(function(err){
|
||||
portalUtils.toast('Unable to delete permission group: ' + err.message, ['top', 'left'], 4000);
|
||||
portalUtils.setScopeValue($scope, 'loadingBlock', false, true);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.edit = function(entity) {
|
||||
$mdDialog.show({
|
||||
templateUrl: 'common/partials/add-permission/add-permission.html',
|
||||
controller: 'AddPermissionCtrl',
|
||||
escapeToClose: false,
|
||||
locals: {
|
||||
modalInstance: {
|
||||
header: 'Edit Permission Group',
|
||||
permission: entity,
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.addPermissions = function() {
|
||||
$mdDialog.show({
|
||||
templateUrl: 'common/partials/add-permission/add-permission.html',
|
||||
controller: 'AddPermissionCtrl',
|
||||
escapeToClose: false,
|
||||
locals: {
|
||||
modalInstance: {
|
||||
header: 'Add Permissions',
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
} //end PermissionBankCtrlController function
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,17 @@
|
||||
<div layout="row" layout-align="end center">
|
||||
<md-button class="md-icon-button" ng-click="grid.appScope.edit(row.entity)" has-permission="{{grid.appScope.Constants.Permissions.ADD_SCRIPT}}">
|
||||
<md-icon class="md-16">edit</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="left">Edit Script</md-tooltip>
|
||||
</md-button>
|
||||
|
||||
<md-button class="md-icon-button" ng-click="grid.appScope.run(row.entity)" has-permission="{{grid.appScope.Constants.Permissions.RUN_SCRIPT}}">
|
||||
<md-icon class="md-16">play_arrow</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="left">Manual Run of script</md-tooltip>
|
||||
</md-button>
|
||||
|
||||
<md-button class="md-icon-button" ng-click="grid.appScope.delete(row.entity)" has-permission="{{grid.appScope.Constants.Permissions.DELETE_SCRIPT}}">
|
||||
<md-icon class="md-16">delete</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="left">Delete Script</md-tooltip>
|
||||
</md-button>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,10 @@
|
||||
<div layout="row" layout-align="end center">
|
||||
<md-button class="md-icon-button" ng-click="grid.appScope.viewStatus(row.entity)" has-permission="{{grid.appScope.Constants.Permissions.VIEW_SCRIPT_SCHED_STATUS}}">
|
||||
<md-icon class="md-16">remove_red_eye</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="left">View Status Results</md-tooltip>
|
||||
</md-button>
|
||||
<md-button class="md-icon-button" ng-click="grid.appScope.deleteSchedule(row.entity)" has-permission="{{grid.appScope.Constants.Permissions.DELETE_SCRIPT_SCHED_STATUS}}">
|
||||
<md-icon class="md-16">delete</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="left">Delete Schedule</md-tooltip>
|
||||
</md-button>
|
||||
</div>
|
||||
@@ -0,0 +1,7 @@
|
||||
<div class="ui-grid-cell-contents"
|
||||
ng-class="{
|
||||
'text-danger': row.entity.executionStatus !== 0 && row.entity.currentExecutionCount !== null,
|
||||
'play-green': row.entity.executionStatus === 0
|
||||
}">
|
||||
{{grid.appScope.formatStatus(row.entity)}}
|
||||
</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="ScriptBankCtrl">
|
||||
<md-content layout-xs="column" layout="row" layout-fill>
|
||||
<md-card class="md-padding" flex>
|
||||
<md-toolbar class="md-portal">
|
||||
<div class="md-toolbar-tools">
|
||||
<span style="padding-bottom=30px;">Available Scripts</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</md-tooltip>
|
||||
</md-button>
|
||||
<md-button class="md-icon-button" ng-click="addScript()" has-permission="{{Constants.Permissions.ADD_SCRIPT}}">
|
||||
<md-icon >add</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="bottom">Add New Script</md-tooltip>
|
||||
</md-button>
|
||||
</div>
|
||||
</md-toolbar>
|
||||
<div class="panel-body padding-none" ui-grid="scriptGrid" ng-if="tab.active" ui-grid-pagination ui-grid-save-state ui-grid-auto-resize ui-grid-resize-columns ui-grid-pinning ui-grid-expandable style="height:95%"></div>
|
||||
</md-card>
|
||||
</md-content>
|
||||
</div>
|
||||
@@ -0,0 +1,234 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* MODULE DESCRIPTION:
|
||||
*
|
||||
* TODO: Write description here.
|
||||
*/
|
||||
angular.module('portal.dashboard.scriptBank', ['ui.router'])
|
||||
.controller('ScriptBankCtrl', ScriptBankCtrlController);
|
||||
|
||||
function ScriptBankCtrlController($scope, cache, scriptStores, scriptProvider,
|
||||
accountStores, $mdDialog, uiGridConstants, portalUtils, $log, Triggers, Constants) {
|
||||
|
||||
$scope.confirmQuestionBox = true;
|
||||
|
||||
$scope.scripts = [];
|
||||
|
||||
$scope.userRole = '';
|
||||
|
||||
$scope.Constants = Constants;
|
||||
|
||||
$scope.mCache = cache.request([
|
||||
new accountStores.Account(),
|
||||
new scriptStores.Scripts()
|
||||
]).then(function(){
|
||||
$scope.acct = $scope.mCache.account.data;
|
||||
$scope.scripts = $scope.mCache.scripts.data.values;
|
||||
for (var i = 0; i < $scope.scripts.length; i++) {
|
||||
$scope.scripts[i].subGridOptions = {
|
||||
data: $scope.scripts[i].schedule,
|
||||
columnDefs: [
|
||||
{field: 'jobId', displayName: 'Job Id', width: '**'},
|
||||
{field: 'startDatetime', displayName: 'Start Date/Time', width: '*',
|
||||
cellTemplate: '<div class="ui-grid-cell-contents">{{grid.appScope.formatTimeSub(row.entity.startDatetime)}}</div>'},
|
||||
{field: 'endDatetime', displayName: 'End Date/Time', width: '*',
|
||||
cellTemplate: '<div class="ui-grid-cell-contents">{{grid.appScope.formatTimeSub(row.entity.endDatetime)}}</div>'},
|
||||
{field: 'frequency', displayName: 'Frequency', width: '*'},
|
||||
{field: 'maxExecutions', displayName: 'Max Executions', width: '*'},
|
||||
{field: 'currentExecutionCount', displayName: 'Current Count', width: '*'},
|
||||
{field: 'lastRun', displayName: 'Last Ran', width: '*',
|
||||
cellTemplate: '<div class="ui-grid-cell-contents">{{grid.appScope.formatTimeSub(row.entity.lastRun)}}</div>'},
|
||||
{field: 'executionStatus', displayName: 'Status', width: '*',
|
||||
cellTemplate: 'main/script-bank/cell-templates/script-sched-status.html'},
|
||||
{field: 'id', displayName: '', width: '100', enableColumnMenu: false, enableFiltering: false, enableHiding: false,
|
||||
cellTemplate: 'main/script-bank/cell-templates/script-sched-actions.html'},
|
||||
]
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
$scope.scriptGrid = {
|
||||
data: 'scripts',
|
||||
expandableRowTemplate:'<div ui-grid="row.entity.subGridOptions" style="height:150px;"></div>',
|
||||
expandableRowScope: {
|
||||
Constants : $scope.Constants,
|
||||
formatTimeSub : function(value) {
|
||||
if (value === null || value === undefined || value === 0) {
|
||||
return 'None';
|
||||
}
|
||||
return $scope.formatTime(value);
|
||||
},
|
||||
deleteSchedule: function(entity) {
|
||||
$scope.deleteSchedule(entity);
|
||||
},
|
||||
formatStatus: function(entity) {
|
||||
return $scope.formatScriptStatus(entity);
|
||||
},
|
||||
viewStatus: function(entity) {
|
||||
$scope.viewScriptStatus(entity);
|
||||
}
|
||||
},
|
||||
paginationPageSizes: [25, 50, 75, 100, 125, 150, 175, 200],
|
||||
paginationPageSize: 25,
|
||||
enableHorizontalScrollbar: uiGridConstants.scrollbars.NEVER,
|
||||
toggleModifierKeysToMultiSelect : true,
|
||||
enableRowHeaderSelection: true,
|
||||
enableColumnMenus: true,
|
||||
enableGridMenu: true,
|
||||
exporterMenuCsv: true,
|
||||
multiSelect: false,
|
||||
noUnselect: false,
|
||||
onRegisterApi: function (gridApi) {
|
||||
$scope.scriptGridApi = gridApi;
|
||||
},
|
||||
columnDefs: [
|
||||
{field: 'name', displayName: 'Name', width: '*'},
|
||||
{field: 'command', displayName: 'Command', width: '**' },
|
||||
{field: 'parameters', displayName: 'Parameters', width: '**',
|
||||
cellTemplate: '<div class="ui-grid-cell-contents">{{grid.appScope.formatParameters(row.entity.parameters)}}</div>'},
|
||||
{field: 'schedule', displayName: 'Schedule Count', width: '*',
|
||||
cellTemplate: '<div class="ui-grid-cell-contents">{{row.entity.schedule.length}}</div>'},
|
||||
{field: 'id', displayName: 'Actions', width: '125', enableColumnMenu: false, enableFiltering: false, enableHiding: false,
|
||||
cellTemplate: 'main/script-bank/cell-templates/script-actions.html'
|
||||
}
|
||||
],
|
||||
};
|
||||
|
||||
$scope.formatScriptStatus = function(entity) {
|
||||
if (entity.currentExecutionCount === null) {
|
||||
return 'Not Ran';
|
||||
}
|
||||
|
||||
if (entity.executionStatus !== 0) {
|
||||
return 'Failed';
|
||||
}
|
||||
|
||||
return 'Success';
|
||||
};
|
||||
|
||||
$scope.formatParameters = function(parameters) {
|
||||
var params = '';
|
||||
|
||||
for (var i = 0; i < parameters.length; i++) {
|
||||
params += parameters[i].parameter + ' ';
|
||||
}
|
||||
return params;
|
||||
};
|
||||
|
||||
$scope.formatTime = function(value) {
|
||||
return moment(value).format('MMM D, YYYY hh:mm:ss A');
|
||||
};
|
||||
|
||||
$scope.run = function(entity) {
|
||||
portalUtils.confirmBox('run', 'Run Script', ['Are you sure you want to manually run the script', entity.name],
|
||||
true, function(value) {
|
||||
if (value.confirm) {
|
||||
$scope.confirmQuestionBox = !value.checkbox;
|
||||
$scope.runScript(entity);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.runScript = function(entity) {
|
||||
scriptProvider.runScript(entity).then(function() {
|
||||
portalUtils.toast('Script scheduled to run', ['top', 'left'], 2000);
|
||||
}, function(err){
|
||||
portalUtils.toast('Unable to run script: ' + err.message, ['top', 'left'], 4000);
|
||||
new scriptStores.Scripts().refresh();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.deleteSchedule = function(entity) {
|
||||
portalUtils.confirmBox('deleteSched', 'Delete Schedule', ['Are you sure you want to delete the schedule', entity.jobId],
|
||||
false, function(value) {
|
||||
if (value.confirm) {
|
||||
$scope.deleteSched(entity);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.deleteSched = function(entity) {
|
||||
scriptProvider.deleteScriptSchedule(entity).then(function(){
|
||||
portalUtils.toast('Script schedule deleted successfully', ['top', 'left'], 2000);
|
||||
}, function(err){
|
||||
portalUtils.toast('Unable to delete script : ' + err.message, ['top', 'left'], 4000);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.delete = function(entity) {
|
||||
if ($scope.confirmQuestionBox) {
|
||||
portalUtils.confirmBox('deleteScript', 'Delete Script', ['Are you sure you want to delete the script', entity.name],
|
||||
true, function(value) {
|
||||
if (value.confirm) {
|
||||
$scope.confirmQuestionBox = !value.checkbox;
|
||||
$scope.deleteScript(entity);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$scope.deleteScript(entity);
|
||||
}
|
||||
};
|
||||
|
||||
$scope.deleteScript = function(entity) {
|
||||
scriptProvider.deleteScript(entity).then(function() {
|
||||
portalUtils.toast('Script deleted successfully', ['top', 'left'], 2000);
|
||||
},function(err){
|
||||
portalUtils.toast('Unable to delete script: ' + err.message, ['top', 'left'], 4000);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.edit = function(entity) {
|
||||
$mdDialog.show({
|
||||
templateUrl: 'common/partials/add-script/add-script.html',
|
||||
controller: 'AddScriptCtrl',
|
||||
escapeToClose: false,
|
||||
locals: {
|
||||
modalInstance: {
|
||||
header: 'Edit Script',
|
||||
script: entity
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.addScript = function() {
|
||||
$mdDialog.show({
|
||||
templateUrl: 'common/partials/add-script/add-script.html',
|
||||
controller: 'AddScriptCtrl',
|
||||
escapeToClose: false,
|
||||
locals: {
|
||||
modalInstance: {
|
||||
header: 'Add New Script',
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.viewScriptStatus = function(entity) {
|
||||
$mdDialog.show({
|
||||
templateUrl: 'common/partials/script-status/view-script-status.html',
|
||||
controller: 'ScriptStatusCtrl',
|
||||
escapeToClose: false,
|
||||
locals: {
|
||||
modalInstance: {
|
||||
jobId: entity.jobId,
|
||||
header: 'Script Status'
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.toggleFiltering = function() {
|
||||
$scope.scriptGrid.enableFiltering = !$scope.scriptGrid.enableFiltering;
|
||||
$scope.scriptGridApi.core.notifyDataChange( uiGridConstants.dataChange.COLUMN );
|
||||
};
|
||||
|
||||
$scope.$on('$destroy', function () {
|
||||
$scope.mCache.unlisten();
|
||||
});
|
||||
|
||||
} //end ScriptBankCtrlController function
|
||||
|
||||
})();
|
||||
@@ -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