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