aboutsummaryrefslogtreecommitdiffstats
path: root/3rd_party/static/testapi-ui/components/application/applicationController.js
diff options
context:
space:
mode:
Diffstat (limited to '3rd_party/static/testapi-ui/components/application/applicationController.js')
-rw-r--r--3rd_party/static/testapi-ui/components/application/applicationController.js265
1 files changed, 129 insertions, 136 deletions
diff --git a/3rd_party/static/testapi-ui/components/application/applicationController.js b/3rd_party/static/testapi-ui/components/application/applicationController.js
index 5666ff2..e2a4f75 100644
--- a/3rd_party/static/testapi-ui/components/application/applicationController.js
+++ b/3rd_party/static/testapi-ui/components/application/applicationController.js
@@ -24,154 +24,147 @@
'$uibModal', 'testapiApiUrl', 'raiseAlert', 'ngDialog', '$scope'
];
- /**
- */
- function ApplicationController($http, $stateParams, $window, $sce,
+ function ApplicationController ($http, $stateParams, $window, $sce,
$uibModal, testapiApiUrl, raiseAlert, ngDialog, $scope) {
var ctrl = this;
- 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.id_type = "Linux Foundation";
- ctrl.user_id = 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;
- ctrl.itemsPerPage = 5;
- ctrl.numPages = null;
- ctrl.lab_tpl = "lab.tpl.html";
- ctrl.product_tpl = "product.tpl.html";
- //ctrl.lab_html=$sce.trustAsHtml('<div>{{app.lab_email}}</div><div>{{app.lab_address}}</div><div>{{app.lab_phone}}</div>');
-
- getApplication();
- }
-
-
- 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,
- "id_type": ctrl.id_type,
- "user_id": ctrl.user_id,
- "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
- };
- console.log(data);
- $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.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.totalItems = null;
+ ctrl.currentPage = 1;
+ ctrl.itemsPerPage = 5;
+ ctrl.numPages = null;
+ ctrl.lab_tpl = "lab.tpl.html";
+ ctrl.product_tpl = "product.tpl.html";
+ //ctrl.lab_html=$sce.trustAsHtml('<div>{{app.lab_email}}</div><div>{{app.lab_address}}</div><div>{{app.lab_phone}}</div>');
+
+ getApplication();
+ }
+
+
+ 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.cancelSubmit = function(){
- ngDialog.close();
- }
+ ctrl.openConfirmModal = function() {
+ var resp = confirm("Are you sure to submit?");
+ if (resp) {
+ ctrl.submitForm();
+ }
+ }
+
+ ctrl.cancelSubmit = function() {
+ ngDialog.close();
+ }
- ctrl.updatePage = function(){
+ ctrl.updatePage = function() {
getApplication();
- }
+ }
- ctrl.deleteApp = function(id){
- var resp = confirm('Are you sure to delete this application?');
- if (!resp)
- return;
+ ctrl.deleteApp = function(id) {
+ var resp = confirm('Are you sure to delete this application?');
+ if (!resp)
+ return;
- var delUrl = testapiApiUrl + "/cvp/applications/" + id;
- $http.delete(delUrl)
- .then( function(ret) {
- if(ret.data.code && ret.data.code != 0) {
+ var delUrl = testapiApiUrl + "/cvp/applications/" + id;
+ $http.delete(delUrl).then(function(ret) {
+ if (ret.data.code && ret.data.code != 0) {
alert(ret.data.msg);
return;
- }
- getApplication();
- });
+ }
+ getApplication();
+ });
}
- 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){
- ctrl.applications = response.data.applications;
- ctrl.totalItems = response.data.pagination.total_pages* ctrl.itemsPerPage;
- ctrl.currentPage = response.data.pagination.current_page;
- ctrl.numPages = response.data.pagination.total_pages;
- }, function(error){
- });
- }
-
- init();
+ 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) {
+ ctrl.applications = response.data.applications;
+ ctrl.totalItems = response.data.pagination.total_pages * ctrl.itemsPerPage;
+ ctrl.currentPage = response.data.pagination.current_page;
+ ctrl.numPages = response.data.pagination.total_pages;
+ }, function(error) {
+ });
+ }
+
+ init();
}
+
})();