-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add alert page for indexing and seeing details about alerts #154
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
d426106
Add basic routes for getting alert details
0df06be
Tweak format of alert list/get
65ee0ef
Clean up typing of alert list/get routes
f3f667b
Merge remote-tracking branch 'origin/main' into jag/alert_page
c9f7d63
WIP alerts page
8c0db18
Tweak and update alerts page, link to dashboard/search, working spark…
b195109
Split alert layout into 3 sections (4 once alerts can be insufficient…
c451753
add lastValue attribute to AlertHistory, display it on alert page if …
85556fb
Icons for alert statuses, dummy disable/enable button for alerts
db92c01
commentary on alert history in alert controller
8363a33
Update with some alert page tweaks and type corrections
75df136
Alerts page updates - using lastValues as an array
b9b5491
Merge remote-tracking branch 'origin/main' into jag/alert_page
1ad6c78
basic smoke tests for the alerts api index
43484fc
Merge branch 'main' into jag/alert_page
wrn14897 0a72739
style: cleanup GET alerts endpoint
wrn14897 8de4edb
fix: cleanup UI + remove unused fields (alert history)
wrn14897 353882d
style: cleanup AlertHistory type
wrn14897 113848f
fix: LogView ref bug (alert model)
wrn14897 cb56756
Merge branch 'main' into jag/alert_page
wrn14897 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import { | ||
clearDBCollections, | ||
closeDB, | ||
getLoggedInAgent, | ||
getServer, | ||
} from '@/fixtures'; | ||
|
||
const randomId = () => Math.random().toString(36).substring(7); | ||
|
||
const makeChart = () => ({ | ||
id: randomId(), | ||
name: 'Test Chart', | ||
x: 1, | ||
y: 1, | ||
w: 1, | ||
h: 1, | ||
series: [ | ||
{ | ||
type: 'time', | ||
table: 'metrics', | ||
}, | ||
], | ||
}); | ||
|
||
const makeAlert = ({ | ||
dashboardId, | ||
chartId, | ||
}: { | ||
dashboardId: string; | ||
chartId: string; | ||
}) => ({ | ||
channel: { | ||
type: 'webhook', | ||
webhookId: 'test-webhook-id', | ||
}, | ||
interval: '15m', | ||
threshold: 8, | ||
type: 'presence', | ||
source: 'CHART', | ||
dashboardId, | ||
chartId, | ||
}); | ||
|
||
const MOCK_DASHBOARD = { | ||
name: 'Test Dashboard', | ||
charts: [makeChart(), makeChart(), makeChart(), makeChart(), makeChart()], | ||
query: 'test query', | ||
}; | ||
|
||
describe('alerts router', () => { | ||
const server = getServer(); | ||
|
||
it('index has alerts attached to dashboards', async () => { | ||
const { agent } = await getLoggedInAgent(server); | ||
|
||
await agent.post('/dashboards').send(MOCK_DASHBOARD).expect(200); | ||
const initialDashboards = await agent.get('/dashboards').expect(200); | ||
|
||
// Create alerts for all charts | ||
const dashboard = initialDashboards.body.data[0]; | ||
await Promise.all( | ||
dashboard.charts.map(chart => | ||
agent | ||
.post('/alerts') | ||
.send( | ||
makeAlert({ | ||
dashboardId: dashboard._id, | ||
chartId: chart.id, | ||
}), | ||
) | ||
.expect(200), | ||
), | ||
); | ||
|
||
const alerts = await agent.get(`/alerts`).expect(200); | ||
expect(alerts.body.data.length).toBe(5); | ||
for (const alert of alerts.body.data) { | ||
expect(alert.chartId).toBeDefined(); | ||
expect(alert.dashboard).toBeDefined(); | ||
} | ||
}); | ||
|
||
beforeAll(async () => { | ||
await server.start(); | ||
}); | ||
|
||
afterEach(async () => { | ||
await clearDBCollections(); | ||
}); | ||
|
||
afterAll(async () => { | ||
await server.closeHttpServer(); | ||
await closeDB(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import AlertsPage from '../src/AlertsPage'; | ||
|
||
export default AlertsPage; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found this bug...that explains why logView couldn't be populated