summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src/app/mock
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/mock
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/mock')
-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
7 files changed, 60 insertions, 22 deletions
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 😁')
});