Skip to content

Commit

Permalink
updation of donut chart on device type change
Browse files Browse the repository at this point in the history
  • Loading branch information
Jayashree-panda committed Jan 27, 2021
1 parent b437b49 commit 3b94e72
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
@@ -1,5 +1,6 @@
import { HostNamesMap } from '@console/local-storage-operator-plugin/src/components/auto-detect-volume/types';
import { diskModeDropdownItems, KMSEmptyState } from '../../../../constants';
import { deviceTypeDropdownItems } from '@console/local-storage-operator-plugin/src/constants';
import { StorageClassResourceKind, NodeKind } from '@console/internal/module/k8s';
import { EncryptionType, KMSConfig, NetworkType } from '../../types';

Expand All @@ -16,7 +17,7 @@ export const initialState: State = {
showNodesListOnLVS: false,
diskType: 'All',
diskMode: diskModeDropdownItems.BLOCK,
deviceType: [],
deviceType: [deviceTypeDropdownItems.DISK, deviceTypeDropdownItems.PART],
maxDiskLimit: '',
nodeNames: [], // nodes selected on the LVS step
minDiskSize: '1',
Expand Down
Expand Up @@ -12,7 +12,10 @@ import { DiskListModal } from './disk-list';
import { State, Action, Discoveries } from '../state';
import { getTotalDeviceCapacity } from '../../../../../utils/install';
import AttachedDevicesNodeTable from '../../sc-node-list';
import { DISK_TYPES } from '@console/local-storage-operator-plugin/src/constants';
import {
DISK_TYPES,
deviceTypeDropdownItems,
} from '@console/local-storage-operator-plugin/src/constants';
import '../../attached-devices.scss';

export const DiscoveryDonutChart: React.FC<DiscoveryDonutChartProps> = ({ state, dispatch }) => {
Expand Down Expand Up @@ -48,7 +51,10 @@ export const DiscoveryDonutChart: React.FC<DiscoveryDonutChartProps> = ({ state,
hasDiskType = DISK_TYPES[state.diskType].property === disk.property;
}

if (isValidSize && hasDiskType) {
const hasDeviceType: boolean = state.deviceType.includes(
deviceTypeDropdownItems[disk.type.toUpperCase()],
);
if (isValidSize && hasDiskType && hasDeviceType) {
return true;
}
}
Expand All @@ -67,6 +73,7 @@ export const DiscoveryDonutChart: React.FC<DiscoveryDonutChartProps> = ({ state,
nodes,
state.nodesDiscoveries,
state.diskType,
state.deviceType,
dispatch,
]);

Expand Down

0 comments on commit 3b94e72

Please sign in to comment.