Code cleanup part #1: move all the services and directive JS code in the app.js file into its own files
This commit is contained in:
parent
3cae6609a7
commit
9b87999c1c
97 changed files with 7076 additions and 6870 deletions
|
@ -401,7 +401,7 @@ function LandingCtrl($scope, UserService, ApiService, Features, Config) {
|
|||
};
|
||||
}
|
||||
|
||||
function RepoCtrl($scope, $sanitize, Restangular, ImageMetadataService, ApiService, $routeParams, $rootScope, $location, $timeout, Config) {
|
||||
function RepoCtrl($scope, $sanitize, Restangular, ImageMetadataService, ApiService, $routeParams, $rootScope, $location, $timeout, Config, UtilService) {
|
||||
$scope.Config = Config;
|
||||
|
||||
var namespace = $routeParams.namespace;
|
||||
|
@ -718,8 +718,6 @@ function RepoCtrl($scope, $sanitize, Restangular, ImageMetadataService, ApiServi
|
|||
$scope.updatePullCommand();
|
||||
};
|
||||
|
||||
$scope.getFirstTextLine = getFirstTextLine;
|
||||
|
||||
$scope.getTagCount = function(repo) {
|
||||
if (!repo) { return 0; }
|
||||
var count = 0;
|
||||
|
@ -809,7 +807,7 @@ function RepoCtrl($scope, $sanitize, Restangular, ImageMetadataService, ApiServi
|
|||
var qualifiedRepoName = namespace + '/' + name;
|
||||
$rootScope.title = qualifiedRepoName;
|
||||
var kind = repo.is_public ? 'public' : 'private';
|
||||
$rootScope.description = jQuery(getFirstTextLine(repo.description)).text() ||
|
||||
$rootScope.description = jQuery(UtilService.getFirstMarkdownLineAsText(repo.description)).text() ||
|
||||
'Visualization of images and tags for ' + kind + ' Docker repository: ' + qualifiedRepoName;
|
||||
|
||||
// Load the builds for this repository. If none are active it will cancel the poll.
|
||||
|
@ -890,7 +888,7 @@ function RepoCtrl($scope, $sanitize, Restangular, ImageMetadataService, ApiServi
|
|||
|
||||
// Create the new tree.
|
||||
var tree = new ImageHistoryTree(namespace, name, resp.images,
|
||||
getFirstTextLine, $scope.getTimeSince, ImageMetadataService.getEscapedFormattedCommand);
|
||||
UtilService.getFirstMarkdownLineAsText, $scope.getTimeSince, ImageMetadataService.getEscapedFormattedCommand);
|
||||
|
||||
$scope.tree = tree.draw('image-history-container');
|
||||
if ($scope.tree) {
|
||||
|
@ -1073,7 +1071,7 @@ function BuildPackageCtrl($scope, Restangular, ApiService, DataFileService, $rou
|
|||
}
|
||||
|
||||
function RepoAdminCtrl($scope, Restangular, ApiService, KeyService, TriggerService, $routeParams,
|
||||
$rootScope, $location, UserService, Config, Features, ExternalNotificationData) {
|
||||
$rootScope, $location, UserService, Config, Features, ExternalNotificationData, UtilService) {
|
||||
|
||||
var namespace = $routeParams.namespace;
|
||||
var name = $routeParams.name;
|
||||
|
@ -1159,7 +1157,7 @@ function RepoAdminCtrl($scope, Restangular, ApiService, KeyService, TriggerServi
|
|||
}
|
||||
});
|
||||
|
||||
var permissionDelete = Restangular.one(getRestUrl('repository', namespace, name, 'permissions', kind, entityName));
|
||||
var permissionDelete = Restangular.one(UtilService.getRestUrl('repository', namespace, name, 'permissions', kind, entityName));
|
||||
permissionDelete.customDELETE().then(function() {
|
||||
delete $scope.permissions[kind][entityName];
|
||||
}, errorHandler);
|
||||
|
@ -1170,7 +1168,7 @@ function RepoAdminCtrl($scope, Restangular, ApiService, KeyService, TriggerServi
|
|||
'role': role,
|
||||
};
|
||||
|
||||
var permissionPost = Restangular.one(getRestUrl('repository', namespace, name, 'permissions', kind, entityName));
|
||||
var permissionPost = Restangular.one(UtilService.getRestUrl('repository', namespace, name, 'permissions', kind, entityName));
|
||||
permissionPost.customPUT(permission).then(function(result) {
|
||||
$scope.permissions[kind][entityName] = result;
|
||||
}, ApiService.errorDisplay('Cannot change permission'));
|
||||
|
@ -1187,7 +1185,7 @@ function RepoAdminCtrl($scope, Restangular, ApiService, KeyService, TriggerServi
|
|||
var currentRole = permission.role;
|
||||
permission.role = role;
|
||||
|
||||
var permissionPut = Restangular.one(getRestUrl('repository', namespace, name, 'permissions', kind, entityName));
|
||||
var permissionPut = Restangular.one(UtilService.getRestUrl('repository', namespace, name, 'permissions', kind, entityName));
|
||||
permissionPut.customPUT(permission).then(function() {}, function(resp) {
|
||||
$scope.permissions[kind][entityName] = {'role': currentRole};
|
||||
$scope.changePermError = null;
|
||||
|
@ -1957,7 +1955,7 @@ function NewRepoCtrl($scope, $location, $http, $timeout, UserService, ApiService
|
|||
};
|
||||
}
|
||||
|
||||
function OrgViewCtrl($rootScope, $scope, ApiService, $routeParams) {
|
||||
function OrgViewCtrl($rootScope, $scope, ApiService, $routeParams, CreateService) {
|
||||
var orgname = $routeParams.orgname;
|
||||
|
||||
$scope.TEAM_PATTERN = TEAM_PATTERN;
|
||||
|
@ -2001,7 +1999,7 @@ function OrgViewCtrl($rootScope, $scope, ApiService, $routeParams) {
|
|||
return;
|
||||
}
|
||||
|
||||
createOrganizationTeam(ApiService, orgname, teamname, function(created) {
|
||||
CreateService.createOrganizationTeam(ApiService, orgname, teamname, function(created) {
|
||||
$scope.organization.teams[teamname] = created;
|
||||
});
|
||||
};
|
||||
|
|
Reference in a new issue