summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi/ui/projects/projectsController.js
diff options
context:
space:
mode:
authorthuva4 <tharma.thuva@gmail.com>2017-11-16 14:51:29 +0530
committerthuva4 <tharma.thuva@gmail.com>2017-11-16 16:31:55 +0530
commit141e16fcbdcacc02ff30d861bf76082b51d4c287 (patch)
treeaf8f398f254d9e1ba27b392b9e36957a75af77b9 /testapi/opnfv_testapi/ui/projects/projectsController.js
parent265e10a036b545d9d4e15bebef17e38e4b013af3 (diff)
Update and Delete functionalities for projects
Implemented the update and delete functions for the projects and wrote the e2e tests for the both functions. Change-Id: I917dd9503f145b0dde61dd9970bd855f9711335e Signed-off-by: thuva4 <tharma.thuva@gmail.com>
Diffstat (limited to 'testapi/opnfv_testapi/ui/projects/projectsController.js')
-rw-r--r--testapi/opnfv_testapi/ui/projects/projectsController.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/testapi/opnfv_testapi/ui/projects/projectsController.js b/testapi/opnfv_testapi/ui/projects/projectsController.js
index d2640b6..16002f6 100644
--- a/testapi/opnfv_testapi/ui/projects/projectsController.js
+++ b/testapi/opnfv_testapi/ui/projects/projectsController.js
@@ -33,6 +33,7 @@
var ctrl = this;
ctrl.url = testapiApiUrl + '/projects';
ctrl.create = create;
+ ctrl.update = update;
ctrl.createRequirements = [
{label: 'name', type: 'text', required: true},
@@ -57,6 +58,7 @@
ctrl.projectsRequest =
$http.post(projects_url, body).success(function (data){
ctrl.showSuccess = true ;
+ ctrl.update();
})
.error(function (data) {
ctrl.showError = true;
@@ -70,5 +72,23 @@
ctrl.error = 'Name is missing.'
}
}
+
+ /**
+ * This will contact the TestAPI to get a listing of declared projects.
+ */
+ function update() {
+ ctrl.showError = false;
+ ctrl.projectsRequest =
+ $http.get(ctrl.url).success(function (data) {
+ ctrl.data = data;
+ }).error(function (error) {
+ ctrl.data = null;
+ ctrl.showError = true;
+ ctrl.error =
+ 'Error retrieving projects from server: ' +
+ angular.toJson(error);
+ });
+ }
+ ctrl.update();
}
})();