Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
@Getter
public enum TimeToRetain {

BTN_1_HOUR("1 hour", "3600000"),
BTN_3_HOURS("3 hours", "10800000"),
BTN_6_HOURS("6 hours", "21600000"),
BTN_12_HOURS("12 hours", "43200000"),
BTN_1_DAY("1 day", "86400000"),
BTN_2_DAYS("2 days", "172800000"),
Expand Down
19 changes: 17 additions & 2 deletions frontend/src/components/Topics/shared/Form/TimeToRetainBtns.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { MILLISECONDS_IN_DAY } from 'lib/constants';
import { MILLISECONDS_IN_DAY, MILLISECONDS_IN_HOUR } from 'lib/constants';
import styled from 'styled-components';

import TimeToRetainBtn from './TimeToRetainBtn';
Expand All @@ -17,10 +17,25 @@ const TimeToRetainBtnsWrapper = styled.div`

const TimeToRetainBtns: React.FC<Props> = ({ name }) => (
<TimeToRetainBtnsWrapper>
<TimeToRetainBtn
text="1 hour"
inputName={name}
value={MILLISECONDS_IN_HOUR}
/>
<TimeToRetainBtn
text="3 hours"
inputName={name}
value={MILLISECONDS_IN_HOUR * 3}
/>
<TimeToRetainBtn
text="6 hours"
inputName={name}
value={MILLISECONDS_IN_HOUR * 6}
/>
<TimeToRetainBtn
text="12 hours"
inputName={name}
value={MILLISECONDS_IN_DAY / 2}
value={MILLISECONDS_IN_HOUR * 12}
/>
<TimeToRetainBtn
text="1 day"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ describe('TimeToRetainBtns', () => {

it('should test the normal view rendering of the component', () => {
SetUpComponent();
expect(screen.getAllByRole('button')).toHaveLength(5);
expect(screen.getAllByRole('button')).toHaveLength(8);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ describe('TopicForm', () => {
'spinbutton',
'Time to retain data (in ms)'
);
expectByRoleAndNameToBeInDocument('button', '1 hour');
expectByRoleAndNameToBeInDocument('button', '3 hours');
expectByRoleAndNameToBeInDocument('button', '6 hours');
expectByRoleAndNameToBeInDocument('button', '12 hours');
expectByRoleAndNameToBeInDocument('button', '1 day');
expectByRoleAndNameToBeInDocument('button', '2 days');
expectByRoleAndNameToBeInDocument('button', '7 days');
expectByRoleAndNameToBeInDocument('button', '4 weeks');
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const TOPIC_CUSTOM_PARAMS: Record<string, string> = {

export const MILLISECONDS_IN_WEEK = 604_800_000;
export const MILLISECONDS_IN_DAY = 86_400_000;
export const MILLISECONDS_IN_HOUR = 3_600_000;
export const MILLISECONDS_IN_SECOND = 1_000;

export const NOT_SET = -1;
Expand Down
Loading