summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal
diff options
context:
space:
mode:
authorChuyi Guo <guochuyi@chinamobile.com>2019-08-30 03:03:49 +0000
committerGerrit Code Review <gerrit@onap.org>2019-08-30 03:03:49 +0000
commit95db8df651691e3645921cc9a795971beb2e855a (patch)
tree2804a433840464edeed59827b99ba56442c53c9f /usecaseui-portal
parent0fe93162839f6848710dccfc49667973a3c3763e (diff)
parent0c1e82ccbfa6dcb8ee5d11220a93fefc61465374 (diff)
Merge "feat: change the mock data path config file"
Diffstat (limited to 'usecaseui-portal')
-rw-r--r--usecaseui-portal/README.md10
-rw-r--r--usecaseui-portal/localproxy.conf.json2
-rw-r--r--usecaseui-portal/package.json2
-rw-r--r--usecaseui-portal/src/app/app.component.html28
-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
17 files changed, 213 insertions, 152 deletions
diff --git a/usecaseui-portal/README.md b/usecaseui-portal/README.md
index 29e92ed4..2fbea7a1 100644
--- a/usecaseui-portal/README.md
+++ b/usecaseui-portal/README.md
@@ -88,7 +88,11 @@ npm run changelog
└── README.md
```
-### [Change log](./CHANGELOG.md)
+
+### Mock data
+
+This project allows developers to develop in mock data with `npm run mock`, which means FEers can develop independently in the beginning of the project developing period. Developers can set mock data in `mock/fake/mock.js`, where supports two methods of creating mock data. The remote method relies on [faker.js](https://github.com/marak/Faker.js/).
+
### Git commit message rules
@@ -139,6 +143,10 @@ When there is breaking changes in the project, please write the commit message i
```
Also, run the script `npm run changelog` can generate all the `feat` and `fix` commits. Click [CHANGELOG.md](./CHANGELOG.md) shows all these commit histories.
+
+### [Change log](./CHANGELOG.md)
+
+
### Contributor
```
diff --git a/usecaseui-portal/localproxy.conf.json b/usecaseui-portal/localproxy.conf.json
index bf4dcf52..99adbad5 100644
--- a/usecaseui-portal/localproxy.conf.json
+++ b/usecaseui-portal/localproxy.conf.json
@@ -1,6 +1,6 @@
{
"/api": {
- "target": "http://localhost:3004",
+ "target": "http://localhost:3002",
"secure": false,
"logLevel": "debug",
"changeOrigin": true,
diff --git a/usecaseui-portal/package.json b/usecaseui-portal/package.json
index 8001ac14..fb08ed80 100644
--- a/usecaseui-portal/package.json
+++ b/usecaseui-portal/package.json
@@ -11,7 +11,7 @@
"lint": "ng lint",
"e2e": "ng e2e",
"mockproxy": "ng serve --host='0.0.0.0' --proxy-config localproxy.conf.json",
- "mockconfig": "node ./src/app/mock/server.js --port 3004",
+ "mockconfig": "node ./src/app/mock/server.js --port 3002",
"mock": "npm run mockconfig & npm run mockproxy",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s"
},
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/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")
+ })
+ }
+
}