@oneuptime/common 10.0.71 → 10.0.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Models/DatabaseModels/Alert.ts +55 -0
- package/Models/DatabaseModels/Incident.ts +55 -0
- package/Models/DatabaseModels/StatusPage.ts +80 -0
- package/Server/API/StatusPageAPI.ts +4 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1776940714709-MigrationName.ts +41 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1776971364783-AddStatusPageLanguageSettings.ts +25 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +4 -0
- package/Server/Services/AnalyticsDatabaseService.ts +17 -7
- package/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.ts +175 -29
- package/Server/Utils/Monitor/Criteria/ServerMonitorCriteria.ts +71 -0
- package/Server/Utils/Monitor/MonitorAlert.ts +91 -7
- package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +171 -2
- package/Server/Utils/Monitor/MonitorIncident.ts +133 -8
- package/Server/Utils/Monitor/MonitorMetricUtil.ts +423 -1
- package/Server/Utils/Monitor/MonitorResource.ts +2 -0
- package/Server/Utils/Monitor/MonitorTemplateUtil.ts +99 -0
- package/Tests/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.test.ts +268 -0
- package/Types/Infrastructure/BasicMetrics.ts +75 -0
- package/Types/Metrics/MetricQueryData.ts +11 -0
- package/Types/Monitor/CriteriaFilter.ts +10 -0
- package/Types/Monitor/MetricMonitor/MetricCriteriaContext.ts +11 -0
- package/Types/Monitor/MetricMonitor/MetricMonitorResponse.ts +10 -0
- package/Types/Monitor/MetricMonitor/MetricSeriesResult.ts +20 -0
- package/Types/Monitor/MonitorMetricType.ts +34 -0
- package/Types/Monitor/ServerMonitor/ServerMonitorResponse.ts +8 -0
- package/Types/Probe/ProbeApiIngestResponse.ts +25 -0
- package/Types/StatusPage/StatusPageLanguage.ts +29 -0
- package/UI/Components/Charts/Area/AreaChart.tsx +17 -12
- package/UI/Components/Charts/Bar/BarChart.tsx +16 -11
- package/UI/Components/Charts/ChartGroup/ChartGroup.tsx +23 -0
- package/UI/Components/Charts/Line/LineChart.tsx +16 -11
- package/UI/Components/Filters/FiltersForm.tsx +26 -2
- package/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.ts +453 -0
- package/UI/Components/MonitorTemplateVariables/TemplateVariablesModal.tsx +229 -0
- package/Utils/Metrics/MetricSeriesFingerprint.ts +97 -0
- package/Utils/Monitor/MonitorMetricType.ts +309 -19
- package/build/dist/Models/DatabaseModels/Alert.js +57 -0
- package/build/dist/Models/DatabaseModels/Alert.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Incident.js +57 -0
- package/build/dist/Models/DatabaseModels/Incident.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPage.js +82 -0
- package/build/dist/Models/DatabaseModels/StatusPage.js.map +1 -1
- package/build/dist/Server/API/StatusPageAPI.js +4 -0
- package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1776940714709-MigrationName.js +22 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1776940714709-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1776971364783-AddStatusPageLanguageSettings.js +14 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1776971364783-AddStatusPageLanguageSettings.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +4 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js +14 -4
- package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.js +132 -30
- package/build/dist/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/ServerMonitorCriteria.js +58 -7
- package/build/dist/Server/Utils/Monitor/Criteria/ServerMonitorCriteria.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js +66 -12
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +112 -0
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js +91 -15
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js +373 -0
- package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorResource.js +2 -0
- package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js +65 -0
- package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js.map +1 -1
- package/build/dist/Tests/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.test.js +199 -0
- package/build/dist/Tests/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.test.js.map +1 -1
- package/build/dist/Types/Monitor/CriteriaFilter.js +10 -0
- package/build/dist/Types/Monitor/CriteriaFilter.js.map +1 -1
- package/build/dist/Types/Monitor/MetricMonitor/MetricSeriesResult.js +2 -0
- package/build/dist/Types/Monitor/MetricMonitor/MetricSeriesResult.js.map +1 -0
- package/build/dist/Types/Monitor/MonitorMetricType.js +28 -0
- package/build/dist/Types/Monitor/MonitorMetricType.js.map +1 -1
- package/build/dist/Types/StatusPage/StatusPageLanguage.js +21 -0
- package/build/dist/Types/StatusPage/StatusPageLanguage.js.map +1 -0
- package/build/dist/UI/Components/Charts/Area/AreaChart.js +13 -12
- package/build/dist/UI/Components/Charts/Area/AreaChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/Bar/BarChart.js +12 -11
- package/build/dist/UI/Components/Charts/Bar/BarChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js +11 -3
- package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js.map +1 -1
- package/build/dist/UI/Components/Charts/Line/LineChart.js +12 -11
- package/build/dist/UI/Components/Charts/Line/LineChart.js.map +1 -1
- package/build/dist/UI/Components/Filters/FiltersForm.js +6 -2
- package/build/dist/UI/Components/Filters/FiltersForm.js.map +1 -1
- package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.js +383 -0
- package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.js.map +1 -0
- package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesModal.js +109 -0
- package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesModal.js.map +1 -0
- package/build/dist/Utils/Metrics/MetricSeriesFingerprint.js +81 -0
- package/build/dist/Utils/Metrics/MetricSeriesFingerprint.js.map +1 -0
- package/build/dist/Utils/Monitor/MonitorMetricType.js +287 -19
- package/build/dist/Utils/Monitor/MonitorMetricType.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import ObjectID from "../ObjectID";
|
|
2
2
|
import MonitorEvaluationSummary from "../Monitor/MonitorEvaluationSummary";
|
|
3
|
+
import { JSONObject } from "../JSON";
|
|
4
|
+
import MetricCriteriaContext from "../Monitor/MetricMonitor/MetricCriteriaContext";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* One per-series match produced by a metric monitor with
|
|
8
|
+
* groupByAttributeKeys set. The criteria evaluator emits an entry per
|
|
9
|
+
* series that breached the threshold, and MonitorResource fans this
|
|
10
|
+
* out into one incident + one alert per (criteria, incident template,
|
|
11
|
+
* fingerprint) triple.
|
|
12
|
+
*/
|
|
13
|
+
export interface PerSeriesCriteriaMatch {
|
|
14
|
+
criteriaMetId: string;
|
|
15
|
+
fingerprint: string;
|
|
16
|
+
labels: JSONObject;
|
|
17
|
+
rootCause: string;
|
|
18
|
+
metricContext?: MetricCriteriaContext | undefined;
|
|
19
|
+
}
|
|
3
20
|
|
|
4
21
|
export default interface ProbeApiIngestResponse {
|
|
5
22
|
monitorId: ObjectID;
|
|
@@ -8,4 +25,12 @@ export default interface ProbeApiIngestResponse {
|
|
|
8
25
|
criteriaMetId?: string | undefined;
|
|
9
26
|
rootCause: string | null; // this is in markdown format
|
|
10
27
|
evaluationSummary?: MonitorEvaluationSummary | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Set when a metric monitor with group-by attributes produced one or
|
|
30
|
+
* more per-series matches. MonitorResource uses this to create one
|
|
31
|
+
* incident/alert per breaching series. When undefined (non-metric
|
|
32
|
+
* monitors or ungrouped metric monitors), the scalar `criteriaMetId`
|
|
33
|
+
* + `rootCause` still drive the legacy single-incident path.
|
|
34
|
+
*/
|
|
35
|
+
perSeriesMatches?: Array<PerSeriesCriteriaMatch> | undefined;
|
|
11
36
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface StatusPageLanguage {
|
|
2
|
+
code: string;
|
|
3
|
+
nativeName: string;
|
|
4
|
+
englishName: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const DEFAULT_STATUS_PAGE_LANGUAGE: string = "en";
|
|
8
|
+
|
|
9
|
+
export const SUPPORTED_STATUS_PAGE_LANGUAGES: Array<StatusPageLanguage> = [
|
|
10
|
+
{ code: "en", nativeName: "English", englishName: "English" },
|
|
11
|
+
{ code: "de", nativeName: "Deutsch", englishName: "German" },
|
|
12
|
+
{ code: "fr", nativeName: "Français", englishName: "French" },
|
|
13
|
+
{ code: "es", nativeName: "Español", englishName: "Spanish" },
|
|
14
|
+
{ code: "it", nativeName: "Italiano", englishName: "Italian" },
|
|
15
|
+
{ code: "pt", nativeName: "Português", englishName: "Portuguese" },
|
|
16
|
+
{ code: "nl", nativeName: "Nederlands", englishName: "Dutch" },
|
|
17
|
+
{ code: "da", nativeName: "Dansk", englishName: "Danish" },
|
|
18
|
+
{ code: "no", nativeName: "Norsk", englishName: "Norwegian" },
|
|
19
|
+
{ code: "sv", nativeName: "Svenska", englishName: "Swedish" },
|
|
20
|
+
{ code: "ru", nativeName: "Русский", englishName: "Russian" },
|
|
21
|
+
{ code: "ja", nativeName: "日本語", englishName: "Japanese" },
|
|
22
|
+
{ code: "ko", nativeName: "한국어", englishName: "Korean" },
|
|
23
|
+
{ code: "zh", nativeName: "中文", englishName: "Chinese" },
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
export const SUPPORTED_STATUS_PAGE_LANGUAGE_CODES: Array<string> =
|
|
27
|
+
SUPPORTED_STATUS_PAGE_LANGUAGES.map((language: StatusPageLanguage) => {
|
|
28
|
+
return language.code;
|
|
29
|
+
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AreaChart } from "../ChartLibrary/AreaChart/AreaChart";
|
|
2
|
+
import { AvailableChartColorsKeys } from "../ChartLibrary/Utils/ChartColors";
|
|
2
3
|
import React, {
|
|
3
4
|
FunctionComponent,
|
|
4
5
|
ReactElement,
|
|
@@ -17,6 +18,19 @@ import ExemplarPoint from "../Types/ExemplarPoint";
|
|
|
17
18
|
import XAxisUtil from "../Utils/XAxis";
|
|
18
19
|
import NoDataMessage from "../ChartGroup/NoDataMessage";
|
|
19
20
|
|
|
21
|
+
export const AreaChartPalette: Array<AvailableChartColorsKeys> = [
|
|
22
|
+
"blue",
|
|
23
|
+
"emerald",
|
|
24
|
+
"violet",
|
|
25
|
+
"amber",
|
|
26
|
+
"cyan",
|
|
27
|
+
"pink",
|
|
28
|
+
"lime",
|
|
29
|
+
"fuchsia",
|
|
30
|
+
"indigo",
|
|
31
|
+
"rose",
|
|
32
|
+
];
|
|
33
|
+
|
|
20
34
|
export interface ComponentProps {
|
|
21
35
|
data: Array<SeriesPoint>;
|
|
22
36
|
xAxis: XAxis;
|
|
@@ -27,6 +41,7 @@ export interface ComponentProps {
|
|
|
27
41
|
referenceLines?: Array<ChartReferenceLineProps> | undefined;
|
|
28
42
|
exemplarPoints?: Array<ExemplarPoint> | undefined;
|
|
29
43
|
onExemplarClick?: ((exemplar: ExemplarPoint) => void) | undefined;
|
|
44
|
+
showLegend?: boolean | undefined;
|
|
30
45
|
}
|
|
31
46
|
|
|
32
47
|
export interface AreaInternalProps extends ComponentProps {
|
|
@@ -93,20 +108,10 @@ const AreaChartElement: FunctionComponent<AreaInternalProps> = (
|
|
|
93
108
|
tickGap={1}
|
|
94
109
|
index={"Time"}
|
|
95
110
|
categories={categories}
|
|
96
|
-
colors={
|
|
97
|
-
"blue",
|
|
98
|
-
"emerald",
|
|
99
|
-
"violet",
|
|
100
|
-
"amber",
|
|
101
|
-
"cyan",
|
|
102
|
-
"pink",
|
|
103
|
-
"lime",
|
|
104
|
-
"fuchsia",
|
|
105
|
-
"indigo",
|
|
106
|
-
"rose",
|
|
107
|
-
]}
|
|
111
|
+
colors={AreaChartPalette}
|
|
108
112
|
valueFormatter={props.yAxis.options.formatter || undefined}
|
|
109
113
|
showTooltip={true}
|
|
114
|
+
showLegend={props.showLegend !== false}
|
|
110
115
|
connectNulls={true}
|
|
111
116
|
curve={props.curve || ChartCurve.MONOTONE}
|
|
112
117
|
syncid={props.sync ? props.syncid : undefined}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BarChart } from "../ChartLibrary/BarChart/BarChart";
|
|
2
|
+
import { AvailableChartColorsKeys } from "../ChartLibrary/Utils/ChartColors";
|
|
2
3
|
import React, { FunctionComponent, ReactElement, useEffect } from "react";
|
|
3
4
|
import SeriesPoint from "../Types/SeriesPoints";
|
|
4
5
|
import { XAxis } from "../Types/XAxis/XAxis";
|
|
@@ -8,6 +9,18 @@ import DataPointUtil from "../Utils/DataPoint";
|
|
|
8
9
|
import ChartReferenceLineProps from "../Types/ReferenceLineProps";
|
|
9
10
|
import NoDataMessage from "../ChartGroup/NoDataMessage";
|
|
10
11
|
|
|
12
|
+
export const BarChartPalette: Array<AvailableChartColorsKeys> = [
|
|
13
|
+
"indigo",
|
|
14
|
+
"rose",
|
|
15
|
+
"emerald",
|
|
16
|
+
"amber",
|
|
17
|
+
"cyan",
|
|
18
|
+
"gray",
|
|
19
|
+
"pink",
|
|
20
|
+
"lime",
|
|
21
|
+
"fuchsia",
|
|
22
|
+
];
|
|
23
|
+
|
|
11
24
|
export interface ComponentProps {
|
|
12
25
|
data: Array<SeriesPoint>;
|
|
13
26
|
xAxis: XAxis;
|
|
@@ -15,6 +28,7 @@ export interface ComponentProps {
|
|
|
15
28
|
sync: boolean;
|
|
16
29
|
heightInPx?: number | undefined;
|
|
17
30
|
referenceLines?: Array<ChartReferenceLineProps> | undefined;
|
|
31
|
+
showLegend?: boolean | undefined;
|
|
18
32
|
}
|
|
19
33
|
|
|
20
34
|
export interface BarInternalProps extends ComponentProps {
|
|
@@ -61,19 +75,10 @@ const BarChartElement: FunctionComponent<BarInternalProps> = (
|
|
|
61
75
|
tickGap={1}
|
|
62
76
|
index={"Time"}
|
|
63
77
|
categories={categories}
|
|
64
|
-
colors={
|
|
65
|
-
"indigo",
|
|
66
|
-
"rose",
|
|
67
|
-
"emerald",
|
|
68
|
-
"amber",
|
|
69
|
-
"cyan",
|
|
70
|
-
"gray",
|
|
71
|
-
"pink",
|
|
72
|
-
"lime",
|
|
73
|
-
"fuchsia",
|
|
74
|
-
]}
|
|
78
|
+
colors={BarChartPalette}
|
|
75
79
|
valueFormatter={props.yAxis.options.formatter || undefined}
|
|
76
80
|
showTooltip={true}
|
|
81
|
+
showLegend={props.showLegend !== false}
|
|
77
82
|
yAxisWidth={60}
|
|
78
83
|
syncid={props.sync ? props.syncid : undefined}
|
|
79
84
|
onValueChange={() => {}}
|
|
@@ -36,6 +36,13 @@ export interface Chart {
|
|
|
36
36
|
metricInfo?: ChartMetricInfo | undefined;
|
|
37
37
|
exemplarPoints?: Array<ExemplarPoint> | undefined;
|
|
38
38
|
onExemplarClick?: ((exemplar: ExemplarPoint) => void) | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Optional control panel rendered between the chart title and the
|
|
41
|
+
* chart body. Used by per-series-grouped metric charts to surface a
|
|
42
|
+
* search box, per-series toggles, and a "show all" escape hatch so
|
|
43
|
+
* the chart stays usable at thousands of unique label combinations.
|
|
44
|
+
*/
|
|
45
|
+
seriesControls?: ReactElement | undefined;
|
|
39
46
|
}
|
|
40
47
|
|
|
41
48
|
export interface ComponentProps {
|
|
@@ -58,6 +65,13 @@ const ChartGroup: FunctionComponent<ComponentProps> = (
|
|
|
58
65
|
chart: Chart,
|
|
59
66
|
index: number,
|
|
60
67
|
): ReactElement => {
|
|
68
|
+
/*
|
|
69
|
+
* When the chart has its own seriesControls panel, that panel doubles
|
|
70
|
+
* as a colored, interactive legend — so we suppress the built-in
|
|
71
|
+
* Recharts legend to avoid showing two legends for the same series.
|
|
72
|
+
*/
|
|
73
|
+
const showLegend: boolean = !chart.seriesControls;
|
|
74
|
+
|
|
61
75
|
switch (chart.type) {
|
|
62
76
|
case ChartType.LINE:
|
|
63
77
|
return (
|
|
@@ -68,6 +82,7 @@ const ChartGroup: FunctionComponent<ComponentProps> = (
|
|
|
68
82
|
heightInPx={props.heightInPx}
|
|
69
83
|
exemplarPoints={chart.exemplarPoints}
|
|
70
84
|
onExemplarClick={chart.onExemplarClick}
|
|
85
|
+
showLegend={showLegend}
|
|
71
86
|
/>
|
|
72
87
|
);
|
|
73
88
|
case ChartType.BAR:
|
|
@@ -77,6 +92,7 @@ const ChartGroup: FunctionComponent<ComponentProps> = (
|
|
|
77
92
|
{...(chart.props as BarChartProps)}
|
|
78
93
|
syncid={syncId}
|
|
79
94
|
heightInPx={props.heightInPx}
|
|
95
|
+
showLegend={showLegend}
|
|
80
96
|
/>
|
|
81
97
|
);
|
|
82
98
|
case ChartType.AREA:
|
|
@@ -88,6 +104,7 @@ const ChartGroup: FunctionComponent<ComponentProps> = (
|
|
|
88
104
|
heightInPx={props.heightInPx}
|
|
89
105
|
exemplarPoints={chart.exemplarPoints}
|
|
90
106
|
onExemplarClick={chart.onExemplarClick}
|
|
107
|
+
showLegend={showLegend}
|
|
91
108
|
/>
|
|
92
109
|
);
|
|
93
110
|
default:
|
|
@@ -239,6 +256,9 @@ const ChartGroup: FunctionComponent<ComponentProps> = (
|
|
|
239
256
|
</p>
|
|
240
257
|
)}
|
|
241
258
|
</div>
|
|
259
|
+
{chart.seriesControls ? (
|
|
260
|
+
<div className="mb-3">{chart.seriesControls}</div>
|
|
261
|
+
) : null}
|
|
242
262
|
{getChartContent(chart, index)}
|
|
243
263
|
</div>
|
|
244
264
|
</div>
|
|
@@ -283,6 +303,9 @@ const ChartGroup: FunctionComponent<ComponentProps> = (
|
|
|
283
303
|
{chart.description}
|
|
284
304
|
</p>
|
|
285
305
|
)}
|
|
306
|
+
{chart.seriesControls ? (
|
|
307
|
+
<div className="mt-3">{chart.seriesControls}</div>
|
|
308
|
+
) : null}
|
|
286
309
|
{getChartContent(chart, index)}
|
|
287
310
|
</div>
|
|
288
311
|
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LineChart } from "../ChartLibrary/LineChart/LineChart";
|
|
2
|
+
import { AvailableChartColorsKeys } from "../ChartLibrary/Utils/ChartColors";
|
|
2
3
|
import React, {
|
|
3
4
|
FunctionComponent,
|
|
4
5
|
ReactElement,
|
|
@@ -17,6 +18,18 @@ import ExemplarPoint from "../Types/ExemplarPoint";
|
|
|
17
18
|
import XAxisUtil from "../Utils/XAxis";
|
|
18
19
|
import NoDataMessage from "../ChartGroup/NoDataMessage";
|
|
19
20
|
|
|
21
|
+
export const LineChartPalette: Array<AvailableChartColorsKeys> = [
|
|
22
|
+
"indigo",
|
|
23
|
+
"rose",
|
|
24
|
+
"emerald",
|
|
25
|
+
"amber",
|
|
26
|
+
"cyan",
|
|
27
|
+
"gray",
|
|
28
|
+
"pink",
|
|
29
|
+
"lime",
|
|
30
|
+
"fuchsia",
|
|
31
|
+
];
|
|
32
|
+
|
|
20
33
|
export interface ComponentProps {
|
|
21
34
|
data: Array<SeriesPoint>;
|
|
22
35
|
xAxis: XAxis;
|
|
@@ -27,6 +40,7 @@ export interface ComponentProps {
|
|
|
27
40
|
referenceLines?: Array<ChartReferenceLineProps> | undefined;
|
|
28
41
|
exemplarPoints?: Array<ExemplarPoint> | undefined;
|
|
29
42
|
onExemplarClick?: ((exemplar: ExemplarPoint) => void) | undefined;
|
|
43
|
+
showLegend?: boolean | undefined;
|
|
30
44
|
}
|
|
31
45
|
|
|
32
46
|
export interface LineInternalProps extends ComponentProps {
|
|
@@ -93,19 +107,10 @@ const LineChartElement: FunctionComponent<LineInternalProps> = (
|
|
|
93
107
|
tickGap={1}
|
|
94
108
|
index={"Time"}
|
|
95
109
|
categories={categories}
|
|
96
|
-
colors={
|
|
97
|
-
"indigo",
|
|
98
|
-
"rose",
|
|
99
|
-
"emerald",
|
|
100
|
-
"amber",
|
|
101
|
-
"cyan",
|
|
102
|
-
"gray",
|
|
103
|
-
"pink",
|
|
104
|
-
"lime",
|
|
105
|
-
"fuchsia",
|
|
106
|
-
]}
|
|
110
|
+
colors={LineChartPalette}
|
|
107
111
|
valueFormatter={props.yAxis.options.formatter || undefined}
|
|
108
112
|
showTooltip={true}
|
|
113
|
+
showLegend={props.showLegend !== false}
|
|
109
114
|
connectNulls={true}
|
|
110
115
|
curve={props.curve}
|
|
111
116
|
syncid={props.sync ? props.syncid : undefined}
|
|
@@ -28,6 +28,22 @@ export interface ComponentProps<T extends GenericObject> {
|
|
|
28
28
|
| undefined
|
|
29
29
|
| ((showAdvancedFilters: boolean) => void);
|
|
30
30
|
showAdvancedFiltersByDefault?: boolean | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Suppress the built-in "Show/Hide Advanced Filters" toggle
|
|
33
|
+
* button. Useful when the parent renders its own toggle further
|
|
34
|
+
* down the page (e.g. below other non-filter controls) and needs
|
|
35
|
+
* full layout control. Parent must drive visibility through
|
|
36
|
+
* `showAdvancedFilters` instead.
|
|
37
|
+
*/
|
|
38
|
+
hideAdvancedFilterToggle?: boolean | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Controlled replacement for the internal toggle state. When
|
|
41
|
+
* provided, the form renders advanced filters based on this flag
|
|
42
|
+
* and calls `onAdvancedFiltersToggle` for changes but does not
|
|
43
|
+
* manage its own state. Pair with `hideAdvancedFilterToggle` when
|
|
44
|
+
* the parent owns the UI toggle.
|
|
45
|
+
*/
|
|
46
|
+
showAdvancedFilters?: boolean | undefined;
|
|
31
47
|
}
|
|
32
48
|
|
|
33
49
|
type FiltersFormFunction = <T extends GenericObject>(
|
|
@@ -51,16 +67,24 @@ const FiltersForm: FiltersFormFunction = <T extends GenericObject>(
|
|
|
51
67
|
}
|
|
52
68
|
};
|
|
53
69
|
|
|
54
|
-
const
|
|
70
|
+
const hasAdvancedFilter: boolean = Boolean(
|
|
55
71
|
props.filters.find((filter: Filter<T>) => {
|
|
56
72
|
return filter.isAdvancedFilter;
|
|
57
73
|
}),
|
|
58
74
|
);
|
|
59
75
|
|
|
60
|
-
const
|
|
76
|
+
const showAdvancedFilterButton: boolean =
|
|
77
|
+
hasAdvancedFilter && !props.hideAdvancedFilterToggle;
|
|
78
|
+
|
|
79
|
+
const [internalShowMoreFilters, setShowMoreFilters] = React.useState<boolean>(
|
|
61
80
|
props.showAdvancedFiltersByDefault ?? false,
|
|
62
81
|
);
|
|
63
82
|
|
|
83
|
+
const showMoreFilters: boolean =
|
|
84
|
+
props.showAdvancedFilters !== undefined
|
|
85
|
+
? props.showAdvancedFilters
|
|
86
|
+
: internalShowMoreFilters;
|
|
87
|
+
|
|
64
88
|
type ClearFilterFunction = (key: keyof T) => void;
|
|
65
89
|
|
|
66
90
|
const clearFilter: ClearFilterFunction = (key: keyof T): void => {
|