Skip to content

Commit

Permalink
fix(msp): fix category criteria
Browse files Browse the repository at this point in the history
fix(msp): fix category criteria
  • Loading branch information
Zero-Rock committed Dec 16, 2021
1 parent 1920573 commit 73bd106
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ const genEle = (nodes: TOPOLOGY.INode[], filterKey: INodeKey) => {
let node = genNodes(nodes, edge);
switch (filterKey) {
case 'unhealthyService':
edge = edge.filter((t) => t.data?.isUnhealthy);
node = node.filter((t) => t.data?.isUnhealthy);
edge = edge.filter((t) => t.data?.isUnhealthy && t.data.isService);
node = node.filter((t) => t.data?.isUnhealthy && t.data.isService);
break;
case 'addon':
edge = edge.filter((t) => t.data?.isAddon);
Expand All @@ -65,7 +65,7 @@ const genEle = (nodes: TOPOLOGY.INode[], filterKey: INodeKey) => {
break;
case 'freeService':
edge = [];
node = node.filter((t) => t.data?.parentCount === 0 && t.data?.childrenCount === 0);
node = node.filter((t) => t.data?.parentCount === 0 && t.data.childrenCount === 0 && t.data.isService);
break;
}
return { node, edge };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import React from 'react';
import i18n from 'i18n';
import { genEdges, genNodes, notAddonTypes, servicesTypes } from 'msp/env-overview/topology/pages/topology/utils';
import { genEdges, genNodes } from 'msp/env-overview/topology/pages/topology/utils';
import ErdaIcon from 'common/components/erda-icon';

export type INodeKey = 'node' | 'service' | 'addon' | 'unhealthyService' | 'freeService' | 'circularDependencies';
Expand Down Expand Up @@ -82,18 +82,17 @@ const TopologyOverview: React.FC<IProps> = ({ data, onClick }) => {
temp.node = node.length;
node.forEach((item) => {
if (item.data?.metaData) {
const { parentCount, childrenCount, metaData, isCircular } = item.data;
const { metric, type } = metaData;
if (metric.error_rate > 0) {
const { parentCount, childrenCount, isCircular, isService, isUnhealthy, isAddon } = item.data;
if (isUnhealthy && isService) {
temp.unhealthyService = temp.unhealthyService + 1;
}
if (servicesTypes.includes(type.toLocaleLowerCase())) {
if (isService) {
temp.service = temp.service + 1;
}
if (!notAddonTypes.includes(type.toLocaleLowerCase())) {
if (isAddon) {
temp.addon = temp.addon + 1;
}
if (parentCount === 0 && childrenCount === 0) {
if (parentCount === 0 && childrenCount === 0 && isService) {
temp.freeService = temp.freeService + 1;
}
if (isCircular) {
Expand Down

0 comments on commit 73bd106

Please sign in to comment.