2 * ============LICENSE_START========================================================================
\r
3 * ONAP : ccsdk feature sdnr wt odlux
\r
4 * =================================================================================================
\r
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
\r
6 * =================================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
\r
8 * in compliance with the License. You may obtain a copy of the License at
\r
10 * http://www.apache.org/licenses/LICENSE-2.0
\r
12 * Unless required by applicable law or agreed to in writing, software distributed under the License
\r
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
\r
14 * or implied. See the License for the specific language governing permissions and limitations under
\r
16 * ============LICENSE_END==========================================================================
\r
19 import * as React from 'react';
\r
20 import * as ReactDOM from 'react-dom';
\r
22 import { MuiThemeProvider } from '@material-ui/core/styles';
\r
24 import { Frame } from './views/frame';
\r
26 import { User } from './models/authentication';
\r
28 import { AddErrorInfoAction } from './actions/errorActions';
\r
29 import { UpdateUser } from './actions/authentication';
\r
31 import { applicationStoreCreator } from './store/applicationStore';
\r
32 import { ApplicationStoreProvider } from './flux/connect';
\r
34 import { startHistoryListener } from './middleware/navigation';
\r
35 import { startRestService } from './services/restService';
\r
37 import { startForceLogoutService } from './services/forceLogoutService';
\r
38 import { startNotificationService } from './services/notificationService';
\r
40 import theme from './design/default';
\r
41 import '!style-loader!css-loader!./app.css';
\r
43 declare module '@material-ui/core/styles/createMuiTheme' {
\r
48 url: string, // image url of a company logo, which will be presented in the ui header
\r
49 height: number, // image height [px] as delivered by the url
\r
50 width: number, // image width [px] as delivered by the url
\r
51 logoHeight: number // height in [px] of the logo (see url) within the ui header
\r
57 interface ThemeOptions {
\r
62 export { configureApplication } from "./handlers/applicationStateHandler";
\r
64 export const transportPCEUrl = "transportPCEUrl";
\r
66 export const runApplication = () => {
\r
68 const initialToken = localStorage.getItem("userToken");
\r
69 const applicationStore = applicationStoreCreator();
\r
72 applicationStore.dispatch(new UpdateUser(User.fromString(initialToken) || undefined));
\r
75 window.onerror = function (msg: string, url: string, line: number, col: number, error: Error) {
\r
76 // Note that col & error are new to the HTML 5 spec and may not be
\r
77 // supported in every browser. It worked for me in Chrome.
\r
78 var extra = !col ? '' : '\ncolumn: ' + col;
\r
79 extra += !error ? '' : '\nerror: ' + error;
\r
81 // You can view the information in an alert to see things working like this:
\r
82 applicationStore.dispatch(new AddErrorInfoAction({ error, message: msg, url, line, col, info: { extra } }));
\r
84 var suppressErrorAlert = true;
\r
85 // If you return true, then error alerts (like in older versions of
\r
86 // Internet Explorer) will be suppressed.
\r
87 return suppressErrorAlert;
\r
90 startRestService(applicationStore);
\r
91 startHistoryListener(applicationStore);
\r
92 startForceLogoutService(applicationStore);
\r
93 startNotificationService(applicationStore);
\r
95 const App = (): JSX.Element => (
\r
96 <ApplicationStoreProvider applicationStore={applicationStore} >
\r
97 <MuiThemeProvider theme={theme}>
\r
100 </ApplicationStoreProvider>
\r
103 ReactDOM.render(<App />, document.getElementById('app'));
\r