diff options
Diffstat (limited to 'usecaseui-portal/src/app/mock')
-rw-r--r-- | usecaseui-portal/src/app/mock/fake/fakedata.js | 1 | ||||
-rw-r--r-- | usecaseui-portal/src/app/mock/fake/mock.js | 3 | ||||
-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.json | 3 | ||||
-rw-r--r-- | usecaseui-portal/src/app/mock/json/user_login.json | 8 | ||||
-rw-r--r-- | usecaseui-portal/src/app/mock/routes.js | 25 | ||||
-rw-r--r-- | usecaseui-portal/src/app/mock/server.js | 42 |
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 😁') }); |