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==========================================================================
19 import { faPlug } from '@fortawesome/free-solid-svg-icons';
21 import applicationManager from '../../../framework/src/services/applicationManager';
22 import { subscribe, IFormatedMessage } from '../../../framework/src/services/notificationService';
24 import connectAppRootHandler from './handlers/connectAppRootHandler';
25 import ConnectApplication from './views/connectView';
27 import { AddSnackbarNotification } from '../../../framework/src/actions/snackbarActions';
28 import { updateCurrentViewAsyncAction } from './actions/commonNetworkElementsActions';
30 type ObjectNotification = {
37 export function register() {
38 const applicationApi = applicationManager.registerApplication({
41 rootComponent: ConnectApplication,
42 rootActionHandler: connectAppRootHandler,
46 // subscribe to the websocket notifications
47 subscribe<ObjectNotification & IFormatedMessage>(["ObjectCreationNotification", "ObjectDeletionNotification", "AttributeValueChangedNotification"], (msg => {
48 const store = applicationApi.applicationStore;
49 if (msg && msg.notifType === "ObjectCreationNotification" && store) {
50 store.dispatch(new AddSnackbarNotification({ message: `Adding network element [${msg.objectId}]`, options: { variant: 'info' } }));
51 } else if (msg && (msg.notifType === "ObjectDeletionNotification" || msg.notifType === "AttributeValueChangedNotification") && store) {
52 store.dispatch(new AddSnackbarNotification({ message: `Updating network element [${msg.objectId}]`, options: { variant: 'info' } }));
54 store && store.dispatch(updateCurrentViewAsyncAction());