Skip to content

Commit

Permalink
refactor(frontend) Set 1 Hour as a default value for recurring pipeli…
Browse files Browse the repository at this point in the history
…ne runs (#5824)

Change the default value of recurring pipeline runs from 1 Munute to 1 Hour
Issue: #5748

Signed-off-by: Diana Atanasova <dianaa@vmware.com>
  • Loading branch information
difince authored Jun 10, 2021
1 parent 538e4ef commit a8ffc50
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
16 changes: 10 additions & 6 deletions frontend/src/components/Trigger.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ const PARAMS_DEFAULT = {
};
const PERIODIC_DEFAULT = {
end_time: undefined,
interval_second: '60',
interval_second: (60 * 60).toString(),
start_time: undefined,
};
const CRON_DEFAULT = { cron: '0 * * * * ?', end_time: undefined, start_time: undefined };
const CRON_DEFAULT = { cron: '0 0 * * * ?', end_time: undefined, start_time: undefined };

beforeAll(() => {
process.env.TZ = 'UTC';
Expand Down Expand Up @@ -98,7 +98,7 @@ describe('Trigger', () => {
});

describe('interval trigger', () => {
it('builds an every-minute trigger by default', () => {
it('builds an every-hour trigger by default', () => {
const spy = jest.fn();
const tree = shallow(<Trigger onChange={spy} />);
(tree.instance() as Trigger).handleChange('type')({
Expand Down Expand Up @@ -438,7 +438,7 @@ describe('Trigger', () => {
});

describe('cron', () => {
it('builds a 1-minute cron trigger by default', () => {
it('builds a 1-hour cron trigger by default', () => {
const spy = jest.fn();
const tree = shallow(<Trigger onChange={spy} />);
(tree.instance() as Trigger).handleChange('type')({ target: { value: TriggerType.CRON } });
Expand All @@ -450,7 +450,7 @@ describe('Trigger', () => {
});
});

it('builds a 1-minute cron trigger with specified start date', () => {
it('builds a 1-hour cron trigger with specified start date', () => {
const spy = jest.fn();
const tree = shallow(<Trigger onChange={spy} />);
(tree.instance() as Trigger).handleChange('type')({ target: { value: TriggerType.CRON } });
Expand All @@ -461,7 +461,11 @@ describe('Trigger', () => {
expect(spy).toHaveBeenLastCalledWith({
...PARAMS_DEFAULT,
trigger: {
cron_schedule: { ...CRON_DEFAULT, start_time: new Date('2018-03-23T07:53:00.000Z') },
cron_schedule: {
...CRON_DEFAULT,
start_time: new Date('2018-03-23T07:53:00.000Z'),
cron: '0 53 * * * ?',
},
},
});
});
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Trigger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default class Trigger extends React.Component<TriggerProps, TriggerState>
editCron: parsedTrigger.type === TriggerType.CRON,
cron: parsedTrigger.cron || '',
// interval state
intervalCategory: parsedTrigger.intervalCategory ?? PeriodicInterval.MINUTE,
intervalCategory: parsedTrigger.intervalCategory ?? PeriodicInterval.HOUR,
intervalValue: parsedTrigger.intervalValue ?? 1,
startTimeMessage: '',
endTimeMessage: '',
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/__snapshots__/Trigger.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ exports[`Trigger renders periodic schedule controls for initial render 1`] = `
onChange={[Function]}
required={true}
select={true}
value="Minute"
value="Hour"
variant="outlined"
width={95}
>
Expand Down Expand Up @@ -1177,7 +1177,7 @@ exports[`Trigger renders periodic schedule controls if the trigger type is CRON
onChange={[Function]}
required={true}
select={true}
value="Minute"
value="Hour"
variant="outlined"
width={95}
>
Expand Down Expand Up @@ -1244,7 +1244,7 @@ exports[`Trigger renders periodic schedule controls if the trigger type is CRON
disabled={true}
label="cron expression"
onChange={[Function]}
value="0 * * * * ?"
value="0 0 * * * ?"
variant="outlined"
width={300}
/>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/NewRun.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1772,7 +1772,7 @@ describe('NewRun', () => {
trigger: {
periodic_schedule: {
end_time: undefined,
interval_second: '60',
interval_second: '3600',
start_time: undefined,
},
},
Expand Down

0 comments on commit a8ffc50

Please sign in to comment.