summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi/ui/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'testapi/opnfv_testapi/ui/app.js')
-rw-r--r--testapi/opnfv_testapi/ui/app.js65
1 files changed, 48 insertions, 17 deletions
diff --git a/testapi/opnfv_testapi/ui/app.js b/testapi/opnfv_testapi/ui/app.js
index 28e5810..c2fa774 100644
--- a/testapi/opnfv_testapi/ui/app.js
+++ b/testapi/opnfv_testapi/ui/app.js
@@ -79,11 +79,31 @@
templateUrl: 'testapi-ui/components/projects/project/project.html',
controller: 'ProjectController as ctrl'
}).
+ state('scenarios', {
+ url: '/scenarios',
+ templateUrl: 'testapi-ui/components/scenarios/scenarios.html',
+ controller: 'ScenariosController as ctrl'
+ }).
+ state('scenario', {
+ url: '/scenarios/:name',
+ templateUrl: 'testapi-ui/components/scenarios/scenario/scenario.html',
+ controller: 'ScenarioController as ctrl'
+ }).
+ state('testCase', {
+ url: '/projects/:project_name/:name',
+ templateUrl: 'testapi-ui/components/projects/project/testCases/testCase/testCase.html',
+ controller: 'TestCaseController as ctrl'
+ }).
state('results', {
url: '/results',
templateUrl: 'testapi-ui/components/results/results.html',
controller: 'ResultsController as ctrl'
}).
+ state('result', {
+ url: '/result/:_id',
+ templateUrl: 'testapi-ui/components/results/result/result.html',
+ controller: 'ResultController as ctrl'
+ }).
state('profile', {
url: '/profile',
templateUrl: 'testapi-ui/components/profile/profile.html',
@@ -124,16 +144,17 @@
.run(setup);
setup.$inject = [
- '$http', '$rootScope', '$window', '$state', 'testapiApiUrl'
+ '$http', '$rootScope', '$window', '$state', 'testapiApiUrl', "authenticate"
];
/**
* Set up the app with injections into $rootscope. This is mainly for auth
* functions.
*/
- function setup($http, $rootScope, $window, $state, testapiApiUrl) {
+ function setup($http, $rootScope, $window, $state, testapiApiUrl, authenticate) {
$rootScope.auth = {};
+ $rootScope.authenticate = authenticate
$rootScope.auth.doSignIn = doSignIn;
$rootScope.auth.doSignOut = doSignOut;
$rootScope.auth.doSignCheck = doSignCheck;
@@ -150,10 +171,14 @@
/** This function will initate a sign out. */
function doSignOut() {
- $rootScope.auth.currentUser = null;
- $rootScope.auth.isAuthenticated = false;
- $rootScope.auth.projectNames = [];
- $window.location.href = sign_out_url;
+ if(authenticate){
+ $rootScope.auth.currentUser = null;
+ $rootScope.auth.isAuthenticated = false;
+ $rootScope.auth.projectNames = [];
+ $window.location.href = sign_out_url;
+ }else{
+ $state.go("home", {reload: true})
+ }
}
/**
@@ -161,17 +186,23 @@
* authenticated.
*/
function doSignCheck() {
- return $http.get(profile_url, {withCredentials: true}).
- success(function (data) {
- $rootScope.auth.currentUser = data;
- $rootScope.auth.isAuthenticated = true;
- $rootScope.auth.projectNames = $rootScope.auth.doSubmitterCheck(data.groups);
- }).
- error(function () {
- $rootScope.auth.currentUser = null;
- $rootScope.auth.isAuthenticated = false;
- $rootScope.auth.projectNames = [];
- });
+ if(authenticate){
+ return $http.get(profile_url, {withCredentials: true}).
+ success(function (data) {
+ $rootScope.auth.currentUser = data;
+ $rootScope.auth.isAuthenticated = true;
+ $rootScope.auth.projectNames = $rootScope.auth.doSubmitterCheck(data.groups);
+ }).
+ error(function () {
+ $rootScope.auth.currentUser = null;
+ $rootScope.auth.isAuthenticated = false;
+ $rootScope.auth.projectNames = [];
+ });
+ }else{
+ $rootScope.auth.currentUser = null;
+ $rootScope.auth.isAuthenticated = true;
+ $rootScope.auth.projectNames = []
+ }
}
function doSubmitterCheck(groups){