diff options
Diffstat (limited to 'gui')
20 files changed, 464 insertions, 569 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..d7a7edfa9 100644 --- a/gui/app/scripts/controllers/image.controller.js +++ b/gui/app/scripts/controllers/image.controller.js @@ -1,155 +1,240 @@ 'use strict'; angular.module('yardStickGui2App') - .controller('ImageController', ['$scope', '$state', '$stateParams', 'mainFactory', 'Upload', 'toaster', '$location', '$interval', - function($scope, $state, $stateParams, mainFactory, Upload, toaster, $location, $interval) { + .controller('ImageController', ['$scope', '$state', '$stateParams', 'mainFactory', 'Upload', 'toaster', '$location', '$interval', 'ngDialog', + function($scope, $state, $stateParams, mainFactory, Upload, toaster, $location, $interval, ngDialog) { init(); - $scope.showloading = false; - $scope.ifshowStatus = 0; function init() { + $scope.showloading = false; + $scope.ifshowStatus = 0; + + $scope.yardstickImage = [ + { + 'name': 'yardstick-image', + 'description': '', + 'size': 'N/A', + 'status': 'N/A', + 'time': 'N/A' + }, + { + 'name': 'Ubuntu-16.04', + 'description': '', + 'size': 'N/A', + 'status': 'N/A', + 'time': 'N/A' + }, + { + 'name': 'cirros-0.3.5', + 'description': '', + 'size': 'N/A', + 'status': 'N/A', + 'time': 'N/A' + } + ]; + $scope.customImage = []; $scope.uuid = $stateParams.uuid; - $scope.uploadImage = uploadImage; - getItemIdDetail(); - getImageListSimple(); + $scope.showloading = false; + $scope.url = null; + $scope.environmentInfo = null; + + getYardstickImageList(); + getCustomImageList(function(image, image_id){}); } - function getItemIdDetail() { + function getYardstickImageList(){ + mainFactory.ImageList().get({}).$promise.then(function(response){ + if(response.status == 1){ + angular.forEach($scope.yardstickImage, function(ele, index){ + if(typeof(response.result.images[ele.name]) != 'undefined'){ + $scope.yardstickImage[index] = response.result.images[ele.name]; + } + }); + }else{ + mainFactory.errorHandler1(response); + } + }, function(response){ + mainFactory.errorHandler2(response); + }); + } + + function getCustomImageList(func){ mainFactory.ItemDetail().get({ 'envId': $stateParams.uuid }).$promise.then(function(response) { - if (response.status == 1) { - $scope.baseElementInfo = response.result.environment; - - - } else { - toaster.pop({ - type: 'error', - title: 'fail', - body: response.error_msg, - timeout: 3000 + if(response.status == 1){ + $scope.environmentInfo = response.result.environment; + $scope.customImage = []; + angular.forEach(response.result.environment.image_id, function(ele){ + mainFactory.getImage().get({'imageId': ele}).$promise.then(function(responseData){ + if(responseData.status == 1){ + $scope.customImage.push(responseData.result.image); + func(responseData.result.image, ele); + }else{ + mainFactory.errorHandler1(responseData); + } + }, function(errorData){ + mainFactory.errorHandler2(errorData); + }); }); + }else{ + mainFactory.errorHandler1(response); } - }, function(error) { - toaster.pop({ - type: 'error', - title: 'fail', - body: 'unknow error', - timeout: 3000 - }); - }) + }, function(response){ + mainFactory.errorHandler2(response); + }); } - function getImageListSimple() { - - mainFactory.ImageList().get({}).$promise.then(function(response) { - if (response.status == 1) { - $scope.imageListData = response.result.images; - // $scope.imageStatus = response.result.status; - - } else { - toaster.pop({ - type: 'error', - title: 'get data failed', - body: 'please retry', - timeout: 3000 - }); - } - }, function(error) { - toaster.pop({ - type: 'error', - title: 'get data failed', - body: 'please retry', - timeout: 3000 + $scope.loadYardstickImage = function(image_name){ + + var updateImageTask = $interval(updateYardstickImage, 10000); + + function updateYardstickImage(){ + mainFactory.ImageList().get({}).$promise.then(function(responseData){ + if(responseData.status == 1){ + if(typeof(responseData.result.images[image_name]) != 'undefined' && responseData.result.images[image_name].status == 'ACTIVE'){ + angular.forEach($scope.yardstickImage, function(ele, index){ + if(ele.name == image_name){ + $scope.yardstickImage[index] = responseData.result.images[ele.name]; + } + }); + $interval.cancel(updateImageTask); + } + }else{ + mainFactory.errorHandler1(responseData); + } + },function(errorData){ + mainFactory.errorHandler2(errorData); }); - }) - } + } + mainFactory.uploadImage().post({'action': 'load_image', 'args': {'name': image_name}}).$promise.then(function(response){ + },function(response){ + mainFactory.errorHandler2(response); + }); + } - function getImageList() { - if ($scope.intervalImgae != undefined) { - $interval.cancel($scope.intervalImgae); - } - mainFactory.ImageList().get({}).$promise.then(function(response) { - if (response.status == 1) { - $scope.imageListData = response.result.images; - $scope.imageStatus = response.result.status; - - if ($scope.imageStatus == 0) { - $scope.intervalImgae = $interval(function() { - getImageList(); - }, 5000); - } else if ($scope.intervalImgae != undefined) { - $interval.cancel($scope.intervalImgae); + $scope.deleteYardstickImage = function(image_name){ + + var updateImageTask = $interval(updateYardstickImage, 10000); + + function updateYardstickImage(){ + mainFactory.ImageList().get({}).$promise.then(function(response){ + if(response.status == 1){ + if(typeof(response.result.images[image_name]) == 'undefined'){ + angular.forEach($scope.yardstickImage, function(ele, index){ + if(ele.name == image_name){ + $scope.yardstickImage[index].size = 'N/A'; + $scope.yardstickImage[index].status = 'N/A'; + $scope.yardstickImage[index].time = 'N/A'; + } + }); + $interval.cancel(updateImageTask); + } + }else{ + mainFactory.errorHandler1(response); } + },function(response){ + mainFactory.errorHandler2(response); + }); + } - } else { - toaster.pop({ - type: 'error', - title: 'get data failed', - body: 'please retry', - timeout: 3000 + mainFactory.uploadImage().post({'action': 'delete_image', 'args': {'name': image_name}}).$promise.then(function(response){ + },function(response){ + mainFactory.errorHandler2(response); + }); + } + + $scope.uploadCustomImageByUrl = function(url){ + mainFactory.uploadImageByUrl().post({ + 'action': 'upload_image_by_url', + 'args': { + 'environment_id': $stateParams.uuid, + 'url': url + } + }).$promise.then(function(response){ + if(response.status == 1){ + var updateImageTask = $interval(getCustomImageList, 30000, 10, true, function(image, image_id){ + if(image_id == response.result.uuid && image.status == 'ACTIVE'){ + $interval.cancel(updateImageTask); + } }); + ngDialog.close(); + }else{ + mainFactory.errorHandler1(response); } - }, function(error) { - toaster.pop({ - type: 'error', - title: 'get data failed', - body: 'please retry', - timeout: 3000 - }); - }) + }, function(response){ + mainFactory.errorHandler2(response); + }); } - function uploadImage() { - $scope.imageStatus = 0; - $interval.cancel($scope.intervalImgae); - $scope.ifshowStatus = 1; + $scope.uploadCustomImage = function($file, $invalidFiles) { $scope.showloading = true; - mainFactory.uploadImage().post({ - 'action': 'load_image', - 'args': { - 'environment_id': $scope.uuid - } - }).$promise.then(function(response) { + $scope.displayImageFile = $file; + Upload.upload({ + url: Base_URL + '/api/v2/yardstick/images', + data: { file: $file, 'environment_id': $scope.uuid, 'action': 'upload_image' } + }).then(function(response) { + $scope.showloading = false; - if (response.status == 1) { + if (response.data.status == 1) { + toaster.pop({ type: 'success', - title: 'create success', + title: 'upload success', body: 'you can go next step', timeout: 3000 }); - setTimeout(function() { - getImageList(); - }, 10000); - } else { - toaster.pop({ - type: 'error', - title: 'failed', - body: 'something wrong', - timeout: 3000 + var updateImageTask = $interval(getCustomImageList, 10000, 10, true, function(image, image_id){ + if(image_id == response.data.result.uuid && image.status == 'ACTIVE'){ + $interval.cancel(updateImageTask); + } }); + }else{ + mainFactory.errorHandler1(response); + } + }, function(response) { + $scope.uploadfile = null; + mainFactory.errorHandler2(response); + }) + } + + $scope.deleteCustomImage = function(image_id){ + mainFactory.deleteImage().delete({'imageId': image_id}).$promise.then(function(response){ + if(response.status == 1){ + $interval(getCustomImageList, 10000, 5, true, function(image, image_id){ + }); + }else{ + mainFactory.errorHandler2(response); } - }, function(error) { - toaster.pop({ - type: 'error', - title: 'failed', - body: 'something wrong', - timeout: 3000 - }); + }, function(response){ + mainFactory.errorHandler2(response); + }); + } + + $scope.openImageDialog = function(){ + $scope.url = null; + ngDialog.open({ + preCloseCallback: function(value) { + }, + template: 'views/modal/imageDialog.html', + scope: $scope, + className: 'ngdialog-theme-default', + width: 950, + showClose: true, + closeByDocument: false }) } $scope.goBack = function goBack() { - $state.go('app2.projectList'); + $state.go('app.projectList'); } $scope.goNext = function goNext() { @@ -158,9 +243,5 @@ angular.module('yardStickGui2App') $state.go('app.podUpload', { uuid: $scope.uuid }); } - - - - } ]); diff --git a/gui/app/scripts/controllers/main.js b/gui/app/scripts/controllers/main.js index e3e880e62..ceec83fa9 100644 --- a/gui/app/scripts/controllers/main.js +++ b/gui/app/scripts/controllers/main.js @@ -15,14 +15,10 @@ angular.module('yardStickGui2App') $scope.showImage = null; $scope.showContainer = null; $scope.showNextOpenRc = null; - $scope.showNextPod = null; + $scope.showNextPod = 1; $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) }); @@ -55,7 +51,6 @@ angular.module('yardStickGui2App') $scope.chooseResult = chooseResult; getEnvironmentList(); - // getImageList(); } @@ -89,7 +84,7 @@ angular.module('yardStickGui2App') } $scope.goToImage = function goToImage() { - getImageListSimple(); + getImageList(); $scope.showImage = 1; } $scope.goToPod = function goToPod() { @@ -294,7 +289,7 @@ angular.module('yardStickGui2App') $scope.showImage = null; $scope.showContainer = null; $scope.showNextOpenRc = null; - $scope.showNextPod = null; + $scope.showNextPod = 1; $scope.displayContainerInfo = []; $scope.displayPodFile = null; @@ -312,7 +307,6 @@ angular.module('yardStickGui2App') ngDialog.open({ preCloseCallback: function(value) { getEnvironmentList(); - // getImageList(); }, template: 'views/modal/environmentDialog.html', scope: $scope, @@ -381,7 +375,7 @@ angular.module('yardStickGui2App') $scope.goBack = function goBack() { - $state.go('app2.projectList'); + $state.go('app.projectList'); } $scope.displayContainerInfo = []; @@ -483,106 +477,97 @@ angular.module('yardStickGui2App') }) } - $scope.uploadImage = function uploadImage() { - $scope.imageStatus = 0; - $scope.showImageStatus = 1; - $scope.showloading = true; - mainFactory.uploadImage().post({ - 'action': 'load_image', - 'args': { - 'environment_id': $scope.uuid + $scope.yardstickImage = { + 'yardstick-image': { + 'name': 'yardstick-image', + 'description': '', + 'status': 'N/A' + }, + 'Ubuntu-16.04': { + 'name': 'Ubuntu-16.04', + 'description': '', + 'status': 'N/A' + }, + 'cirros-0.3.5': { + 'name': 'cirros-0.3.5', + 'description': '', + 'status': 'N/A' + } + }; - } - }).$promise.then(function(response) { - $scope.showloading = false; - if (response.status == 1) { - toaster.pop({ - type: 'success', - title: 'create success', - body: 'you can go next step', - timeout: 3000 - }); - setTimeout(function() { - getImageList(); - }, 10000); - $scope.showNextPod = 1; + $scope.selectImageList = []; - } else { - toaster.pop({ - type: 'error', - title: 'failed', - body: 'something wrong', - timeout: 3000 - }); + $scope.selectImage = function(name){ + $scope.selectImageList.push(name); + } - } - }, function(error) { - toaster.pop({ - type: 'error', - title: 'failed', - body: 'something wrong', - timeout: 3000 - }); - }) + $scope.unselectImage = function(name){ + var index = $scope.selectImageList.indexOf(name); + $scope.selectImageList.splice(index, 1); } - function getImageList() { - if ($scope.intervalImgae != undefined) { - $interval.cancel($scope.intervalImgae); - } - mainFactory.ImageList().get({}).$promise.then(function(response) { - if (response.status == 1) { - $scope.imageListData = response.result.images; - $scope.imageStatus = response.result.status; + $scope.uploadImage = function() { + $scope.imageStatus = 0; + $scope.showImageStatus = 1; + $scope.showloading = true; - if ($scope.imageStatus == 0) { - $scope.intervalImgae = $interval(function() { - getImageList(); - }, 5000); - } else if ($scope.intervalImgae != undefined) { - $interval.cancel($scope.intervalImgae); + var updateImageTask = $interval(function(){ + mainFactory.ImageList().get({}).$promise.then(function(response){ + if(response.status == 1){ + var isOk = true; + angular.forEach($scope.selectImageList, function(ele){ + if(typeof(response.result.images[ele]) != 'undefined' && response.result.images[ele].status == 'ACTIVE'){ + $scope.yardstickImage[ele] = response.result.images[ele]; + }else{ + isOk = false; + } + }); + if(isOk){ + $interval.cancel(updateImageTask); + $scope.imageStatus = 1; + } + }else{ + mainFactory.errorHandler1(response); } - - } else { - toaster.pop({ - type: 'error', - title: 'get data failed', - body: 'please retry', - timeout: 3000 - }); - } - }, function(error) { - toaster.pop({ - type: 'error', - title: 'get data failed', - body: 'please retry', - timeout: 3000 + }, function(response){ + mainFactory.errorHandler2(response); }); - }) + }, 10000); + + angular.forEach($scope.selectImageList, function(ele){ + mainFactory.uploadImage().post({ + 'action': 'load_image', + 'args': { + 'name': ele + } + }).$promise.then(function(response) { + if(response.status == 1){ + $scope.showloading = false; + $scope.showNextPod = 1; + }else{ + mainFactory.errorHandler1(response); + } + }, function(response) { + mainFactory.errorHandler2(response); + }) + }); } - function getImageListSimple() { + function getImageList() { mainFactory.ImageList().get({}).$promise.then(function(response) { if (response.status == 1) { - $scope.imageListData = response.result.images; - $scope.imageStatus = response.result.status; - - } else { - toaster.pop({ - type: 'error', - title: 'get data failed', - body: 'please retry', - timeout: 3000 + angular.forEach($scope.yardstickImage, function(value, key){ + if(typeof(response.result.images[key]) != 'undefined'){ + $scope.yardstickImage[key] = response.result.images[key]; + } }); + $scope.imageStatus = response.result.status; + }else{ + mainFactory.errorHandler1(response); } - }, function(error) { - toaster.pop({ - type: 'error', - title: 'get data failed', - body: 'please retry', - timeout: 3000 - }); + }, function(response) { + mainFactory.errorHandler2(response); }) } 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 a616f3ee7..e8468045d 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() { @@ -672,7 +672,7 @@ angular.module('yardStickGui2App') } $scope.gotoLog = function gotoLog(task_id) { - $state.go('app2.taskLog', { taskId: task_id }); + $state.go('app.taskLog', { taskId: task_id }); } } ]); 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 44fbeb39f..7637a9ff3 100644 --- a/gui/app/scripts/factory/main.factory.js +++ b/gui/app/scripts/factory/main.factory.js @@ -9,7 +9,7 @@ var Base_URL; var Grafana_URL; angular.module('yardStickGui2App') - .factory('mainFactory', ['$resource','$rootScope','$http', '$location',function($resource, $rootScope,$http,$location) { + .factory('mainFactory', ['$resource','$rootScope','$http', '$location', 'toaster',function($resource, $rootScope ,$http ,$location, toaster) { Base_URL = 'http://' + $location.host() + ':' + $location.port(); Grafana_URL = 'http://' + $location.host(); @@ -86,6 +86,20 @@ angular.module('yardStickGui2App') } }) }, + getImage: function(){ + return $resource(Base_URL + '/api/v2/yardstick/images/:imageId', {imageId: "@imageId"}, { + 'get': { + method: 'GET' + } + }) + }, + deleteImage: function() { + return $resource(Base_URL + '/api/v2/yardstick/images/:imageId', { imageId: '@imageId' }, { + 'delete': { + method: 'DELETE' + } + }) + }, uploadImage: function() { return $resource(Base_URL + '/api/v2/yardstick/images', {}, { 'post': { @@ -93,6 +107,13 @@ angular.module('yardStickGui2App') } }) }, + uploadImageByUrl: function() { + return $resource(Base_URL + '/api/v2/yardstick/images', {}, { + 'post': { + method: 'POST' + } + }) + }, getPodDetail: function() { return $resource(Base_URL + '/api/v2/yardstick/pods/:podId', { podId: "@podId" }, { 'get': { @@ -249,6 +270,22 @@ angular.module('yardStickGui2App') method: 'DELETE' } }) + }, + errorHandler1: function(response){ + toaster.pop({ + 'type': 'error', + 'title': 'error', + 'body': response.result, + 'showCloseButton': true + }); + }, + errorHandler2: function(response){ + toaster.pop({ + 'type': 'error', + 'title': response.status, + 'body': response.statusText, + 'showCloseButton': true + }); } }; diff --git a/gui/app/scripts/router.config.js b/gui/app/scripts/router.config.js index 9d3c045bd..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,7 @@ angular.module('yardStickGui2App') } }) - .state('app2.taskLog', { + .state('app.taskLog', { url: '/task/:taskId/log', templateUrl: 'views/taskLog.html', controller: 'TaskLogController', @@ -153,7 +145,7 @@ angular.module('yardStickGui2App') } }) - .state('app2.report', { + .state('app.report', { url: '/report/:taskId', templateUrl: 'views/report.html', controller: 'ReportController', @@ -163,7 +155,7 @@ angular.module('yardStickGui2App') } }) - .state('app2.projectdetail', { + .state('app.projectdetail', { url: '/projectdetail/:projectId', templateUrl: 'views/projectdetail.html', controller: 'ProjectDetailController', @@ -173,7 +165,7 @@ angular.module('yardStickGui2App') } }) - .state('app2.taskModify', { + .state('app.taskModify', { url: '/taskModify/:taskId', templateUrl: 'views/taskmodify.html', controller: 'TaskModifyController', diff --git a/gui/app/styles/main.css b/gui/app/styles/main.css index e13a66bce..d2ea8ba42 100644 --- a/gui/app/styles/main.css +++ b/gui/app/styles/main.css @@ -20,6 +20,8 @@ body { } + + /* Custom page header */ .header { @@ -206,3 +208,7 @@ input:focus{outline: 0} overflow: hidden; } +.bs-sidenav{ + margin-top:21px !important; +} + diff --git a/gui/app/views/layout/sideNav.html b/gui/app/views/layout/sideNav.html index 4fc99cd4f..6c4426307 100644 --- a/gui/app/views/layout/sideNav.html +++ b/gui/app/views/layout/sideNav.html @@ -18,7 +18,7 @@ </div> </div> - <div class="panel-group" role="tablist" aria-multiselectable="true" bs-collapse style="margin-bottom:0px;" ng-model="activeStatus"> + <div class="panel-group" role="tablist" aria-multiselectable="true" bs-collapse style="margin-bottom:0px;" ng-model="activeStatus" ng-if="ifshowEnvChild"> <div class="panel panel-default"> <div class="panel-heading" role="tab"> <h4 class="panel-title"> @@ -48,6 +48,19 @@ </div> </div> </div> + <div class="panel-group" role="tablist" aria-multiselectable="false" bs-collapse style="margin-bottom:0px;" ng-if="!ifshowEnvChild"> + <div class="panel panel-default"> + <div class="panel-heading" role="tab"> + <h4 class="panel-title"> + <a bs-collapse-toggle style=" text-decoration: none;"> + <div style="display:inline;" ng-click="gotoEnviron()">Environment </div> + <!--<i class="fa fa-sort-asc" aria-hidden="true" style="margin-left: 71px;display:inline"></i>--> + </a> + </h4> + </div> + + </div> + </div> <div class="panel-group " role="tablist " aria-multiselectable="true " bs-collapse style="margin-bottom:0px; "> <div class="panel panel-default "> @@ -138,4 +151,4 @@ .active.panel-body { background-color: #dfe3e4; } -</style> +</style>
\ No newline at end of file diff --git a/gui/app/views/layout/sideNav2.html b/gui/app/views/layout/sideNav2.html deleted file mode 100644 index 93e0de4be..000000000 --- a/gui/app/views/layout/sideNav2.html +++ /dev/null @@ -1,108 +0,0 @@ -<div class="naviSide"> - - - <ul class="nav bs-sidenav"> - - <div class="panel-group " role="tablist " aria-multiselectable="true " bs-collapse style="margin-bottom:0px; "> - <div class="panel panel-default "> - <div class="panel-heading " role="tab "> - <h4 class="panel-title "> - <a bs-collapse-toggle style=" text-decoration: none;" ng-click="gotoProject();"> - Project - </a> - </h4> - - </div> - - </div> - </div> - <div class="panel-group" role="tablist" aria-multiselectable="false" bs-collapse style="margin-bottom:0px;"> - <div class="panel panel-default"> - <div class="panel-heading" role="tab"> - <h4 class="panel-title"> - <a bs-collapse-toggle style=" text-decoration: none;"> - <div style="display:inline;" ng-click="gotoEnviron()">Environment </div> - <!--<i class="fa fa-sort-asc" aria-hidden="true" style="margin-left: 71px;display:inline"></i>--> - </a> - </h4> - </div> - - </div> - </div> - - <div class="panel-group " role="tablist " aria-multiselectable="true " bs-collapse style="margin-bottom:0px; "> - <div class="panel panel-default "> - <div class="panel-heading " role="tab "> - <h4 class="panel-title "> - <a bs-collapse-toggle style=" text-decoration: none;" ng-click="gotoTestcase()"> - Test Case - </a> - </h4> - - </div> - - </div> - </div> - - <div class="panel-group " role="tablist " aria-multiselectable="true " bs-collapse style="margin-bottom:0px; "> - <div class="panel panel-default "> - <div class="panel-heading " role="tab "> - <h4 class="panel-title "> - <a bs-collapse-toggle style=" text-decoration: none;" ng-click="gotoSuite()"> - Test Suite - </a> - </h4> - - </div> - - </div> - </div> - - - - </ul> - -</div> - -<style> - .bs-sidenav { - margin-top: 21px; - margin-bottom: 20px; - width: 124px; - } - - .nav { - margin-bottom: 0; - padding-left: 0; - list-style: none; - } - - .nav>li { - position: relative; - display: block; - } - - li { - display: list-item; - text-align: -webkit-match-parent; - } - - a { - cursor: pointer; - } - - a.active { - background-color: #EEEEEE; - border-radius: 5px; - width: 165px; - } - /*a:hover { - width: 165px; - }*/ - - .nav>li>a:hover, - .nav>li>a:focus { - text-decoration: underline; - background-color: transparent; - } -</style> diff --git a/gui/app/views/main2.html b/gui/app/views/main2.html deleted file mode 100644 index 3f49e82e0..000000000 --- a/gui/app/views/main2.html +++ /dev/null @@ -1,174 +0,0 @@ -<div> - <div ng-include="'views/layout/header.html'"></div> -</div> -<div ng-include="'views/layout/sideNav2.html'"></div> - - -<div style="margin-top:80px;margin-left:220px;"> - <!--<div ncy-breadcrumb></div>--> - <div> - <ol class="progressDefine"> - <li data-step="1" ng-click="gotoProject();" style="cursor:pointer" ng-class="{'is-complete':projectShow}"> - Project - </li> - <li data-step="2" ng-class="{'is-complete':taskShow}"> - Task - </li> - - <li data-step="3" ng-class="{'is-complete':reportShow}"> - Reporting - </li> - - </ol> - </div> - - -</div> - - - - - - - - - -<div ui-view></div> - - - -<style> - .stepsContent { - display: flex; - flex-direction: row; - justify-content: space-around; - margin-left: 120px; - margin-top: 100px; - } - - .stepItem { - display: flex; - flex-direction: column; - } - - .nextButton { - margin-left: 500px; - } - - .progressDefine { - list-style: none; - margin: 0; - padding: 0; - display: table; - table-layout: fixed; - width: 100%; - color: #849397; - } - - .progressDefine>li { - position: relative; - display: table-cell; - text-align: center; - font-size: 0.8em; - } - - .progressDefine>li:before { - content: attr(data-step); - display: block; - margin: 0 auto; - background: #DFE3E4; - width: 3em; - height: 3em; - text-align: center; - margin-bottom: 0.25em; - line-height: 3em; - border-radius: 100%; - position: relative; - z-index: 5; - } - - .progressDefine>li:after { - content: ''; - position: absolute; - display: block; - background: #DFE3E4; - width: 100%; - height: 0.5em; - top: 1.25em; - left: 50%; - margin-left: 1.5em\9; - z-index: -1; - } - - .progressDefine>li:last-child:after { - display: none; - } - - .progressDefine>li.is-complete { - color: #4dc5cf; - } - - .progressDefine>li.is-complete:before, - .progressDefine>li.is-complete:after { - color: #FFF; - background: #4dc5cf; - } - - .progressDefine>li.is-active { - color: #3498DB; - } - - .progressDefine>li.is-active:before { - color: #FFF; - background: #3498DB; - } - /** - * Needed for IE8 - */ - - .progressDefine__last:after { - display: none !important; - } - /** - * Size Extensions - */ - - .progressDefine--medium { - font-size: 1.5em; - } - - .progressDefine--large { - font-size: 2em; - } - /** - * Some Generic Stylings - */ - - *, - *:after, - *:before { - box-sizing: border-box; - } - - h1 { - margin-bottom: 1.5em; - } - - .progressDefine { - margin-bottom: 3em; - } - - a { - color: #3498DB; - text-decoration: none; - } - - a:hover { - text-decoration: underline; - } - /* - body { - text-align: center; - color: #444; - }*/ -</style> diff --git a/gui/app/views/modal/environmentDialog.html b/gui/app/views/modal/environmentDialog.html index 389de8340..4c539fc33 100644 --- a/gui/app/views/modal/environmentDialog.html +++ b/gui/app/views/modal/environmentDialog.html @@ -133,16 +133,17 @@ <table class="table table-striped"> <tr> + <th>choose</th> <th>name</th> - <th>size</th> + <th>description</th> <th>status</th> - <th>time</th> </tr> - <tr ng-repeat="image in imageListData"> - <td>{{image.name}}</td> - <td>{{image.size/1024}} mb</td> - <td>{{image.status}}</td> - <td>{{image.time}}</td> + <tr ng-repeat="(name, value) in yardstickImage"> + <td ng-if="selectImageList.indexOf(name) > -1"><img src="images/checkyes.png" style="height:12px;cursor:pointer" ng-click="unselectImage(name)" /></td> + <td ng-if="selectImageList.indexOf(name) == -1"><img src="images/checkno.png" style="height:12px;cursor:pointer" ng-click="selectImage(name)" /></td> + <td>{{name}}</td> + <td>{{value.description}}</td> + <td>{{value.status}}</td> </tr> diff --git a/gui/app/views/modal/imageDialog.html b/gui/app/views/modal/imageDialog.html new file mode 100644 index 000000000..c568f2aba --- /dev/null +++ b/gui/app/views/modal/imageDialog.html @@ -0,0 +1,19 @@ +<div> + + <h4>Enter Remote Image Url</h4> + <input type="text" ng-model="url" /> + + <div style="text-align:center;margin-top:20px;"> + <button class="btn btn-default" ng-disabled=" url==null || url==''" ng-click="uploadCustomImageByUrl(url)">Upload</button> + </div> + +</div> + + +<style> + input { + border-radius: 10px; + border: 1px solid #eeeeee; + width: 100%; + } +</style> diff --git a/gui/app/views/podupload.html b/gui/app/views/podupload.html index 99e83aca2..d6d7c0c6e 100644 --- a/gui/app/views/podupload.html +++ b/gui/app/views/podupload.html @@ -13,7 +13,7 @@ <hr/> - <button class="btn btn-default" ngf-select="uploadFiles($file, $invalidFiles)" ngf-max-size="5MB"> + <button class="btn btn-default" ngf-select="uploadFiles($file, $invalidFiles)" ngf-max-size="1024MB"> <div ng-show="!loadingOPENrc">Upload</div> <img src="images/loading2.gif" width="25" height="25" ng-if="loadingOPENrc" /> </button> diff --git a/gui/app/views/uploadImage.html b/gui/app/views/uploadImage.html index 17ccfdb8b..0c337feeb 100644 --- a/gui/app/views/uploadImage.html +++ b/gui/app/views/uploadImage.html @@ -4,56 +4,86 @@ <div style="display:flex;flex-direction:row;"> <div style="width:750px;"> - <h3>{{baseElementInfo.name}} -- Image + <h3>{{environmentInfo.name}} -- Image <button class="btn btn-default" style="float:right" ng-click="goNext()">Next</button> </h3> <!--<p>In this process, you can input your define openrc config or upload a openrc file</p>--> - <hr/> - <button class="btn btn-default" ng-click="uploadImage()"> - <div ng-if="!showloading">Load Image</div> - <img src="images/loading2.gif" width="25" height="25" ng-if="showloading" /> - </button> - <i class="fa fa-check" aria-hidden="true" style="margin-top:34px;margin-left:5px;color: #2ecc71;" ng-show="imageStatus==1&&ifshowStatus==1">done</i> - <i class="fa fa-spinner" aria-hidden="true" style="margin-top:34px;margin-left:5px;color: #2ecc71;" ng-show="imageStatus==0&&ifshowStatus==1">loading</i> - <i class="fa fa-exclamation-triangle" aria-hidden="true" style="margin-top:34px;margin-left:5px;color: red;" ng-show="imageStatus==2&&ifshowStatus==1">error</i> - <hr> - <h4>Current Images</h4> - + <h4>Alternative Images</h4> <div> <table class="table table-striped"> <tr> <th>name</th> + <th>description</th> <th>size</th> <th>status</th> <th>time</th> + <th>action</th> </tr> - <tr ng-repeat="image in imageListData"> + <tr ng-repeat="image in yardstickImage"> <td>{{image.name}}</td> - <td>{{image.size/1024}} MB</td> + <td>{{image.description}}</td> + <td>{{image.size | number:2}} MB</td> <td>{{image.status}}</td> <td>{{image.time}}</td> - + <td> + <div class="btn-group" uib-dropdown> + <button id="single-button" type="button" class="btn btn-default btn-sm" uib-dropdown-toggle> + action<span class="caret"></span> + </button> + <ul class="dropdown-menu" uib-dropdown-menu role="menu" aria-labelledby="single-button"> + <li role="menuitem" ng-show="image.status == 'N/A'"><a ng-click="loadYardstickImage(image.name)">load</a></li> + <li role="menuitem" ng-show="image.status != 'N/A'"><a ng-click="deleteYardstickImage(image.name)">delete</a></li> + </ul> + </div> + </td> </tr> - - - </table> </div> + <hr> + <h4 style="display:inline">Custom Images</h4> + <div class="btn-group button-margin" style="float:right;margin-top:-10px;margin-bottom:5px"> + <button class="btn btn-default" style="width:60px" ngf-select="uploadCustomImage($file, $invalidFiles)" ngf-max-size="2048MB"> + <div ng-show="!showloading">Local</div> + <img src="images/loading2.gif" width="25" height="25" ng-if="showloading" /> + </button> + <button class="btn btn-default" style="width:60px" ng-click="openImageDialog()">Url</button> + </div> + <div> + <table class="table table-striped"> - - - - - - + <tr> + <th>name</th> + <th>description</th> + <th>size</th> + <th>status</th> + <th>time</th> + <th>action</th> + </tr> + <tr ng-repeat="image in customImage"> + <td>{{image.name}}</td> + <td>{{image.description}}</td> + <td>{{image.size | number:2}} MB</td> + <td>{{image.status}}</td> + <td>{{image.time}}</td> + <td> + <div class="btn-group" uib-dropdown> + <button id="single-button" type="button" class="btn btn-default btn-sm" uib-dropdown-toggle> + action<span class="caret"></span> + </button> + <ul class="dropdown-menu" uib-dropdown-menu role="menu" aria-labelledby="single-button"> + <li role="menuitem" ><a ng-click="deleteCustomImage(image.id)">delete</a></li> + </ul> + </div> + </td> + </tr> + </table> + </div> </div> - - </div> </div> |