summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/apps/connectApp/src/views
diff options
context:
space:
mode:
authorHerbert Eiselt <herbert.eiselt@highstreet-technologies.com>2019-02-11 14:54:12 +0100
committerHerbert Eiselt <herbert.eiselt@highstreet-technologies.com>2019-02-11 14:54:53 +0100
commit3d202a04b99f0e61b6ccf8b7a5610e1a15ca58e7 (patch)
treeab756cfa8de5eced886d3947423d198be8c0ce62 /sdnr/wt/odlux/apps/connectApp/src/views
parent12a8c669f52c0e84d580c078cee849b25133b585 (diff)
Add sdnr wt odlux
Add complete sdnr wireless transport app odlux core and apps Change-Id: I5dcbfb8f3b790e3bda7c8df67bd69d81958f65e5 Issue-ID: SDNC-576 Signed-off-by: Herbert Eiselt <herbert.eiselt@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/odlux/apps/connectApp/src/views')
-rw-r--r--sdnr/wt/odlux/apps/connectApp/src/views/connectView.tsx93
1 files changed, 93 insertions, 0 deletions
diff --git a/sdnr/wt/odlux/apps/connectApp/src/views/connectView.tsx b/sdnr/wt/odlux/apps/connectApp/src/views/connectView.tsx
new file mode 100644
index 000000000..b73eb39d7
--- /dev/null
+++ b/sdnr/wt/odlux/apps/connectApp/src/views/connectView.tsx
@@ -0,0 +1,93 @@
+import * as React from 'react';
+
+import connect, { IDispatcher, Connect } from '../../../../framework/src/flux/connect';
+import { Panel } from '../../../../framework/src/components/material-ui';
+
+import { requiredNetworkElementsReloadAction } from '../handlers/requiredNetworkElementsHandler';
+import { loadAllMountedNetworkElementsAsync } from '../actions/mountedNetworkElementsActions';
+import { connectionStatusLogReloadAction } from '../handlers/connectionStatusLogHandler';
+
+import { RequiredNetworkElementsList } from '../components/requiredNetworkElements';
+import { ConnectionStatusLog } from '../components/connectionStatusLog';
+import { UnknownNetworkElementsList } from '../components/unknownNetworkElements';
+
+const mapDispatcher = (dispatcher: IDispatcher) => ({
+ onLoadUnknownNetworkElements: () => {
+ dispatcher.dispatch(loadAllMountedNetworkElementsAsync);
+ },
+ onLoadRequiredNetworkElements: () => {
+ dispatcher.dispatch(requiredNetworkElementsReloadAction);
+ },
+ onLoadConnectionStatusLog: () => {
+ dispatcher.dispatch(connectionStatusLogReloadAction);
+ }
+});
+
+type PanelId = null | "RequiredNetworkElements" | "UnknownNetworkElements" | "ConnectionStatusLog";
+
+type ConnectApplicationComponentProps = Connect<undefined, typeof mapDispatcher> ;
+
+type ConnectApplicationComponentState = {
+ activePanel: PanelId;
+};
+
+class ConnectApplicationComponent extends React.Component<ConnectApplicationComponentProps, ConnectApplicationComponentState>{
+ /**
+ * Initialises this instance
+ */
+ constructor(props: ConnectApplicationComponentProps) {
+ super(props);
+
+ this.state = {
+ activePanel: null
+ };
+ }
+ private onTogglePanel = (panelId: PanelId) => {
+ const nextActivePanel = panelId === this.state.activePanel ? null : panelId;
+ this.setState({
+ activePanel: nextActivePanel
+ }, () => {
+ switch (nextActivePanel) {
+ case 'RequiredNetworkElements':
+ this.props.onLoadRequiredNetworkElements();
+ break;
+ case 'UnknownNetworkElements':
+ // todo: should we update the application state ?
+ break;
+ case 'ConnectionStatusLog':
+ this.props.onLoadConnectionStatusLog();
+ break;
+ case null:
+ // do nothing if all panels are closed
+ break;
+ default:
+ console.warn("Unknown nextActivePanel [" + nextActivePanel + "] in connectView");
+ break;
+ }
+ });
+ };
+
+ render(): JSX.Element {
+ const { activePanel } = this.state;
+
+ return (
+ <>
+ <Panel activePanel={ activePanel } panelId={ 'RequiredNetworkElements' } onToggle={ this.onTogglePanel } title={ "Required Network Elements" }>
+ <RequiredNetworkElementsList />
+ </Panel>
+ <Panel activePanel={ activePanel } panelId={ 'UnknownNetworkElements' } onToggle={ this.onTogglePanel } title={ "Unknown Network Elements" }>
+ <UnknownNetworkElementsList />
+ </Panel>
+ <Panel activePanel={ activePanel } panelId={ 'ConnectionStatusLog' } onToggle={ this.onTogglePanel } title={ "Connection Status Log" }>
+ <ConnectionStatusLog />
+ </Panel>
+ </>
+ );
+ };
+ public componentDidMount() {
+ this.props.onLoadUnknownNetworkElements();
+ }
+}
+
+export const ConnectApplication = (connect(undefined, mapDispatcher)(ConnectApplicationComponent));
+export default ConnectApplication; \ No newline at end of file