@oneuptime/common 12.0.7 → 12.0.8
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/TelemetryEntity.ts +45 -0
- package/Models/DatabaseModels/TelemetryEntityRelationship.ts +26 -0
- package/Models/DatabaseModels/WorkflowLog.ts +38 -0
- package/Server/API/UserAPI.ts +16 -1
- package/Server/Infrastructure/Postgres/SchemaMigrations/1786551733814-MigrationName.ts +41 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1786559879134-AddWorkflowLogStepTrace.ts +17 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +4 -0
- package/Server/Middleware/MasterAdminAuthorization.ts +11 -6
- package/Server/Services/TelemetryEntityRelationshipService.ts +3 -0
- package/Server/Services/TelemetryEntityService.ts +114 -1
- package/Server/Types/Workflow/Components/API/Utils.ts +44 -1
- package/Server/Types/Workflow/TriggerCode.ts +12 -0
- package/Server/Types/Workflow/Workflow.ts +5 -0
- package/Server/Utils/Telemetry/InventoryEntityRegistry.ts +689 -0
- package/Server/Utils/VM/VMAPI.ts +56 -8
- package/Tests/App/Dashboard/MonitorCriteriaAttributeFilter.test.tsx +574 -0
- package/Tests/Server/API/UserProjectsAPI.test.ts +478 -4
- package/Tests/Server/Services/TelemetryEntityManualCreate.test.ts +248 -0
- package/Tests/Server/Types/Workflow/Components/ApiComponentHeaders.test.ts +192 -0
- package/Tests/Server/Utils/AnalyticsDatabase/QuerySettingsHelper.test.ts +152 -0
- package/Tests/Server/Utils/Telemetry/InventoryEntityRegistry.test.ts +322 -0
- package/Tests/Server/Utils/VM/VMAPISubstitution.test.ts +243 -0
- package/Tests/Types/SerializableObjectDictionaryImportCycle.test.ts +197 -0
- package/Tests/Types/Telemetry/EntityTypeGroups.test.ts +140 -0
- package/Tests/Types/Workflow/StepTrace.test.ts +235 -0
- package/Tests/Types/Workflow/TemplateSyntax.test.ts +379 -0
- package/Tests/Types/Workflow/Templates.test.ts +403 -0
- package/Tests/UI/Components/CustomTimeRangeModal.test.tsx +459 -0
- package/Tests/UI/Components/DictionaryAttributeFilterRow.test.tsx +477 -0
- package/Tests/UI/Components/Forms/AnchoredFieldPopupKeyboard.test.tsx +382 -0
- package/Tests/UI/Components/Forms/ColorPickerPicking.test.tsx +569 -0
- package/Tests/UI/Components/Forms/ValidationJSON.test.ts +241 -0
- package/Tests/UI/Components/LogTimeRangePicker.test.tsx +42 -0
- package/Tests/UI/Components/ModalPortalDismissal.test.tsx +90 -0
- package/Tests/UI/Components/TelemetryTimeRangePicker.test.tsx +49 -7
- package/Tests/UI/Components/TimeRangePickerDropdown.test.tsx +325 -0
- package/Tests/UI/Components/Workflow/GraphLint.test.ts +821 -0
- package/Tests/UI/Components/Workflow/ModelColumnEditor.test.ts +287 -0
- package/Tests/UI/Components/Workflow/ModelColumnEditorServerContract.test.ts +185 -0
- package/Tests/UI/Components/Workflow/ModelSchema.test.ts +174 -0
- package/Tests/UI/Components/Workflow/RunStatusWatcher.test.ts +152 -0
- package/Tests/UI/Components/Workflow/Utils.test.ts +192 -0
- package/Tests/UI/Monitor/MonitorStepCriteriaView.test.tsx +432 -0
- package/Tests/Utils/Monitor/NetworkDeviceRoleUtil.test.ts +514 -0
- package/Tests/Utils/Monitor/NetworkTopologyUtil.test.ts +240 -0
- package/Tests/Utils/Schema/AnalyticsModelSchema.test.ts +469 -0
- package/Tests/Utils/Schema/ModelSchema.test.ts +268 -0
- package/Tests/Utils/Telemetry/EntityKeyNonTelemetry.test.ts +193 -0
- package/Types/Monitor/SnmpMonitor/NetworkTopology.ts +31 -0
- package/Types/SerializableObjectDictionary.ts +133 -39
- package/Types/Telemetry/EntitySource.ts +40 -0
- package/Types/Telemetry/EntityType.ts +27 -0
- package/Types/Telemetry/EntityTypeGroups.ts +65 -0
- package/Types/Workflow/Component.ts +29 -0
- package/Types/Workflow/Components/API.ts +35 -0
- package/Types/Workflow/Components/BaseModel.ts +7 -3
- package/Types/Workflow/StepTrace.ts +181 -0
- package/Types/Workflow/TemplateSyntax.ts +499 -0
- package/Types/Workflow/Templates.ts +316 -0
- package/UI/Components/Date/CustomTimeRangeModal.tsx +278 -0
- package/UI/Components/Date/TimeRangePickerDropdown.tsx +250 -0
- package/UI/Components/Dictionary/Dictionary.tsx +23 -6
- package/UI/Components/Forms/Fields/ColorPicker.tsx +66 -10
- package/UI/Components/Forms/Fields/IconPicker.tsx +48 -10
- package/UI/Components/Forms/Types/Field.ts +7 -0
- package/UI/Components/Forms/Validation.ts +63 -1
- package/UI/Components/Input/Input.tsx +31 -3
- package/UI/Components/LogsViewer/components/LogTimeRangePicker.tsx +11 -216
- package/UI/Components/Modal/Modal.tsx +37 -4
- package/UI/Components/TelemetryViewer/components/TelemetryTimeRangePicker.tsx +11 -210
- package/UI/Components/Workflow/ArgumentsForm.tsx +194 -7
- package/UI/Components/Workflow/Component.tsx +28 -26
- package/UI/Components/Workflow/ComponentSettingsModal.tsx +69 -8
- package/UI/Components/Workflow/GraphLint.ts +591 -0
- package/UI/Components/Workflow/ModelColumnEditor.tsx +396 -0
- package/UI/Components/Workflow/ModelSchema.ts +196 -0
- package/UI/Components/Workflow/RunForm.tsx +41 -7
- package/UI/Components/Workflow/RunStatusWatcher.ts +122 -0
- package/UI/Components/Workflow/StepTraceViewer.tsx +186 -0
- package/UI/Components/Workflow/Utils.ts +93 -1
- package/UI/Components/Workflow/Workflow.tsx +77 -4
- package/UI/Types/LayeredDismissal.ts +31 -0
- package/UI/Types/UseAnchoredFieldPopup.ts +99 -0
- package/Utils/Monitor/NetworkDeviceRoleUtil.ts +533 -0
- package/Utils/Monitor/NetworkTopologyUtil.ts +45 -7
- package/Utils/Telemetry/EntityKey.ts +66 -0
- package/build/dist/Models/DatabaseModels/TelemetryEntity.js +47 -0
- package/build/dist/Models/DatabaseModels/TelemetryEntity.js.map +1 -1
- package/build/dist/Models/DatabaseModels/TelemetryEntityRelationship.js +27 -0
- package/build/dist/Models/DatabaseModels/TelemetryEntityRelationship.js.map +1 -1
- package/build/dist/Models/DatabaseModels/WorkflowLog.js +39 -0
- package/build/dist/Models/DatabaseModels/WorkflowLog.js.map +1 -1
- package/build/dist/Server/API/UserAPI.js +16 -1
- package/build/dist/Server/API/UserAPI.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786551733814-MigrationName.js +20 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786551733814-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786559879134-AddWorkflowLogStepTrace.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786559879134-AddWorkflowLogStepTrace.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/Middleware/MasterAdminAuthorization.js +11 -6
- package/build/dist/Server/Middleware/MasterAdminAuthorization.js.map +1 -1
- package/build/dist/Server/Services/TelemetryEntityRelationshipService.js +3 -0
- package/build/dist/Server/Services/TelemetryEntityRelationshipService.js.map +1 -1
- package/build/dist/Server/Services/TelemetryEntityService.js +91 -1
- package/build/dist/Server/Services/TelemetryEntityService.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/API/Utils.js +28 -0
- package/build/dist/Server/Types/Workflow/Components/API/Utils.js.map +1 -1
- package/build/dist/Server/Types/Workflow/TriggerCode.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/InventoryEntityRegistry.js +507 -0
- package/build/dist/Server/Utils/Telemetry/InventoryEntityRegistry.js.map +1 -0
- package/build/dist/Server/Utils/VM/VMAPI.js +51 -4
- package/build/dist/Server/Utils/VM/VMAPI.js.map +1 -1
- package/build/dist/Types/SerializableObjectDictionary.js +133 -39
- package/build/dist/Types/SerializableObjectDictionary.js.map +1 -1
- package/build/dist/Types/Telemetry/EntitySource.js +39 -0
- package/build/dist/Types/Telemetry/EntitySource.js.map +1 -0
- package/build/dist/Types/Telemetry/EntityType.js +27 -0
- package/build/dist/Types/Telemetry/EntityType.js.map +1 -1
- package/build/dist/Types/Telemetry/EntityTypeGroups.js +57 -0
- package/build/dist/Types/Telemetry/EntityTypeGroups.js.map +1 -0
- package/build/dist/Types/Workflow/Component.js +21 -0
- package/build/dist/Types/Workflow/Component.js.map +1 -1
- package/build/dist/Types/Workflow/Components/API.js +35 -0
- package/build/dist/Types/Workflow/Components/API.js.map +1 -1
- package/build/dist/Types/Workflow/Components/BaseModel.js +7 -3
- package/build/dist/Types/Workflow/Components/BaseModel.js.map +1 -1
- package/build/dist/Types/Workflow/StepTrace.js +104 -0
- package/build/dist/Types/Workflow/StepTrace.js.map +1 -0
- package/build/dist/Types/Workflow/TemplateSyntax.js +326 -0
- package/build/dist/Types/Workflow/TemplateSyntax.js.map +1 -0
- package/build/dist/Types/Workflow/Templates.js +218 -0
- package/build/dist/Types/Workflow/Templates.js.map +1 -0
- package/build/dist/UI/Components/Date/CustomTimeRangeModal.js +126 -0
- package/build/dist/UI/Components/Date/CustomTimeRangeModal.js.map +1 -0
- package/build/dist/UI/Components/Date/TimeRangePickerDropdown.js +123 -0
- package/build/dist/UI/Components/Date/TimeRangePickerDropdown.js.map +1 -0
- package/build/dist/UI/Components/Dictionary/Dictionary.js +22 -6
- package/build/dist/UI/Components/Dictionary/Dictionary.js.map +1 -1
- package/build/dist/UI/Components/Forms/Fields/ColorPicker.js +52 -13
- package/build/dist/UI/Components/Forms/Fields/ColorPicker.js.map +1 -1
- package/build/dist/UI/Components/Forms/Fields/IconPicker.js +28 -12
- package/build/dist/UI/Components/Forms/Fields/IconPicker.js.map +1 -1
- package/build/dist/UI/Components/Forms/Validation.js +44 -0
- package/build/dist/UI/Components/Forms/Validation.js.map +1 -1
- package/build/dist/UI/Components/Input/Input.js +12 -4
- package/build/dist/UI/Components/Input/Input.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogTimeRangePicker.js +5 -108
- package/build/dist/UI/Components/LogsViewer/components/LogTimeRangePicker.js.map +1 -1
- package/build/dist/UI/Components/Modal/Modal.js +31 -5
- package/build/dist/UI/Components/Modal/Modal.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryTimeRangePicker.js +5 -105
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryTimeRangePicker.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ArgumentsForm.js +140 -11
- package/build/dist/UI/Components/Workflow/ArgumentsForm.js.map +1 -1
- package/build/dist/UI/Components/Workflow/Component.js +20 -19
- package/build/dist/UI/Components/Workflow/Component.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ComponentSettingsModal.js +31 -3
- package/build/dist/UI/Components/Workflow/ComponentSettingsModal.js.map +1 -1
- package/build/dist/UI/Components/Workflow/GraphLint.js +396 -0
- package/build/dist/UI/Components/Workflow/GraphLint.js.map +1 -0
- package/build/dist/UI/Components/Workflow/ModelColumnEditor.js +225 -0
- package/build/dist/UI/Components/Workflow/ModelColumnEditor.js.map +1 -0
- package/build/dist/UI/Components/Workflow/ModelSchema.js +118 -0
- package/build/dist/UI/Components/Workflow/ModelSchema.js.map +1 -0
- package/build/dist/UI/Components/Workflow/RunForm.js +22 -6
- package/build/dist/UI/Components/Workflow/RunForm.js.map +1 -1
- package/build/dist/UI/Components/Workflow/RunStatusWatcher.js +76 -0
- package/build/dist/UI/Components/Workflow/RunStatusWatcher.js.map +1 -0
- package/build/dist/UI/Components/Workflow/StepTraceViewer.js +76 -0
- package/build/dist/UI/Components/Workflow/StepTraceViewer.js.map +1 -0
- package/build/dist/UI/Components/Workflow/Utils.js +73 -1
- package/build/dist/UI/Components/Workflow/Utils.js.map +1 -1
- package/build/dist/UI/Components/Workflow/Workflow.js +51 -6
- package/build/dist/UI/Components/Workflow/Workflow.js.map +1 -1
- package/build/dist/UI/Types/LayeredDismissal.js +21 -0
- package/build/dist/UI/Types/LayeredDismissal.js.map +1 -0
- package/build/dist/UI/Types/UseAnchoredFieldPopup.js +74 -1
- package/build/dist/UI/Types/UseAnchoredFieldPopup.js.map +1 -1
- package/build/dist/Utils/Monitor/NetworkDeviceRoleUtil.js +386 -0
- package/build/dist/Utils/Monitor/NetworkDeviceRoleUtil.js.map +1 -0
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js +35 -6
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js.map +1 -1
- package/build/dist/Utils/Telemetry/EntityKey.js +52 -0
- package/build/dist/Utils/Telemetry/EntityKey.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
2
|
+
import { render, screen, waitFor } from "@testing-library/react";
|
|
3
|
+
import { beforeEach, describe, expect, it, jest } from "@jest/globals";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { MemoryRouter } from "react-router-dom";
|
|
6
|
+
import AggregationType from "../../../Types/BaseDatabase/AggregationType";
|
|
7
|
+
import Hostname from "../../../Types/API/Hostname";
|
|
8
|
+
import HTTPMethod from "../../../Types/API/HTTPMethod";
|
|
9
|
+
import URL from "../../../Types/API/URL";
|
|
10
|
+
import MetricsViewConfig from "../../../Types/Metrics/MetricsViewConfig";
|
|
11
|
+
import DnsRecordType from "../../../Types/Monitor/DnsMonitor/DnsRecordType";
|
|
12
|
+
import MonitorCriteria from "../../../Types/Monitor/MonitorCriteria";
|
|
13
|
+
import { KubernetesResourceScope } from "../../../Types/Monitor/MonitorStepKubernetesMonitor";
|
|
14
|
+
import Port from "../../../Types/Port";
|
|
15
|
+
import MonitorStep, {
|
|
16
|
+
MonitorStepType,
|
|
17
|
+
} from "../../../Types/Monitor/MonitorStep";
|
|
18
|
+
import MonitorType from "../../../Types/Monitor/MonitorType";
|
|
19
|
+
import ObjectID from "../../../Types/ObjectID";
|
|
20
|
+
import RollingTime from "../../../Types/RollingTime/RollingTime";
|
|
21
|
+
import Service from "../../../Models/DatabaseModels/Service";
|
|
22
|
+
import NetworkDevice from "../../../Models/DatabaseModels/NetworkDevice";
|
|
23
|
+
import getJestMockFunction, { MockFunction } from "../../MockType";
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
* WHAT THIS FILE PROTECTS
|
|
27
|
+
*
|
|
28
|
+
* This is the monitor "Criteria" page's step viewer, rendered for real.
|
|
29
|
+
* The bug it pins: for most monitor types the page showed criteria and
|
|
30
|
+
* nothing else — no destination, no metric name, no host — while the edit
|
|
31
|
+
* modal showed the whole configuration. MonitorStepViewModel.test.ts holds
|
|
32
|
+
* the mapping from step to rows; this file holds the other half, that the
|
|
33
|
+
* component actually PUTS those rows on the page (and, for metric monitors,
|
|
34
|
+
* the chart preview beside them).
|
|
35
|
+
*
|
|
36
|
+
* The metric preview is stubbed: it is the metric explorer's chart stack,
|
|
37
|
+
* and what matters here is that the viewer hands it the right config, not
|
|
38
|
+
* that ClickHouse answers.
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
const getListMock: MockFunction = getJestMockFunction();
|
|
42
|
+
const getItemMock: MockFunction = getJestMockFunction();
|
|
43
|
+
|
|
44
|
+
jest.mock("../../../UI/Utils/ModelAPI/ModelAPI", () => {
|
|
45
|
+
return {
|
|
46
|
+
__esModule: true,
|
|
47
|
+
default: {
|
|
48
|
+
getList: (...args: Array<any>) => {
|
|
49
|
+
return getListMock(...args);
|
|
50
|
+
},
|
|
51
|
+
getItem: (...args: Array<any>) => {
|
|
52
|
+
return getItemMock(...args);
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
jest.mock("../../../UI/Utils/Project", () => {
|
|
59
|
+
return {
|
|
60
|
+
__esModule: true,
|
|
61
|
+
default: {
|
|
62
|
+
getCurrentProjectId: () => {
|
|
63
|
+
return new ObjectID("99999999-9999-4999-8999-999999999999");
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
jest.mock(
|
|
70
|
+
"../../../../App/FeatureSet/Dashboard/src/Components/Monitor/MonitorSteps/MonitorStepMetricPreview",
|
|
71
|
+
() => {
|
|
72
|
+
return {
|
|
73
|
+
__esModule: true,
|
|
74
|
+
default: (props: {
|
|
75
|
+
metricsViewConfig: MetricsViewConfig;
|
|
76
|
+
rollingTime: RollingTime | undefined;
|
|
77
|
+
}) => {
|
|
78
|
+
return (
|
|
79
|
+
<div data-testid="metric-preview">
|
|
80
|
+
{`${props.metricsViewConfig.queryConfigs.length} queries over ${props.rollingTime}`}
|
|
81
|
+
</div>
|
|
82
|
+
);
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
},
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
// Imported after the mocks above so the component picks them up.
|
|
89
|
+
import MonitorStepElement from "../../../../App/FeatureSet/Dashboard/src/Components/Monitor/MonitorSteps/MonitorStep";
|
|
90
|
+
|
|
91
|
+
/*
|
|
92
|
+
* The heading of the criteria section is the word "Criteria", which is also
|
|
93
|
+
* the default NAME of a criteria instance — so the heading alone is an
|
|
94
|
+
* ambiguous query. The description under it is unique to the section.
|
|
95
|
+
*/
|
|
96
|
+
const CRITERIA_SECTION_DESCRIPTION: string =
|
|
97
|
+
"Criteria we will use to determine your resource status.";
|
|
98
|
+
|
|
99
|
+
const METRIC_VIEW_CONFIG: MetricsViewConfig = {
|
|
100
|
+
queryConfigs: [
|
|
101
|
+
{
|
|
102
|
+
metricAliasData: {
|
|
103
|
+
metricVariable: "a",
|
|
104
|
+
title: "CPU Usage",
|
|
105
|
+
description: undefined,
|
|
106
|
+
legend: undefined,
|
|
107
|
+
legendUnit: undefined,
|
|
108
|
+
},
|
|
109
|
+
metricQueryData: {
|
|
110
|
+
filterData: {
|
|
111
|
+
metricName: "container.cpu.usage",
|
|
112
|
+
aggegationType: AggregationType.Avg,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
formulaConfigs: [],
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
function buildStep(data: Partial<MonitorStepType>): MonitorStep {
|
|
121
|
+
const monitorStep: MonitorStep = new MonitorStep();
|
|
122
|
+
|
|
123
|
+
monitorStep.data = {
|
|
124
|
+
...(monitorStep.data as MonitorStepType),
|
|
125
|
+
monitorCriteria: new MonitorCriteria(),
|
|
126
|
+
...data,
|
|
127
|
+
} as MonitorStepType;
|
|
128
|
+
|
|
129
|
+
return monitorStep;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function renderStep(monitorType: MonitorType, monitorStep: MonitorStep): void {
|
|
133
|
+
render(
|
|
134
|
+
<MemoryRouter>
|
|
135
|
+
<MonitorStepElement
|
|
136
|
+
monitorType={monitorType}
|
|
137
|
+
monitorStep={monitorStep}
|
|
138
|
+
monitorStatusOptions={[]}
|
|
139
|
+
incidentSeverityOptions={[]}
|
|
140
|
+
alertSeverityOptions={[]}
|
|
141
|
+
onCallPolicyOptions={[]}
|
|
142
|
+
labelOptions={[]}
|
|
143
|
+
teamOptions={[]}
|
|
144
|
+
userOptions={[]}
|
|
145
|
+
incidentRoleOptions={[]}
|
|
146
|
+
/>
|
|
147
|
+
</MemoryRouter>,
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
beforeEach(() => {
|
|
152
|
+
getListMock.mockReset();
|
|
153
|
+
getItemMock.mockReset();
|
|
154
|
+
getListMock.mockResolvedValue({ data: [], count: 0, skip: 0, limit: 0 });
|
|
155
|
+
getItemMock.mockResolvedValue(null);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
describe("Monitor criteria page — metric monitors", () => {
|
|
159
|
+
it("names the metric and the window instead of showing an empty section", async () => {
|
|
160
|
+
renderStep(
|
|
161
|
+
MonitorType.Metrics,
|
|
162
|
+
buildStep({
|
|
163
|
+
metricMonitor: {
|
|
164
|
+
metricViewConfig: METRIC_VIEW_CONFIG,
|
|
165
|
+
rollingTime: RollingTime.Past30Minutes,
|
|
166
|
+
telemetryServiceIds: [],
|
|
167
|
+
},
|
|
168
|
+
}),
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
await waitFor(() => {
|
|
172
|
+
expect(screen.getByText("Metrics")).toBeInTheDocument();
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
expect(
|
|
176
|
+
screen.getByText("CPU Usage (container.cpu.usage · Avg)"),
|
|
177
|
+
).toBeInTheDocument();
|
|
178
|
+
expect(screen.getByText("Time Range")).toBeInTheDocument();
|
|
179
|
+
expect(screen.getByText(RollingTime.Past30Minutes)).toBeInTheDocument();
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
it("renders the metric preview with the step's own config", async () => {
|
|
183
|
+
renderStep(
|
|
184
|
+
MonitorType.Metrics,
|
|
185
|
+
buildStep({
|
|
186
|
+
metricMonitor: {
|
|
187
|
+
metricViewConfig: METRIC_VIEW_CONFIG,
|
|
188
|
+
rollingTime: RollingTime.Past30Minutes,
|
|
189
|
+
telemetryServiceIds: [],
|
|
190
|
+
},
|
|
191
|
+
}),
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
await waitFor(() => {
|
|
195
|
+
expect(screen.getByTestId("metric-preview")).toHaveTextContent(
|
|
196
|
+
"1 queries over Past 30 Minutes",
|
|
197
|
+
);
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
it("shows the host an infrastructure monitor watches", async () => {
|
|
202
|
+
renderStep(
|
|
203
|
+
MonitorType.Host,
|
|
204
|
+
buildStep({
|
|
205
|
+
hostMonitor: {
|
|
206
|
+
hostIdentifier: "web-1",
|
|
207
|
+
metricViewConfig: METRIC_VIEW_CONFIG,
|
|
208
|
+
rollingTime: RollingTime.Past5Minutes,
|
|
209
|
+
},
|
|
210
|
+
}),
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
await waitFor(() => {
|
|
214
|
+
expect(screen.getByText("web-1")).toBeInTheDocument();
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
expect(screen.getByTestId("metric-preview")).toBeInTheDocument();
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
it("shows the Kubernetes cluster and its resource filters", async () => {
|
|
221
|
+
renderStep(
|
|
222
|
+
MonitorType.Kubernetes,
|
|
223
|
+
buildStep({
|
|
224
|
+
kubernetesMonitor: {
|
|
225
|
+
clusterIdentifier: "prod-cluster",
|
|
226
|
+
resourceScope: KubernetesResourceScope.Workload,
|
|
227
|
+
resourceFilters: { namespace: "payments" },
|
|
228
|
+
metricViewConfig: METRIC_VIEW_CONFIG,
|
|
229
|
+
rollingTime: RollingTime.Past5Minutes,
|
|
230
|
+
},
|
|
231
|
+
}),
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
await waitFor(() => {
|
|
235
|
+
expect(screen.getByText("prod-cluster")).toBeInTheDocument();
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
expect(screen.getByText("Namespace")).toBeInTheDocument();
|
|
239
|
+
expect(screen.getByText("payments")).toBeInTheDocument();
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
describe("Monitor criteria page — probe monitors", () => {
|
|
244
|
+
it("still shows the API destination and request type", async () => {
|
|
245
|
+
renderStep(
|
|
246
|
+
MonitorType.API,
|
|
247
|
+
buildStep({
|
|
248
|
+
monitorDestination: URL.fromString("https://api.example.com/health"),
|
|
249
|
+
requestType: HTTPMethod.POST,
|
|
250
|
+
}),
|
|
251
|
+
);
|
|
252
|
+
|
|
253
|
+
await waitFor(() => {
|
|
254
|
+
expect(screen.getByText("API URL")).toBeInTheDocument();
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
expect(
|
|
258
|
+
screen.getByText("https://api.example.com/health"),
|
|
259
|
+
).toBeInTheDocument();
|
|
260
|
+
expect(screen.getByText(HTTPMethod.POST)).toBeInTheDocument();
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
it("shows the SSL certificate monitor's destination", async () => {
|
|
264
|
+
renderStep(
|
|
265
|
+
MonitorType.SSLCertificate,
|
|
266
|
+
buildStep({
|
|
267
|
+
monitorDestination: URL.fromString("https://secure.example.com"),
|
|
268
|
+
}),
|
|
269
|
+
);
|
|
270
|
+
|
|
271
|
+
await waitFor(() => {
|
|
272
|
+
expect(
|
|
273
|
+
// URL.toString() renders the root path explicitly.
|
|
274
|
+
screen.getByText("https://secure.example.com/"),
|
|
275
|
+
).toBeInTheDocument();
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
it("shows the port monitor's host and port", async () => {
|
|
280
|
+
renderStep(
|
|
281
|
+
MonitorType.Port,
|
|
282
|
+
buildStep({
|
|
283
|
+
monitorDestination: new Hostname("db.example.com"),
|
|
284
|
+
monitorDestinationPort: new Port(5432),
|
|
285
|
+
}),
|
|
286
|
+
);
|
|
287
|
+
|
|
288
|
+
await waitFor(() => {
|
|
289
|
+
expect(screen.getByText("db.example.com")).toBeInTheDocument();
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
expect(screen.getByText("5432")).toBeInTheDocument();
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
it("shows the DNS query, record type and resolver", async () => {
|
|
296
|
+
renderStep(
|
|
297
|
+
MonitorType.DNS,
|
|
298
|
+
buildStep({
|
|
299
|
+
dnsMonitor: {
|
|
300
|
+
queryName: "example.com",
|
|
301
|
+
recordType: DnsRecordType.A,
|
|
302
|
+
hostname: "8.8.8.8",
|
|
303
|
+
port: 53,
|
|
304
|
+
timeout: 5000,
|
|
305
|
+
retries: 3,
|
|
306
|
+
},
|
|
307
|
+
}),
|
|
308
|
+
);
|
|
309
|
+
|
|
310
|
+
await waitFor(() => {
|
|
311
|
+
expect(screen.getByText("example.com")).toBeInTheDocument();
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
expect(screen.getByText("Record Type")).toBeInTheDocument();
|
|
315
|
+
expect(screen.getByText("8.8.8.8")).toBeInTheDocument();
|
|
316
|
+
});
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
describe("Monitor criteria page — resolved references", () => {
|
|
320
|
+
it("names the telemetry services a log monitor is scoped to", async () => {
|
|
321
|
+
const service: Service = new Service();
|
|
322
|
+
service.id = new ObjectID("11111111-1111-4111-8111-111111111111");
|
|
323
|
+
service.name = "checkout";
|
|
324
|
+
|
|
325
|
+
getListMock.mockResolvedValue({
|
|
326
|
+
data: [service],
|
|
327
|
+
count: 1,
|
|
328
|
+
skip: 0,
|
|
329
|
+
limit: 10,
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
renderStep(
|
|
333
|
+
MonitorType.Logs,
|
|
334
|
+
buildStep({
|
|
335
|
+
logMonitor: {
|
|
336
|
+
attributes: {},
|
|
337
|
+
body: "timeout",
|
|
338
|
+
severityTexts: [],
|
|
339
|
+
telemetryServiceIds: [
|
|
340
|
+
new ObjectID("11111111-1111-4111-8111-111111111111"),
|
|
341
|
+
],
|
|
342
|
+
lastXSecondsOfLogs: 60,
|
|
343
|
+
},
|
|
344
|
+
}),
|
|
345
|
+
);
|
|
346
|
+
|
|
347
|
+
await waitFor(() => {
|
|
348
|
+
expect(screen.getByText("checkout")).toBeInTheDocument();
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
expect(screen.getByText("Telemetry Services")).toBeInTheDocument();
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
it("names the network device a network device monitor alerts on", async () => {
|
|
355
|
+
const networkDevice: NetworkDevice = new NetworkDevice();
|
|
356
|
+
networkDevice.name = "core-switch-1";
|
|
357
|
+
|
|
358
|
+
getItemMock.mockResolvedValue(networkDevice);
|
|
359
|
+
|
|
360
|
+
renderStep(
|
|
361
|
+
MonitorType.NetworkDevice,
|
|
362
|
+
buildStep({
|
|
363
|
+
networkDeviceMonitor: {
|
|
364
|
+
networkDeviceId: "44444444-4444-4444-8444-444444444444",
|
|
365
|
+
monitorInterfaces: true,
|
|
366
|
+
collectEndpoints: false,
|
|
367
|
+
oids: [],
|
|
368
|
+
},
|
|
369
|
+
}),
|
|
370
|
+
);
|
|
371
|
+
|
|
372
|
+
await waitFor(() => {
|
|
373
|
+
expect(screen.getByText("core-switch-1")).toBeInTheDocument();
|
|
374
|
+
});
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
it("falls back to the stored id when the network device no longer resolves", async () => {
|
|
378
|
+
getItemMock.mockResolvedValue(null);
|
|
379
|
+
|
|
380
|
+
renderStep(
|
|
381
|
+
MonitorType.NetworkDevice,
|
|
382
|
+
buildStep({
|
|
383
|
+
networkDeviceMonitor: {
|
|
384
|
+
networkDeviceId: "44444444-4444-4444-8444-444444444444",
|
|
385
|
+
monitorInterfaces: true,
|
|
386
|
+
collectEndpoints: false,
|
|
387
|
+
oids: [],
|
|
388
|
+
},
|
|
389
|
+
}),
|
|
390
|
+
);
|
|
391
|
+
|
|
392
|
+
await waitFor(() => {
|
|
393
|
+
expect(
|
|
394
|
+
screen.getByText("44444444-4444-4444-8444-444444444444"),
|
|
395
|
+
).toBeInTheDocument();
|
|
396
|
+
});
|
|
397
|
+
});
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
describe("Monitor criteria page — types without step configuration", () => {
|
|
401
|
+
it("hides the Monitor Details section for incoming request monitors but still shows criteria", async () => {
|
|
402
|
+
renderStep(MonitorType.IncomingRequest, buildStep({}));
|
|
403
|
+
|
|
404
|
+
await waitFor(() => {
|
|
405
|
+
expect(
|
|
406
|
+
screen.getByText(CRITERIA_SECTION_DESCRIPTION),
|
|
407
|
+
).toBeInTheDocument();
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
expect(
|
|
411
|
+
screen.queryByTestId("monitor-step-details"),
|
|
412
|
+
).not.toBeInTheDocument();
|
|
413
|
+
expect(screen.queryByText("Monitor Details")).not.toBeInTheDocument();
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
it("always renders the criteria section, whatever the monitor type", async () => {
|
|
417
|
+
renderStep(
|
|
418
|
+
MonitorType.Website,
|
|
419
|
+
buildStep({
|
|
420
|
+
monitorDestination: URL.fromString("https://example.com"),
|
|
421
|
+
}),
|
|
422
|
+
);
|
|
423
|
+
|
|
424
|
+
await waitFor(() => {
|
|
425
|
+
expect(
|
|
426
|
+
screen.getByText(CRITERIA_SECTION_DESCRIPTION),
|
|
427
|
+
).toBeInTheDocument();
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
expect(screen.getByTestId("monitor-step-details")).toBeInTheDocument();
|
|
431
|
+
});
|
|
432
|
+
});
|