Skip to content

Commit afbd85c

Browse files
authored
Merge pull request #9 from oslabs-beta/victor/pushnow
hi
2 parents 8ea797d + d2562a2 commit afbd85c

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

app/charts/EventChart.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ const EventChart: React.FC<EventChartProps> = React.memo(props => {
2929

3030
const createChart = () => {
3131
const timeArr = timeList.map((el: any) => moment(el).format('kk:mm:ss'));
32+
const reverseTimeArr = timeArr.reverse()
3233
const hashedColour = colourGenerator(metric);
34+
const newMetricName = metric.replace("kubernetes-cadvisor/docker-desktop/", ""); // this will get rid of the long path
35+
const re = /_/g;
3336
let plotlyData: {
3437
name: any;
3538
x: any;
@@ -40,7 +43,7 @@ const EventChart: React.FC<EventChartProps> = React.memo(props => {
4043
};
4144
plotlyData = {
4245
name: metric,
43-
x: timeArr,
46+
x: reverseTimeArr,
4447
y: valueList,
4548
type: 'scattergl',
4649
mode: 'lines',
@@ -53,7 +56,7 @@ const EventChart: React.FC<EventChartProps> = React.memo(props => {
5356
data={[plotlyData]}
5457
config={{ displayModeBar: false }}
5558
layout={{
56-
title: metric,
59+
title: newMetricName.replace(re," "), // this will reaplce all the underscores in the graph titlke,
5760
...sizeSwitch,
5861
font: {
5962
color: '#444d56',

app/charts/HealthChart.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ const HealthChart: React.FC<HealthChartProps> = React.memo(props => {
2929

3030
const createChart = () => {
3131
const timeArr = timeList.map((el: any) => moment(el).format('kk:mm:ss'));
32+
const reverseTimeArr = timeArr.reverse()
3233
const hashedColour = colourGenerator(renderService);
34+
const re = /_/g;
3335
let plotlyData: {
3436
name: any;
3537
x: any;
@@ -39,8 +41,8 @@ const HealthChart: React.FC<HealthChartProps> = React.memo(props => {
3941
marker: { color: string };
4042
};
4143
plotlyData = {
42-
name: metric,
43-
x: timeArr,
44+
name: metric.replace(re, " "),
45+
x: reverseTimeArr,
4446
y: valueList,
4547
type: 'scattergl',
4648
mode: 'lines',

app/components/TransferColumns.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ const TransferColumns = React.memo(() => {
174174
const row = {};
175175
row['id'] = index;
176176
row['tag'] = el.tag;
177-
row['title'] = el.title.split(' | ')[1];
177+
row['title'] = el.title.split(' | ')[1].replace("kubernetes-cadvisor/docker-desktop/", ""); // gets rid of the full path
178178
rows.push(row);
179179
});
180180

app/containers/HealthContainer.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,12 @@ const HealthContainer: React.FC<HealthContainerProps> = React.memo(props => {
5454
// console.log('valueList is', valueList); -> 50 values in an array
5555
// console.log('newTimeList array is:', newTimeList); -> 50 values in an array
5656
if (selectedMetricsList.includes(metric)) {
57+
const re = /_/g;
5758
const newHealthChart = (
5859
<HealthChart
5960
key={`Chart${counter}`}
6061
renderService={serviceName}
61-
metric={metric}
62+
metric={metric.replace(re, " ")}
6263
timeList={newTimeList}
6364
valueList={valueList}
6465
sizing={props.sizing}

0 commit comments

Comments
 (0)