mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-11 23:18:59 +08:00
feat: add 1 month option in time range (#5639)
This commit is contained in:
parent
f9d1494657
commit
61e6316736
@ -36,6 +36,10 @@ export const timeItems: timePreferance[] = [
|
||||
name: 'Last 1 week',
|
||||
enum: 'LAST_1_WEEK',
|
||||
},
|
||||
{
|
||||
name: 'Last 1 month',
|
||||
enum: 'LAST_1_MONTH',
|
||||
},
|
||||
];
|
||||
|
||||
export interface timePreferance {
|
||||
@ -52,7 +56,8 @@ export type timePreferenceType =
|
||||
| LAST_6_HR
|
||||
| LAST_1_DAY
|
||||
| LAST_3_DAYS
|
||||
| LAST_1_WEEK;
|
||||
| LAST_1_WEEK
|
||||
| LAST_1_MONTH;
|
||||
|
||||
type GLOBAL_TIME = 'GLOBAL_TIME';
|
||||
type LAST_5_MIN = 'LAST_5_MIN';
|
||||
@ -63,5 +68,6 @@ type LAST_6_HR = 'LAST_6_HR';
|
||||
type LAST_1_DAY = 'LAST_1_DAY';
|
||||
type LAST_3_DAYS = 'LAST_3_DAYS';
|
||||
type LAST_1_WEEK = 'LAST_1_WEEK';
|
||||
type LAST_1_MONTH = 'LAST_1_MONTH';
|
||||
|
||||
export default timeItems;
|
||||
|
@ -19,6 +19,7 @@ type TenDay = '10d';
|
||||
type OneWeek = '1w';
|
||||
type TwoWeek = '2w';
|
||||
type SixWeek = '6w';
|
||||
type OneMonth = '1month';
|
||||
type TwoMonths = '2months';
|
||||
type Custom = 'custom';
|
||||
|
||||
@ -42,6 +43,7 @@ export type Time =
|
||||
| TwelveHour
|
||||
| TenDay
|
||||
| TwoWeek
|
||||
| OneMonth
|
||||
| TwoMonths;
|
||||
|
||||
export type TimeUnit = 'm' | 'h' | 'd' | 'w';
|
||||
@ -57,6 +59,7 @@ export const Options: Option[] = [
|
||||
{ value: '1d', label: 'Last 1 day' },
|
||||
{ value: '3d', label: 'Last 3 days' },
|
||||
{ value: '1w', label: 'Last 1 week' },
|
||||
{ value: '1month', label: 'Last 1 month' },
|
||||
{ value: 'custom', label: 'Custom' },
|
||||
];
|
||||
|
||||
@ -95,6 +98,7 @@ export const RelativeDurationOptions: Option[] = [
|
||||
{ value: '1d', label: 'Last 1 day' },
|
||||
{ value: '3d', label: 'Last 3 days' },
|
||||
{ value: '1w', label: 'Last 1 week' },
|
||||
{ value: '1month', label: 'Last 1 month' },
|
||||
];
|
||||
|
||||
export const RelativeDurationSuggestionOptions: Option[] = [
|
||||
|
@ -99,6 +99,10 @@ const GetMinMax = (
|
||||
// six week = one day * 42
|
||||
const minTimeAgo = getMinAgo({ minutes: 24 * 60 * 42 }).getTime();
|
||||
minTime = minTimeAgo;
|
||||
} else if (interval === '1month') {
|
||||
// one month = one day * 30
|
||||
const minTimeAgo = getMinAgo({ minutes: 24 * 60 * 30 }).getTime();
|
||||
minTime = minTimeAgo;
|
||||
} else if (interval === '2months') {
|
||||
// two months = one day * 60
|
||||
const minTimeAgo = getMinAgo({ minutes: 24 * 60 * 60 }).getTime();
|
||||
|
@ -56,6 +56,10 @@ const GetStartAndEndTime = ({
|
||||
return calculateStartAndEndTime(24 * 60 * 7, endString);
|
||||
}
|
||||
|
||||
if (type === 'LAST_1_MONTH') {
|
||||
return calculateStartAndEndTime(24 * 60 * 30, endString);
|
||||
}
|
||||
|
||||
return {
|
||||
start: getMicroSeconds({ time: minTime / 1000000 }),
|
||||
end: getMicroSeconds({ time: maxTime / 1000000 }),
|
||||
|
Loading…
x
Reference in New Issue
Block a user