2 * Copyright © 2018 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 import { hot } from 'react-hot-loader';
18 import React, { Component } from 'react';
19 import { Route } from 'react-router-dom';
22 import { PluginPubSub } from 'shared/pubsub/plugin-pubsub';
23 import 'resources/scss/style.scss';
24 import 'bpmn-js-properties-panel/styles/properties.less';
25 import { routes } from 'wfapp/routes';
26 import { USER_ID } from 'wfapp/appConstants';
28 const RouteWithSubRoutes = route => (
32 render={props => <route.component {...props} routes={route.routes} />}
36 class App extends Component {
40 this.searchParams = qs.parse(location.search, {
41 ignoreQueryPrefix: true
44 if (this.searchParams && this.searchParams.userId) {
45 localStorage.setItem(USER_ID, this.searchParams.userId);
50 if (this.searchParams) {
51 const { eventsClientId, parentUrl } = this.searchParams;
53 if (eventsClientId && parentUrl) {
54 const client = new PluginPubSub(eventsClientId, parentUrl);
56 client.notify('READY');
63 <div className="workflow-app">
64 {routes.map((route, i) => (
65 <RouteWithSubRoutes key={`App.route.${i}`} {...route} />
72 export default hot(module)(App);