Skip to content

Follow-up from: Distribute daily cron schedules out over the hour"

What does this MR do?

Change the cron job form to use the GlFormCheckbox and also fix 2 issues at the same time.

Context On page load, this form generates random value as suggestion for the cron schedule to allow us to spread the load of schedules over time for people whos time is not important. Each radio button triggers the input field to be filled with its value. The custom radio does not trigger anything to happen: you can click on it, and then edit, or just directly edits and the custom radio will be come selected (see it more as a reflection of the fact that the user wants to or as edited).

The input field is used to enter a custom cron schedule, which as mentioned, will trigger the custom radio to become selected if that's not the case already.

Issues fixed

  • There was a flaky workaround that was done in the past where we would bind v-model to each radio button with the value of the cronInterval prop, and also bind that value with the input field. This would make it so each radio button held its own value, except the custom radio button which held the value of whatever was in the input field. So when you clicked on the custom input, the v-model did not trigger the update because the value had not changed (if you had say 0 5 * * * and clicked on custom, the value would still be 0 5 * * *. So the workaround was to add a space after the value 0 5 * * *_ which was trimmed server side later if it was submitted as is, or if the user edited the field, then they had to erase the space, and then erase whatever other values they wanted.

This has been fixed because now, each radio button has a value that represent its function and not the actually value (called radioValue) which is bound with a v-model to each radio. The text input is still bound with cronTnterval and we check when a user clicks on a radio, what the preset value is for that value and boom! So whatever is held in th text input is what will be submitted to the API, and each radio is just a way to "autofill" the input.

Screenshots

Because we now use the GlFormRadio Component, the styling changed from horizontal to vertical.

Before

Screen_Shot_2020-07-10_at_11.23.43_AM

After

Screen_Shot_2020-07-10_at_2.16.36_PM

Does this MR meet the acceptance criteria?

Conformity

Edited by Frédéric Caplette

Merge request reports