summaryrefslogtreecommitdiffstats
path: root/testapi
diff options
context:
space:
mode:
authorthuva4 <tharma.thuva@gmail.com>2017-08-29 16:00:58 +0530
committerthuva4 <tharma.thuva@gmail.com>2017-08-30 13:35:48 +0530
commit69981f892f673835510f17be1cab09fa24b96fd6 (patch)
tree41b663c3fc54d9d0215c1017d1ccf60d777c4d20 /testapi
parentea7706279a99c03181c348d29c157f70037ed217 (diff)
Added the validation for name field in create pod function
Change-Id: I18a072c7b2677794a64693135904cf97eb7b3349 Signed-off-by: thuva4 <tharma.thuva@gmail.com>
Diffstat (limited to 'testapi')
-rw-r--r--testapi/3rd_party/static/testapi-ui/components/pods/pods.html2
-rw-r--r--testapi/3rd_party/static/testapi-ui/components/pods/podsController.js35
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.'
+ }
}
/**