diff options
author | Serena Feng <feng.xiaowei@zte.com.cn> | 2017-09-01 01:17:40 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-09-01 01:17:40 +0000 |
commit | 2efecc1438fdaed8aa7e9f4eb4c4b42b4fbef1fc (patch) | |
tree | b9d9a150f31684ac09edd65771f68c896004eb03 /utils/test/testapi/3rd_party/static/testapi-ui/components | |
parent | 6b51b809665b325ef4b6c71e4397d9a454ba35c3 (diff) | |
parent | b4c8d76e239dd4f5b5d6af00b38180d620b4ec89 (diff) |
Merge "Added the validation for name field in create pod function"
Diffstat (limited to 'utils/test/testapi/3rd_party/static/testapi-ui/components')
-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.' + } } /** |