Skip to content

Commit 5bd6708

Browse files
committed
2 parents ff54c23 + 95b892a commit 5bd6708

File tree

11 files changed

+78
-32
lines changed

11 files changed

+78
-32
lines changed

dqops/src/main/frontend/src/pages/GlobalIncidents/GlobalIncidentDashboard/GlobalIncidentsDashboard.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default function GlobalIncidentsDashboard({
1212
const groups = incidents.topIncidents || {};
1313

1414
return (
15-
<div className="flex flex-wrap pt-4 grid lg:grid-cols-1 screen1900:grid-cols-2">
15+
<div className="flex flex-wrap pt-2 grid lg:grid-cols-1 screen1900:grid-cols-2">
1616
{Object.entries(groups)
1717
.filter(([, value]) => value.length !== 0)
1818
.sort(([, valueA], [, valueB]) => {

dqops/src/main/frontend/src/pages/GlobalIncidents/Summary/Gauge.tsx

+15-17
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React from "react";
22
import { IncidentCountsModel, IncidentSeverityLevelCountsModel, TopIncidentsModel } from "../../../api";
33
import SectionWrapper from "../../../components/Dashboard/SectionWrapper";
44
import moment from 'moment';
5-
import Button from "../../../components/Button";
65
import { ROUTES } from "../../../shared/routes";
76
import { useHistory } from 'react-router-dom';
87

@@ -16,7 +15,7 @@ export default function Gauge({
1615
incidentCounts: IncidentCountsModel | undefined,
1716
colorClassName: string,
1817
title: string,
19-
severity: string,
18+
severity: number,
2019
status: string
2120
}) {
2221
const history = useHistory();
@@ -26,28 +25,27 @@ export default function Gauge({
2625
return formattedDate;
2726
}
2827

29-
const goToIncidents = (severity: string, status: string) => {
28+
const goToIncidents = (severity: number, status: string) => {
3029
history.push(
3130
ROUTES.INCIDENT_CONNECTION(
32-
`*?severity=${severity}&status=${status}`
31+
`*?severity=${severity}&${status}=true`
3332
)
3433
);
3534
};
3635

3736
return (
38-
<SectionWrapper
39-
className={"flex justify-center border-2 my-4 mx-4 lg:mx-10 xl:mx-14 2xl:mx-4 screen1900:mx-14 screen3000:mx-34 " + colorClassName}
40-
title={title}
41-
// titleIcon={<div className={"w-4 h-4 border " + colorClassName}></div>}
42-
>
43-
<div
44-
className="w-[150px]"
37+
<div className={"flex flex-col justify-center mx-1 lg:mx-4 lg:my-2 pb-2 cursor-pointer border-2 " + colorClassName}>
38+
<div
39+
className="w-full min-w-[110px] max-w-[160px] mx-auto"
4540
onClick={() => goToIncidents(severity, status)}
4641
>
47-
<div className="text-center pt-1 pb-3 text-2xl ">
42+
<div className="text-center pt-1 text-2xl w-full">
4843
{incidentCounts?.currentMonthCount && incidentCounts?.previousMonthCount && incidentCounts?.currentMonthCount + incidentCounts?.previousMonthCount}
4944
</div>
50-
<div className="flex justify-between text-xs px-5">
45+
<div className="text-center pb-3 text-2xl text-xs">
46+
{title}
47+
</div>
48+
<div className="flex justify-between text-xs px-1">
5149
<div className="">
5250
Last 24h
5351
</div>
@@ -57,7 +55,7 @@ export default function Gauge({
5755
{incidentCounts?.countFromLast24h}
5856
</div>
5957
</div>
60-
<div className="flex justify-between text-xs px-5">
58+
<div className="flex justify-between text-xs px-1">
6159
<div className="">
6260
Last 7 days
6361
</div>
@@ -67,7 +65,7 @@ export default function Gauge({
6765
{incidentCounts?.countFromLast7days}
6866
</div>
6967
</div>
70-
<div className="flex justify-between text-xs px-5">
68+
<div className="flex justify-between text-xs px-1">
7169
<div className="">
7270
{incidentCounts?.currentMonthDate && getMonthName(incidentCounts?.currentMonthDate)}
7371
</div>
@@ -77,7 +75,7 @@ export default function Gauge({
7775
{incidentCounts?.currentMonthCount}
7876
</div>
7977
</div>
80-
<div className="flex justify-between text-xs px-5">
78+
<div className="flex justify-between text-xs px-1">
8179
<div className="">
8280
{incidentCounts?.previousMonthDate && getMonthName(incidentCounts?.previousMonthDate)}
8381
</div>
@@ -88,7 +86,7 @@ export default function Gauge({
8886
</div>
8987
</div>
9088
</div>
91-
</SectionWrapper>
89+
</div>
9290
);
9391

9492
}

dqops/src/main/frontend/src/pages/GlobalIncidents/Summary/IncidentSeverityLevelCounts.tsx

+4-6
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,39 @@ export default function IncidentSeverityLevelCounts({
88
incidentSeverityLevelCounts,
99
title,
1010
icon,
11-
classNameValue,
1211
incidentStatus
1312
}: {
1413
incidentSeverityLevelCounts: IncidentSeverityLevelCountsModel | undefined,
1514
title: string,
1615
icon: React.ReactNode
17-
classNameValue: string,
1816
incidentStatus: string
1917
}) {
2018

2119
return (
2220
<SectionWrapper
23-
className={"flex items-center m-4 grid grid-cols-3 " + classNameValue}
21+
className={"flex items-center grid grid-cols-3 "}
2422
title={title}
2523
titleIcon={icon}
2624
>
2725
<Gauge
2826
incidentCounts={incidentSeverityLevelCounts?.warningCounts}
2927
colorClassName="border-yellow-500"
3028
title="Warnings"
31-
severity="warning"
29+
severity={1}
3230
status={incidentStatus}
3331
/>
3432
<Gauge
3533
incidentCounts={incidentSeverityLevelCounts?.errorCounts}
3634
colorClassName="border-orange-500"
3735
title="Errors"
38-
severity="error"
36+
severity={2}
3937
status={incidentStatus}
4038
/>
4139
<Gauge
4240
incidentCounts={incidentSeverityLevelCounts?.fatalCounts}
4341
colorClassName="border-red-500"
4442
title="Fatal errors"
45-
severity="fatal"
43+
severity={3}
4644
status={incidentStatus}
4745
/>
4846
</SectionWrapper>

dqops/src/main/frontend/src/pages/GlobalIncidents/Summary/SummaryTable.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,17 @@ export default function Summary({
1111
}) {
1212

1313
return (
14-
<div className="flex flex-wrap m-2 mt-3 p-2 grid md:grid-cols-1 2xl:grid-cols-2">
14+
<div className="flex flex-wrap mt-4 ml-2 p-1 grid grid-cols-1 lg:grid-cols-2">
1515
<IncidentSeverityLevelCounts
1616
incidentSeverityLevelCounts={incidents.openIncidentSeverityLevelCounts}
1717
title="Open incidents"
1818
icon={<SvgIcon name="info-filled" className="text-red-900 w-6 h-6" />}
19-
classNameValue=""
2019
incidentStatus="open"
2120
/>
2221
<IncidentSeverityLevelCounts
2322
incidentSeverityLevelCounts={incidents.acknowledgedIncidentSeverityLevelCounts}
2423
title="Acknowledged incidents"
2524
icon={<div className="w-5 h-5 rounded-full bg-black" />}
26-
classNameValue=""
2725
incidentStatus="acknowledged"
2826
/>
2927
</div>

dqops/src/main/frontend/src/pages/IncidentConnection/index.tsx

+35-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,28 @@ const options = [
4646
}
4747
];
4848

49+
const severityOptions = [
50+
{
51+
label: '',
52+
value: undefined
53+
},
54+
{
55+
label: 'Warning',
56+
value: 1,
57+
icon: renderIncidentHighestSeveritySquare(1)
58+
},
59+
{
60+
label: 'Error',
61+
value: 2,
62+
icon: renderIncidentHighestSeveritySquare(2)
63+
},
64+
{
65+
label: 'Fatal',
66+
value: 3,
67+
icon: renderIncidentHighestSeveritySquare(3)
68+
}
69+
];
70+
4971
const statusOptions = [
5072
{
5173
label: 'OPEN',
@@ -443,9 +465,10 @@ export const IncidentConnection = () => {
443465
);
444466
dispatch(
445467
getIncidentsByConnection({
468+
...params,
446469
...(filters || {}),
447470
...obj,
448-
...params,
471+
449472
connection
450473
})
451474
);
@@ -480,6 +503,17 @@ export const IncidentConnection = () => {
480503
</div>
481504
</div>
482505
<div className="flex items-center">
506+
<Select
507+
options={severityOptions}
508+
className="mr-8 w-40"
509+
value={
510+
filters.severity === undefined
511+
? 'Select severity'
512+
: filters.severity
513+
}
514+
onChange={(val) => onChangeFilter({ severity: val })}
515+
placeholder="Select severity"
516+
/>
483517
<div className="mr-20">
484518
<StatusSelect onChangeFilter={onChangeFilter} />
485519
</div>

dqops/src/main/frontend/src/redux/actions/incidents.actions.ts

+2
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export const getIncidentsByConnection =
9999
acknowledgedIncidents = true,
100100
resolvedIncidents = false,
101101
mutedIncidents = false,
102+
severity = undefined,
102103
page = 1,
103104
pageSize = 10,
104105
optionalFilter = '',
@@ -118,6 +119,7 @@ export const getIncidentsByConnection =
118119
acknowledgedIncidents,
119120
resolvedIncidents,
120121
mutedIncidents,
122+
severity,
121123
page,
122124
pageSize,
123125
optionalFilter,

dqops/src/main/frontend/src/redux/reducers/incidents.reducer.ts

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export interface IncidentFilter {
2525
acknowledgedIncidents?: boolean;
2626
resolvedIncidents?: boolean;
2727
mutedIncidents?: boolean;
28+
severity?: number;
2829
page?: number;
2930
pageSize?: number;
3031
optionalFilter?: string;

dqops/src/main/java/com/dqops/data/incidents/models/IncidentListFilterParameters.java

+6
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ public class IncidentListFilterParameters {
9393
@JsonPropertyDescription("Load incidents in 'muted' status. The default value is false.")
9494
private boolean muted = false;
9595

96+
/**
97+
* Load incidents with given severity level.
98+
*/
99+
@JsonPropertyDescription("Load incidents with given severity level.")
100+
private Integer severity;
101+
96102
/**
97103
* Sort order.
98104
*/

dqops/src/main/java/com/dqops/data/incidents/models/IncidentSeverityLevelCountsModel.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static IncidentSeverityLevelCountsModel createInstance(ZoneId defaultTime
5151

5252
/**
5353
* Processes the incident of a given severity that occurred on the specific time to verify the incrementation of inner counts.
54-
* @param highestSeverity The highest severity value that.
54+
* @param highestSeverity The highest severity value to be count.
5555
* @param occurrenceTime The time of occurrence of the incident.
5656
*/
5757
public void processAddCount(int highestSeverity, Instant occurrenceTime){

dqops/src/main/java/com/dqops/data/incidents/services/IncidentsDataServiceImpl.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,16 @@ public Collection<IncidentModel> loadRecentIncidentsOnConnection(
160160
String status = statusColumn.get(rowIndex);
161161
IncidentStatus incidentStatus = IncidentStatus.valueOf(status);
162162

163+
int highestSeverity = highestSeverityColumn.get(rowIndex);
164+
163165
if (!filterParameters.isIncidentStatusEnabled(incidentStatus)) {
164166
continue; // skipping
165167
}
166168

169+
if (filterParameters.getSeverity() != null && filterParameters.getSeverity() != highestSeverity) {
170+
continue; // skipping
171+
}
172+
167173
if (!Strings.isNullOrEmpty(filterParameters.getCategory())) {
168174
if (!Objects.equals(checkCategoryColumn.get(rowIndex), filterParameters.getCategory())) {
169175
continue;
@@ -210,7 +216,7 @@ public Collection<IncidentModel> loadRecentIncidentsOnConnection(
210216
if (!issueUrlColumn.isMissing(rowIndex)) {
211217
incidentModel.setIssueUrl(issueUrlColumn.get(rowIndex));
212218
}
213-
incidentModel.setHighestSeverity(highestSeverityColumn.get(rowIndex));
219+
incidentModel.setHighestSeverity(highestSeverity);
214220
if (minSeverityColumn != null && !minSeverityColumn.isMissing(rowIndex)) {
215221
incidentModel.setMinimumSeverity(minSeverityColumn.get(rowIndex));
216222
}
@@ -582,7 +588,7 @@ public TopIncidentsModel findTopIncidents(TopIncidentGrouping incidentGrouping,
582588
if (!issueUrlColumn.isMissing(rowIndex)) {
583589
incidentModel.setIssueUrl(issueUrlColumn.get(rowIndex));
584590
}
585-
incidentModel.setHighestSeverity(highestSeverityColumn.get(rowIndex));
591+
incidentModel.setHighestSeverity(highestSeverity);
586592
if (minSeverityColumn != null && !minSeverityColumn.isMissing(rowIndex)) {
587593
incidentModel.setMinimumSeverity(minSeverityColumn.get(rowIndex));
588594
}

dqops/src/main/java/com/dqops/rest/controllers/IncidentsController.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,8 @@ public Mono<ResponseEntity<Flux<IncidentModel>>> findRecentIncidentsOnConnection
335335
@RequestParam(required = false) Optional<Boolean> resolved,
336336
@ApiParam(name = "muted", value = "Returns muted incidents, when the parameter is missing, the default value is false", required = false)
337337
@RequestParam(required = false) Optional<Boolean> muted,
338+
@ApiParam(name = "severity", value = "Returns incidents with given severity level", required = false)
339+
@RequestParam(required = false) Optional<Integer> severity,
338340
@ApiParam(name = "page", value = "Page number, the first page is 1", required = false)
339341
@RequestParam(required = false) Optional<Integer> page,
340342
@ApiParam(name = "limit", value = "Page size, the default is 50 rows", required = false)
@@ -356,6 +358,7 @@ public Mono<ResponseEntity<Flux<IncidentModel>>> findRecentIncidentsOnConnection
356358
filterParameters.setAcknowledged(acknowledged.orElse(Boolean.TRUE));
357359
filterParameters.setResolved(resolved.orElse(Boolean.FALSE));
358360
filterParameters.setMuted(muted.orElse(Boolean.FALSE));
361+
filterParameters.setSeverity(severity.orElse(null));
359362
filterParameters.setDimension(dimension.orElse(null));
360363
filterParameters.setCategory(category.orElse(null));
361364

@@ -433,7 +436,7 @@ public Mono<ResponseEntity<Mono<TopIncidentsModel>>> findTopIncidentsGrouped(
433436
@RequestParam(required = false) Optional<TopIncidentGrouping> groupBy,
434437
@ApiParam(name = "limit", value = "The result limit for each group. When this parameter is missing, returns the default limit of " + TOP_INCIDENTS_LIMIT_PER_GROUP, required = false)
435438
@RequestParam(required = false) Optional<Integer> limit,
436-
@ApiParam(name = "limit", value = "Optional filter to configure a time window before now to scan for incidents based on the incident's first seen attribute.", required = false)
439+
@ApiParam(name = "days", value = "Optional filter to configure a time window before now to scan for incidents based on the incident's first seen attribute.", required = false)
437440
@RequestParam(required = false) Optional<Integer> days) {
438441
return Mono.fromFuture(CompletableFuture.supplyAsync(() -> {
439442
TopIncidentsModel topIncidentsModel = this.incidentsDataService.findTopIncidents(

0 commit comments

Comments
 (0)