Merge "Web Client context menu item display"
[ccsdk/features.git] / sdnr / wt / odlux / apps / connectApp / webpack.config.js
index 4c458a6..b7aebb9 100644 (file)
@@ -11,6 +11,8 @@ const webpack = require("webpack");
 const CopyWebpackPlugin = require("copy-webpack-plugin");
 const TerserPlugin = require('terser-webpack-plugin');
 
+const policies = require('./policies.json');
+
 // const __dirname = (path => path.replace(/^([a-z]\:)/, c => c.toUpperCase()))(process.__dirname());
 
 module.exports = (env) => {
@@ -57,6 +59,16 @@ module.exports = (env) => {
         use: [{
           loader: "babel-loader"
         }]
+      },{
+        //don't minify images
+        test: /\.(png|gif|jpg|svg)$/,
+        use: [{
+          loader: 'url-loader',
+          options: {
+            limit: 10,
+            name: './images/[name].[ext]'
+          }
+        }]
       }]
     },
 
@@ -85,7 +97,7 @@ module.exports = (env) => {
         manifest: require(path.resolve(frameworkPath, "app-manifest.json")),
         sourceType: "umd2"
       }),
-      ...(env === "release") ? [
+      ...(env === "release" ? [
         new webpack.DefinePlugin({
           "process.env": {
             NODE_ENV: "'production'",
@@ -103,7 +115,7 @@ module.exports = (env) => {
             from: 'index.html',
             to: distPath
           }]),
-        ]
+        ])
     ],
 
     devServer: {
@@ -124,29 +136,62 @@ module.exports = (env) => {
       stats: {
         colors: true
       },
-      proxy: {
-        "/oauth2/": {
-          target: "http://10.20.6.29:28181",
+      before: function(app, server, compiler) {
+        app.get('/oauth/policies',(_, res) => res.json(policies));
+      },
+       proxy: {
+        "/about": {
+          target: "http://sdnr:8181",
+          secure: false
+        }, 
+        "/yang-schema/": {
+          target: "http://sdnr:8181",
+          secure: false
+        },   
+        "/oauth/": {
+          target: "http://sdnr:8181",
           secure: false
         },
         "/database/": {
-          target: "http://10.20.6.29:28181",
+          target: "http://sdnr:8181",
           secure: false
         },
-        "/tree/": {
-          target: "http://10.20.6.29:28181",
+        "/restconf/": {
+          target: "http://sdnr:8181",
           secure: false
         },
         "/rests/": {
-          target: "http://10.20.6.29:28181",
+          target: "http://sdnr:8181",
+          secure: false
+        },
+        "/userdata": {
+          target: "http://sdnr:8181",
+          secure: false
+        },
+        "/userdata/": {
+          target: "http://sdnr:8181",
           secure: false
         },
         "/help/": {
-          target: "http://10.20.6.29:28181",
+          target: "http://sdnr:8181",
+          secure: false
+        },
+         "/about/": {
+          target: "http://sdnr:8181",
+          secure: false
+        },
+        "/tree/": {
+          target: "http://sdnr:8181",
           secure: false
         },
         "/websocket": {
-          target: "http://10.20.6.29:28181",
+          target: "http://sdnr:8181",
+          ws: true,
+          changeOrigin: true,
+          secure: false
+        },
+        "/apidoc": {
+          target: "http://sdnr:8181",
           ws: true,
           changeOrigin: true,
           secure: false