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 | d5688db86d7e534c9bf821bad90346ea69feb224 (patch) | |
tree | 01751890d294a6780dc44edcf5f3a787df92c2df /testapi/3rd_party/static/testapi-ui/components | |
parent | 67b81863bc0ab1005db6d8914f9eedebc21c39b6 (diff) | |
parent | 69981f892f673835510f17be1cab09fa24b96fd6 (diff) |
Merge "Added the validation for name field in create pod function"
Diffstat (limited to 'testapi/3rd_party/static/testapi-ui/components')
-rw-r--r-- | testapi/3rd_party/static/testapi-ui/components/pods/pods.html | 2 | ||||
-rw-r--r-- | testapi/3rd_party/static/testapi-ui/components/pods/podsController.js | 35 |
2 files changed, 21 insertions, 16 deletions
diff --git a/testapi/3rd_party/static/testapi-ui/components/pods/pods.html b/testapi/3rd_party/static/testapi-ui/components/pods/pods.html index cdfcfaf..7ce36ca 100644 --- a/testapi/3rd_party/static/testapi-ui/components/pods/pods.html +++ b/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/testapi/3rd_party/static/testapi-ui/components/pods/podsController.js b/testapi/3rd_party/static/testapi-ui/components/pods/podsController.js index 53e8b1e..2012586 100644 --- a/testapi/3rd_party/static/testapi-ui/components/pods/podsController.js +++ b/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.' + } } /** |