docker-registry-frontend/app/app.js
Marc Abramowitz 3ad864b388 Handle images with no user properly (#147)
* Uncomment test for no repositoryUser

in `app/app.spec.js`, so I can work on getting this case working.

* Add $log to repository-detail-controller

* Set $scope.repository properly even if no user

Check if `$scope.repositoryUser` is defined and if it's not, set
`$scope.repository` simply to `$scope.repositoryName`.

* Add route for repo with no repositoryUser

* Make tagsPerPage dropdown use query string vars

instead of putting `tagsPerPage` in the route part of the URL, which
makes it difficult to distinguish between `repositoryName` and
`tagsPerPage`, because the routes are too similar.

* Make first/next links use query string vars

instead of putting `tagsPerPage` in the route part of the URL, which
makes it difficult to distinguish between `repositoryName` and
`tagsPerPage`, because the routes are too similar.

* Move defaultTagsPerPage

from `RepositoryListController` to `TagController`.

I think it makes more sense to read `defaultTagsPerPage` in
`TagController` than to do it in `RepositoryListController` and have to
pass it in URLs.

* Fix "Details for repository" for repo w/ no user

* Fix breadcrumb when no repositoryUser

* Remove tagsPerPage/tagPage from repo detail routes

* Update unit tests to use tagsPerPage qs param

Updated the unit tests to page `tagsPerPage` as a query string parameter
rather than in the route.

* Uncomment assertions about scope.reposPerPage

an make them work by casting string to an int with `parseInt`.

* Make /tag work for image with no repositoryUser

* repository-detail.html: Fix breadcrumb link

for case when there is no `repositoryUser`.

* tag-detail.html: Fix breadcrumb link

when image has no `repositoryUser`.

* tag-detail.html: Fix shown docker pull command

when image has no `repositoryUser`.

* tag-detail.html: Show docker pull cmd in code font

I think it looks better.
2016-08-04 17:16:32 +02:00

93 lines
2.9 KiB
JavaScript

'use strict';
/**
* @ngdoc overview
* @name docker-registry-frontend
* @description
* # docker-registry-frontend
*
* Main module of the application.
*/
angular
.module('docker-registry-frontend', [
'ngAnimate',
'ngCookies',
'ngResource',
'ngRoute',
'ngSanitize',
'ngTouch',
'registry-services', // TODO: Maybe the following dependencies are not needed? At least they weren't in the "yo angular" output.
'main-controller',
'repository-detail-controller',
'tag-controller',
'repository-list-controller',
'tag-list-directive',
'image-details-directive',
'tag-item-controller',
'image-controller',
'home-controller',
'create-tag-controller',
'delete-tags-controller',
'delete-repository-controller',
'ui.bootstrap',
'angular-loading-bar',
'angularMoment',
'app-version-services',
'app-mode-services',
'smart-table',
'angular.filter',
'ui.checkbox'
])
.config(['$routeProvider', '$resourceProvider', 'cfpLoadingBarProvider', '$locationProvider',
function($routeProvider, $resourceProvider, cfpLoadingBarProvider, $locationProvider){
$locationProvider.html5Mode(true);
// Don't show the spinner when making XHR requests.
// Also, show the bar only if an XHR request takes longer than 50ms.
cfpLoadingBarProvider.includeSpinner = false;
cfpLoadingBarProvider.latencyThreshold = 10;
// Don't strip trailing slashes from calculated URLs
$resourceProvider.defaults.stripTrailingSlashes = false;
$routeProvider.
when('/home', {
templateUrl: 'home.html',
controller: 'HomeController',
}).
when('/repositories/:reposPerPage?/:lastNamespace?/:lastRepository?', {
templateUrl: 'repository/repository-list.html',
controller: 'RepositoryListController'
}).
when('/repository/:repositoryUser/:repositoryName', {
templateUrl: 'repository/repository-detail.html',
controller: 'RepositoryDetailController'
}).
when('/repository/:repositoryName', {
templateUrl: 'repository/repository-detail.html',
controller: 'RepositoryDetailController'
}).
when('/repository/:repositoryUser/:repositoryName/tags/:searchName?', {
templateUrl: 'repository/repository-detail.html',
controller: 'RepositoryController',
}).
when('/about', {
templateUrl: 'about.html',
}).
when('/tag/:repositoryUser?/:repositoryName/:tagName/', {
templateUrl: 'tag/tag-detail.html',
controller: 'TagController',
}).
when('/image/:imageId', {
templateUrl: 'tag/image-detail.html',
controller: 'ImageController',
}).
when('/image/:imageId/tag/:repositoryUser?/:repositoryName?', {
templateUrl: 'tag/create-tag.html',
controller: 'CreateTagController',
}).
otherwise({
redirectTo: '/home'
});
}]);