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
10 * http://www.apache.org/licenses/LICENSE-2.0
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
16 * ============LICENSE_END==========================================================================
18 import { getConnectionStatusCountStateFromDatabase } from '../services/connectionStatusCountService';
19 import { Dispatch } from '../../../../framework/src/flux/store';
21 import { Action } from '../../../../framework/src/flux/action';
24 export class ConnectionStatusCountBaseAction extends Action { }
27 export class SetConnectionStatusCountAction extends ConnectionStatusCountBaseAction {
28 constructor(public ConnectedCount: number, public ConnectingCount: number, public DisconnectedCount: number,
29 public MountedCount: number, public UnableToConnectCount: number, public UndefinedCount: number, public UnmountedCount: number, public totalCount: number) {
35 export const refreshConnectionStatusCountAsyncAction = async (dispatch: Dispatch) => {
36 const result = await getConnectionStatusCountStateFromDatabase().catch(_ => null);
38 const statusAction = new SetConnectionStatusCountAction(
39 result["Connected"] || 0,
40 result["Connecting"] || 0,
41 result["Disconnected"] || 0,
42 result["Mounted"] || 0,
43 result["UnableToConnect"] || 0,
44 result["Undefined"] || 0,
45 result["Unmounted"] || 0,
48 dispatch(statusAction);
51 dispatch(new SetConnectionStatusCountAction(0, 0, 0, 0, 0, 0, 0, 0));