fixes edge case

This commit is contained in:
dhrubesh 2021-05-09 19:12:54 +05:30
parent 2d646c0655
commit 45375fbd53

View File

@ -2,11 +2,11 @@ import { uniqBy, uniq, maxBy, cloneDeep, find } from "lodash";
import { serviceMapStore } from "Src/store/actions";
import { graphDataType } from "./ServiceMap";
const MAX_WIDTH = 8;
const MIN_WIDTH = 5;
const MAX_FONT_SIZE = 8;
const MIN_FONT_SIZE = 5;
export const getDimensions = (num, highest) => {
const MAX_WIDTH = 8;
const MIN_WIDTH = 5;
const MAX_FONT_SIZE = 8;
const MIN_FONT_SIZE = 5;
const percentage = (num / highest) * 100;
const width = (percentage * (MAX_WIDTH - MIN_WIDTH)) / 100 + MIN_WIDTH;
const fontSize =
@ -39,6 +39,19 @@ export const getGraphData = (serviceMap: serviceMapStore): graphDataType => {
const nodes = uniqNodes.map((node, i) => {
const service = find(services, (service) => service.serviceName === node);
let color = "#84ff00";
if (!service) {
return {
id: node,
group: i + 1,
fontSize: MIN_FONT_SIZE,
width: MIN_WIDTH,
color,
nodeVal: MIN_WIDTH,
callRate: 0,
errorRate: 0,
p99: 0,
};
}
if (service.errorRate > 0) {
color = "#f00a0a";
} else if (service.fourXXRate > 0) {