Initial commit
This commit is contained in:
commit
880e39de2e
511 files changed
+38363
No files matched your search
@@ -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
|
||||
|
||||
})();
|
||||
Reference in new issue
Block a user