diff options
Diffstat (limited to 'gui/app/scripts')
-rw-r--r-- | gui/app/scripts/controllers/container.controller.js | 2 | ||||
-rw-r--r-- | gui/app/scripts/controllers/content.controller.js | 30 | ||||
-rw-r--r-- | gui/app/scripts/controllers/detail.controller.js | 5 | ||||
-rw-r--r-- | gui/app/scripts/controllers/image.controller.js | 2 | ||||
-rw-r--r-- | gui/app/scripts/controllers/main.js | 8 | ||||
-rw-r--r-- | gui/app/scripts/controllers/pod.controller.js | 2 | ||||
-rw-r--r-- | gui/app/scripts/controllers/project.controller.js | 2 | ||||
-rw-r--r-- | gui/app/scripts/controllers/projectDetail.controller.js | 26 | ||||
-rw-r--r-- | gui/app/scripts/controllers/taskLog.controller.js | 34 | ||||
-rw-r--r-- | gui/app/scripts/controllers/testcase.controller.js | 4 | ||||
-rw-r--r-- | gui/app/scripts/controllers/testsuit.controller.js | 6 | ||||
-rw-r--r-- | gui/app/scripts/factory/main.factory.js | 8 | ||||
-rw-r--r-- | gui/app/scripts/router.config.js | 40 |
13 files changed, 105 insertions, 64 deletions
diff --git a/gui/app/scripts/controllers/container.controller.js b/gui/app/scripts/controllers/container.controller.js index 6c2ccd8ff..3ad200a91 100644 --- a/gui/app/scripts/controllers/container.controller.js +++ b/gui/app/scripts/controllers/container.controller.js @@ -128,7 +128,7 @@ angular.module('yardStickGui2App') $scope.selectContainer = name; } $scope.goBack = function goBack() { - $state.go('app2.projectList'); + $state.go('app.projectList'); } $scope.openDeleteEnv = function openDeleteEnv(id, name) { diff --git a/gui/app/scripts/controllers/content.controller.js b/gui/app/scripts/controllers/content.controller.js index d2bc19eea..0288fa540 100644 --- a/gui/app/scripts/controllers/content.controller.js +++ b/gui/app/scripts/controllers/content.controller.js @@ -2,7 +2,7 @@ angular.module('yardStickGui2App') .controller('ContentController', ['$scope', '$state', '$stateParams', 'mainFactory', 'Upload', 'toaster', '$location', '$localStorage', - function($scope, $state, $stateParams, mainFactory, Upload, toaster, $location, $localStorage) { + function ($scope, $state, $stateParams, mainFactory, Upload, toaster, $location, $localStorage) { @@ -11,10 +11,11 @@ angular.module('yardStickGui2App') $scope.showEnvironment = false; $scope.counldGoDetail = false; $scope.activeStatus = 0; + $scope.ifshowEnvChild = false; - $scope.$watch(function() { + $scope.$watch(function () { return location.hash - }, function(newvalue, oldvalue) { + }, function (newvalue, oldvalue) { if (location.hash.indexOf('project') > -1) { $scope.projectShow = true; $scope.taskShow = false; @@ -26,6 +27,13 @@ angular.module('yardStickGui2App') $scope.reportShow = true; $scope.taskShow = true; $scope.projectShow = true; + } else if (location.hash.indexOf('envDetail') > -1 || location.hash.indexOf('envimageDetail') > -1 || + location.hash.indexOf('envpodupload') > -1 || location.hash.indexOf('envcontainer') > -1) { + $scope.ifshowEnvChild = true; + $scope.activeStatus=0; + }else{ + $scope.ifshowEnvChild=false; + $scope.activeStatus=-1; } }) @@ -88,30 +96,30 @@ angular.module('yardStickGui2App') } function gotoTestcase() { - $state.go('app2.testcase'); + $state.go('app.testcase'); } function gotoEnviron() { if ($location.path().indexOf('env') > -1 || $location.path().indexOf('environment') > -1) { $scope.counldGoDetail = true; } - $state.go('app2.environment'); + $state.go('app.environment'); } function gotoSuite() { - $state.go('app2.testsuite'); + $state.go('app.testsuite'); } function gotoProject() { - $state.go('app2.projectList'); + $state.go('app.projectList'); } function gotoTask() { - $state.go('app2.tasklist'); + $state.go('app.tasklist'); } function gotoReport() { - $state.go('app2.report'); + $state.go('app.report'); } function goBack() { @@ -119,7 +127,7 @@ angular.module('yardStickGui2App') return; } else if ($location.path().indexOf('main/envDetail/') || $location.path().indexOf('main/imageDetail/') || $location.path().indexOf('main/podupload/') || $location.path().indexOf('main/container/')) { - $state.go('app2.environment'); + $state.go('app.environment'); return; } else { window.history.back(); @@ -133,4 +141,4 @@ angular.module('yardStickGui2App') } - ]);
\ No newline at end of file + ]); diff --git a/gui/app/scripts/controllers/detail.controller.js b/gui/app/scripts/controllers/detail.controller.js index 3e2eaa100..bfdb525f7 100644 --- a/gui/app/scripts/controllers/detail.controller.js +++ b/gui/app/scripts/controllers/detail.controller.js @@ -108,6 +108,7 @@ angular.module('yardStickGui2App') //buildtoEnvInfo function buildToEnvInfo(object) { + $scope.envInfo=[]; var tempKeyArray = Object.keys(object); for (var i = 0; i < tempKeyArray.length; i++) { @@ -118,7 +119,11 @@ angular.module('yardStickGui2App') value: tempValue }; $scope.envInfo.push(temp); + } + + console.log($scope.envInfo); + console.log($scope.openrcInfo); } function uploadFiles($file, $invalidFiles) { diff --git a/gui/app/scripts/controllers/image.controller.js b/gui/app/scripts/controllers/image.controller.js index 53acff405..f6c91592f 100644 --- a/gui/app/scripts/controllers/image.controller.js +++ b/gui/app/scripts/controllers/image.controller.js @@ -149,7 +149,7 @@ angular.module('yardStickGui2App') } $scope.goBack = function goBack() { - $state.go('app2.projectList'); + $state.go('app.projectList'); } $scope.goNext = function goNext() { diff --git a/gui/app/scripts/controllers/main.js b/gui/app/scripts/controllers/main.js index e3e880e62..ab76bf0f2 100644 --- a/gui/app/scripts/controllers/main.js +++ b/gui/app/scripts/controllers/main.js @@ -18,11 +18,7 @@ angular.module('yardStickGui2App') $scope.showNextPod = null; $scope.displayContainerInfo = []; $scope.containerList = [{ value: 'create_influxdb', name: "InfluxDB" }, { value: 'create_grafana', name: "Grafana" }] - $scope.items = [ - 'The first choice!', - 'And another choice for you.', - 'but wait! A third!' - ]; + $scope.$on('$destroy', function() { $interval.cancel($scope.intervalImgae) }); @@ -381,7 +377,7 @@ angular.module('yardStickGui2App') $scope.goBack = function goBack() { - $state.go('app2.projectList'); + $state.go('app.projectList'); } $scope.displayContainerInfo = []; diff --git a/gui/app/scripts/controllers/pod.controller.js b/gui/app/scripts/controllers/pod.controller.js index 3ef236854..56dfee148 100644 --- a/gui/app/scripts/controllers/pod.controller.js +++ b/gui/app/scripts/controllers/pod.controller.js @@ -113,7 +113,7 @@ angular.module('yardStickGui2App') } $scope.goBack = function goBack() { - $state.go('app2.projectList'); + $state.go('app.projectList'); } diff --git a/gui/app/scripts/controllers/project.controller.js b/gui/app/scripts/controllers/project.controller.js index 0a7b8b932..197474567 100644 --- a/gui/app/scripts/controllers/project.controller.js +++ b/gui/app/scripts/controllers/project.controller.js @@ -91,7 +91,7 @@ angular.module('yardStickGui2App') } function gotoDetail(id) { - $state.go('app2.projectdetail', { projectId: id }) + $state.go('app.projectdetail', { projectId: id }) } diff --git a/gui/app/scripts/controllers/projectDetail.controller.js b/gui/app/scripts/controllers/projectDetail.controller.js index 4ab4a055a..843f66c57 100644 --- a/gui/app/scripts/controllers/projectDetail.controller.js +++ b/gui/app/scripts/controllers/projectDetail.controller.js @@ -606,16 +606,16 @@ angular.module('yardStickGui2App') function gotoDetail(id) { - $state.go('app2.tasklist', { taskId: id }); + $state.go('app.tasklist', { taskId: id }); } function gotoReport(id) { - $state.go('app2.report', { taskId: id }); + $state.go('app.report', { taskId: id }); } function gotoModify(id) { - $state.go('app2.taskModify', { taskId: id }); + $state.go('app.taskModify', { taskId: id }); } function goBack() { @@ -671,20 +671,8 @@ angular.module('yardStickGui2App') }) } - - - - - - - - - - - - - - - + $scope.gotoLog = function gotoLog(task_id) { + $state.go('app2.taskLog', { taskId: task_id }); + } } - ]);
\ No newline at end of file + ]); diff --git a/gui/app/scripts/controllers/taskLog.controller.js b/gui/app/scripts/controllers/taskLog.controller.js new file mode 100644 index 000000000..17722b7da --- /dev/null +++ b/gui/app/scripts/controllers/taskLog.controller.js @@ -0,0 +1,34 @@ +'use strict'; + +angular.module('yardStickGui2App').controller('TaskLogController', ['$scope', '$stateParams', '$http', '$interval', 'mainFactory', function ($scope, $stateParams, $http, $interval, mainFactory) { + $scope.logLines = []; + $scope.getLog = getLog; + $scope.taskId = $stateParams.taskId; + $scope.taskStatus = 0; + $scope.index = 0; + + $scope.goBack = function goBack() { + window.history.back(); + } + + function getLog(){ + + function get_data(){ + mainFactory.getTaskLog().get({'taskId': $scope.taskId, 'index': $scope.index}).$promise.then(function(data){ + angular.forEach(data.result.data, function(ele){ + $scope.logLines.push(ele); + $scope.index = data.result.index; + }); + + if(data.status == 1){ + $interval.cancel($scope.intervalTask); + $scope.taskStatus = 1; + } + }); + } + + $scope.intervalTask = $interval(get_data, 2000); + } + + getLog(); +}]); diff --git a/gui/app/scripts/controllers/testcase.controller.js b/gui/app/scripts/controllers/testcase.controller.js index 616ceb4a8..c93fd8cb0 100644 --- a/gui/app/scripts/controllers/testcase.controller.js +++ b/gui/app/scripts/controllers/testcase.controller.js @@ -41,7 +41,7 @@ angular.module('yardStickGui2App') } function gotoDetail(name) { - $state.go('app2.testcasedetail', { name: name }); + $state.go('app.testcasedetail', { name: name }); } @@ -93,7 +93,7 @@ angular.module('yardStickGui2App') } $scope.goBack = function goBack() { - $state.go('app2.projectList'); + $state.go('app.projectList'); } $scope.openDeleteEnv = function openDeleteEnv(id, name) { diff --git a/gui/app/scripts/controllers/testsuit.controller.js b/gui/app/scripts/controllers/testsuit.controller.js index abc9095c7..a15daa776 100644 --- a/gui/app/scripts/controllers/testsuit.controller.js +++ b/gui/app/scripts/controllers/testsuit.controller.js @@ -41,16 +41,16 @@ angular.module('yardStickGui2App') function gotoDetail(name) { var temp = name.split('.')[0]; - $state.go('app2.suitedetail', { name: temp }) + $state.go('app.suitedetail', { name: temp }) } function gotoCreateSuite() { - $state.go('app2.suitcreate'); + $state.go('app.suitcreate'); } $scope.goBack = function goBack() { - $state.go('app2.projectList'); + $state.go('app.projectList'); } diff --git a/gui/app/scripts/factory/main.factory.js b/gui/app/scripts/factory/main.factory.js index f8e9df9a1..44fbeb39f 100644 --- a/gui/app/scripts/factory/main.factory.js +++ b/gui/app/scripts/factory/main.factory.js @@ -178,6 +178,14 @@ angular.module('yardStickGui2App') }) }, + getTaskLog: function(){ + return $resource(Base_URL + '/api/v2/yardstick/tasks/:taskId/log?index=:index', { taskId: "@taskId", index: "@index" }, { + 'get': { + method: 'GET' + } + }) + }, + taskAddEnv: function() { return $resource(Base_URL + '/api/v2/yardstick/tasks/:taskId', { taskId: "@taskId" }, { 'put': { diff --git a/gui/app/scripts/router.config.js b/gui/app/scripts/router.config.js index b42954272..da2eb086b 100644 --- a/gui/app/scripts/router.config.js +++ b/gui/app/scripts/router.config.js @@ -20,14 +20,6 @@ angular.module('yardStickGui2App') $stateProvider - .state('app2', { - url: "/main", - controller: 'ContentController', - templateUrl: "views/main2.html", - ncyBreadcrumb: { - label: 'Main' - } - }) .state('app', { url: "/main", controller: 'ContentController', @@ -37,7 +29,7 @@ angular.module('yardStickGui2App') } }) - .state('app2.environment', { + .state('app.environment', { url: '/environment', templateUrl: 'views/environmentList.html', controller: 'MainCtrl', @@ -45,7 +37,7 @@ angular.module('yardStickGui2App') label: 'Environment' } }) - .state('app2.testcase', { + .state('app.testcase', { url: '/testcase', templateUrl: 'views/testcaselist.html', controller: 'TestcaseController', @@ -53,7 +45,7 @@ angular.module('yardStickGui2App') label: 'Test Case' } }) - .state('app2.testsuite', { + .state('app.testsuite', { url: '/suite', templateUrl: 'views/suite.html', controller: 'SuiteListController', @@ -61,7 +53,7 @@ angular.module('yardStickGui2App') label: 'Test Suite' } }) - .state('app2.suitcreate', { + .state('app.suitcreate', { url: '/suitcreate', templateUrl: 'views/testcasechoose.html', controller: 'suitcreateController', @@ -69,7 +61,7 @@ angular.module('yardStickGui2App') label: 'Suite Create' } }) - .state('app2.testcasedetail', { + .state('app.testcasedetail', { url: '/testdetail/:name', templateUrl: 'views/testcasedetail.html', controller: 'testcaseDetailController', @@ -78,7 +70,7 @@ angular.module('yardStickGui2App') }, params: { name: null } }) - .state('app2.suitedetail', { + .state('app.suitedetail', { url: '/suitedetail/:name', templateUrl: 'views/suitedetail.html', controller: 'suiteDetailController', @@ -124,7 +116,7 @@ angular.module('yardStickGui2App') label: 'Container Manage' } }) - .state('app2.projectList', { + .state('app.projectList', { url: '/project', templateUrl: 'views/projectList.html', controller: 'ProjectController', @@ -133,7 +125,7 @@ angular.module('yardStickGui2App') } }) - .state('app2.tasklist', { + .state('app.tasklist', { url: '/task/:taskId', templateUrl: 'views/taskList.html', controller: 'TaskController', @@ -143,7 +135,17 @@ angular.module('yardStickGui2App') } }) - .state('app2.report', { + .state('app.taskLog', { + url: '/task/:taskId/log', + templateUrl: 'views/taskLog.html', + controller: 'TaskLogController', + params: { taskId: null }, + ncyBreadcrumb: { + label: 'TaskLog' + } + + }) + .state('app.report', { url: '/report/:taskId', templateUrl: 'views/report.html', controller: 'ReportController', @@ -153,7 +155,7 @@ angular.module('yardStickGui2App') } }) - .state('app2.projectdetail', { + .state('app.projectdetail', { url: '/projectdetail/:projectId', templateUrl: 'views/projectdetail.html', controller: 'ProjectDetailController', @@ -163,7 +165,7 @@ angular.module('yardStickGui2App') } }) - .state('app2.taskModify', { + .state('app.taskModify', { url: '/taskModify/:taskId', templateUrl: 'views/taskmodify.html', controller: 'TaskModifyController', |