diff options
author | thuva4 <tharma.thuva@gmail.com> | 2017-08-29 16:00:58 +0530 |
---|---|---|
committer | thuva4 <tharma.thuva@gmail.com> | 2017-08-30 13:35:48 +0530 |
commit | b4c8d76e239dd4f5b5d6af00b38180d620b4ec89 (patch) | |
tree | e73175eab4776e809a842ca8fcdfe85d8907aacf | |
parent | 5034e8cd06f9842c7683295eb280a7c82d1756a2 (diff) |
Added the validation for name field in create pod function
Change-Id: I18a072c7b2677794a64693135904cf97eb7b3349
Signed-off-by: thuva4 <tharma.thuva@gmail.com>
-rw-r--r-- | utils/test/testapi/3rd_party/static/testapi-ui/components/pods/pods.html | 2 | ||||
-rw-r--r-- | utils/test/testapi/3rd_party/static/testapi-ui/components/pods/podsController.js | 35 |
2 files changed, 21 insertions, 16 deletions
diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/components/pods/pods.html b/utils/test/testapi/3rd_party/static/testapi-ui/components/pods/pods.html index cdfcfaf36..7ce36ca7c 100644 --- a/utils/test/testapi/3rd_party/static/testapi-ui/components/pods/pods.html +++ b/utils/test/testapi/3rd_party/static/testapi-ui/components/pods/pods.html @@ -63,7 +63,7 @@ </tbody> </table> </div> - +<br> <div ng-show="ctrl.showError" class="alert alert-danger" role="alert"> <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> <span class="sr-only">Error:</span> 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..201258619 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 @@ -31,7 +31,6 @@ function PodsController($scope, $http, $filter, $state, testapiApiUrl, raiseAlert) { var ctrl = this; - ctrl.url = testapiApiUrl + '/pods'; ctrl.create = create; @@ -82,21 +81,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.' + } } /** |