summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/apps/connectApp/src/pluginConnect.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/odlux/apps/connectApp/src/pluginConnect.tsx')
-rw-r--r--sdnr/wt/odlux/apps/connectApp/src/pluginConnect.tsx65
1 files changed, 63 insertions, 2 deletions
diff --git a/sdnr/wt/odlux/apps/connectApp/src/pluginConnect.tsx b/sdnr/wt/odlux/apps/connectApp/src/pluginConnect.tsx
index 93bed1aad..461e14023 100644
--- a/sdnr/wt/odlux/apps/connectApp/src/pluginConnect.tsx
+++ b/sdnr/wt/odlux/apps/connectApp/src/pluginConnect.tsx
@@ -16,22 +16,70 @@
* ============LICENSE_END==========================================================================
*/
+import * as React from "react";
+import { withRouter, RouteComponentProps, Route, Switch, Redirect } from 'react-router-dom';
import { faPlug } from '@fortawesome/free-solid-svg-icons';
import applicationManager from '../../../framework/src/services/applicationManager';
import { subscribe, IFormatedMessage } from '../../../framework/src/services/notificationService';
import { AddSnackbarNotification } from '../../../framework/src/actions/snackbarActions';
+import { IApplicationStoreState } from "../../../framework/src/store/applicationStore";
+import connect, { Connect, IDispatcher } from '../../../framework/src/flux/connect';
+import { findWebUrisForGuiCutThroughAsyncAction, updateCurrentViewAsyncAction, SetPanelAction } from './actions/commonNetworkElementsActions';
+import { refreshConnectionStatusCountAsyncAction } from './actions/connectionStatusCountActions';
+import { createNetworkElementsActions, createNetworkElementsProperties, networkElementsReloadAction } from './handlers/networkElementsHandler';
import connectAppRootHandler from './handlers/connectAppRootHandler';
import ConnectApplication from './views/connectView';
+import { PanelId } from "./models/panelId";
+import { NetworkElementsList } from './components/networkElements'
-import { findWebUrisForGuiCutThroughAsyncAction, updateCurrentViewAsyncAction } from './actions/commonNetworkElementsActions';
+let currentStatus: string | undefined = undefined;
+
+const mapProps = (state: IApplicationStoreState) => ({
+ currentProblemsProperties: createNetworkElementsProperties(state),
+});
+
+const mapDisp = (dispatcher: IDispatcher) => ({
+ currentProblemsActions: createNetworkElementsActions(dispatcher.dispatch, true),
+ setCurrentPanel: (panelId: PanelId) => dispatcher.dispatch(new SetPanelAction(panelId)),
+});
+
+const ConnectApplicationRouteAdapter = connect(mapProps, mapDisp)((props: RouteComponentProps<{ status?: string }> & Connect<typeof mapProps, typeof mapDisp>) => {
+ if (currentStatus !== props.match.params.status) {
+ currentStatus = props.match.params.status || undefined;
+ window.setTimeout(() => {
+ if (currentStatus) {
+ props.setCurrentPanel("NetworkElements");
+ props.currentProblemsActions.onFilterChanged("status", currentStatus);
+ if (!props.currentProblemsProperties.showFilter) {
+ props.currentProblemsActions.onToggleFilter(false);
+ props.currentProblemsActions.onRefresh();
+ }
+ else
+ props.currentProblemsActions.onRefresh();
+ }
+ });
+ }
+ return (
+ <NetworkElementsList />
+ )
+});
+
+
+const App = withRouter((props: RouteComponentProps) => (
+ <Switch>
+ <Route path={`${props.match.path}/connectionStatus/:status?`} component={ConnectApplicationRouteAdapter} />
+ <Route path={`${props.match.path}`} component={ConnectApplication} />
+ <Redirect to={`${props.match.path}`} />
+ </Switch>
+));
export function register() {
const applicationApi = applicationManager.registerApplication({
name: "connect",
icon: faPlug,
- rootComponent: ConnectApplication,
+ rootComponent: App,
rootActionHandler: connectAppRootHandler,
menuEntry: "Connect"
});
@@ -52,4 +100,17 @@ export function register() {
});
}
}));
+
+ applicationApi.applicationStoreInitialized.then(store => {
+ store.dispatch(networkElementsReloadAction);
+ });
+
+ applicationApi.applicationStoreInitialized.then(store => {
+ store.dispatch(refreshConnectionStatusCountAsyncAction);
+ });
+ window.setInterval(() => {
+ applicationApi.applicationStoreInitialized.then(store => {
+ store.dispatch(refreshConnectionStatusCountAsyncAction);
+ });
+ }, 15000);
} \ No newline at end of file