aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/apps/faultApp/src
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/odlux/apps/faultApp/src')
-rw-r--r--sdnr/wt/odlux/apps/faultApp/src/actions/notificationActions.ts33
-rw-r--r--sdnr/wt/odlux/apps/faultApp/src/actions/panelChangeActions.ts26
-rw-r--r--sdnr/wt/odlux/apps/faultApp/src/actions/statusActions.ts43
-rw-r--r--sdnr/wt/odlux/apps/faultApp/src/components/faultStatus.tsx71
-rw-r--r--sdnr/wt/odlux/apps/faultApp/src/handlers/alarmLogEntriesHandler.ts41
-rw-r--r--sdnr/wt/odlux/apps/faultApp/src/handlers/currentProblemsHandler.ts41
-rw-r--r--sdnr/wt/odlux/apps/faultApp/src/handlers/faultAppRootHandler.ts62
-rw-r--r--sdnr/wt/odlux/apps/faultApp/src/handlers/faultStatusHandler.ts46
-rw-r--r--sdnr/wt/odlux/apps/faultApp/src/handlers/notificationsHandler.ts47
-rw-r--r--sdnr/wt/odlux/apps/faultApp/src/index.html29
-rw-r--r--sdnr/wt/odlux/apps/faultApp/src/models/fault.ts31
-rw-r--r--sdnr/wt/odlux/apps/faultApp/src/models/panelId.ts18
-rw-r--r--sdnr/wt/odlux/apps/faultApp/src/plugin.tsx112
-rw-r--r--sdnr/wt/odlux/apps/faultApp/src/services/faultStatusService.ts39
-rw-r--r--sdnr/wt/odlux/apps/faultApp/src/views/faultApplication.tsx135
15 files changed, 0 insertions, 774 deletions
diff --git a/sdnr/wt/odlux/apps/faultApp/src/actions/notificationActions.ts b/sdnr/wt/odlux/apps/faultApp/src/actions/notificationActions.ts
deleted file mode 100644
index b990536e4..000000000
--- a/sdnr/wt/odlux/apps/faultApp/src/actions/notificationActions.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt odlux
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-import { Action } from '../../../../framework/src/flux/action';
-
-import { Fault } from '../models/fault';
-
-export class FaultApplicationBaseAction extends Action { }
-
-
-export class AddFaultNotificationAction extends FaultApplicationBaseAction {
- constructor(public fault:Fault) {
- super();
- }
-}
-
-export class ResetFaultNotificationsAction extends FaultApplicationBaseAction {
-
-}
diff --git a/sdnr/wt/odlux/apps/faultApp/src/actions/panelChangeActions.ts b/sdnr/wt/odlux/apps/faultApp/src/actions/panelChangeActions.ts
deleted file mode 100644
index f032c139a..000000000
--- a/sdnr/wt/odlux/apps/faultApp/src/actions/panelChangeActions.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt odlux
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-import { Action } from '../../../../framework/src/flux/action';
-import { PanelId } from '../models/panelId';
-
-export class SetPanelAction extends Action {
- constructor(public panelId: PanelId) {
- super();
- }
-}
-
diff --git a/sdnr/wt/odlux/apps/faultApp/src/actions/statusActions.ts b/sdnr/wt/odlux/apps/faultApp/src/actions/statusActions.ts
deleted file mode 100644
index 8a3633243..000000000
--- a/sdnr/wt/odlux/apps/faultApp/src/actions/statusActions.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt odlux
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-import { FaultApplicationBaseAction } from './notificationActions';
-import { getFaultStateFromDatabase } from '../services/faultStatusService';
-import { Dispatch } from '../../../../framework/src/flux/store';
-
-
-export class SetFaultStatusAction extends FaultApplicationBaseAction {
- constructor (public criticalFaults: number, public majorFaults: number, public minorFaults: number, public warnings: number) {
- super();
- }
-}
-
-
-export const refreshFaultStatusAsyncAction = async (dispatch: Dispatch ) => {
- const result = await getFaultStateFromDatabase().catch(_=>null);
- if (result) {
- const statusAction = new SetFaultStatusAction(
- result["Critical"] || 0,
- result["Major"] || 0,
- result["Minor"] || 0,
- result["Warning"] || 0
- );
- dispatch(statusAction);
- return;
- }
- dispatch(new SetFaultStatusAction(0, 0, 0, 0));
-}
diff --git a/sdnr/wt/odlux/apps/faultApp/src/components/faultStatus.tsx b/sdnr/wt/odlux/apps/faultApp/src/components/faultStatus.tsx
deleted file mode 100644
index 780e61d7a..000000000
--- a/sdnr/wt/odlux/apps/faultApp/src/components/faultStatus.tsx
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt odlux
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-import * as React from 'react';
-
-import { withStyles, WithStyles, createStyles, Theme } from '@material-ui/core/styles';
-import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons'; // select app icon
-
-import connect, { Connect } from '../../../../framework/src/flux/connect';
-import { IApplicationStoreState } from '../../../../framework/src/store/applicationStore';
-
-import Typography from '@material-ui/core/Typography';
-import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-
-const styles = (theme: Theme) => createStyles({
- icon: {
- marginLeft: 8,
- marginRight: 8
- },
- critical: {
- color: "red"
- },
- major: {
- color: "orange"
- },
- minor: {
- color: "#f7f700"
- },
- warning: {
- color: "#428bca"
- }
-});
-
-const mapProps = (state: IApplicationStoreState) => ({
- faultStatus: state.fault.faultStatus,
-});
-
-
-type FaultStatusComponentProps = & WithStyles<typeof styles> & Connect<typeof mapProps>;
-
-class FaultStatusComponent extends React.Component<FaultStatusComponentProps> {
- render(): JSX.Element {
- const { classes, faultStatus } = this.props;
-
- return (
- <Typography variant="body1" color="inherit" >
- Alarm status: <FontAwesomeIcon className={`${classes.icon} ${classes.critical}`} icon={faExclamationTriangle} /> { faultStatus.critical } |
- <FontAwesomeIcon className={`${classes.icon} ${classes.major}`} icon={faExclamationTriangle} /> { faultStatus.major } |
- <FontAwesomeIcon className={`${classes.icon} ${classes.minor}`} icon={faExclamationTriangle} /> { faultStatus.minor } |
- <FontAwesomeIcon className={`${classes.icon} ${classes.warning}`} icon={faExclamationTriangle} /> { faultStatus.warning } |
- </Typography>
- );
- };
-}
-
-export const FaultStatus = withStyles(styles)(connect(mapProps)(FaultStatusComponent));
-export default FaultStatus; \ No newline at end of file
diff --git a/sdnr/wt/odlux/apps/faultApp/src/handlers/alarmLogEntriesHandler.ts b/sdnr/wt/odlux/apps/faultApp/src/handlers/alarmLogEntriesHandler.ts
deleted file mode 100644
index be41a51b2..000000000
--- a/sdnr/wt/odlux/apps/faultApp/src/handlers/alarmLogEntriesHandler.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt odlux
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-import { createExternal,IExternalTableState } from '../../../../framework/src/components/material-table/utilities';
-import { createSearchDataHandler } from '../../../../framework/src/utilities/elasticSearch';
-
-import { Fault, FaultLog } from '../models/fault';
-
-export interface IAlarmLogEntriesState extends IExternalTableState<Fault> { }
-
-// create eleactic search material data fetch handler
-const alarmLogEntriesSearchHandler = createSearchDataHandler<FaultLog, Fault>(
- 'sdnevents/faultlog',
- null,
- (hit) => ({ _id: hit._id, ...hit._source.fault }),
- (name) => `fault.${ name }`
-);
-
-export const {
- actionHandler: alarmLogEntriesActionHandler,
- createActions: createAlarmLogEntriesActions,
- createProperties: createAlarmLogEntriesProperties,
- reloadAction: alarmLogEntriesReloadAction,
-
- // set value action, to change a value
-} = createExternal<Fault>(alarmLogEntriesSearchHandler, appState => appState.fault.alarmLogEntries);
-
diff --git a/sdnr/wt/odlux/apps/faultApp/src/handlers/currentProblemsHandler.ts b/sdnr/wt/odlux/apps/faultApp/src/handlers/currentProblemsHandler.ts
deleted file mode 100644
index 760dbeadc..000000000
--- a/sdnr/wt/odlux/apps/faultApp/src/handlers/currentProblemsHandler.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt odlux
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-import { createExternal,IExternalTableState } from '../../../../framework/src/components/material-table/utilities';
-import { createSearchDataHandler } from '../../../../framework/src/utilities/elasticSearch';
-
-import { FaultResult, Fault } from '../models/fault';
-
-export interface ICurrentProblemsState extends IExternalTableState<Fault> { }
-
-// create eleactic search material data fetch handler
-const currentProblemsSearchHandler = createSearchDataHandler<FaultResult, Fault>(
- 'sdnevents/faultcurrent',
- null,
- (hit) => ({ _id: hit._id, ...hit._source.faultCurrent }),
- (name) => `faultCurrent.${name}`
- );
-
-export const {
- actionHandler: currentProblemsActionHandler,
- createActions: createCurrentProblemsActions,
- createProperties: createCurrentProblemsProperties,
- reloadAction: currentProblemsReloadAction,
-
- // set value action, to change a value
-} = createExternal<Fault>(currentProblemsSearchHandler, appState => appState.fault.currentProblems);
-
diff --git a/sdnr/wt/odlux/apps/faultApp/src/handlers/faultAppRootHandler.ts b/sdnr/wt/odlux/apps/faultApp/src/handlers/faultAppRootHandler.ts
deleted file mode 100644
index 22a9a58a2..000000000
--- a/sdnr/wt/odlux/apps/faultApp/src/handlers/faultAppRootHandler.ts
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt odlux
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-// main state handler
-
-import { combineActionHandler } from '../../../../framework/src/flux/middleware';
-
-// ** do not remove **
-import { IApplicationStoreState } from '../../../../framework/src/store/applicationStore';
-import { IActionHandler } from '../../../../framework/src/flux/action';
-
-import { IFaultNotifications, faultNotificationsHandler } from './notificationsHandler';
-import { ICurrentProblemsState, currentProblemsActionHandler } from './currentProblemsHandler';
-import { IAlarmLogEntriesState, alarmLogEntriesActionHandler } from './alarmLogEntriesHandler';
-import { SetPanelAction } from '../actions/panelChangeActions';
-import { IFaultStatus, faultStatusHandler } from './faultStatusHandler';
-
-export interface IFaultAppStoreState {
- currentProblems: ICurrentProblemsState;
- faultNotifications: IFaultNotifications;
- alarmLogEntries: IAlarmLogEntriesState;
- currentOpenPanel: string|null;
- faultStatus: IFaultStatus;
-}
-
-const currentOpenPanelHandler: IActionHandler<string | null> = (state = null, action) => {
- if (action instanceof SetPanelAction) {
- state = action.panelId;
- }
- return state;
-}
-
-declare module '../../../../framework/src/store/applicationStore' {
- interface IApplicationStoreState {
- fault: IFaultAppStoreState;
- }
-}
-
-const actionHandlers = {
- currentProblems: currentProblemsActionHandler,
- faultNotifications: faultNotificationsHandler,
- alarmLogEntries: alarmLogEntriesActionHandler,
- currentOpenPanel: currentOpenPanelHandler,
- faultStatus: faultStatusHandler
-};
-
-export const faultAppRootHandler = combineActionHandler<IFaultAppStoreState>(actionHandlers);
-export default faultAppRootHandler;
diff --git a/sdnr/wt/odlux/apps/faultApp/src/handlers/faultStatusHandler.ts b/sdnr/wt/odlux/apps/faultApp/src/handlers/faultStatusHandler.ts
deleted file mode 100644
index 1c76a4b1a..000000000
--- a/sdnr/wt/odlux/apps/faultApp/src/handlers/faultStatusHandler.ts
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt odlux
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-import { IActionHandler } from "../../../../framework/src/flux/action";
-import { SetFaultStatusAction } from "../actions/statusActions";
-
-export interface IFaultStatus {
- critical: number,
- major: number,
- minor: number,
- warning: number
-}
-
-const faultStatusInit: IFaultStatus = {
- critical: 0,
- major: 0,
- minor: 0,
- warning: 0
-};
-
-export const faultStatusHandler: IActionHandler<IFaultStatus> = (state = faultStatusInit, action) => {
- if (action instanceof SetFaultStatusAction) {
- state = {
- critical: action.criticalFaults,
- major: action.majorFaults,
- minor: action.minorFaults,
- warning: action.warnings
- }
- }
-
- return state;
-} \ No newline at end of file
diff --git a/sdnr/wt/odlux/apps/faultApp/src/handlers/notificationsHandler.ts b/sdnr/wt/odlux/apps/faultApp/src/handlers/notificationsHandler.ts
deleted file mode 100644
index 4377a1b0a..000000000
--- a/sdnr/wt/odlux/apps/faultApp/src/handlers/notificationsHandler.ts
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt odlux
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-import { IActionHandler } from '../../../../framework/src/flux/action';
-import { AddFaultNotificationAction, ResetFaultNotificationsAction } from '../actions/notificationActions';
-import { Fault } from '../models/fault';
-
-export interface IFaultNotifications {
- faults: Fault[];
- since: Date;
-}
-
-const faultNotoficationsInit: IFaultNotifications = {
- faults: [],
- since: new Date()
-};
-
-export const faultNotificationsHandler: IActionHandler<IFaultNotifications> = (state = faultNotoficationsInit, action) => {
- if (action instanceof AddFaultNotificationAction) {
- state = {
- ...state,
- faults: [...state.faults, action.fault]
- };
- } else if (action instanceof ResetFaultNotificationsAction){
- state = {
- ...state,
- faults: [],
- since: new Date()
- };
- }
-
- return state;
-} \ No newline at end of file
diff --git a/sdnr/wt/odlux/apps/faultApp/src/index.html b/sdnr/wt/odlux/apps/faultApp/src/index.html
deleted file mode 100644
index a2a0830b3..000000000
--- a/sdnr/wt/odlux/apps/faultApp/src/index.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <!-- <link rel="stylesheet" href="./vendor.css"> -->
- <title>Minimal App</title>
-</head>
-
-<body>
- <div id="app"></div>
- <script type="text/javascript" src="./require.js"></script>
- <script type="text/javascript" src="./config.js"></script>
- <script>
- // run the application
- require(["app", "connectApp", "faultApp", "maintenanceApp", "configurationApp", "helpApp"], function (app, connectApp, faultApp, maintenanceApp, configurationApp, helpApp) {
- connectApp.register();
- faultApp.register();
- configurationApp.register();
- maintenanceApp.register();
- helpApp.register();
- app("./app.tsx").runApplication();
- });
- </script>
-</body>
-
-</html> \ No newline at end of file
diff --git a/sdnr/wt/odlux/apps/faultApp/src/models/fault.ts b/sdnr/wt/odlux/apps/faultApp/src/models/fault.ts
deleted file mode 100644
index 153e8def3..000000000
--- a/sdnr/wt/odlux/apps/faultApp/src/models/fault.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt odlux
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-export type FaultType = {
- nodeName: string;
- counter: string;
- timeStamp: string;
- objectId: string;
- problem: string;
- severity: null | 'Warning' | 'Minor' | 'Major' | 'Critical' ;
- type: string;
-}
-export type FaultResult = { faultCurrent: FaultType };
-
-export type FaultLog = { fault: FaultType };
-
-export type Fault = FaultType & { _id: string };
diff --git a/sdnr/wt/odlux/apps/faultApp/src/models/panelId.ts b/sdnr/wt/odlux/apps/faultApp/src/models/panelId.ts
deleted file mode 100644
index 186aa53d9..000000000
--- a/sdnr/wt/odlux/apps/faultApp/src/models/panelId.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt odlux
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-export type PanelId = null | "CurrentProblem" | "AlarmNotifications" | "AlarmLog"; \ No newline at end of file
diff --git a/sdnr/wt/odlux/apps/faultApp/src/plugin.tsx b/sdnr/wt/odlux/apps/faultApp/src/plugin.tsx
deleted file mode 100644
index eec8c0821..000000000
--- a/sdnr/wt/odlux/apps/faultApp/src/plugin.tsx
+++ /dev/null
@@ -1,112 +0,0 @@
-/**
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt odlux
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-// app configuration and main entry point for the app
-
-
-import * as React from "react";
-import { withRouter, RouteComponentProps, Route, Switch, Redirect } from 'react-router-dom';
-
-import connect, { Connect, IDispatcher } from '../../../framework/src/flux/connect';
-
-import { faBell } from '@fortawesome/free-solid-svg-icons'; // select app icon
-import applicationManager from '../../../framework/src/services/applicationManager';
-import { subscribe, IFormatedMessage } from '../../../framework/src/services/notificationService';
-import { IApplicationStoreState } from "../../../framework/src/store/applicationStore";
-
-import { faultAppRootHandler } from './handlers/faultAppRootHandler';
-import { FaultApplication } from "./views/faultApplication";
-
-import { Fault } from "./models/fault";
-import { PanelId } from "./models/panelId";
-
-import { SetPanelAction } from "./actions/panelChangeActions";
-import { AddFaultNotificationAction } from "./actions/notificationActions";
-
-import { createCurrentProblemsProperties, createCurrentProblemsActions, currentProblemsReloadAction } from "./handlers/currentProblemsHandler";
-import { FaultStatus } from "./components/faultStatus";
-import { refreshFaultStatusAsyncAction } from "./actions/statusActions";
-
-let currentMountId: string | undefined = undefined;
-
-const mapProps = (state: IApplicationStoreState) => ({
- currentProblemsProperties: createCurrentProblemsProperties(state),
-});
-
-const mapDisp = (dispatcher: IDispatcher) => ({
- currentProblemsActions: createCurrentProblemsActions(dispatcher.dispatch, true),
- setCurrentPanel: (panelId: PanelId) => dispatcher.dispatch(new SetPanelAction(panelId))
-});
-
-const FaultApplicationRouteAdapter = connect(mapProps, mapDisp)((props: RouteComponentProps<{ mountId?: string }> & Connect<typeof mapProps, typeof mapDisp>) => {
- if (currentMountId !== props.match.params.mountId) {
- // route parameter has changed
- currentMountId = props.match.params.mountId || undefined;
- // Hint: This timeout is need, since it is not recommended to change the state while rendering is in progress !
- window.setTimeout(() => {
- if (currentMountId) {
- props.setCurrentPanel("CurrentProblem");
- props.currentProblemsActions.onFilterChanged("objectId", currentMountId);
- props.currentProblemsProperties.showFilter || (props.currentProblemsActions.onToggleFilter());
- props.currentProblemsActions.onRefresh();
- }
- });
- }
- return (
- <FaultApplication />
- )
-});
-
-const App = withRouter((props: RouteComponentProps) => (
- <Switch>
- <Route path={ `${ props.match.path }/:mountId?` } component={ FaultApplicationRouteAdapter } />
- <Redirect to={ `${ props.match.path }` } />
- </Switch>
-));
-
-export function register() {
- const applicationApi = applicationManager.registerApplication({
- name: "fault",
- icon: faBell,
- rootComponent: App,
- rootActionHandler: faultAppRootHandler,
- statusBarElement: FaultStatus,
- menuEntry: "Fault"
- });
-
- // subscribe to the websocket notifications
- subscribe<Fault & IFormatedMessage>("ProblemNotification", (fault => {
- const store = applicationApi && applicationApi.applicationStore;
- if (fault && store) {
- store.dispatch(new AddFaultNotificationAction(fault));
- }
- }));
-
- applicationApi.applicationStoreInitialized.then(store => {
- store.dispatch(currentProblemsReloadAction);
- });
-
- applicationApi.applicationStoreInitialized.then(store => {
- store.dispatch(refreshFaultStatusAsyncAction);
- });
- window.setInterval(() => {
- applicationApi.applicationStoreInitialized.then(store => {
- store.dispatch(refreshFaultStatusAsyncAction);
- });
- }, 15000);
-
-}
diff --git a/sdnr/wt/odlux/apps/faultApp/src/services/faultStatusService.ts b/sdnr/wt/odlux/apps/faultApp/src/services/faultStatusService.ts
deleted file mode 100644
index ed1f3f919..000000000
--- a/sdnr/wt/odlux/apps/faultApp/src/services/faultStatusService.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt odlux
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-import { requestRest } from "../../../../framework/src/services/restService";
-import { Result } from "../../../../framework/src/models/elasticSearch";
-
-export const getFaultStateFromDatabase = async (): Promise < { [key: string]: number } | null > => {
- const path = 'database/sdnevents/faultcurrent/_search';
- const query = {
- "size": 0,
- "aggregations": {
- "severity": {
- "terms": {
- "field": "faultCurrent.severity"
- }
- }
- }
- };
-
- const result = await requestRest<Result<{ severity: { buckets: { key: string, doc_count: number }[] } }>>(path, { method: "POST", body: JSON.stringify(query) });
- return result && result.aggregations && result.aggregations["severity"].buckets.reduce<{ [key: string]: number }>((acc, cur) => {
- acc[cur.key] = cur.doc_count;
- return acc;
- }, {}) || null;
-} \ No newline at end of file
diff --git a/sdnr/wt/odlux/apps/faultApp/src/views/faultApplication.tsx b/sdnr/wt/odlux/apps/faultApp/src/views/faultApplication.tsx
deleted file mode 100644
index 9faa3566b..000000000
--- a/sdnr/wt/odlux/apps/faultApp/src/views/faultApplication.tsx
+++ /dev/null
@@ -1,135 +0,0 @@
-/**
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt odlux
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-import * as React from 'react';
-
-import { withRouter, RouteComponentProps } from 'react-router-dom';
-
-import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
-
-import { MaterialTable, ColumnType, MaterialTableCtorType } from '../../../../framework/src/components/material-table';
-import { Panel } from '../../../../framework/src/components/material-ui';
-
-import { IApplicationStoreState } from '../../../../framework/src/store/applicationStore';
-import connect, { Connect, IDispatcher } from '../../../../framework/src/flux/connect';
-
-import { Fault } from '../models/fault';
-import { PanelId } from '../models/panelId';
-
-import { createCurrentProblemsProperties, createCurrentProblemsActions, currentProblemsReloadAction } from '../handlers/currentProblemsHandler';
-import { createAlarmLogEntriesProperties, createAlarmLogEntriesActions, alarmLogEntriesReloadAction } from '../handlers/alarmLogEntriesHandler';
-import { SetPanelAction } from '../actions/panelChangeActions';
-
-const mapProps = (state: IApplicationStoreState) => ({
- activePanel: state.fault.currentOpenPanel,
- currentProblemsProperties: createCurrentProblemsProperties(state),
- faultNotifications: state.fault.faultNotifications,
- alarmLogEntriesProperties: createAlarmLogEntriesProperties(state)
-});
-
-const mapDisp = (dispatcher: IDispatcher) => ({
- currentProblemsActions: createCurrentProblemsActions(dispatcher.dispatch),
- alarmLogEntriesActions: createAlarmLogEntriesActions(dispatcher.dispatch),
- reloadCurrentProblems: () => dispatcher.dispatch(currentProblemsReloadAction),
- reloadAlarmLogEntries: () => dispatcher.dispatch(alarmLogEntriesReloadAction),
- setCurrentPanel: (panelId: PanelId) => dispatcher.dispatch(new SetPanelAction(panelId))
-});
-
-type FaultApplicationComponentProps = RouteComponentProps & Connect<typeof mapProps, typeof mapDisp>;
-
-
-const FaultTable = MaterialTable as MaterialTableCtorType<Fault>;
-
-class FaultApplicationComponent extends React.Component<FaultApplicationComponentProps>{
-
- render(): JSX.Element {
-
- const { activePanel } = this.props;
-
- const onTogglePanel = (panelId: PanelId) => {
- const nextActivePanel = panelId === this.props.activePanel ? null : panelId;
- this.props.setCurrentPanel(nextActivePanel);
-
- switch (nextActivePanel) {
- case 'CurrentProblem':
- this.props.reloadCurrentProblems();
- break;
- case 'AlarmLog':
- this.props.reloadAlarmLogEntries();
- break;
- case 'AlarmNotifications':
- case null:
- default:
- // nothing to do
- break;
- }
- };
-
- return (
- <>
- <Panel activePanel={ activePanel } panelId={ 'CurrentProblem' } onToggle={ onTogglePanel } title={ 'Current Problem List' }>
- <FaultTable idProperty={ '_id' } columns={ [
- { property: "icon", title: "", type: ColumnType.custom, customControl: this.renderIcon },
- { property: "timeStamp", type: ColumnType.text, title: "Time Stamp" },
- { property: "nodeName", title: "Node Name", type: ColumnType.text },
- { property: "counter", title: "Count", type: ColumnType.numeric, width: "100px" },
- { property: "objectId", title: "Object Id", type: ColumnType.text } ,
- { property: "problem", title: "Alarm Type", type: ColumnType.text },
- { property: "severity", title: "Severity", type: ColumnType.text, width: "140px" },
- ] } { ...this.props.currentProblemsProperties } { ...this.props.currentProblemsActions } />
- </Panel>
- <Panel activePanel={ activePanel } panelId={ 'AlarmNotifications' } onToggle={ onTogglePanel } title={ `Alarm Notifications ${this.props.faultNotifications.faults.length} since ${this.props.faultNotifications.since}` }>
- <FaultTable rows={ this.props.faultNotifications.faults } asynchronus columns={ [
- { property: "icon", title: "", type: ColumnType.custom, customControl: this.renderIcon },
- { property: "timeStamp", title: "Time Stamp" },
- { property: "nodeName", title: "Node Name" },
- { property: "counter", title: "Count", width: "100px" },
- { property: "objectId", title: "Object Id" },
- { property: "problem", title: "Alarm Type" },
- { property: "severity", title: "Severity", width: "140px" },
- ] } idProperty={ '_id' } />
- </Panel>
- <Panel activePanel={ activePanel } panelId={ 'AlarmLog' } onToggle={ onTogglePanel } title={ 'Alarm Log' }>
- <FaultTable idProperty={ '_id' } columns={ [
- { property: "icon", title: "", type: ColumnType.custom, customControl: this.renderIcon },
- { property: "timeStamp", title: "Time Stamp" },
- { property: "nodeName", title: "Node Name" },
- { property: "counter", title: "Count", type: ColumnType.numeric, width: "100px" },
- { property: "objectId", title: "Object Id" },
- { property: "problem", title: "Alarm Type" },
- { property: "severity", title: "Severity", width: "140px" },
- ] } { ...this.props.alarmLogEntriesProperties } { ...this.props.alarmLogEntriesActions }/>
- </Panel>
- </>
- );
- };
-
- public componentDidMount() {
- this.props.alarmLogEntriesActions.onToggleFilter();
- this.props.currentProblemsActions.onToggleFilter();
- }
- private renderIcon = (props: { rowData: Fault }) => {
- return (
- <FontAwesomeIcon icon={ faExclamationTriangle } />
- );
- };
-
-}
-
-export const FaultApplication = withRouter(connect(mapProps, mapDisp)(FaultApplicationComponent));
-export default FaultApplication;