summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi/ui/components/pods
diff options
context:
space:
mode:
Diffstat (limited to 'testapi/opnfv_testapi/ui/components/pods')
-rw-r--r--testapi/opnfv_testapi/ui/components/pods/pods.html13
-rw-r--r--testapi/opnfv_testapi/ui/components/pods/podsController.js10
2 files changed, 16 insertions, 7 deletions
diff --git a/testapi/opnfv_testapi/ui/components/pods/pods.html b/testapi/opnfv_testapi/ui/components/pods/pods.html
index 22f2934..72a9f6c 100644
--- a/testapi/opnfv_testapi/ui/components/pods/pods.html
+++ b/testapi/opnfv_testapi/ui/components/pods/pods.html
@@ -27,9 +27,18 @@
</div>
</div>
- <div class="col-md-3" style="margin-top:12px; margin-left:8px;">
+ <div class="col-md-1" style="margin-top:12px;">
<button type="submit" class="btn btn-primary" ng-click="ctrl.create()">Create</button>
</div>
+ <div ng-show="ctrl.showError" class="col-md-11 alert alert-danger" role="alert">
+ <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
+ <span class="sr-only">Error:</span>
+ {{ctrl.error}}
+ </div>
+ <div ng-show="ctrl.showSuccess" class="col-md-11 alert alert-success" role="alert">
+ <span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
+ Create Success
+ </div>
</div>
</div>
@@ -69,7 +78,7 @@
</table>
</div>
<br>
-<div ng-show="ctrl.showError" class="alert alert-danger" role="alert">
+<div ng-show="ctrl.showError" class="alert alert-danger" ng-class="{ 'hidden': auth.isAuthenticated }" role="alert">
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
<span class="sr-only">Error:</span>
{{ctrl.error}}
diff --git a/testapi/opnfv_testapi/ui/components/pods/podsController.js b/testapi/opnfv_testapi/ui/components/pods/podsController.js
index 489fa8a..9789cf2 100644
--- a/testapi/opnfv_testapi/ui/components/pods/podsController.js
+++ b/testapi/opnfv_testapi/ui/components/pods/podsController.js
@@ -78,6 +78,7 @@
*/
function create() {
ctrl.showError = false;
+ ctrl.showSuccess = false;
if(ctrl.name != ""){
var pods_url = ctrl.url;
@@ -88,12 +89,11 @@
details: ctrl.details
};
ctrl.podsRequest =
- $http.post(pods_url, body).error(function (data, status) {
+ $http.post(pods_url, body).success(function (data) {
+ ctrl.showSuccess = true ;
+ }).catch(function (data) {
ctrl.showError = true;
- if(status == 403){
- ctrl.error =
- 'Error creating the new pod from server: Pod\'s name already exists'
- }
+ ctrl.error = "Error creating the new pod from server: " + data.statusText;
});
}
else{