From 162482dbc42aefe55a5f0541650199f9989aece3 Mon Sep 17 00:00:00 2001 From: kevgliss Date: Mon, 5 Oct 2015 09:00:51 -0700 Subject: [PATCH] Adding ui router and perma links to certificates and authorities --- bower.json | 3 ++- lemur/static/app/angular/app.js | 14 ++++++------ .../app/angular/authentication/login/login.js | 5 +++-- .../angular/authentication/logout/logout.js | 7 +++--- .../app/angular/authorities/view/view.js | 21 ++++++++++++------ .../angular/authorities/view/view.tpl.html | 3 +++ .../app/angular/certificates/view/view.js | 22 +++++++++++++------ .../angular/certificates/view/view.tpl.html | 4 ++++ .../static/app/angular/dashboard/dashboard.js | 5 +++-- .../app/angular/destinations/view/view.js | 5 +++-- lemur/static/app/angular/domains/view/view.js | 5 +++-- .../app/angular/notifications/view/view.js | 5 +++-- lemur/static/app/angular/roles/view/view.js | 5 +++-- lemur/static/app/angular/sources/view/view.js | 5 +++-- lemur/static/app/angular/users/view/view.js | 5 +++-- lemur/static/app/index.html | 22 +++++++++---------- 16 files changed, 84 insertions(+), 52 deletions(-) diff --git a/bower.json b/bower.json index e0a15d3f..ccb98a7a 100644 --- a/bower.json +++ b/bower.json @@ -30,7 +30,8 @@ "angular-chart.js": "~0.7.1", "satellizer": "~0.9.4", "angularjs-toaster": "~0.4.14", - "ngletteravatar": "~3.0.1" + "ngletteravatar": "~3.0.1", + "angular-ui-router": "~0.2.15" }, "devDependencies": { "angular-mocks": "~1.3", diff --git a/lemur/static/app/angular/app.js b/lemur/static/app/angular/app.js index c00bb26d..1355cbc2 100644 --- a/lemur/static/app/angular/app.js +++ b/lemur/static/app/angular/app.js @@ -2,7 +2,7 @@ var lemur = angular .module('lemur', [ - 'ngRoute', + 'ui.router', 'ngTable', 'ngAnimate', 'chart.js', @@ -16,13 +16,13 @@ var lemur = angular 'satellizer', 'ngLetterAvatar' ]) - .config(function ($routeProvider, $authProvider) { - $routeProvider - .when('/', { + .config(function ($stateProvider, $urlRouterProvider, $authProvider) { + $urlRouterProvider.otherwise("/welcome"); + + $stateProvider + .state('welcome', { + url: "/welcome", templateUrl: 'angular/welcome/welcome.html' - }) - .otherwise({ - redirectTo: '/' }); $authProvider.oauth2({ diff --git a/lemur/static/app/angular/authentication/login/login.js b/lemur/static/app/angular/authentication/login/login.js index b7cc7902..cfcd715c 100644 --- a/lemur/static/app/angular/authentication/login/login.js +++ b/lemur/static/app/angular/authentication/login/login.js @@ -1,8 +1,9 @@ 'use strict'; angular.module('lemur') - .config(function config($routeProvider) { - $routeProvider.when('/login', { + .config(function config($stateProvider) { + $stateProvider.state('login', { + url: '/login', templateUrl: '/angular/authentication/login/login.tpl.html', controller: 'LoginController' }); diff --git a/lemur/static/app/angular/authentication/logout/logout.js b/lemur/static/app/angular/authentication/logout/logout.js index 18cbd489..b47d5075 100644 --- a/lemur/static/app/angular/authentication/logout/logout.js +++ b/lemur/static/app/angular/authentication/logout/logout.js @@ -1,9 +1,10 @@ 'use strict'; angular.module('lemur') - .config(function config($routeProvider) { - $routeProvider.when('/logout', { - controller: 'LogoutCtrl' + .config(function config($stateProvider) { + $stateProvider.state('logout', { + controller: 'LogoutCtrl', + url: "/logout" }); }) .controller('LogoutCtrl', function ($scope, $location, lemurRestangular, userService) { diff --git a/lemur/static/app/angular/authorities/view/view.js b/lemur/static/app/angular/authorities/view/view.js index 71cdbb9a..dade31a4 100644 --- a/lemur/static/app/angular/authorities/view/view.js +++ b/lemur/static/app/angular/authorities/view/view.js @@ -2,15 +2,22 @@ angular.module('lemur') - .config(function config($routeProvider) { - $routeProvider.when('/authorities', { - templateUrl: '/angular/authorities/view/view.tpl.html', - controller: 'AuthoritiesViewController' - }); + .config(function config($stateProvider) { + $stateProvider + .state('authorities', { + url: "/authorities", + templateUrl: '/angular/authorities/view/view.tpl.html', + controller: 'AuthoritiesViewController' + }) + .state('authority', { + url: "/authorities/:name", + templateUrl: '/angular/authorities/view/view.tpl.html', + controller: 'AuthoritiesViewController' + }); }) - .controller('AuthoritiesViewController', function ($scope, $q, $modal, AuthorityApi, AuthorityService, ngTableParams) { - $scope.filter = {}; + .controller('AuthoritiesViewController', function ($scope, $q, $modal, $stateParams, AuthorityApi, AuthorityService, ngTableParams) { + $scope.filter = $stateParams; $scope.authoritiesTable = new ngTableParams({ page: 1, // show first page count: 10, // count per page diff --git a/lemur/static/app/angular/authorities/view/view.tpl.html b/lemur/static/app/angular/authorities/view/view.tpl.html index d04bc750..5bbc2e30 100644 --- a/lemur/static/app/angular/authorities/view/view.tpl.html +++ b/lemur/static/app/angular/authorities/view/view.tpl.html @@ -34,6 +34,9 @@ + + Permalink +
@@ -122,6 +125,7 @@
+

diff --git a/lemur/static/app/angular/dashboard/dashboard.js b/lemur/static/app/angular/dashboard/dashboard.js index 69cfd554..71f0f557 100644 --- a/lemur/static/app/angular/dashboard/dashboard.js +++ b/lemur/static/app/angular/dashboard/dashboard.js @@ -1,8 +1,9 @@ 'use strict'; angular.module('lemur') - .config(function config($routeProvider) { - $routeProvider.when('/dashboard', { + .config(function config($stateProvider) { + $stateProvider.state('dashboard', { + url: '/dashboard', templateUrl: '/angular/dashboard/dashboard.tpl.html', controller: 'DashboardController' }); diff --git a/lemur/static/app/angular/destinations/view/view.js b/lemur/static/app/angular/destinations/view/view.js index cee6d691..c9a01505 100644 --- a/lemur/static/app/angular/destinations/view/view.js +++ b/lemur/static/app/angular/destinations/view/view.js @@ -2,8 +2,9 @@ angular.module('lemur') - .config(function config($routeProvider) { - $routeProvider.when('/destinations', { + .config(function config($stateProvider) { + $stateProvider.state('destinations', { + url: '/destinations', templateUrl: '/angular/destinations/view/view.tpl.html', controller: 'DestinationsViewController' }); diff --git a/lemur/static/app/angular/domains/view/view.js b/lemur/static/app/angular/domains/view/view.js index 335b9c5a..269d0e84 100644 --- a/lemur/static/app/angular/domains/view/view.js +++ b/lemur/static/app/angular/domains/view/view.js @@ -2,8 +2,9 @@ angular.module('lemur') - .config(function config($routeProvider) { - $routeProvider.when('/domains', { + .config(function config($stateProvider) { + $stateProvider.state('domains', { + url: '/domains', templateUrl: '/angular/domains/view/view.tpl.html', controller: 'DomainsViewController' }); diff --git a/lemur/static/app/angular/notifications/view/view.js b/lemur/static/app/angular/notifications/view/view.js index ae269e67..f037494e 100644 --- a/lemur/static/app/angular/notifications/view/view.js +++ b/lemur/static/app/angular/notifications/view/view.js @@ -2,8 +2,9 @@ angular.module('lemur') - .config(function config($routeProvider) { - $routeProvider.when('/notifications', { + .config(function config($stateProvider) { + $stateProvider.state('notifications', { + url: '/notifications', templateUrl: '/angular/notifications/view/view.tpl.html', controller: 'NotificationsViewController' }); diff --git a/lemur/static/app/angular/roles/view/view.js b/lemur/static/app/angular/roles/view/view.js index 17d60ae4..4957f8b0 100644 --- a/lemur/static/app/angular/roles/view/view.js +++ b/lemur/static/app/angular/roles/view/view.js @@ -2,8 +2,9 @@ angular.module('lemur') - .config(function config($routeProvider) { - $routeProvider.when('/roles', { + .config(function config($stateProvider) { + $stateProvider.state('roles', { + url: '/roles', templateUrl: '/angular/roles/view/view.tpl.html', controller: 'RolesViewController' }); diff --git a/lemur/static/app/angular/sources/view/view.js b/lemur/static/app/angular/sources/view/view.js index 031ea8d7..f125eb85 100644 --- a/lemur/static/app/angular/sources/view/view.js +++ b/lemur/static/app/angular/sources/view/view.js @@ -2,8 +2,9 @@ angular.module('lemur') - .config(function config($routeProvider) { - $routeProvider.when('/sources', { + .config(function config($stateProvider) { + $stateProvider.state('sources', { + url: '/sources', templateUrl: '/angular/sources/view/view.tpl.html', controller: 'SourcesViewController' }); diff --git a/lemur/static/app/angular/users/view/view.js b/lemur/static/app/angular/users/view/view.js index 104fc245..1b60e048 100644 --- a/lemur/static/app/angular/users/view/view.js +++ b/lemur/static/app/angular/users/view/view.js @@ -2,8 +2,9 @@ angular.module('lemur') - .config(function config($routeProvider) { - $routeProvider.when('/users', { + .config(function config($stateProvider) { + $stateProvider.state('users', { + url: '/users', templateUrl: '/angular/users/view/view.tpl.html', controller: 'UsersViewController' }); diff --git a/lemur/static/app/index.html b/lemur/static/app/index.html index fa659d1e..b9df4202 100644 --- a/lemur/static/app/index.html +++ b/lemur/static/app/index.html @@ -49,24 +49,24 @@

-
+