summaryrefslogtreecommitdiffstats
path: root/ecomp-portal-FE-os/mock/ecomp/router.js
diff options
context:
space:
mode:
authorst782s <statta@research.att.com>2017-05-04 07:48:42 -0400
committerst782s <statta@research.att.com>2017-05-04 12:28:17 -0400
commitb54df0ddd0c6a0372327c5aa3668e5a6458fcd64 (patch)
treee69cfa9b314a801bd187cf0145d1d4306436229c /ecomp-portal-FE-os/mock/ecomp/router.js
parent39d1e62c84041831bfc52cca73b5ed5efaf57d27 (diff)
[PORTAL-7] Rebase
This rebasing includes common libraries and common overlays projects abstraction of components Change-Id: I9a24a338665c7cd058978e8636bc412d9e2fdce8 Signed-off-by: st782s <statta@research.att.com>
Diffstat (limited to 'ecomp-portal-FE-os/mock/ecomp/router.js')
-rw-r--r--ecomp-portal-FE-os/mock/ecomp/router.js144
1 files changed, 144 insertions, 0 deletions
diff --git a/ecomp-portal-FE-os/mock/ecomp/router.js b/ecomp-portal-FE-os/mock/ecomp/router.js
new file mode 100644
index 00000000..44db7160
--- /dev/null
+++ b/ecomp-portal-FE-os/mock/ecomp/router.js
@@ -0,0 +1,144 @@
+'use strict';
+
+let conf = require('../../client/configurations/mock.json');
+let router = require('express').Router();
+var concatRegex = /\/portalApi\/[\d,\w,\/,:,?]+$/;
+
+
+//**Mock endpoints goes here:
+
+//User apps home page
+router.get(stripEndpoint(conf.api.userApps), function (req, res) {
+ res.json(require('./data/applications/user-apps.json'));
+});
+
+//User widgets
+router.get(stripEndpoint(conf.api.widgets), function (req, res) {
+ res.json(require('./data/widgets/widgets.json'));
+});
+
+router.post(stripEndpoint(conf.api.widgets), function (req, res) {
+ //res.status(409).json([{"errorCode": 1201, "fields": [{"name":"name"},{"name":"url"}]}]).send();
+ res.json();
+});
+
+router.put(stripEndpoint(conf.api.widgets + '/:widgetId'), function (req, res) {
+ res.json();
+});
+
+router.delete(stripEndpoint(conf.api.widgets + '/:widgetId'), function (req, res) {
+ res.json();
+});
+
+//widget validation
+router.post(stripEndpoint(conf.api.widgetsValidation), function (req, res) {
+ //404 - not found in DB means valid
+ res.status(404).send();
+});
+
+//Admins view
+router.get(stripEndpoint(conf.api.accountAdmins), function (req, res) {
+ res.json(require('./data/admins/account-admins.json'));
+});
+
+router.get(stripEndpoint(conf.api.availableApps), function (req, res) {
+ res.json(require('./data/applications/available-apps.json'));
+});
+
+//Header
+router.get(stripEndpoint(conf.api.userProfile), function (req, res) {
+ res.json(require('./data/user-profile/user-profile.json'));
+});
+
+//New Admin + User adding dialogs
+router.get(stripEndpoint(conf.api.queryUsers), function (req, res) {
+ res.json(require('./data/users/query-users-results.json'));
+});
+
+//new admin dialog
+router.get(stripEndpoint(conf.api.adminAppsRoles), function (req, res) {
+ res.json(require('./data/admins/admin-app-roles.json'));
+});
+
+router.put(stripEndpoint(conf.api.adminAppsRoles), function (req, res) {
+ res.send();
+});
+
+//Users view
+router.get(stripEndpoint(conf.api.adminApps), function (req, res) {
+ res.send(require('./data/applications/admin-apps.json'));
+});
+
+router.get(stripEndpoint(conf.api.accountUsers), function (req, res) {
+ res.send(require('./data/users/account-users.json'));
+});
+
+//new user view
+// router.get(stripEndpoint(conf.api.userAppsRoles), function (req, res) {
+// res.send(require('./data/users/user-apps-roles.json'));
+// });
+//
+// router.put(stripEndpoint(conf.api.userAppsRoles), function (req, res) {
+// res.send();
+// });
+
+//apps onboarding view
+router.get(stripEndpoint(conf.api.onboardingApps), function (req, res) {
+ res.send(require('./data/applications/applications-onboarding.json'));
+});
+
+router.post(stripEndpoint(conf.api.onboardingApps), function (req, res) {
+ //res.status(409).json([{"errorCode": 1201, "fields": [{"name":"name"},{"name":"url"}]}]).send();
+ res.send();
+});
+
+router.put(stripEndpoint(conf.api.onboardingApps), function (req, res) {
+ res.send();
+});
+
+router.get(stripEndpoint(conf.api.functionalMenuForAuthUser), function (req, res) {
+ res.json(require('./data/functional-menu/menu-items.json'));
+});
+router.get(stripEndpoint(conf.api.functionalMenu), function (req, res) {
+ res.json(require('./data/functional-menu/menu-items.json'));
+});
+router.get(stripEndpoint(conf.api.functionalMenuItemDetails), function (req, res) {
+ res.json(require('./data/functional-menu/menu-item-details.json'));
+});
+router.get(stripEndpoint(conf.api.appRoles), function (req, res) {
+ res.json(require('./data/functional-menu/app-roles.json'));
+});
+// create a new menu item
+router.post(stripEndpoint(conf.api.functionalMenuItem), function (req, res) {
+ res.send();
+});
+// edit a menu item
+router.put(stripEndpoint(conf.api.functionalMenuItem), function (req, res) {
+ res.send();
+});
+// delete a menu item
+router.delete(stripEndpoint(conf.api.functionalMenuItem), function (req, res) {
+ res.send();
+});
+router.get(stripEndpoint(conf.api.getFavoriteItems), function (req, res) {
+ res.json(require('./data/functional-menu/favorites.json'));
+});
+// functionalMenuStaticInfo
+router.get(stripEndpoint(conf.api.functionalMenuStaticInfo), function (req, res) {
+ res.json(require('./data/user-profile/user-static-info.json'));
+});
+// Portal Admins
+router.get(stripEndpoint(conf.api.portalAdmins), function (req, res) {
+ res.json(require('./data/portal-admins/portal-admins.json'));
+});
+// Ping
+router.get(stripEndpoint(conf.api.ping), function (req, res) {
+ res.json(require('./data/ping/ping.json'));
+});
+
+
+function stripEndpoint(endpoint) {
+ return endpoint.match(concatRegex)[0];
+}
+
+module.exports = router;