X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=utils%2Ftest%2Ftestapi%2F3rd_party%2Fstatic%2Ftestapi-ui%2Fcomponents%2Fpods%2FpodsController.js;h=894fcc152efd543793e4cb44b661113885c93675;hb=9e686dafc73f390c13ca05bbeea7f7729aa57f38;hp=53e8b1efffc18d323a8d3da8b5fda94f7e107041;hpb=ede0336258973c16ec2ba557ec7c8a2bc2cc8168;p=releng.git diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/components/pods/podsController.js b/utils/test/testapi/3rd_party/static/testapi-ui/components/pods/podsController.js index 53e8b1eff..894fcc152 100644 --- a/utils/test/testapi/3rd_party/static/testapi-ui/components/pods/podsController.js +++ b/utils/test/testapi/3rd_party/static/testapi-ui/components/pods/podsController.js @@ -20,7 +20,7 @@ .controller('PodsController', PodsController); PodsController.$inject = [ - '$scope', '$http', '$filter', '$state', 'testapiApiUrl','raiseAlert' + '$rootScope', '$scope', '$http', '$filter', '$state', 'testapiApiUrl','raiseAlert' ]; /** @@ -31,7 +31,6 @@ function PodsController($scope, $http, $filter, $state, testapiApiUrl, raiseAlert) { var ctrl = this; - ctrl.url = testapiApiUrl + '/pods'; ctrl.create = create; @@ -53,9 +52,6 @@ ctrl.mode = 'metal'; ctrl.details = ''; - ctrl.pageHeader = 'Pods'; - ctrl.pageParagraph = 'This page is used to create or query pods.'; - /** * This is called when the date filter calendar is opened. It * does some event handling, and sets a scope variable so the UI @@ -82,21 +78,27 @@ */ function create() { ctrl.showError = false; - var pods_url = ctrl.url; - var body = { - name: ctrl.name, - mode: ctrl.mode, - role: ctrl.role, - details: ctrl.details - }; - ctrl.podsRequest = - $http.post(pods_url, body).error(function (error) { - ctrl.showError = true; - ctrl.error = - 'Error creating the new pod from server: ' + - angular.toJson(error); - }); + if(ctrl.name != ""){ + var pods_url = ctrl.url; + var body = { + name: ctrl.name, + mode: ctrl.mode, + role: ctrl.role, + details: ctrl.details + }; + ctrl.podsRequest = + $http.post(pods_url, body).error(function (error) { + ctrl.showError = true; + ctrl.error = + 'Error creating the new pod from server: ' + + angular.toJson(error); + }); + } + else{ + ctrl.showError = true; + ctrl.error = 'Name is missing.' + } } /**