feat:optimize the mock api json of customer page 13/95213/2
authorcyuamber <xuranyjy@chinamobile.com>
Mon, 9 Sep 2019 09:20:46 +0000 (17:20 +0800)
committercyuamber <xuranyjy@chinamobile.com>
Tue, 10 Sep 2019 07:38:30 +0000 (15:38 +0800)
Change-Id: Ia1892e198693ffb64aae54553e46d54c9afe1ead
Issue-ID: USECASEUI-307
Signed-off-by: cyuamber <xuranyjy@chinamobile.com>
usecaseui-portal/src/app/core/services/managemencs.service.ts
usecaseui-portal/src/app/mock/json/CustomersColumn.json [new file with mode: 0644]
usecaseui-portal/src/app/mock/json/serviceType.json [new file with mode: 0644]
usecaseui-portal/src/app/mock/routes.js
usecaseui-portal/src/app/shared/components/customer/customer.component.ts

index da43b8f..b7aff87 100644 (file)
@@ -12,18 +12,18 @@ export class ManagemencsService {
 
     /* line up */
     url = {
-        // The following APIs are optimizable
-        customers: this.baseUrl + "/uui-lcm/customers", /* get */
+        //mock Currently tuned api interface
+        customers: this.baseUrl + "/uui-lcm/customers", /* get or delete */
         CustomersPir: this.baseUrl + "/uui-lcm/serviceNumByCustomer", /* get */
-        deleteCustomer: this.baseUrl + "/uui-lcm/customers?customerId=*_*&resourceVersion=*+*", /* delete */
-        // The following APIs are not optimizable
-        serviceType: this.baseUrl + "/uui-lcm/customers/" + "*_*" + "/service-subscriptions", /* get */
+        serviceType: this.baseUrl + "/uui-lcm/customers/*_*/service-subscriptions", /* get */
         CustomersColumn: this.baseUrl + "/uui-lcm/serviceNumByServiceType/" + "*_*", /* get */
+        //mock Currently unadjustable api interface
+        deleteCustomer: this.baseUrl + "/uui-lcm/customers", /* delete */
         createCustomer: this.baseUrl + "/uui-lcm/customers/", /* put */
         createServiceType: this.baseUrl + "/uui-lcm/customers/*_*/service-subscriptions/*+*", /* put */
-        getCustomerresourceVersion: this.baseUrl + "/uui-lcm/customers/*_*", /* put */
+        getCustomerresourceVersion: this.baseUrl + "/uui-lcm/customers/*_*", /* get */
         getServiceTypeResourceVersion: this.baseUrl + "/uui-lcm/customers/*_*/service-subscriptions/*+*",
-        deleteServiceType: this.baseUrl + "/uui-lcm/customers/*_*/service-subscriptions/*+*?resourceVersion=*@*  ",
+        deleteServiceType: this.baseUrl + "/uui-lcm/customers/*_*/service-subscriptions/*+*",
     };
 
     //The following APIs are optimizable ----------------------------------
@@ -38,11 +38,10 @@ export class ManagemencsService {
         return this.http.put(url, createParams);
     }
     // delete SelectCustomer
-    deleteSelectCustomer(params) {
-        let customerId = params.customerId,
-            version = params.version;
-        let url = this.url.deleteCustomer.replace("*_*", customerId).replace("*+*", version);
-        return this.http.delete(url);
+    deleteSelectCustomer(paramsObj) {
+        let url = this.url.deleteCustomer;
+        let params = new HttpParams({ fromObject: paramsObj });
+        return this.http.delete(url,{params});
     }
 
     //The following APIs are not optimizable ---------------------------------
@@ -81,11 +80,14 @@ export class ManagemencsService {
         return this.http.get(url);
     }
     // delete Select ServiceType
-    deleteSelectServiceType(params) {
-        let customerId = params.customerId.id,
-            ServiceType = params.ServiceType,
-            version = params.version;
-        let url = this.url.deleteServiceType.replace("*_*", customerId).replace("*+*", ServiceType).replace("*@*", version);
-        return this.http.delete(url);
+    deleteSelectServiceType(paramsObj) {
+        let customerId = paramsObj.customerId.id,
+            ServiceType = paramsObj.ServiceType,
+            version = {
+            "resourceVersion":paramsObj.version
+            };
+        let url = this.url.deleteServiceType.replace("*_*", customerId).replace("*+*", ServiceType);
+        let params = new HttpParams({ fromObject: version });
+        return this.http.delete(url,{params});
     }
 }
diff --git a/usecaseui-portal/src/app/mock/json/CustomersColumn.json b/usecaseui-portal/src/app/mock/json/CustomersColumn.json
new file mode 100644 (file)
index 0000000..329258d
--- /dev/null
@@ -0,0 +1,8 @@
+{
+  "list":[
+    {"name":"SOTN","value":"23"},
+    {"name":"CCVPN","value":"67"},
+    {"name":"CCVPN1","value":"34"},
+    {"name":"SOTN1","value":"12"}
+  ]
+}
\ No newline at end of file
diff --git a/usecaseui-portal/src/app/mock/json/serviceType.json b/usecaseui-portal/src/app/mock/json/serviceType.json
new file mode 100644 (file)
index 0000000..cda17d5
--- /dev/null
@@ -0,0 +1,21 @@
+[
+  {
+    "service-type": "CCVPN",
+    "temp-ub-sub-account-id": "sotnaccount",
+    "resource-version": "1535601345780"
+  },
+  {
+    "service-type": "SOTN",
+    "temp-ub-sub-account-id": "sotnaccount",
+    "resource-version": "1535601333330"
+  },
+  {
+    "service-type": "E2E Service",
+    "temp-ub-sub-account-id": "sotnaccount",
+    "resource-version": "1536111036667"
+  },{
+  "service-type": "Network Service",
+  "temp-ub-sub-account-id": "sotnaccount",
+  "resource-version": "1536111036467"
+}
+]
\ No newline at end of file
index 9668e2f..4a4b405 100644 (file)
@@ -35,7 +35,9 @@ module.exports =
         /////////////////////////
 
         ///////<-------------managemence services--------->/////
-        "/uui-lcm/customers/:customer/service-subscriptions": "/serviceTypes?customer=:customer",
+        "/uui-lcm/customers/:customer/service-subscriptions": "/serviceType",
+        "/uui-lcm/serviceNumByServiceType/:customer":"/CustomersColumn",
+
         /////////////////////////
 
         ///////<-------------myhttp services--------->/////
index a510e6d..17142d7 100644 (file)
@@ -436,7 +436,7 @@ export class CustomerComponent implements OnInit {
             if (data["status"] == 'SUCCESS') {
                 let params = {
                     customerId: thisdeleteCustomer.id,
-                    version: data["result"]["resource-version"]
+                    resourceVersion: data["result"]["resource-version"]
                 };
                 this.deleteCustomer(params, notificationModel);
             } else {
@@ -444,8 +444,8 @@ export class CustomerComponent implements OnInit {
             }
         })
     }
-    deleteCustomer(params, notificationModel) {
-        this.managemencs.deleteSelectCustomer(params).subscribe((data) => {
+    deleteCustomer(paramsObj, notificationModel) {
+        this.managemencs.deleteSelectCustomer(paramsObj).subscribe((data) => {
             if (data["status"] == 'SUCCESS') {
                 this.notificationSuccess(notificationModel);
                 this.getAllCustomers();