signoz/frontend/src/lib/getSettingsPeroid.ts
pal-sig 510815655f
Feat(FE): retention UI (#353)
* feat: get set retention api is updated

* feat: Settings retention UI is updated
2021-11-09 17:10:15 +05:30

37 lines
483 B
TypeScript

import { SettingPeroid } from 'container/GeneralSettings';
const getSettingsPeroid = (hr: number): PayloadProps => {
if (hr <= 0) {
return {
peroid: 'hr',
value: 0,
};
}
if (hr < 24) {
return {
peroid: 'hr',
value: hr,
};
}
if (hr < 720) {
return {
peroid: 'day',
value: hr / 24,
};
}
return {
peroid: 'month',
value: hr / 720,
};
};
interface PayloadProps {
value: number;
peroid: SettingPeroid;
}
export default getSettingsPeroid;