feat: alert history feedback changes (#5903)

* fix: make the default offset 0

* chore: add beta tag to alert history

* fix: don't add 5 minutes earlier to the timeline graph data
This commit is contained in:
Shaheer Kochai 2024-09-11 18:16:41 +04:30 committed by GitHub
parent f3cb3b9840
commit 41d3342a42
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 5 deletions

View File

@ -26,17 +26,14 @@ function HorizontalTimelineGraph({
return [[], []];
}
// add a first and last entry to make sure the graph displays all the data
const FIVE_MINUTES_IN_SECONDS = 300;
// add an entry for the end time of the last entry to make sure the graph displays all the data
const timestamps = [
data[0].start / 1000 - FIVE_MINUTES_IN_SECONDS, // 5 minutes before the first entry
...data.map((item) => item.start / 1000),
data[data.length - 1].end / 1000, // end value of last entry
];
const states = [
ALERT_STATUS[data[0].state], // Same state as the first entry
...data.map((item) => ALERT_STATUS[item.state]),
ALERT_STATUS[data[data.length - 1].state], // Same state as the last entry
];

View File

@ -26,6 +26,7 @@ import history from 'lib/history';
import { History, Table } from 'lucide-react';
import EditRules from 'pages/EditRules';
import { OrderPreferenceItems } from 'pages/Logs/config';
import BetaTag from 'periscope/components/BetaTag/BetaTag';
import PaginationInfoText from 'periscope/components/PaginationInfoText/PaginationInfoText';
import { useAlertRule } from 'providers/Alert';
import { useCallback, useMemo } from 'react';
@ -125,6 +126,7 @@ export const useRouteTabUtils = (): { routes: TabRoutes[] } => {
<div className="tab-item">
<History size={14} />
History
<BetaTag />
</div>
),
route: getRouteUrl(AlertDetailsTab.HISTORY),
@ -256,7 +258,7 @@ export const useGetAlertRuleDetailsTimelineTable = (): GetAlertRuleDetailsTimeli
const { updatedOrder, offset } = useMemo(
() => ({
updatedOrder: params.get(urlKey.order) ?? OrderPreferenceItems.ASC,
offset: parseInt(params.get(urlKey.offset) ?? '1', 10),
offset: parseInt(params.get(urlKey.offset) ?? '0', 10),
}),
[params],
);

View File

@ -0,0 +1,9 @@
import { Tag } from 'antd';
export default function BetaTag(): JSX.Element {
return (
<Tag bordered={false} color="geekblue">
Beta
</Tag>
);
}