diff --git a/js/app.jsx b/js/app.jsx index ca63be370..b389dd624 100644 --- a/js/app.jsx +++ b/js/app.jsx @@ -1,3 +1,4 @@ +const assign = require('object-assign'); /** * Copyright 2016, GeoSolutions Sas. * All rights reserved. @@ -37,13 +38,25 @@ ConfigUtils.setLocalConfigurationFile('MapStore2/web/client/localConfig.json'); * }] * }); */ -const appConfig = require('@mapstore/product/appConfig'); - +const appConfig = assign({}, require('@mapstore/product/appConfig'), { + pages: [{ + name: "mapviewer", + path: "/", + component: require('@mapstore/product/pages/MapViewer') + }] +}); /** * Define a custom list of plugins with: * * const plugins = require('./plugins'); */ const plugins = require('@mapstore/product/plugins'); +const appPlugins = { + plugins: { + ...plugins.plugins, + LoginPlugin: require('./plugins/Login').default + }, + requires: plugins.requires +}; -require('@mapstore/product/main')(appConfig, plugins); +require('@mapstore/product/main')(appConfig, appPlugins); diff --git a/js/components/User.jsx b/js/components/User.jsx new file mode 100644 index 000000000..423dfb60f --- /dev/null +++ b/js/components/User.jsx @@ -0,0 +1,25 @@ +import React, { Component } from "react"; +import PropTypes from "prop-types"; +import loadingState from "@mapstore/components/misc/enhancers/loadingState"; +const UserInfo = ({user}) => {user.name}; +const LoadingUser = loadingState(({ user }) => !user)(UserInfo); +class User extends Component { + static propTypes = { + className: PropTypes.string, + onLogin: PropTypes.func, + user: PropTypes.object + }; + componentDidMount() { + if (!this.props.user) { + this.props.onLogin("", ""); + } + } + render() { + const {className, ...props} = this.props; + return
; + } +} + +export const Empty = () => ; + +export default User; diff --git a/js/plugins/Login.jsx b/js/plugins/Login.jsx new file mode 100644 index 000000000..1b70aa2ab --- /dev/null +++ b/js/plugins/Login.jsx @@ -0,0 +1,29 @@ +import {createPlugin} from "@mapstore/utils/PluginsUtils"; +import {login} from "@mapstore/actions/security"; +import {connect} from "react-redux"; +import User, {Empty} from "../components/User"; +import security from "@mapstore/reducers/security"; + +const Login = connect((state) => ({ + user: state.security && state.security.user, + bsStyle: "primary", + className: "square-button" +}), { + onLogin: login +})(User); + + +export default createPlugin('Login', { + component: Empty, + containers: { + OmniBar: { + name: "login", + position: 3, + tool: Login, + priority: 1 + } + }, + reducers: { + security + } +}); diff --git a/web/pom.xml b/web/pom.xml index 5ff12d3a6..fb3b737be 100644 --- a/web/pom.xml +++ b/web/pom.xml @@ -22,7 +22,7 @@ it.geosolutions.geostore geostore-webapp - 1.4.2-SNAPSHOT + 1.4.3-SNAPSHOT war runtime diff --git a/web/src/main/resources/geostore-spring-security.xml b/web/src/main/resources/geostore-spring-security.xml new file mode 100644 index 000000000..1621529ab --- /dev/null +++ b/web/src/main/resources/geostore-spring-security.xml @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index 2c5f1da1d..a793cd4a2 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -24,5 +24,39 @@ module.exports = require('./MapStore2/build/buildConfig')( { "@mapstore": path.resolve(__dirname, "MapStore2", "web", "client"), "@js": path.resolve(__dirname, "js") + }, + { + '/rest/geostore': { + target: "http://localhost:8080/mapstore", + secure: false, + headers: { + host: "localhost:8080" + } + }, + '/pdf': { + target: "http://localhost:8080/mapstore", + secure: false, + headers: { + host: "localhost:8080" + } + }, + '/mapstore/pdf': { + target: "http://localhost:8080", + secure: false, + headers: { + host: "localhost:8080" + } + }, + '/proxy': { + target: "http://localhost:8080/mapstore", + secure: false, + headers: { + host: "localhost:8080" + } + }, + '/docs': { + target: "http://localhost:8081", + pathRewrite: { '/docs': '/mapstore/docs' } + } } );