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