summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src/app
diff options
context:
space:
mode:
authorcyuamber <xuranyjy@chinamobile.com>2019-08-29 18:43:08 +0800
committerxu ran <xuranyjy@chinamobile.com>2019-08-30 02:20:49 +0000
commit0c1e82ccbfa6dcb8ee5d11220a93fefc61465374 (patch)
treedbd894bc5909df38bde9a2738e366d7913627195 /usecaseui-portal/src/app
parentcbb4b91ad39b44a76d1b1d4b745ef2b38fab74ce (diff)
feat: change the mock data path config file
Change-Id: I5ca301d8ff0b084f64366312543c9036d8e76de8 Issue-ID: USECASEUI-307 Signed-off-by: cyuamber <xuranyjy@chinamobile.com>
Diffstat (limited to 'usecaseui-portal/src/app')
-rw-r--r--usecaseui-portal/src/app/app.component.html28
-rw-r--r--usecaseui-portal/src/app/app.component.less18
-rw-r--r--usecaseui-portal/src/app/app.component.ts11
-rw-r--r--usecaseui-portal/src/app/core/services/myhttp.service.ts118
-rw-r--r--usecaseui-portal/src/app/core/services/onboard.service.ts74
-rw-r--r--usecaseui-portal/src/app/core/services/text.service.spec.ts15
-rw-r--r--usecaseui-portal/src/app/core/services/text.service.ts17
-rw-r--r--usecaseui-portal/src/app/mock/fake/fakedata.js1
-rw-r--r--usecaseui-portal/src/app/mock/fake/mock.js3
-rw-r--r--usecaseui-portal/src/app/mock/json/alarm_form_data.json (renamed from usecaseui-portal/src/app/mock/json/alarmFormData.json)0
-rw-r--r--usecaseui-portal/src/app/mock/json/current_language.json3
-rw-r--r--usecaseui-portal/src/app/mock/json/user_login.json8
-rw-r--r--usecaseui-portal/src/app/mock/routes.js25
-rw-r--r--usecaseui-portal/src/app/mock/server.js42
-rw-r--r--usecaseui-portal/src/app/test/test.component.html2
-rw-r--r--usecaseui-portal/src/app/test/test.component.ts15
16 files changed, 225 insertions, 155 deletions
diff --git a/usecaseui-portal/src/app/app.component.html b/usecaseui-portal/src/app/app.component.html
index 26e736de..f5ee199c 100644
--- a/usecaseui-portal/src/app/app.component.html
+++ b/usecaseui-portal/src/app/app.component.html
@@ -23,7 +23,8 @@
<a routerLink="home">
<span title>
<i>
- <img src="{{ url === 'home' ? 'assets/images/home-icon-active.png':'assets/images/home-icon.png'}}" alt="home">
+ <img src="{{ url === 'home' ? 'assets/images/home-icon-active.png':'assets/images/home-icon.png'}}"
+ alt="home">
</i>
<span> {{"i18nTextDefine_Home" | translate}} </span>
</span>
@@ -33,8 +34,10 @@
<li nz-menu-item [ngClass]="{'activeMenuBar': url === 'management'}">
<a routerLink="management">
<span title>
- <i>
- <img src="{{url === 'management' ? 'assets/images/customer-icon-active.png':'assets/images/customer-icon.png'}}" alt="home">
+ <i>
+ <img
+ src="{{url === 'management' ? 'assets/images/customer-icon-active.png':'assets/images/customer-icon.png'}}"
+ alt="home">
</i>
<span> {{"i18nTextDefine_Customer" | translate}} </span>
</span>
@@ -45,7 +48,8 @@
<a routerLink="fcaps">
<span title>
<i>
- <img src="{{ url === 'fcaps' ? 'assets/images/monitor-icon-active.png':'assets/images/monitor-icon.png'}}" alt="home">
+ <img src="{{ url === 'fcaps' ? 'assets/images/monitor-icon-active.png':'assets/images/monitor-icon.png'}}"
+ alt="home">
</i>
<span> {{"i18nTextDefine_Monitor" | translate}} </span>
</span>
@@ -53,11 +57,13 @@
</li>
<hr>
<li nz-submenu [ngClass]="{'activeMenuBar': url.indexOf('services') === 0}" [nzOpen]="flag">
- <span title>
+ <span title>
<i>
- <img src="{{url.indexOf('services') === 0 ? 'assets/images/Services-icon-active.png':'assets/images/Services-icon.png'}}" alt="home">
- </i>
- {{"i18nTextDefine_Services" | translate}}
+ <img
+ src="{{url.indexOf('services') === 0 ? 'assets/images/Services-icon-active.png':'assets/images/Services-icon.png'}}"
+ alt="home">
+ </i>
+ {{"i18nTextDefine_Services" | translate}}
</span>
<ul>
<li nz-menu-item [ngClass]="{'activeMenuList': url === 'services/services-list'}">
@@ -72,8 +78,10 @@
<li nz-menu-item [ngClass]="{'activeMenuBar': url === 'network'}">
<a routerLink="network">
<span title>
- <i>
- <img src="{{url === 'network' ? 'assets/images/network-icon-active.png':'assets/images/network-icon.png'}}" alt="home">
+ <i>
+ <img
+ src="{{url === 'network' ? 'assets/images/network-icon-active.png':'assets/images/network-icon.png'}}"
+ alt="home">
</i>
<span> {{"i18nTextDefine_NetworkTopology" | translate}} </span>
</span>
diff --git a/usecaseui-portal/src/app/app.component.less b/usecaseui-portal/src/app/app.component.less
index ade860b1..ed7ad4f1 100644
--- a/usecaseui-portal/src/app/app.component.less
+++ b/usecaseui-portal/src/app/app.component.less
@@ -1,3 +1,21 @@
+/*
+ Copyright (C) 2019 CMCC, Inc. and others. All rights reserved.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+
+// left menu bar adaptation
@media screen and (min-width: 1200px){
.siderContent{
height:240px;
diff --git a/usecaseui-portal/src/app/app.component.ts b/usecaseui-portal/src/app/app.component.ts
index 7306db1c..2642b3ed 100644
--- a/usecaseui-portal/src/app/app.component.ts
+++ b/usecaseui-portal/src/app/app.component.ts
@@ -26,14 +26,14 @@ import 'rxjs/add/operator/map';
styleUrls: ['./app.component.less']
})
export class AppComponent {
- public url:string = 'home';
+ public url:string = 'home';
constructor(private translate: TranslateService,private myhttp: HomesService,private router:Router,) {
this.currentLanguageGet();
this.getUrl();
-
-
}
+
+ // Get the current routing path
getUrl(){
this.router.events.map(event=> {
if(event instanceof NavigationEnd){
@@ -42,15 +42,12 @@ export class AppComponent {
}).subscribe(event=>{})
}
-
//209.05.08 Get the currentLanguage
currentloginId = null;
currentLanguage = "en";
currentLanguageGet() {
this.currentloginId = sessionStorage.getItem("userId") || null;
- console.log(this.currentloginId,"this.currentloginId","loginId");
if (this.currentloginId != null) {
- console.log(this.currentloginId,"this.currentloginId","loginId","you id");
this.myhttp.getCurrentLanguage(this.currentloginId)
.subscribe(
(data) => {
@@ -68,6 +65,8 @@ export class AppComponent {
sessionStorage.setItem("DefaultLang",this.currentLanguage);
}
}
+
+ // Whether the submenu expands the identifier
get flag () {
if(!this.url.indexOf('services')){
return true
diff --git a/usecaseui-portal/src/app/core/services/myhttp.service.ts b/usecaseui-portal/src/app/core/services/myhttp.service.ts
index bcb83e21..cc9c181a 100644
--- a/usecaseui-portal/src/app/core/services/myhttp.service.ts
+++ b/usecaseui-portal/src/app/core/services/myhttp.service.ts
@@ -59,66 +59,66 @@ export class MyhttpService {
//The following APIs are optimizable
- // Get all customers
- getAllCustomers() {
- return this.http.get<any>(this.url.customers);
- }
- // Get all Orchestrators
- getAllOrchestrators() {
- return this.http.get<any>(this.url.orchestrators);
- }
- // serviceTable list
- getServicesTableData(paramsObj): Observable<HttpResponse<servicesTableData>> {
- let params = new HttpParams({ fromObject: paramsObj });
- return this.http.get<servicesTableData>(this.url.servicesTableData, { observe: 'response', params });
- }
- // Get all template types
- getAllServiceTemplates(type) {
- if (type == "Network Service") {
- let nsUrl = this.url.serviceTemplates.replace("service-templates", "listNsTemplates").replace("serviceTemplates2", "serviceTemplates-ns");
- console.log(nsUrl);
- return this.http.get<any>(nsUrl);
- }
- return this.http.get<any>(this.url.serviceTemplates);
- }
- // Get Vim Info
- getVimInfo() {
- return this.http.get<any>(this.url.vimInfo);
- };
- //Get SdnControllers
- getSdnControllers() {
- return this.http.get<any>(this.url.sdnControllers);
- }
- // Create interface
- createInstance(requestBody, createParams) {
- return this.http.post<any>(this.url.createService + createParams, requestBody);
- }
- // NS CreateInstance step one
- nsCreateInstance(requestBody) {
- return this.http.post<any>(this.url.ns_createService, requestBody);
- }
- // NS CreateInstance step two
- nsCreateInstance2(params, requestBody) {
- return this.http.post<any>(this.url.ns_createService2 + params, requestBody);
- }
- //Delete ns Service
- nsDeleteInstance(id) {
- return this.http.delete<any>(this.url.ns_deleteService + id);
- }
- //stop ns Service
- stopNsService(id, requestBody) { //You need to terminate before deleting
- return this.http.post<any>(this.url.ns_stopService + id, requestBody);
- }
- //heal ns Service
- healNsService(id, requestBody) {
- return this.http.post<any>(this.url.ns_healService + id, requestBody);
- }
- //Get allotted-resource to get tp and pnf values
- getAllottedResource(obj) {
- let params = new HttpParams({ fromObject: obj });
- let url = this.url.allottedResource;
- return this.http.get<any>(url, { params });
+ // Get all customers
+ getAllCustomers() {
+ return this.http.get<any>(this.url.customers);
+ }
+ // Get all Orchestrators
+ getAllOrchestrators() {
+ return this.http.get<any>(this.url.orchestrators);
+ }
+ // serviceTable list
+ getServicesTableData(paramsObj): Observable<HttpResponse<servicesTableData>> {
+ let params = new HttpParams({ fromObject: paramsObj });
+ return this.http.get<servicesTableData>(this.url.servicesTableData, { observe: 'response', params });
+ }
+ // Get all template types
+ getAllServiceTemplates(type) {
+ if (type == "Network Service") {
+ let nsUrl = this.url.serviceTemplates.replace("service-templates", "listNsTemplates").replace("serviceTemplates2", "serviceTemplates-ns");
+ console.log(nsUrl);
+ return this.http.get<any>(nsUrl);
}
+ return this.http.get<any>(this.url.serviceTemplates);
+ }
+ // Get Vim Info
+ getVimInfo() {
+ return this.http.get<any>(this.url.vimInfo);
+ };
+ //Get SdnControllers
+ getSdnControllers() {
+ return this.http.get<any>(this.url.sdnControllers);
+ }
+ // Create interface
+ createInstance(requestBody, createParams) {
+ return this.http.post<any>(this.url.createService + createParams, requestBody);
+ }
+ // NS CreateInstance step one
+ nsCreateInstance(requestBody) {
+ return this.http.post<any>(this.url.ns_createService, requestBody);
+ }
+ // NS CreateInstance step two
+ nsCreateInstance2(params, requestBody) {
+ return this.http.post<any>(this.url.ns_createService2 + params, requestBody);
+ }
+ //Delete ns Service
+ nsDeleteInstance(id) {
+ return this.http.delete<any>(this.url.ns_deleteService + id);
+ }
+ //stop ns Service
+ stopNsService(id, requestBody) { //You need to terminate before deleting
+ return this.http.post<any>(this.url.ns_stopService + id, requestBody);
+ }
+ //heal ns Service
+ healNsService(id, requestBody) {
+ return this.http.post<any>(this.url.ns_healService + id, requestBody);
+ }
+ //Get allotted-resource to get tp and pnf values
+ getAllottedResource(obj) {
+ let params = new HttpParams({ fromObject: obj });
+ let url = this.url.allottedResource;
+ return this.http.get<any>(url, { params });
+ }
//The following APIs are not optimizable ---------------------------------
diff --git a/usecaseui-portal/src/app/core/services/onboard.service.ts b/usecaseui-portal/src/app/core/services/onboard.service.ts
index c3959a29..ea312d34 100644
--- a/usecaseui-portal/src/app/core/services/onboard.service.ts
+++ b/usecaseui-portal/src/app/core/services/onboard.service.ts
@@ -20,58 +20,58 @@ import { baseUrl } from '../models/dataInterface';
@Injectable()
export class onboardService {
- constructor(private http: HttpClient) { }
+ constructor(private http: HttpClient) { }
- baseUrl = baseUrl.baseUrl + "/uui-lcm/";
- url = {
- //The following APIs are optimizable------------------------
- // list Data
- onboardTableData: this.baseUrl + "ns-packages",
- onboardDataVNF: this.baseUrl + "vnf-packages",
- onboardDataPNF: this.baseUrl + "pnf-packages",
- //ns sdc
- sdc_nsListData: this.baseUrl + "sdc-ns-packages", // GET
- // vnf sdc
- sdc_vnfListData: this.baseUrl + "sdc-vf-packages", // GET
- // onboard ns sdc data
- onboardNs: this.baseUrl + "ns-packages", //POST
- //onboard VNF sdc data
- onboardVNF: this.baseUrl + "vf-packages", //POST
- //Delete ns package
- deleteNspack: this.baseUrl + "deleteNsdPackage?nsdInfoId=",
- // Delete Vnf vfc package
- deleteVnfPack: this.baseUrl + "deleteVnfPackage?vnfPkgId=",
- // Delete Pnf package
- deletePnfPack: this.baseUrl + "deletePnfPackage?pnfdInfoId=",
- // The following APIs are not optimizable-------------------
- // createnspackages
- creatensData: this.baseUrl + "_jsonData", //POST
- //Progress interface
- progress: this.baseUrl + "jobs/" + "_jobId" + "?responseId="
- };
+ baseUrl = baseUrl.baseUrl + "/uui-lcm/";
+ url = {
+ //The following APIs are optimizable------------------------
+ // list Data
+ onboardTableData: this.baseUrl + "ns-packages",
+ onboardDataVNF: this.baseUrl + "vnf-packages",
+ onboardDataPNF: this.baseUrl + "pnf-packages",
+ //ns sdc
+ sdc_nsListData: this.baseUrl + "sdc-ns-packages", // GET
+ // vnf sdc
+ sdc_vnfListData: this.baseUrl + "sdc-vf-packages", // GET
+ // onboard ns sdc data
+ onboardNs: this.baseUrl + "ns-packages", //POST
+ //onboard VNF sdc data
+ onboardVNF: this.baseUrl + "vf-packages", //POST
+ //Delete ns package
+ deleteNspack: this.baseUrl + "deleteNsdPackage?nsdInfoId=",
+ // Delete Vnf vfc package
+ deleteVnfPack: this.baseUrl + "deleteVnfPackage?vnfPkgId=",
+ // Delete Pnf package
+ deletePnfPack: this.baseUrl + "deletePnfPackage?pnfdInfoId=",
+ // The following APIs are not optimizable-------------------
+ // createnspackages
+ creatensData: this.baseUrl + "_jsonData", //POST
+ //Progress interface
+ progress: this.baseUrl + "jobs/" + "_jobId" + "?responseId="
+ };
- //The following APIs function are optimizable------------------------
+ //The following APIs function are optimizable------------------------
/* Query data list */
// NS Data
getOnboardTableData() {
- return this.http.get<any>(this.url["onboardTableData"]);
+ return this.http.get<any>(this.url["onboardTableData"]);
}
// NS SDC Data
getSDC_NSTableData() {
- return this.http.get<any>(this.url["sdc_nsListData"]);
+ return this.http.get<any>(this.url["sdc_nsListData"]);
}
// VNF Data
getOnboardTableVnfData() {
- return this.http.get<any>(this.url.onboardDataVNF);
+ return this.http.get<any>(this.url.onboardDataVNF);
}
// onboard VNF sdc Data
getSDC_VNFTableData() {
- return this.http.get<any>(this.url["sdc_vnfListData"]);
+ return this.http.get<any>(this.url["sdc_vnfListData"]);
}
// PNF Data
getOnboardTablePnfData() {
- return this.http.get<any>(this.url.onboardDataPNF);
+ return this.http.get<any>(this.url.onboardDataPNF);
}
//onboard sdc ns
getNsonboard(requestBody) {
@@ -98,12 +98,12 @@ export class onboardService {
//create--Get the id after dragging the file before uploading
getCreatensData(url_upId, requestBody) {
- return this.http.post<any>(this.url.creatensData.replace("_jsonData", url_upId), requestBody);
+ return this.http.post<any>(this.url.creatensData.replace("_jsonData", url_upId), requestBody);
}
//onboard progress
getProgress(jobid, responseId) {
- let url = this.url.progress.replace("_jobId", jobid) + responseId;
- return this.http.get<any>(url);
+ let url = this.url.progress.replace("_jobId", jobid) + responseId;
+ return this.http.get<any>(url);
}
}
diff --git a/usecaseui-portal/src/app/core/services/text.service.spec.ts b/usecaseui-portal/src/app/core/services/text.service.spec.ts
deleted file mode 100644
index 7b4d9efc..00000000
--- a/usecaseui-portal/src/app/core/services/text.service.spec.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { TestBed, inject } from '@angular/core/testing';
-
-import { TextService } from './text.service';
-
-describe('TextService', () => {
- beforeEach(() => {
- TestBed.configureTestingModule({
- providers: [TextService]
- });
- });
-
- it('should be created', inject([TextService], (service: TextService) => {
- expect(service).toBeTruthy();
- }));
-});
diff --git a/usecaseui-portal/src/app/core/services/text.service.ts b/usecaseui-portal/src/app/core/services/text.service.ts
index 9ccea18a..9698ee64 100644
--- a/usecaseui-portal/src/app/core/services/text.service.ts
+++ b/usecaseui-portal/src/app/core/services/text.service.ts
@@ -20,14 +20,16 @@ import { HttpClient } from '@angular/common/http';
export class TextService {
constructor(private http: HttpClient) { }
//---------------------------------------------------------------------------------------
- /* line up*/
baseUrl = "/api";
+
url = {
textInterface: this.baseUrl + "/user/login",
singleInterface: this.baseUrl + "/home",
doubleInterface: this.baseUrl + "/customer/info",
- multipleInterface: this.baseUrl + "/alarm/formdata/multiple",
+ multipleInterface: this.baseUrl + "/alarm/form/data",
jsonInterface: this.baseUrl + "/xuran/test/data",
+ currentLanguage: "/api/portal-auxapi/languageSetting/user/",
+ creatensData: this.baseUrl + "_jsonData", //POST
}
//-----------------------------------Function-local-start------------------------------------------------------
@@ -35,8 +37,15 @@ export class TextService {
getfakeData() {
return this.http.get<any>(this.url["singleInterface"]);
}
- getjsonData() {
- return this.http.get<any>(this.url["multipleInterface"]);
+ getjsonData(user) {
+ return this.http.get<any>(this.url["multipleInterface"], user);
+ }
+ getCurrentLanguage(currentloginId) {
+ let url = this.url.currentLanguage + currentloginId;
+ return this.http.get<any>(url);
+ }
+ getCreatensData(url_upId: string, requestBody: object) {
+ return this.http.post<any>(this.url.creatensData.replace("_jsonData", url_upId), requestBody);
}
//-------------------------------------------------------------------------------------
diff --git a/usecaseui-portal/src/app/mock/fake/fakedata.js b/usecaseui-portal/src/app/mock/fake/fakedata.js
index a008c14a..3fc3a588 100644
--- a/usecaseui-portal/src/app/mock/fake/fakedata.js
+++ b/usecaseui-portal/src/app/mock/fake/fakedata.js
@@ -21,4 +21,5 @@ module.exports = {
avatar: faker.internet.avatar()
}
}),
+ language: { language: faker.random.locale() }
} \ No newline at end of file
diff --git a/usecaseui-portal/src/app/mock/fake/mock.js b/usecaseui-portal/src/app/mock/fake/mock.js
index 2864d4c5..74b9fc9f 100644
--- a/usecaseui-portal/src/app/mock/fake/mock.js
+++ b/usecaseui-portal/src/app/mock/fake/mock.js
@@ -2,6 +2,7 @@ const fakeData = require('./fakedata.js');
module.exports = {
//Mock json
'customer_info': fakeData.customer,
- 'alarm_formdata_multiple': fakeData,
+ 'alarm_formdata_multiple': fakeData.customer,
'home': fakeData.home,
+ 'language': fakeData.language,
} \ No newline at end of file
diff --git a/usecaseui-portal/src/app/mock/json/alarmFormData.json b/usecaseui-portal/src/app/mock/json/alarm_form_data.json
index fc97ae0c..fc97ae0c 100644
--- a/usecaseui-portal/src/app/mock/json/alarmFormData.json
+++ b/usecaseui-portal/src/app/mock/json/alarm_form_data.json
diff --git a/usecaseui-portal/src/app/mock/json/current_language.json b/usecaseui-portal/src/app/mock/json/current_language.json
new file mode 100644
index 00000000..db3a4f27
--- /dev/null
+++ b/usecaseui-portal/src/app/mock/json/current_language.json
@@ -0,0 +1,3 @@
+{
+ "language": "en"
+} \ No newline at end of file
diff --git a/usecaseui-portal/src/app/mock/json/user_login.json b/usecaseui-portal/src/app/mock/json/user_login.json
new file mode 100644
index 00000000..1e6321b1
--- /dev/null
+++ b/usecaseui-portal/src/app/mock/json/user_login.json
@@ -0,0 +1,8 @@
+{
+ "esr-system-info-id": "xuran",
+ "service-url": "http://10.10.10.10:8080/",
+ "user-name": "demo",
+ "password": "demo123456!",
+ "system-type": "ONAP",
+ "resource-version": "1536221798873"
+} \ No newline at end of file
diff --git a/usecaseui-portal/src/app/mock/routes.js b/usecaseui-portal/src/app/mock/routes.js
index 269f008c..11dedb0f 100644
--- a/usecaseui-portal/src/app/mock/routes.js
+++ b/usecaseui-portal/src/app/mock/routes.js
@@ -1,8 +1,33 @@
// proxy routers setting
module.exports =
{
+ //text interface
+ "/user/login/:user/test": "/user/login?user=:user",
+ "/pnf/:cloudnode/p-interfaces/p-interface/:interface-name/createTerminationPoint":
+ "/status",
+ "/alarm/form/data": "/alarm_form_data",
+ "/upload/:url_upId": "/status",
+ ///////////////
+ ///////<-------------home services--------->/////
+ "/portal-auxapi/languageSetting/user/:currentloginId": "/language",
+ /////////////////////////
+ ///////<-------------managemence services--------->/////
+
+ /////////////////////////
+ ///////<-------------myhttp services--------->/////
+
+ /////////////////////////
+ ///////<-------------networkhttp services--------->/////
+
+ /////////////////////////
+ ///////<-------------onboard services--------->/////
+
+ /////////////////////////
+
+ ///////<-------------general interface--------->/////
"/api/*": "/$1",
"/*/*": "/$1_$2",
"/*/*/*": "/$1_$2_$3",
"/*/*/*/*": "/$1_$2_$3_$4",
+ /////////////////////////
}
diff --git a/usecaseui-portal/src/app/mock/server.js b/usecaseui-portal/src/app/mock/server.js
index 45773284..b993734c 100644
--- a/usecaseui-portal/src/app/mock/server.js
+++ b/usecaseui-portal/src/app/mock/server.js
@@ -1,7 +1,7 @@
const jsonServer = require('json-server');
const server = jsonServer.create();
const middlewares = jsonServer.defaults();
-// const customersRouters = require('./routes');
+const customersRouters = require('./routes');
// Set default middlewares (logger, static, cors and no-cache)
server.use(middlewares);
@@ -19,8 +19,8 @@ fileDisplay(filePath);
function fileDisplay(filePath) {
let fileList = [];
- let originPath = [];
- let rewriter = {};
+ // let originPath = [];
+ // let rewriter = {};
// Return filelist on based of filePath
const files = fs.readdirSync(filePath);
files.forEach((filename) => {
@@ -36,11 +36,11 @@ function fileDisplay(filePath) {
if (isFile) {
fileList.push(path.basename(filedir, '.json'));
fileList.forEach(item => {
- let paser = item.split("_").join("/");
- originPath.push({ route: `/${paser}`, origin: `/${item}` })
- originPath.map(route => {
- rewriter[route.route] = route.origin;
- })
+ // let paser = item.split("_").join("/");
+ // originPath.push({ route: `/${paser}`, origin: `/${item}` })
+ // originPath.map(route => {
+ // rewriter[route.route] = route.origin;
+ // })
localJsonDb[item] = getjsonContent(item);
})
}
@@ -55,7 +55,8 @@ function fileDisplay(filePath) {
})
})
setTimeout(() => {
- serverRewrite(rewriter);
+ // serverRewrite(rewriter);
+ serverRewrite();
runServer(localJsonDb);
}, 100)
}
@@ -66,23 +67,22 @@ function getjsonContent(path) {
}
//only multi router data needs jsonServer.rewriter
-function serverRewrite(routerpath) {
- let routerpathArr = routerpath;
- //rewrite mock multiple routers here
- Object.keys(fakeoriginalData).map(item => {
- let newPath = item.split("_").join("/")
- routerpathArr[`/${newPath}`] = `/${item}`;
- })
+function serverRewrite() {
+ // let routerpathArr = routerpath;
+ // rewrite mock multiple routers here
+ // Object.keys(fakeoriginalData).map(item => {
+ // let newPath = item.split("_").join("/")
+ // routerpathArr[`/${newPath}`] = `/${item}`;
+ // })
//start to rewrite routers
- // console.log(customersRouters, "===customersRouters")
- // server.use(jsonServer.rewriter(customersRouters))
- server.use(jsonServer.rewriter(routerpathArr));
+ server.use(jsonServer.rewriter(customersRouters))
+ // server.use(jsonServer.rewriter(routerpathArr));
}
function runServer(db) {
server.use(jsonServer.router(db));
}
-server.listen(3004, () => {
- console.log('Mock Server is successfully running on port 3004 😁')
+server.listen(3002, () => {
+ console.log('Mock Server is successfully running on port 3002 😁')
});
diff --git a/usecaseui-portal/src/app/test/test.component.html b/usecaseui-portal/src/app/test/test.component.html
index 200be4e6..6dbca0a9 100644
--- a/usecaseui-portal/src/app/test/test.component.html
+++ b/usecaseui-portal/src/app/test/test.component.html
@@ -15,7 +15,7 @@
<td>{{data.phone}}</td>
<td>{{data.address}}</td>
<td>
- <a>Action δΈ€ {{data.name}}</a>
+ <a>Action</a>
<nz-divider nzType="vertical"></nz-divider>
<a>Delete</a>
</td>
diff --git a/usecaseui-portal/src/app/test/test.component.ts b/usecaseui-portal/src/app/test/test.component.ts
index 30fdedc7..e217919f 100644
--- a/usecaseui-portal/src/app/test/test.component.ts
+++ b/usecaseui-portal/src/app/test/test.component.ts
@@ -15,6 +15,8 @@ export class TestComponent implements OnInit {
ngOnInit() {
this.getMockData();
this.getjsonData();
+ this.getCurrentLanguage();
+ this.createPostData();
}
tableData = []
@@ -25,10 +27,21 @@ export class TestComponent implements OnInit {
})
}
getjsonData() {
- this.TextService.getjsonData().subscribe(res => {
+ this.TextService.getjsonData("xuran").subscribe(res => {
console.log(res, "======json data")
})
}
+ getCurrentLanguage() {
+ this.TextService.getCurrentLanguage(10).subscribe(res => {
+ console.log(res, "======> current language")
+ })
+ }
+ createPostData() {
+ this.TextService.getCreatensData("/upload/name", { user: "xuran" }).subscribe(res => {
+ console.log(res, "======> post data")
+ })
+ }
+
}