Merge "YANG Model update for A1 Adapter"
[ccsdk/features.git] / sdnr / wt / odlux / framework / src / components / routing / appFrame.tsx
1 /**
2  * ============LICENSE_START========================================================================
3  * ONAP : ccsdk feature sdnr wt odlux
4  * =================================================================================================
5  * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
6  * =================================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8  * in compliance with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software distributed under the License
13  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14  * or implied. See the License for the specific language governing permissions and limitations under
15  * the License.
16  * ============LICENSE_END==========================================================================
17  */
18 import * as React from 'react';\r
19 \r
20 import connect, { Connect } from '../../flux/connect';\r
21 \r
22 import { SetTitleAction } from '../../actions/titleActions';\r
23 import { AddErrorInfoAction } from '../../actions/errorActions';\r
24 \r
25 import { IconType } from '../../models/iconDefinition';\r
26 \r
27 export interface IAppFrameProps  {\r
28   title: string;\r
29   icon?: IconType;\r
30   appId?: string\r
31 }\r
32 \r
33 /**\r
34  * Represents a component to wich will embed each single app providing the\r
35  * functionality to update the title and implement an exeprion border.\r
36  */\r
37 export class AppFrame extends React.Component<IAppFrameProps & Connect> {\r
38 \r
39   public render(): JSX.Element {\r
40     return (\r
41       <div style={{ flex: "1", overflow: "auto", display: "flex", flexDirection: "column" }}>\r
42         { this.props.children }\r
43       </div>\r
44      )\r
45     }\r
46 \r
47   public componentDidMount() {\r
48     this.props.dispatch(new SetTitleAction(this.props.title, this.props.icon, this.props.appId));\r
49   }\r
50   public componentDidCatch(error: Error | null, info: object) {\r
51     this.props.dispatch(new AddErrorInfoAction({ error, info }));\r
52   }\r
53 }\r
54 \r
55 export default connect()(AppFrame);