aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/apps/inventoryApp/src
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/odlux/apps/inventoryApp/src')
-rw-r--r--sdnr/wt/odlux/apps/inventoryApp/src/actions/inventoryDeviceListActions.ts59
-rw-r--r--sdnr/wt/odlux/apps/inventoryApp/src/actions/inventoryTreeActions.ts101
-rw-r--r--sdnr/wt/odlux/apps/inventoryApp/src/actions/panelActions.ts31
-rw-r--r--sdnr/wt/odlux/apps/inventoryApp/src/assets/icons/inventoryAppIcon.svg23
-rw-r--r--sdnr/wt/odlux/apps/inventoryApp/src/components/refreshInventoryDialog.tsx113
-rw-r--r--sdnr/wt/odlux/apps/inventoryApp/src/fakeData/index.ts77
-rw-r--r--sdnr/wt/odlux/apps/inventoryApp/src/handlers/inventoryAppRootHandler.ts53
-rw-r--r--sdnr/wt/odlux/apps/inventoryApp/src/handlers/inventoryDeviceListActionHandler.ts56
-rw-r--r--sdnr/wt/odlux/apps/inventoryApp/src/handlers/inventoryElementsHandler.ts36
-rw-r--r--sdnr/wt/odlux/apps/inventoryApp/src/handlers/inventoryTreeHandler.ts68
-rw-r--r--sdnr/wt/odlux/apps/inventoryApp/src/handlers/panelHandler.ts11
-rw-r--r--sdnr/wt/odlux/apps/inventoryApp/src/index.html28
-rw-r--r--sdnr/wt/odlux/apps/inventoryApp/src/models/inventory.ts50
-rw-r--r--sdnr/wt/odlux/apps/inventoryApp/src/models/inventoryDeviceListType.ts25
-rw-r--r--sdnr/wt/odlux/apps/inventoryApp/src/models/networkElementConnection.ts37
-rw-r--r--sdnr/wt/odlux/apps/inventoryApp/src/models/panelId.ts19
-rw-r--r--sdnr/wt/odlux/apps/inventoryApp/src/pluginInventory.tsx88
-rw-r--r--sdnr/wt/odlux/apps/inventoryApp/src/services/inventoryService.ts92
-rw-r--r--sdnr/wt/odlux/apps/inventoryApp/src/views/dashboard.tsx202
-rw-r--r--sdnr/wt/odlux/apps/inventoryApp/src/views/detail.tsx44
-rw-r--r--sdnr/wt/odlux/apps/inventoryApp/src/views/treeview.tsx155
21 files changed, 0 insertions, 1368 deletions
diff --git a/sdnr/wt/odlux/apps/inventoryApp/src/actions/inventoryDeviceListActions.ts b/sdnr/wt/odlux/apps/inventoryApp/src/actions/inventoryDeviceListActions.ts
deleted file mode 100644
index 710959a2a..000000000
--- a/sdnr/wt/odlux/apps/inventoryApp/src/actions/inventoryDeviceListActions.ts
+++ /dev/null
@@ -1,59 +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 { Dispatch } from '../../../../framework/src/flux/store';
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
-import { IApplicationStoreState } from '../../../../framework/src/store/applicationStore';
-
-import { InventoryDeviceListType } from '../models/inventoryDeviceListType';
-import { inventoryService } from '../services/inventoryService';
-
-/**
- * Represents the base action.
- */
-export class BaseAction extends Action { }
-
-/**
- * Represents an action causing the store to load all nodes.
- */
-export class LoadAllInventoryDeviceListAction extends BaseAction { }
-
-/**
- * Represents an action causing the store to update all nodes.
- */
-export class AllInventoryDeviceListLoadedAction extends BaseAction {
- /**
- * Initialize this instance.
- *
- * @param inventoryDeviceList All the distinct nodes from the Inventory database.
- */
- constructor(public inventoryDeviceList: InventoryDeviceListType[] | null, public error?: string) {
- super();
- }
-}
-
-/**
- * Represents an asynchronous thunk action to load all nodes.
- */
-export const loadAllInventoryDeviceListAsync = async (dispatch: Dispatch) => {
- dispatch(new LoadAllInventoryDeviceListAction());
- const inventoryDeviceList: InventoryDeviceListType[] = (await inventoryService.getInventoryDeviceList().then(ne =>
- (ne))) || [];
- return inventoryDeviceList && dispatch(new AllInventoryDeviceListLoadedAction(inventoryDeviceList));
-};
-
diff --git a/sdnr/wt/odlux/apps/inventoryApp/src/actions/inventoryTreeActions.ts b/sdnr/wt/odlux/apps/inventoryApp/src/actions/inventoryTreeActions.ts
deleted file mode 100644
index 2c6a0ed65..000000000
--- a/sdnr/wt/odlux/apps/inventoryApp/src/actions/inventoryTreeActions.ts
+++ /dev/null
@@ -1,101 +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 { AddErrorInfoAction } from '../../../../framework/src/actions/errorActions';
-import { NavigateToApplication } from '../../../../framework/src/actions/navigationActions';
-import { Action } from '../../../../framework/src/flux/action';
-import { Dispatch } from '../../../../framework/src/flux/store';
-
-import { InventoryTreeNode, InventoryType, TreeDemoItem } from '../models/inventory';
-import { inventoryService } from '../services/inventoryService';
-
-/**
- * Represents the base action.
- */
-export class BaseAction extends Action { }
-
-export class SetBusyAction extends BaseAction {
- constructor(public busy: boolean = true) {
- super();
-
- }
-}
-
-export class SetSearchTextAction extends BaseAction {
- constructor(public searchTerm: string = '') {
- super();
-
- }
-}
-
-export class UpdateInventoryTreeAction extends BaseAction {
- constructor(public rootNode: InventoryTreeNode) {
- super();
-
- }
-}
-
-export class UpdateSelectedNodeAction extends BaseAction {
- constructor(public selectedNode?: InventoryType) {
- super();
-
- }
-}
-
-export class UpdateExpandedNodesAction extends BaseAction {
- constructor(public expandedNodes?: TreeDemoItem[]) {
- super();
-
- }
-}
-
-export const setSearchTermAction = (searchTerm: string) => (dispatch: Dispatch) =>{
- dispatch(new SetSearchTextAction(searchTerm));
-};
-
-
-export const updateInventoryTreeAsyncAction = (mountId: string, searchTerm?: string) => async (dispatch: Dispatch) => {
- dispatch(new SetBusyAction(true));
- dispatch(new SetSearchTextAction(searchTerm));
- try {
- const result = await inventoryService.getInventoryTree(mountId, searchTerm);
- if (!result) {
- dispatch(new AddErrorInfoAction({ title: 'Error', message: `Could not load inventory tree for [${mountId}]. Please check you connection to the server and try later.` }));
- dispatch(new NavigateToApplication('inventory'));
- } else {
- dispatch(new UpdateInventoryTreeAction(result));
- }
- } catch (err) {
- throw new Error('Could not load inventory tree from server.');
- } finally {
- dispatch(new SetBusyAction(false));
- }
-};
-
-export const selectInventoryNodeAsyncAction = (nodeId: string) => async (dispatch: Dispatch) => {
- dispatch(new SetBusyAction(true));
- try {
- const result = await inventoryService.getInventoryEntry(nodeId);
- if (!result) throw new Error('Could not load inventory tree from server.');
- dispatch(new UpdateSelectedNodeAction(result));
- } catch (err) {
- throw new Error('Could not load inventory tree from server.');
- } finally {
- dispatch(new SetBusyAction(false));
- }
-};
diff --git a/sdnr/wt/odlux/apps/inventoryApp/src/actions/panelActions.ts b/sdnr/wt/odlux/apps/inventoryApp/src/actions/panelActions.ts
deleted file mode 100644
index d66608296..000000000
--- a/sdnr/wt/odlux/apps/inventoryApp/src/actions/panelActions.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt odlux
- * =================================================================================================
- * Copyright (C) 2020 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();
- }
-}
-
-export const setPanelAction = (panelId: PanelId) => {
- return new SetPanelAction(panelId);
-}; \ No newline at end of file
diff --git a/sdnr/wt/odlux/apps/inventoryApp/src/assets/icons/inventoryAppIcon.svg b/sdnr/wt/odlux/apps/inventoryApp/src/assets/icons/inventoryAppIcon.svg
deleted file mode 100644
index 507a835ab..000000000
--- a/sdnr/wt/odlux/apps/inventoryApp/src/assets/icons/inventoryAppIcon.svg
+++ /dev/null
@@ -1,23 +0,0 @@
-<!-- highstreet technologies GmbH colour scheme
- Grey #565656
- LBlue #36A9E1
- DBlue #246DA2
- Green #003F2C / #006C4B
- Yellw #C8D400
- Red #D81036
--->
-
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="-224 -202 882 882">
-
-<path fill="#565656" d="M 576 544 H -64 V -160 C -64 -177.673 -49.673 -192 -32 -192 H 544 C 561.673 -192 576 -177.673 576 -160 V 544 Z "/>
-
-<path fill="#ffffff" d="M 480 0 H 32 C 14.327 0 0 -14.327 0 -32 V -96 C 0 -113.673 14.327 -128 32 -128 H 480 C 497.673 -128 512 -113.673 512 -96 V -32 C 512 -14.327 497.673 0 480 0 Z M 432 -88 C 418.745 -88 408 -77.255 408 -64 S 418.745 -40 432 -40 S 456 -50.745 456 -64 S 445.255 -88 432 -88 Z M 368 -88 C 354.745 -88 344 -77.255 344 -64 S 354.745 -40 368 -40 S 392 -50.745 392 -64 S 381.255 -88 368 -88 Z "/>
-
-<path fill="#ffffff" d="M 480 160 H 32 C 14.327 160 0 145.673 0 128 V 64 C 0 46.327 14.327 32 32 32 H 480 C 497.673 32 512 46.327 512 64 V 128 C 512 145.673 497.673 160 480 160 Z M 432 72 C 418.745 72 408 82.745 408 96 S 418.745 120 432 120 S 456 109.255 456 96 S 445.255 72 432 72 Z M 368 72 C 354.745 72 344 82.745 344 96 S 354.745 120 368 120 S 392 109.255 392 96 S 381.255 72 368 72 Z "/>
-
-<path fill="#ffffff" d="M 480 320 H 32 C 14.327 320 0 305.673 0 288 V 224 C 0 206.327 14.327 192 32 192 H 480 C 497.673 192 512 206.327 512 224 V 288 C 512 305.673 497.673 320 480 320 Z M 432 232 C 418.745 232 408 242.745 408 256 S 418.745 280 432 280 S 456 269.255 456 256 S 445.255 232 432 232 Z M 368 232 C 354.745 232 344 242.745 344 256 S 354.745 280 368 280 S 392 269.255 392 256 S 381.255 232 368 232 Z "/>
-
-<path fill="#ffffff" d="M 480 480 H 32 C 14.327 480 0 465.673 0 448 V 384 C 0 366.327 14.327 352 32 352 H 480 C 497.673 352 512 366.327 512 384 V 448 C 512 465.673 497.673 480 480 480 Z M 432 392 C 418.745 392 408 402.745 408 416 S 418.745 440 432 440 S 456 429.255 456 416 S 445.255 392 432 392 Z M 368 392 C 354.745 392 344 402.745 344 416 S 354.745 440 368 440 S 392 429.255 392 416 S 381.255 392 368 392 Z"/>
-
-<path fill="#C8D400" d="M 480 670 H -96 C -155 670 -190 631 -192 574 H 576 C 575 622 543 670 480 670 Z"/>
-</svg>
diff --git a/sdnr/wt/odlux/apps/inventoryApp/src/components/refreshInventoryDialog.tsx b/sdnr/wt/odlux/apps/inventoryApp/src/components/refreshInventoryDialog.tsx
deleted file mode 100644
index 027622249..000000000
--- a/sdnr/wt/odlux/apps/inventoryApp/src/components/refreshInventoryDialog.tsx
+++ /dev/null
@@ -1,113 +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 Button from '@mui/material/Button';
-import Dialog from '@mui/material/Dialog';
-import DialogActions from '@mui/material/DialogActions';
-import DialogContent from '@mui/material/DialogContent';
-import DialogContentText from '@mui/material/DialogContentText';
-import DialogTitle from '@mui/material/DialogTitle';
-
-import { connect, Connect, IDispatcher } from '../../../../framework/src/flux/connect';
-import { inventoryElementsReloadAction } from '../handlers/inventoryElementsHandler';
-
-import { InventoryType } from '../models/inventory';
-
-export enum RefreshInventoryDialogMode {
- None = 'none',
- RefreshInventoryTable = 'RefreshInventoryTable',
-}
-
-const mapDispatch = (dispatcher: IDispatcher) => ({
- refreshInventory: () => dispatcher.dispatch(inventoryElementsReloadAction),
-});
-
-type DialogSettings = {
- dialogTitle: string;
- dialogDescription: string;
- applyButtonText: string;
- cancelButtonText: string;
- enableMountIdEditor: boolean;
- enableUsernameEditor: boolean;
- enableExtendedEditor: boolean;
-};
-
-const settings: { [key: string]: DialogSettings } = {
- [RefreshInventoryDialogMode.None]: {
- dialogTitle: '',
- dialogDescription: '',
- applyButtonText: '',
- cancelButtonText: '',
- enableMountIdEditor: false,
- enableUsernameEditor: false,
- enableExtendedEditor: false,
- },
- [RefreshInventoryDialogMode.RefreshInventoryTable]: {
- dialogTitle: 'Do you want to refresh the Inventory table?',
- dialogDescription: '',
- applyButtonText: 'Yes',
- cancelButtonText: 'Cancel',
- enableMountIdEditor: true,
- enableUsernameEditor: true,
- enableExtendedEditor: true,
- },
-};
-
-type RefreshInventoryDialogComponentProps = Connect<undefined, typeof mapDispatch> & {
- mode: RefreshInventoryDialogMode;
- onClose: () => void;
-};
-
-type RefreshInventoryDialogComponentState = InventoryType & { isNameValid: boolean; isHostSet: boolean };
-
-class RefreshInventoryDialogComponent extends React.Component<RefreshInventoryDialogComponentProps, RefreshInventoryDialogComponentState> {
- render(): JSX.Element {
- const setting = settings[this.props.mode];
- return (
- <Dialog open={this.props.mode !== RefreshInventoryDialogMode.None}>
- <DialogTitle id="form-dialog-title" aria-label={`${setting.dialogTitle.replace(/ /g, '-').toLowerCase()}-dialog`}>{setting.dialogTitle}</DialogTitle>
- <DialogContent>
- <DialogContentText>
- {setting.dialogDescription}
- </DialogContentText>
- </DialogContent>
- <DialogActions>
- <Button aria-label="dialog-confirm-button" onClick={() => {
- this.onRefresh();
- }} color="inherit" > {setting.applyButtonText} </Button>
- <Button aria-label="dialog-cancel-button" onClick={() => {
- this.onCancel();
- }} color="secondary"> {setting.cancelButtonText} </Button>
- </DialogActions>
- </Dialog>
- );
- }
-
- private onRefresh = () => {
- this.props.refreshInventory();
- this.props.onClose();
- };
-
- private onCancel = () => {
- this.props.onClose();
- };
-}
-
-export const RefreshInventoryDialog = connect(undefined, mapDispatch)(RefreshInventoryDialogComponent);
-export default RefreshInventoryDialog; \ No newline at end of file
diff --git a/sdnr/wt/odlux/apps/inventoryApp/src/fakeData/index.ts b/sdnr/wt/odlux/apps/inventoryApp/src/fakeData/index.ts
deleted file mode 100644
index 136b908dd..000000000
--- a/sdnr/wt/odlux/apps/inventoryApp/src/fakeData/index.ts
+++ /dev/null
@@ -1,77 +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 { convertPropertyNames, replaceHyphen } from "../../../../framework/src/utilities/yangHelper";
-
-import { InventoryTreeNode, InventoryType } from "../models/inventory";
-
-const data = [
- { "manufacturer-identifier": "ONF-Wireless-Transport", "version": "a2.module-newest", "uuid": "a2.module-1.1.1.5", "part-type-id": "3FE25774AA01", "model-identifier": "VAUIAEYAAA", "tree-level": 2, "node-id": "robot_sim_2_equipment", "description": "WS/CORE-MAIN/a2.module#5", "type-name": "a2.module", "serial": "0003548168", "id": "robot_sim_2_equipment/a2.module-1.1.1.5", "parent-uuid": "CARD-1.1.1.0", "contained-holder": ["SUBRACK-1.15.0.0"], "date": "2005-11-09T00:00:00.0Z" },
- { "manufacturer-identifier": "SAN", "version": "234", "uuid": "CARD-1.1.6.0", "part-type-id": "part-number-12", "model-identifier": "model-id-12", "tree-level": 1, "node-id": "robot_sim_2_equipment", "description": "WS/p8.module", "type-name": "p8.module", "serial": "serial-number-124", "id": "robot_sim_2_equipment/CARD-1.1.6.0", "parent-uuid": "SHELF-1.1.0.0", "contained-holder": ["PORT-1.1.6.5", "PORT-1.1.6.8", "PORT-1.1.6.7", "PORT-1.1.6.6"], "date": "2013-11-23T00:00:00.0Z" },
- { "manufacturer-identifier": "ONF-Wireless-Transport", "version": "a2.module-newest", "uuid": "a2.module-1.1.6.5", "part-type-id": "3EM23141AD01", "model-identifier": "CRPQABVFAA", "tree-level": 2, "node-id": "robot_sim_2_equipment", "description": "WS/p8.module/a2.module#5", "type-name": "a2.module", "serial": "310330008", "id": "robot_sim_2_equipment/a2.module-1.1.6.5", "parent-uuid": "CARD-1.1.6.0", "contained-holder": ["SUBRACK-1.65.0.0"], "date": "2013-04-13T00:00:00.0Z" },
- { "manufacturer-identifier": "ONF-Wireless-Transport", "version": "2017", "uuid": "CARD-1.55.1.4", "part-type-id": "partNo2017-12", "model-identifier": "model-id-s3s", "tree-level": 1, "node-id": "robot_sim_2_equipment", "description": "MWR#55Ch#1/RxDiv", "type-name": "RxDiv", "serial": "Serie2017-12", "id": "robot_sim_2_equipment/CARD-1.55.1.4", "parent-uuid": "IDU-1.55.0.0", "date": "2014-01-07T00:00:00.0Z" },
- { "manufacturer-identifier": "ONF-Wireless-Transport", "version": "a2.module-newest", "uuid": "a2.module-1.56.1.2", "part-type-id": "Partnumber", "model-identifier": "model-id", "tree-level": 1, "node-id": "robot_sim_2_equipment", "description": "MWR#56Ch#1/a2.moduletraff", "type-name": "a2.module", "serial": "Serial1", "id": "robot_sim_2_equipment/a2.module-1.56.1.2", "parent-uuid": "ODU-1.56.0.0", "date": "2017-09-09T00:00:00.0Z" },
- { "manufacturer-identifier": "SAN", "version": "123", "uuid": "CARD-1.1.1.0", "part-type-id": "part-number-2", "model-identifier": "model-id-2", "tree-level": 1, "node-id": "robot_sim_2_equipment", "description": "WS/CORE-MAIN", "type-name": "latest", "serial": "asdf-asdasd-asd", "id": "robot_sim_2_equipment/CARD-1.1.1.0", "parent-uuid": "SHELF-1.1.0.0", "contained-holder": ["PORT-1.1.1.8", "PORT-1.1.1.7", "PORT-1.1.1.6", "PORT-1.1.1.5"], "date": "2015-08-17T00:00:00.0Z" },
- { "manufacturer-identifier": "ONF-Wireless-Transport", "version": "a2.module-newest", "uuid": "a2.module-1.1.1.8", "part-type-id": "1AB376720002", "model-identifier": "NGI7AMLMAA", "tree-level": 2, "node-id": "robot_sim_2_equipment", "description": "WS/CORE-MAIN/a2.module#8", "type-name": "a2.module", "serial": "01T441601301", "id": "robot_sim_2_equipment/a2.module-1.1.1.8", "parent-uuid": "CARD-1.1.1.0", "contained-holder": ["SUBRACK-1.18.0.0"], "date": "2010-02-05T00:00:00.0Z" },
- { "manufacturer-identifier": "SAN", "version": "234", "uuid": "CARD-1.1.5.0", "part-type-id": "part-number-12", "model-identifier": "model-id-12", "tree-level": 1, "node-id": "robot_sim_2_equipment", "description": "WS/p8.module", "type-name": "p8.module", "serial": "africa", "id": "robot_sim_2_equipment/CARD-1.1.5.0", "parent-uuid": "SHELF-1.1.0.0", "contained-holder": ["PORT-1.1.5.6", "PORT-1.1.5.5", "PORT-1.1.5.8", "PORT-1.1.5.7"], "date": "2013-10-21T00:00:00.0Z" },
- { "manufacturer-identifier": "", "version": "", "uuid": "a2.module-1.1.5.6", "part-type-id": "", "model-identifier": "", "tree-level": 2, "node-id": "robot_sim_2_equipment", "description": "WS/p8.module/a2.module#6", "type-name": "a2.module", "serial": "", "id": "robot_sim_2_equipment/a2.module-1.1.5.6", "parent-uuid": "CARD-1.1.5.0", "contained-holder": ["SUBRACK-1.56.0.0"] }, { "manufacturer-identifier": "ONF-Wireless-Transport", "version": "MWR-ng", "uuid": "IDU-1.65.0.0", "part-type-id": "3DB76047BAAA02", "model-identifier": "model-id-s3s", "tree-level": 0, "node-id": "robot_sim_2_equipment", "description": "MWR-ng Dir#6.5-Ch#1", "type-name": "MWR-ng", "serial": "WAUZZI", "id": "robot_sim_2_equipment/IDU-1.65.0.0", "parent-uuid": "network-element", "contained-holder": ["PORT-1.65.1.4", "PORT-1.65.1.2"], "date": "2014-01-16T00:00:00.0Z" },
- { "manufacturer-identifier": "ONF-Wireless-Transport", "version": "a2.module-newest", "uuid": "a2.module-1.65.1.2", "part-type-id": "3EM23141AD01", "model-identifier": "CRPQABVFAA", "tree-level": 1, "node-id": "robot_sim_2_equipment", "description": "MWR#65Ch#1/a2.moduletraff", "type-name": "a2.module", "serial": "310330008", "id": "robot_sim_2_equipment/a2.module-1.65.1.2", "parent-uuid": "IDU-1.65.0.0", "date": "2013-04-13T00:00:00.0Z" },
- { "manufacturer-identifier": "ONF-Wireless-Transport", "version": "a2.module-newest", "uuid": "a2.module-1.1.5.5", "part-type-id": "3EM23141AD01", "model-identifier": "CRPQABVFAA", "tree-level": 2, "node-id": "robot_sim_2_equipment", "description": "WS/p8.module/a2.module#5", "type-name": "a2.module", "serial": "310330015", "id": "robot_sim_2_equipment/a2.module-1.1.5.5", "parent-uuid": "CARD-1.1.5.0", "contained-holder": ["SUBRACK-1.55.0.0"], "date": "2013-04-13T00:00:00.0Z" },
- { "manufacturer-identifier": "ONF-Wireless-Transport", "version": "unknown", "uuid": "CARD-1.1.8.0", "part-type-id": "unknown", "model-identifier": "model-id-s3s", "tree-level": 1, "node-id": "robot_sim_2_equipment", "description": "WS/DS3", "type-name": "p4.module", "serial": "sd-dsa-eqw", "id": "robot_sim_2_equipment/CARD-1.1.8.0", "parent-uuid": "SHELF-1.1.0.0", "date": "2008-10-21T00:00:00.0Z" },
- { "manufacturer-identifier": "CIT", "version": "wind", "uuid": "CARD-1.1.9.0", "part-type-id": "party-yea", "model-identifier": "model-id-s3s", "tree-level": 1, "node-id": "robot_sim_2_equipment", "description": "WS/wind", "type-name": "wind", "serial": "proto-type", "id": "robot_sim_2_equipment/CARD-1.1.9.0", "parent-uuid": "SHELF-1.1.0.0", "date": "2007-02-19T00:00:00.0Z" },
- { "manufacturer-identifier": "ONF-Wireless-Transport", "version": "a2.module-newest", "uuid": "a2.module-1.55.1.2", "part-type-id": "3EM23141AD01", "model-identifier": "CRPQABVFAA", "tree-level": 1, "node-id": "robot_sim_2_equipment", "description": "MWR#55Ch#1/a2.moduletraff", "type-name": "a2.module", "serial": "310330015", "id": "robot_sim_2_equipment/a2.module-1.55.1.2", "parent-uuid": "IDU-1.55.0.0", "date": "2013-04-13T00:00:00.0Z" },
- { "manufacturer-identifier": "ONF-Wireless-Transport", "version": "a2.module-newest", "uuid": "SHELF-1.1.0.0", "part-type-id": "Partnumber", "model-identifier": "model-id", "tree-level": 0, "node-id": "robot_sim_2_equipment", "description": "WS-8", "type-name": "WS-8", "serial": "Serial1", "id": "robot_sim_2_equipment/SHELF-1.1.0.0", "parent-uuid": "network-element", "contained-holder": ["SLOT-1.1.9.0", "SLOT-1.1.7.0", "SLOT-1.1.8.0", "SLOT-1.1.5.0", "SLOT-1.1.6.0", "SLOT-1.1.3.0", "SLOT-1.1.4.0", "SLOT-1.1.2.0", "SLOT-1.1.1.0"], "date": "2017-09-09T00:00:00.0Z" },
- { "manufacturer-identifier": "ONF-Wireless-Transport", "version": "MWR-ng", "uuid": "IDU-1.55.0.0", "part-type-id": "3DB76047BAAA02", "model-identifier": "model-id-s3s", "tree-level": 0, "node-id": "robot_sim_2_equipment", "description": "MWR-ng Dir#5.5-Ch#1", "type-name": "MWR-ng", "serial": "Serie2017-14", "id": "robot_sim_2_equipment/IDU-1.55.0.0", "parent-uuid": "network-element", "contained-holder": ["PORT-1.55.1.2", "PORT-1.55.1.4"], "date": "2014-01-15T00:00:00.0Z" },
- { "manufacturer-identifier": "ONF-Wireless-Transport", "version": "2017", "uuid": "CARD-1.65.1.4", "part-type-id": "partNo2017-12", "model-identifier": "model-id-s3s", "tree-level": 1, "node-id": "robot_sim_2_equipment", "description": "MWR#55Ch#0/RxDiv", "type-name": "RxDiv", "serial": "Serie2017-13", "id": "robot_sim_2_equipment/CARD-1.65.1.4", "parent-uuid": "IDU-1.65.0.0", "date": "2014-01-08T00:00:00.0Z" }, { "manufacturer-identifier": "ONF-Wireless-Transport", "version": "a2.module-newest", "uuid": "a2.module-1.1.1.7", "part-type-id": "1AB187280031", "model-identifier": "mod2", "tree-level": 2, "node-id": "robot_sim_2_equipment", "description": "WS/CORE-MAIN/a2.module#7", "type-name": "a2.module", "serial": "91T403003322", "id": "robot_sim_2_equipment/a2.module-1.1.1.7", "parent-uuid": "CARD-1.1.1.0", "contained-holder": ["SUBRACK-1.17.0.0"], "date": "2009-01-19T00:00:00.0Z" },
- { "manufacturer-identifier": "CIT", "version": "p1.module", "uuid": "CARD-1.1.7.0", "part-type-id": "part-number-s3s", "model-identifier": "model-id-s3s", "tree-level": 1, "node-id": "robot_sim_2_equipment", "description": "WS/DS1", "type-name": "p1.module_A", "serial": "serial-number-s3s", "id": "robot_sim_2_equipment/CARD-1.1.7.0", "parent-uuid": "SHELF-1.1.0.0", "date": "2007-08-27T00:00:00.0Z" },
- { "manufacturer-identifier": "", "version": "extrem-hyper", "uuid": "ODU-1.56.0.0", "part-type-id": "", "model-identifier": "", "tree-level": 0, "node-id": "robot_sim_2_equipment", "description": "MWR-hyper Dir#5.6-Ch#1", "type-name": "MWR-hyper", "serial": "", "id": "robot_sim_2_equipment/ODU-1.56.0.0", "parent-uuid": "network-element", "contained-holder": ["PORT-1.56.1.3", "PORT-1.56.1.4", "PORT-1.56.1.2"] }
-];
-
-const deleay = (time: number) => () => new Promise<number>(resolve => setTimeout(resolve, time, time));
-
-const getTreeElements = (searchTerm: string | null, treeLevel: number = 0, parentUUID: string | null = null): [InventoryTreeNode, boolean] => {
- const elements = (data.filter(e => e["tree-level"] === treeLevel && (!parentUUID || e["parent-uuid"] === parentUUID)) || [])
- let elementMatch = false;
- const treeNode = elements.reduce<InventoryTreeNode>((acc, cur) => {
- const [children, childMatch] = getTreeElements(searchTerm, treeLevel + 1, cur["uuid"]);
- const isMatch = searchTerm ? Object.keys(cur).some(k => String((cur as any)[k]).indexOf(searchTerm) > -1) : false;
- elementMatch = elementMatch || isMatch || childMatch;
- if (!searchTerm || isMatch || childMatch) {
- acc[cur["uuid"]] = {
- label: cur["uuid"],
- children: children,
- isMatch: isMatch,
- };
- }
- return acc;
- }, {});
-
- return [treeNode, elementMatch]
-};
-
-export const getTree = async (searchTerm: string | null = null): Promise<InventoryTreeNode> => {
- await deleay(600);
- const [node] = getTreeElements(searchTerm);
- return node;
-};
-
-export const getElement = async (id: string): Promise<InventoryType | undefined> => {
- await deleay(600);
- const res = data.find(e => e.uuid === id);
- return res && convertPropertyNames(res, replaceHyphen) as unknown as InventoryType;
-};
diff --git a/sdnr/wt/odlux/apps/inventoryApp/src/handlers/inventoryAppRootHandler.ts b/sdnr/wt/odlux/apps/inventoryApp/src/handlers/inventoryAppRootHandler.ts
deleted file mode 100644
index b1a0c581f..000000000
--- a/sdnr/wt/odlux/apps/inventoryApp/src/handlers/inventoryAppRootHandler.ts
+++ /dev/null
@@ -1,53 +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 **
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
-import { IApplicationStoreState } from '../../../../framework/src/store/applicationStore';
-
-import { PanelId } from '../models/panelId';
-import { IInventoryDeviceListState, inventoryDeviceListActionHandler } from './inventoryDeviceListActionHandler';
-import { IInventoryElementsState, inventoryElementsActionHandler } from './inventoryElementsHandler';
-import { IInvenroryTree, inventoryTreeHandler } from './inventoryTreeHandler';
-import { currentOpenPanelHandler } from './panelHandler';
-
-export interface IInventoryAppStateState {
- inventoryTree: IInvenroryTree;
- currentOpenPanel: PanelId;
- inventoryElements: IInventoryElementsState;
- inventoryDeviceList: IInventoryDeviceListState;
-}
-
-declare module '../../../../framework/src/store/applicationStore' {
- interface IApplicationStoreState {
- inventory: IInventoryAppStateState;
- }
-}
-
-const actionHandlers = {
- inventoryTree: inventoryTreeHandler,
- currentOpenPanel: currentOpenPanelHandler,
- inventoryElements: inventoryElementsActionHandler,
- inventoryDeviceList: inventoryDeviceListActionHandler,
-};
-
-export const inventoryAppRootHandler = combineActionHandler<IInventoryAppStateState>(actionHandlers);
-export default inventoryAppRootHandler;
-
diff --git a/sdnr/wt/odlux/apps/inventoryApp/src/handlers/inventoryDeviceListActionHandler.ts b/sdnr/wt/odlux/apps/inventoryApp/src/handlers/inventoryDeviceListActionHandler.ts
deleted file mode 100644
index 7c06cad99..000000000
--- a/sdnr/wt/odlux/apps/inventoryApp/src/handlers/inventoryDeviceListActionHandler.ts
+++ /dev/null
@@ -1,56 +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 { AllInventoryDeviceListLoadedAction, LoadAllInventoryDeviceListAction } from '../actions/inventoryDeviceListActions';
-import { InventoryDeviceListType } from '../models/inventoryDeviceListType';
-
-export interface IInventoryDeviceListState {
- inventoryDeviceList: InventoryDeviceListType[];
- busy: boolean;
-}
-
-const inventoryDeviceListListStateInit: IInventoryDeviceListState = {
- inventoryDeviceList: [],
- busy: false,
-};
-
-export const inventoryDeviceListActionHandler: IActionHandler<IInventoryDeviceListState> = (state = inventoryDeviceListListStateInit, action) => {
- if (action instanceof LoadAllInventoryDeviceListAction) {
-
- state = {
- ...state,
- busy: true,
- };
-
- } else if (action instanceof AllInventoryDeviceListLoadedAction) {
- if (!action.error && action.inventoryDeviceList) {
- state = {
- ...state,
- inventoryDeviceList: action.inventoryDeviceList,
- busy: false,
- };
- } else {
- state = {
- ...state,
- busy: false,
- };
- }
- }
- return state;
-}; \ No newline at end of file
diff --git a/sdnr/wt/odlux/apps/inventoryApp/src/handlers/inventoryElementsHandler.ts b/sdnr/wt/odlux/apps/inventoryApp/src/handlers/inventoryElementsHandler.ts
deleted file mode 100644
index 7bac8f632..000000000
--- a/sdnr/wt/odlux/apps/inventoryApp/src/handlers/inventoryElementsHandler.ts
+++ /dev/null
@@ -1,36 +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 { InventoryType } from '../models/inventory';
-
-export interface IInventoryElementsState extends IExternalTableState<InventoryType> { }
-
-// create eleactic search material data fetch handler
-const inventoryElementsSearchHandler = createSearchDataHandler<InventoryType>('inventory');
-
-export const {
- actionHandler: inventoryElementsActionHandler,
- createActions: createInventoryElementsActions,
- createProperties: createInventoryElementsProperties,
- reloadAction: inventoryElementsReloadAction,
-
- // set value action, to change a value
-} = createExternal<InventoryType>(inventoryElementsSearchHandler, appState => appState.inventory.inventoryElements);
-
diff --git a/sdnr/wt/odlux/apps/inventoryApp/src/handlers/inventoryTreeHandler.ts b/sdnr/wt/odlux/apps/inventoryApp/src/handlers/inventoryTreeHandler.ts
deleted file mode 100644
index fe90d9820..000000000
--- a/sdnr/wt/odlux/apps/inventoryApp/src/handlers/inventoryTreeHandler.ts
+++ /dev/null
@@ -1,68 +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 { SetBusyAction, SetSearchTextAction, UpdateExpandedNodesAction, UpdateInventoryTreeAction, UpdateSelectedNodeAction } from '../actions/inventoryTreeActions';
-import { InventoryTreeNode, InventoryType, TreeDemoItem } from '../models/inventory';
-
-
-export interface IInvenroryTree {
- isBusy: boolean;
- rootNodes: TreeDemoItem[];
- selectedNode?: InventoryType;
- expandedItems: TreeDemoItem[];
- searchTerm: string;
-}
-
-const initialState: IInvenroryTree = {
- isBusy: false,
- rootNodes: [],
- searchTerm: '',
- selectedNode: undefined,
- expandedItems: [],
-};
-
-
-const getTreeDataFromInvetoryTreeNode = (node: InventoryTreeNode): TreeDemoItem[] => Object.keys(node).reduce<TreeDemoItem[]>((acc, key) => {
- const cur = node[key];
- acc.push({
- isMatch: cur.isMatch,
- content: cur.label || key,
- value: key,
- children: cur.children && getTreeDataFromInvetoryTreeNode(cur.children),
- });
- return acc;
-}, []);
-
-export const inventoryTreeHandler: IActionHandler<IInvenroryTree> = (state = initialState, action) => {
- if (action instanceof SetBusyAction) {
- state = { ...state, isBusy: action.busy };
- } else if (action instanceof SetSearchTextAction) {
- state = { ...state, searchTerm: action.searchTerm };
- } else if (action instanceof UpdateInventoryTreeAction) {
- const rootNodes = getTreeDataFromInvetoryTreeNode(action.rootNode);
- state = { ...state, rootNodes: rootNodes, expandedItems: [], selectedNode: undefined };
- } else if (action instanceof UpdateSelectedNodeAction) {
- state = { ...state, selectedNode: action.selectedNode };
- } else if (action instanceof UpdateExpandedNodesAction) {
- state = { ...state, expandedItems: action.expandedNodes || [] };
- }
-
- return state;
-}; \ No newline at end of file
diff --git a/sdnr/wt/odlux/apps/inventoryApp/src/handlers/panelHandler.ts b/sdnr/wt/odlux/apps/inventoryApp/src/handlers/panelHandler.ts
deleted file mode 100644
index 7912d0ea5..000000000
--- a/sdnr/wt/odlux/apps/inventoryApp/src/handlers/panelHandler.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { IActionHandler } from '../../../../framework/src/flux/action';
-
-import { SetPanelAction } from '../actions/panelActions';
-import { PanelId } from '../models/panelId';
-
-export const currentOpenPanelHandler: IActionHandler<PanelId> = (state = null, action) => {
- if (action instanceof SetPanelAction) {
- state = action.panelId;
- }
- return state;
-}; \ No newline at end of file
diff --git a/sdnr/wt/odlux/apps/inventoryApp/src/index.html b/sdnr/wt/odlux/apps/inventoryApp/src/index.html
deleted file mode 100644
index 2c44424dd..000000000
--- a/sdnr/wt/odlux/apps/inventoryApp/src/index.html
+++ /dev/null
@@ -1,28 +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>Inventory 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", "inventoryApp", "connectApp", "configurationApp", "faultApp"], function (app, inventoryApp, connectApp, configurationApp, faultApp) {
- inventoryApp.register();
- connectApp.register();
- configurationApp.register();
- faultApp.register();
- app("./app.tsx").runApplication();
- });
- </script>
-</body>
-
-</html> \ No newline at end of file
diff --git a/sdnr/wt/odlux/apps/inventoryApp/src/models/inventory.ts b/sdnr/wt/odlux/apps/inventoryApp/src/models/inventory.ts
deleted file mode 100644
index a09fd7e41..000000000
--- a/sdnr/wt/odlux/apps/inventoryApp/src/models/inventory.ts
+++ /dev/null
@@ -1,50 +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 { ExternalTreeItem } from '../../../../framework/src/components/material-ui/treeView';
-
-export { HitEntry, Result } from '../../../../framework/src/models';
-
-export type InventoryType = {
- treeLevel: number;
- parentUuid: string;
- nodeId: string;
- uuid: string;
- containedHolder?: (string)[] | null;
- manufacturerName?: string;
- manufacturerIdentifier: string;
- serial: string;
- date: string;
- version: string;
- description: string;
- partTypeId: string;
- modelIdentifier: string;
- typeName: string;
-};
-
-export type InventoryTreeNode = {
- [key: string]: {
- label: string;
- children?: InventoryTreeNode;
- isMatch?: boolean;
- ownSeverity?: string;
- childrenSeveritySummary?: string;
- };
-};
-
-export type TreeDemoItem = ExternalTreeItem<string>; \ No newline at end of file
diff --git a/sdnr/wt/odlux/apps/inventoryApp/src/models/inventoryDeviceListType.ts b/sdnr/wt/odlux/apps/inventoryApp/src/models/inventoryDeviceListType.ts
deleted file mode 100644
index ab2411401..000000000
--- a/sdnr/wt/odlux/apps/inventoryApp/src/models/inventoryDeviceListType.ts
+++ /dev/null
@@ -1,25 +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==========================================================================
- */
-
-/**
- * Represents all the distinct devices from the inventory history data.
- */
-
-export type InventoryDeviceListType = {
- nodeId: string;
-};
diff --git a/sdnr/wt/odlux/apps/inventoryApp/src/models/networkElementConnection.ts b/sdnr/wt/odlux/apps/inventoryApp/src/models/networkElementConnection.ts
deleted file mode 100644
index e1ef1ea2d..000000000
--- a/sdnr/wt/odlux/apps/inventoryApp/src/models/networkElementConnection.ts
+++ /dev/null
@@ -1,37 +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 NetworkElementConnection = {
- id?: string;
- nodeId: string;
- host: string;
- port: number;
- username?: string;
- password?: string;
- isRequired?: boolean;
- status?: 'connected' | 'mounted' | 'unmounted' | 'connecting' | 'disconnected' | 'idle';
- coreModelCapability?: string;
- deviceType?: string;
- nodeDetails?: {
- availableCapabilities: string[];
- unavailableCapabilities: {
- failureReason: string;
- capability: string;
- }[];
- };
-};
diff --git a/sdnr/wt/odlux/apps/inventoryApp/src/models/panelId.ts b/sdnr/wt/odlux/apps/inventoryApp/src/models/panelId.ts
deleted file mode 100644
index 8f8224c8c..000000000
--- a/sdnr/wt/odlux/apps/inventoryApp/src/models/panelId.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt odlux
- * =================================================================================================
- * Copyright (C) 2020 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 | 'Equipment' | 'TreeView'; \ No newline at end of file
diff --git a/sdnr/wt/odlux/apps/inventoryApp/src/pluginInventory.tsx b/sdnr/wt/odlux/apps/inventoryApp/src/pluginInventory.tsx
deleted file mode 100644
index 819859919..000000000
--- a/sdnr/wt/odlux/apps/inventoryApp/src/pluginInventory.tsx
+++ /dev/null
@@ -1,88 +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 React from 'react';
-import { Redirect, Route, RouteComponentProps, Switch, withRouter } from 'react-router-dom';
-
-import { connect, Connect, IDispatcher } from '../../../framework/src/flux/connect';
-import applicationManager from '../../../framework/src/services/applicationManager';
-import { IApplicationStoreState } from '../../../framework/src/store/applicationStore';
-import { SetPanelAction } from './actions/panelActions';
-import inventoryAppRootHandler from './handlers/inventoryAppRootHandler';
-import { createInventoryElementsActions, createInventoryElementsProperties } from './handlers/inventoryElementsHandler';
-import { PanelId } from './models/panelId';
-import Dashboard from './views/dashboard';
-import { InventoryTreeView } from './views/treeview';
-
-const appIcon = require('./assets/icons/inventoryAppIcon.svg'); // select app icon
-
-let currentMountId: string | undefined = undefined;
-const mapProps = (state: IApplicationStoreState) => ({
- inventoryProperties: createInventoryElementsProperties(state),
- panelId: state.inventory.currentOpenPanel,
-});
-
-const mapDispatch = (dispatcher: IDispatcher) => ({
- inventoryActions: createInventoryElementsActions(dispatcher.dispatch, true),
- setCurrentPanel: (panelId: PanelId) => dispatcher.dispatch(new SetPanelAction(panelId)),
-});
-
-const InventoryTableApplicationRouteAdapter = connect(mapProps, mapDispatch)((props: RouteComponentProps<{ mountId?: string }> & Connect<typeof mapProps, typeof mapDispatch>) => {
- if (currentMountId !== props.match.params.mountId) {
- // route parameter has changed
- currentMountId = props.match.params.mountId || undefined;
- // Hint: This timeout is needed, since it is not recommended to change the state while rendering is in progress !
- window.setTimeout(() => {
- if (currentMountId) {
- if (props.panelId) {
- props.setCurrentPanel(props.panelId);
- } else {
- props.setCurrentPanel('Equipment');
- }
- props.inventoryActions.onFilterChanged('nodeId', currentMountId);
- if (!props.inventoryProperties.showFilter) {
- props.inventoryActions.onToggleFilter(false);
- }
- props.inventoryActions.onRefresh();
- }
- });
- }
- return (
- <Dashboard />
- );
-});
-
-const App = withRouter((props: RouteComponentProps) => (
- <Switch>
- <Route path={`${props.match.path}/dashboard/:mountId`} component={InventoryTableApplicationRouteAdapter} />
- <Route path={`${props.match.path}/:mountId`} component={InventoryTreeView} />
- <Route path={`${props.match.path}`} component={Dashboard} />
- <Redirect to={`${props.match.path}`} />
- </Switch>
-));
-
-export function register() {
- applicationManager.registerApplication({
- name: 'inventory',
- icon: appIcon,
- rootActionHandler: inventoryAppRootHandler,
- rootComponent: App,
- menuEntry: 'Inventory',
- });
-}
-
diff --git a/sdnr/wt/odlux/apps/inventoryApp/src/services/inventoryService.ts b/sdnr/wt/odlux/apps/inventoryApp/src/services/inventoryService.ts
deleted file mode 100644
index 4014fcf6d..000000000
--- a/sdnr/wt/odlux/apps/inventoryApp/src/services/inventoryService.ts
+++ /dev/null
@@ -1,92 +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 { Result } from '../../../../framework/src/models/elasticSearch';
-import { requestRest } from '../../../../framework/src/services/restService';
-
-import { InventoryTreeNode, InventoryType } from '../models/inventory';
-import { InventoryDeviceListType } from '../models/inventoryDeviceListType';
-
-/**
- * Represents a web api accessor service for all maintenence entries related actions.
- */
-class InventoryService {
- public async getInventoryTree(mountId: string, searchTerm: string = ''): Promise<InventoryTreeNode | null> {
- //return await getTree(searchTerm);
- const path = `/tree/read-inventoryequipment-tree/${mountId}`;
- const body = {
- 'query': searchTerm,
- };
- const inventoryTree = await requestRest<InventoryTreeNode>(path, { method: 'POST', body: JSON.stringify(body) });
- return inventoryTree && inventoryTree || null;
- }
-
- public async getInventoryEntry(id: string): Promise<InventoryType | undefined> {
- const path = '/rests/operations/data-provider:read-inventory-list';
- const body = {
- 'data-provider:input': {
- 'filter': [
- { property: 'id', filtervalue: id },
- ],
- 'sortorder': [],
- 'pagination': {
- 'size': 1,
- 'page': 1,
- },
- },
- };
- const inventoryTreeElement = await requestRest<{
- 'data-provider:output': {
- 'pagination': {
- 'size': number;
- 'page': number;
- 'total': number;
- };
- 'data': InventoryType[];
- };
- }>(path, { method: 'POST', body: JSON.stringify(body) });
-
- return inventoryTreeElement && inventoryTreeElement['data-provider:output'] && inventoryTreeElement['data-provider:output'].pagination && inventoryTreeElement['data-provider:output'].pagination.total >= 1 &&
- inventoryTreeElement['data-provider:output'].data && inventoryTreeElement['data-provider:output'].data[0] || undefined;
- // return await getElement(id);
- }
-
- /**
- * Gets all nodes from the inventory device list.
- */
- public async getInventoryDeviceList(): Promise<(InventoryDeviceListType)[] | null> {
- const path = '/rests/operations/data-provider:read-inventory-device-list';
- const query = {
- 'data-provider:input': {
- 'filter': [],
- 'sortorder': [],
- 'pagination': {
- 'size': 20,
- 'page': 1,
- },
- },
- };
-
- const result = await requestRest<Result<any>>(path, { method: 'POST', body: JSON.stringify(query) });
- return result && result['data-provider:output'] && result['data-provider:output'].data && result['data-provider:output'].data.map(ne => ({
- nodeId: ne,
- })) || null;
- }
-
-}
-
-export const inventoryService = new InventoryService(); \ No newline at end of file
diff --git a/sdnr/wt/odlux/apps/inventoryApp/src/views/dashboard.tsx b/sdnr/wt/odlux/apps/inventoryApp/src/views/dashboard.tsx
deleted file mode 100644
index acd2c6216..000000000
--- a/sdnr/wt/odlux/apps/inventoryApp/src/views/dashboard.tsx
+++ /dev/null
@@ -1,202 +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 React from 'react';
-import { RouteComponentProps, withRouter } from 'react-router-dom';
-
-import Refresh from '@mui/icons-material/Refresh';
-import { AppBar, MenuItem, Tab, Tabs, Typography } from '@mui/material';
-
-import { NavigateToApplication } from '../../../../framework/src/actions/navigationActions';
-import { ColumnType, MaterialTable, MaterialTableCtorType } from '../../../../framework/src/components/material-table';
-import { connect, Connect, IDispatcher } from '../../../../framework/src/flux/connect';
-import { IApplicationStoreState } from '../../../../framework/src/store/applicationStore';
-
-import { loadAllInventoryDeviceListAsync } from '../actions/inventoryDeviceListActions';
-import { updateInventoryTreeAsyncAction } from '../actions/inventoryTreeActions';
-import { setPanelAction } from '../actions/panelActions';
-import RefreshInventoryDialog, { RefreshInventoryDialogMode } from '../components/refreshInventoryDialog';
-import { createInventoryElementsActions, createInventoryElementsProperties } from '../handlers/inventoryElementsHandler';
-import { InventoryType } from '../models/inventory';
-import { InventoryDeviceListType } from '../models/inventoryDeviceListType';
-import { PanelId } from '../models/panelId';
-
-const InventoryTable = MaterialTable as MaterialTableCtorType<InventoryType & { _id: string }>;
-
-const mapProps = (state: IApplicationStoreState) => ({
- panelId: state.inventory.currentOpenPanel,
- inventoryElementsProperties: createInventoryElementsProperties(state),
- inventoryElements: state.inventory.inventoryElements,
- inventoryDeviceList: state.inventory.inventoryDeviceList.inventoryDeviceList,
-});
-
-const mapDispatch = (dispatcher: IDispatcher) => ({
- switchActivePanel: (panelId: PanelId) => {
- dispatcher.dispatch(setPanelAction(panelId));
- },
- inventoryElementsActions: createInventoryElementsActions(dispatcher.dispatch),
- navigateToApplication: (applicationName: string, path?: string) => dispatcher.dispatch(new NavigateToApplication(applicationName, path)),
- updateInventoryTree: (mountId: string, searchTerm?: string) => dispatcher.dispatch(updateInventoryTreeAsyncAction(mountId, searchTerm)),
- getAllInventoryDeviceList: async () => {
- await dispatcher.dispatch(loadAllInventoryDeviceListAsync);
- },
-});
-
-let treeViewInitialSorted = false;
-let inventoryInitialSorted = false;
-
-const InventoryDeviceListTable = MaterialTable as MaterialTableCtorType<InventoryDeviceListType>;
-
-type DashboardComponentProps = RouteComponentProps & Connect<typeof mapProps, typeof mapDispatch>;
-type DashboardComponentState = {
- refreshInventoryEditorMode: RefreshInventoryDialogMode;
-};
-
-class DashboardSelectorComponent extends React.Component<DashboardComponentProps, DashboardComponentState> {
- constructor(props: DashboardComponentProps) {
- super(props);
-
- this.state = {
- refreshInventoryEditorMode: RefreshInventoryDialogMode.None,
- };
- }
-
- private onHandleTabChange = (event: React.SyntheticEvent, newValue: PanelId) => {
- this.onTogglePanel(newValue);
- };
-
- private onTogglePanel = (panelId: PanelId) => {
- const nextActivePanel = panelId;
- this.props.switchActivePanel(nextActivePanel);
-
- switch (nextActivePanel) {
- case 'Equipment':
-
- if (!inventoryInitialSorted) {
- this.props.inventoryElementsActions.onHandleExplicitRequestSort('nodeId', 'asc');
- inventoryInitialSorted = true;
- } else {
- this.props.inventoryElementsActions.onRefresh();
-
- }
- break;
- case 'TreeView':
- this.props.getAllInventoryDeviceList();
- break;
- case null:
- // do nothing if all panels are closed
- break;
- default:
- console.warn('Unknown nextActivePanel [' + nextActivePanel + '] in connectView');
- break;
- }
-
- };
-
- getContextMenu = (rowData: InventoryType) => {
- return [
- <MenuItem aria-label={'inventory-button'} onClick={() => { this.props.updateInventoryTree(rowData.nodeId, rowData.uuid); this.props.navigateToApplication('inventory', rowData.nodeId); }}><Typography>View in Treeview</Typography></MenuItem>,
- ];
-
- };
-
- render() {
-
- const refreshInventoryAction = {
- icon: Refresh, tooltip: 'Refresh Inventory', ariaLabel: 'refresh', onClick: () => {
- this.setState({
- refreshInventoryEditorMode: RefreshInventoryDialogMode.RefreshInventoryTable,
- });
- },
- };
- const { panelId: activePanelId } = this.props;
- return (
- <>
- <AppBar enableColorOnDark position="static">
- <Tabs indicatorColor="secondary" textColor="inherit" value={activePanelId} onChange={this.onHandleTabChange} aria-label="inventory-app-tabs">
- <Tab label="Equipment" value="Equipment" aria-label="equipment-tab" />
- <Tab label="Tree View" value="TreeView" aria-label="treeview-tab" />
- </Tabs>
- </AppBar>
-
- {
-
- activePanelId === 'Equipment' &&
- <>
- <InventoryTable stickyHeader idProperty="_id" tableId="inventory-table" customActionButtons={[refreshInventoryAction]} columns={[
- { property: 'nodeId', title: 'Node Name' },
- { property: 'manufacturerIdentifier', title: 'Manufacturer' },
- { property: 'parentUuid', title: 'Parent' },
- { property: 'uuid', title: 'Name' },
- { property: 'serial', title: 'Serial' },
- { property: 'version', title: 'Version' },
- { property: 'date', title: 'Date' },
- { property: 'description', title: 'Description' },
- { property: 'partTypeId', title: 'Part Type Id' },
- { property: 'modelIdentifier', title: 'Model Identifier' },
- { property: 'typeName', title: 'Type' },
- { property: 'treeLevel', title: 'Containment Level' },
- ]} {...this.props.inventoryElementsActions} {...this.props.inventoryElementsProperties}
- createContextMenu={rowData => {
-
- return this.getContextMenu(rowData);
- }} >
- </InventoryTable>
- <RefreshInventoryDialog
- mode={this.state.refreshInventoryEditorMode}
- onClose={this.onCloseRefreshInventoryDialog}
- />
- </>
-
- }
- {
- activePanelId === 'TreeView' &&
- <>
- <InventoryDeviceListTable stickyHeader tableId="treeview-networkelement-selection-table"
- defaultSortColumn={'nodeId'} defaultSortOrder="asc"
- onHandleClick={(e, row) => {
- this.props.navigateToApplication('inventory', row.nodeId);
- this.props.updateInventoryTree(row.nodeId, '*');
- }}
- rows={this.props.inventoryDeviceList} asynchronus
- columns={[
- { property: 'nodeId', title: 'Node Name', type: ColumnType.text },
- ]} idProperty="nodeId" >
- </InventoryDeviceListTable>
- </>
- }
- </>
- );
- }
-
- private onCloseRefreshInventoryDialog = () => {
- this.setState({
- refreshInventoryEditorMode: RefreshInventoryDialogMode.None,
- });
- };
-
- componentDidMount() {
- if (this.props.panelId === null) { //set default tab if none is set
- this.onTogglePanel('Equipment');
- }
- }
-}
-
-export const Dashboard = withRouter(connect(mapProps, mapDispatch)(DashboardSelectorComponent));
-export default Dashboard;
-
diff --git a/sdnr/wt/odlux/apps/inventoryApp/src/views/detail.tsx b/sdnr/wt/odlux/apps/inventoryApp/src/views/detail.tsx
deleted file mode 100644
index 8d47ec3d9..000000000
--- a/sdnr/wt/odlux/apps/inventoryApp/src/views/detail.tsx
+++ /dev/null
@@ -1,44 +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 React from 'react';
-import { RouteComponentProps, withRouter } from 'react-router-dom';
-
-import Button from '@mui/material/Button';
-import { Theme } from '@mui/material/styles'; // infra for styling
-import { WithStyles } from '@mui/styles';
-import createStyles from '@mui/styles/createStyles';
-import withStyles from '@mui/styles/withStyles';
-
-const styles = (theme: Theme) => createStyles({
- warnButton: {
- backgroundColor: theme.palette.primary.dark,
- },
-});
-
-type DetailProps = RouteComponentProps<{ id: string }> & WithStyles<typeof styles>;
-
-export const Detail = withStyles( styles )( withRouter( (props: DetailProps) => (
- <div>
- <h1>Detail {props.match.params.id}</h1>
- <p>This are the information about {props.staticContext}.</p>
- <Button color={'secondary'} variant={'contained'}>Start</Button>
- <Button color="inherit" className={ props.classes.warnButton } variant={'contained'}>Stop</Button>
- </div>
-)));
-
-export default Detail; \ No newline at end of file
diff --git a/sdnr/wt/odlux/apps/inventoryApp/src/views/treeview.tsx b/sdnr/wt/odlux/apps/inventoryApp/src/views/treeview.tsx
deleted file mode 100644
index 954c074c1..000000000
--- a/sdnr/wt/odlux/apps/inventoryApp/src/views/treeview.tsx
+++ /dev/null
@@ -1,155 +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 React from 'react';
-
-import Breadcrumbs from '@mui/material/Breadcrumbs';
-import Link from '@mui/material/Link';
-import { Theme } from '@mui/material/styles';
-import { WithStyles } from '@mui/styles';
-import createStyles from '@mui/styles/createStyles';
-import withStyles from '@mui/styles/withStyles';
-import { RouteComponentProps } from 'react-router-dom';
-import { SearchMode, TreeView, TreeViewCtorType } from '../../../../framework/src/components/material-ui/treeView';
-import { renderObject } from '../../../../framework/src/components/objectDump';
-import { Connect, connect, IDispatcher } from '../../../../framework/src/flux/connect';
-import { IApplicationStoreState } from '../../../../framework/src/store/applicationStore';
-
-import { selectInventoryNodeAsyncAction, setSearchTermAction, UpdateExpandedNodesAction, updateInventoryTreeAsyncAction, UpdateSelectedNodeAction } from '../actions/inventoryTreeActions';
-import { TreeDemoItem } from '../models/inventory';
-
-const styles = (theme: Theme) => createStyles({
- root: {
- flex: '1 0 0%',
- display: 'flex',
- flexDirection: 'row',
- },
- tree: {
- wordWrap: 'break-word',
- minWidth: '250px',
- padding: `0px ${theme.spacing(1)}`,
- },
- details: {
- flex: '5 0 0%',
- padding: `0px ${theme.spacing(1)}`,
- },
-});
-
-const mapProps = (state: IApplicationStoreState) => ({
- isBusy: state.inventory.inventoryTree.isBusy,
- rootNodes: state.inventory.inventoryTree.rootNodes,
- searchTerm: state.inventory.inventoryTree.searchTerm,
- selectedNode: state.inventory.inventoryTree.selectedNode,
- expendedItems: state.inventory.inventoryTree.expandedItems,
-});
-
-const mapDispatch = (dispatcher: IDispatcher) => ({
- updateExpendedNodes: (expendedNodes: TreeDemoItem[]) => dispatcher.dispatch(new UpdateExpandedNodesAction(expendedNodes)),
- updateInventoryTree: (mountId: string, searchTerm?: string) => dispatcher.dispatch(updateInventoryTreeAsyncAction(mountId, searchTerm)),
- selectTreeNode: (nodeId?: string) => nodeId ? dispatcher.dispatch(selectInventoryNodeAsyncAction(nodeId)) : dispatcher.dispatch(new UpdateSelectedNodeAction(undefined)),
- setSearchTerm: (searchTerm: string) => dispatcher.dispatch(setSearchTermAction(searchTerm)),
-});
-
-const propsChache = Symbol('PropsCache');
-const InventoryTree = TreeView as any as TreeViewCtorType<string>;
-
-
-
-type TreeviewComponentProps = RouteComponentProps<{ mountId: string }> & WithStyles<typeof styles> & Connect<typeof mapProps, typeof mapDispatch>;
-
-type TreeviewComponentState = {
- [propsChache]: {
- rootNodes?: TreeDemoItem[];
- };
- rootNodes: TreeDemoItem[];
-};
-
-
-class DashboardComponent extends React.Component<TreeviewComponentProps, TreeviewComponentState> {
-
- constructor(props: TreeviewComponentProps) {
- super(props);
-
- this.state = {
- [propsChache]: {},
- rootNodes: [],
- };
- }
-
- static getDerivedStateFromProps(props: TreeviewComponentProps, state: TreeviewComponentState) {
- if (state[propsChache].rootNodes != props.rootNodes) {
- // eslint-disable-next-line no-param-reassign
- state = { ...state, rootNodes: props.rootNodes };
- }
- return state;
- }
-
- render() {
- const { classes, updateInventoryTree, updateExpendedNodes, expendedItems, selectedNode, selectTreeNode, searchTerm, match: { params: { mountId } } } = this.props;
- const scrollbar = { overflow: 'auto', paddingRight: '20px' };
-
- let filteredDashboardPath = `/inventory/dashboard/${this.props.match.params.mountId}`;
- let basePath = `/inventory/${this.props.match.params.mountId}`;
-
- return (
- <div style={scrollbar} >
- <div >
- <Breadcrumbs aria-label="breadcrumbs">
- <Link underline="hover" color="inherit" href="#" aria-label="back-breadcrumb"
- onClick={(event: React.MouseEvent<HTMLElement>) => {
- event.preventDefault();
- this.props.history.push(filteredDashboardPath);
- }}>Back</Link>
- <Link underline="hover" color="inherit" href="#"
- aria-label={this.props.match.params.mountId + '-breadcrumb'}
- onClick={(event: React.MouseEvent<HTMLElement>) => {
- event.preventDefault();
- this.props.history.push(basePath);
- }}><span>{this.props.match.params.mountId}</span></Link>
- </Breadcrumbs>
- </div>
- <br />
- <div style={scrollbar} className={classes.root}>
- <InventoryTree className={classes.tree} items={this.state.rootNodes} enableSearchBar initialSearchTerm={searchTerm} searchMode={SearchMode.OnEnter} searchTerm={searchTerm}
- // eslint-disable-next-line @typescript-eslint/no-shadow
- onSearch={(searchTerm) => updateInventoryTree(mountId, searchTerm)} expandedItems={expendedItems} onFolderClick={(item) => {
- const indexOfItemToToggle = expendedItems.indexOf(item);
- if (indexOfItemToToggle === -1) {
- updateExpendedNodes([...expendedItems, item]);
- } else {
- updateExpendedNodes([
- ...expendedItems.slice(0, indexOfItemToToggle),
- ...expendedItems.slice(indexOfItemToToggle + 1),
- ]);
- }
- }}
- onItemClick={(elm) => selectTreeNode(elm.value)} />
- <div className={classes.details}>{
- selectedNode && renderObject(selectedNode, 'tree-view') || null
- }</div>
- </div>
- </div>
- );
- }
-
- componentWillUnmount() {
- this.props.setSearchTerm('*');
- }
-}
-
-export const InventoryTreeView = connect(mapProps, mapDispatch)(withStyles(styles)(DashboardComponent));
-export default InventoryTreeView; \ No newline at end of file