diff options
author | Dan Xu <xudan16@huawei.com> | 2019-04-11 06:39:25 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2019-04-11 06:39:25 +0000 |
commit | dbcc039303c7f010348814694b8f75d621aa51e3 (patch) | |
tree | 2ecc14d87b24166c2e6d49f33103b63e1ca4c6fd /3rd_party/static/testapi-ui/components/application/applicationController.js | |
parent | d32ce7d109fb36277681629c8e648777664862b2 (diff) | |
parent | 71bdc6752f47b7da7282f786570fbe717973fb6d (diff) |
Merge "Enhanced OVP Web Portal"
Diffstat (limited to '3rd_party/static/testapi-ui/components/application/applicationController.js')
-rw-r--r-- | 3rd_party/static/testapi-ui/components/application/applicationController.js | 198 |
1 files changed, 114 insertions, 84 deletions
diff --git a/3rd_party/static/testapi-ui/components/application/applicationController.js b/3rd_party/static/testapi-ui/components/application/applicationController.js index e2a4f75..6ae157e 100644 --- a/3rd_party/static/testapi-ui/components/application/applicationController.js +++ b/3rd_party/static/testapi-ui/components/application/applicationController.js @@ -28,35 +28,36 @@ $uibModal, testapiApiUrl, raiseAlert, ngDialog, $scope) { var ctrl = this; - ctrl.uploadLogo = uploadLogo; +// ctrl.uploadLogo = uploadLogo; function init() { - ctrl.organization_name = null; - ctrl.organization_web = null; - ctrl.product_name = null; - ctrl.product_spec = null; - ctrl.product_documentation = null; - ctrl.product_categories = "soft&hard"; - ctrl.prim_name = null; - ctrl.prim_email = null; - ctrl.prim_address = null; - ctrl.prim_phone = null; - ctrl.description = null; - ctrl.sut_version = null; - ctrl.sut_hw_version = null; - ctrl.ovp_version = "2018.01"; - ctrl.ovp_category = "Infrastructure"; - ctrl.company_logo = null; - ctrl.approve_date = null; - ctrl.approved = "false"; - ctrl.test_id = null; - ctrl.lab_location = "internal"; - ctrl.lab_name = null; - ctrl.lab_email = null; - ctrl.lab_address = null; - ctrl.lab_phone = null; ctrl.applications = []; - ctrl.showApplications = []; +// ctrl.organization_name = null; +// ctrl.organization_web = null; +// ctrl.product_name = null; +// ctrl.product_spec = null; +// ctrl.product_documentation = null; +// ctrl.product_categories = "soft&hard"; +// ctrl.prim_name = null; +// ctrl.prim_email = null; +// ctrl.prim_address = null; +// ctrl.prim_phone = null; +// ctrl.description = null; +// ctrl.sut_version = null; +// ctrl.sut_hw_version = null; +// ctrl.ovp_version = "2018.01"; +// ctrl.ovp_category = "Infrastructure"; +// ctrl.company_logo = null; +// ctrl.approve_date = null; +// ctrl.approved = "false"; +// ctrl.test_id = null; +// ctrl.lab_location = "internal"; +// ctrl.lab_name = null; +// ctrl.lab_email = null; +// ctrl.lab_address = null; +// ctrl.lab_phone = null; +// ctrl.applications = []; +// ctrl.showApplications = []; ctrl.totalItems = null; ctrl.currentPage = 1; @@ -70,52 +71,52 @@ } - ctrl.submitForm = function() { - var data = { - "organization_name": ctrl.organization_name, - "organization_web": ctrl.organization_web, - "product_name": ctrl.product_name, - "product_spec": ctrl.product_spec, - "product_documentation": ctrl.product_documentation, - "product_categories": ctrl.product_categories, - "prim_name": ctrl.prim_name, - "prim_email": ctrl.prim_email, - "prim_address": ctrl.prim_address, - "prim_phone": ctrl.prim_phone, - "description": ctrl.description, - "sut_version": ctrl.sut_version, - "sut_hw_version": ctrl.sut_hw_version, - "ovp_version": ctrl.ovp_version, - "ovp_category": ctrl.ovp_category, - "company_logo": ctrl.company_logo, - "approve_date": ctrl.approve_date, - "approved": ctrl.approved, - "test_id": ctrl.test_id, - "lab_location": ctrl.lab_location, - "lab_email": ctrl.lab_email, - "lab_address": ctrl.lab_address, - "lab_phone": ctrl.lab_phone - }; - $http.post(testapiApiUrl + "/cvp/applications", data).then(function(resp) { - if (resp.data.code && resp.data.code != 0) { - alert(resp.data.msg); - return; - } - getApplication(); - }, function(error) { - }); - } - - ctrl.openConfirmModal = function() { - var resp = confirm("Are you sure to submit?"); - if (resp) { - ctrl.submitForm(); - } - } - - ctrl.cancelSubmit = function() { - ngDialog.close(); - } +// ctrl.submitForm = function() { +// var data = { +// "organization_name": ctrl.organization_name, +// "organization_web": ctrl.organization_web, +// "product_name": ctrl.product_name, +// "product_spec": ctrl.product_spec, +// "product_documentation": ctrl.product_documentation, +// "product_categories": ctrl.product_categories, +// "prim_name": ctrl.prim_name, +// "prim_email": ctrl.prim_email, +// "prim_address": ctrl.prim_address, +// "prim_phone": ctrl.prim_phone, +// "description": ctrl.description, +// "sut_version": ctrl.sut_version, +// "sut_hw_version": ctrl.sut_hw_version, +// "ovp_version": ctrl.ovp_version, +// "ovp_category": ctrl.ovp_category, +// "company_logo": ctrl.company_logo, +// "approve_date": ctrl.approve_date, +// "approved": ctrl.approved, +// "test_id": ctrl.test_id, +// "lab_location": ctrl.lab_location, +// "lab_email": ctrl.lab_email, +// "lab_address": ctrl.lab_address, +// "lab_phone": ctrl.lab_phone +// }; +// $http.post(testapiApiUrl + "/cvp/applications", data).then(function(resp) { +// if (resp.data.code && resp.data.code != 0) { +// alert(resp.data.msg); +// return; +// } +// getApplication(); +// }, function(error) { +// }); +// } + +// ctrl.openConfirmModal = function() { +// var resp = confirm("Are you sure to submit?"); +// if (resp) { +// ctrl.submitForm(); +// } +// } +// +// ctrl.cancelSubmit = function() { +// ngDialog.close(); +// } ctrl.updatePage = function() { getApplication(); @@ -136,23 +137,52 @@ }); } - function uploadLogo() { - var file = $scope.logoFile; - var fd = new FormData(); - fd.append('file', file); + ctrl.toggleApproveApp = function(id, approved) { + if (approved === 'true') { + var text = 'Are you sure you want to approve this application?'; + } else { + var text = 'Are you sure you want to remove approval of this application?'; + } + + var resp = confirm(text); + if (!resp) + return; - $http.post(testapiApiUrl + "/cvp/applications/uploadlogo", fd, { + var updateUrl = testapiApiUrl + "/cvp/applications/" + id; + var data = {}; + data['item'] = 'approved'; + data['approved'] = approved; + + $http.put(updateUrl, JSON.stringify(data), { transformRequest: angular.identity, - headers: {'Content-Type': undefined} - }).then(function(resp) { - if (resp.data.code && resp.data.code != 0) { - alert(resp.data.msg); - return; - } + headers: {'Content-Type': 'application/json'}}).then(function(ret) { + if (ret.data.code && ret.data.code != 0) { + alert(ret.data.msg); + return; + } + getApplication(); }, function(error) { + alert('Error when update data'); }); + } - }; +// function uploadLogo() { +// var file = $scope.logoFile; +// var fd = new FormData(); +// fd.append('file', file); +// +// $http.post(testapiApiUrl + "/cvp/applications/uploadlogo", fd, { +// transformRequest: angular.identity, +// headers: {'Content-Type': undefined} +// }).then(function(resp) { +// if (resp.data.code && resp.data.code != 0) { +// alert(resp.data.msg); +// return; +// } +// }, function(error) { +// }); +// +// }; function getApplication() { $http.get(testapiApiUrl + "/cvp/applications?page=" + ctrl.currentPage + "&signed&per_page=" + ctrl.itemsPerPage).then(function(response) { |