Merge pull request #7171 from nixocio/ui_issue_6718

Add "of" to "Run on" field in schedule form

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot]
2020-05-28 15:06:38 +00:00
committed by GitHub

View File

@@ -3,7 +3,7 @@ import React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { useField } from 'formik'; import { useField } from 'formik';
import { withI18n } from '@lingui/react'; import { withI18n } from '@lingui/react';
import { t } from '@lingui/macro'; import { t, Trans } from '@lingui/macro';
import { RRule } from 'rrule'; import { RRule } from 'rrule';
import { import {
Checkbox as _Checkbox, Checkbox as _Checkbox,
@@ -45,7 +45,7 @@ export function requiredPositiveInteger(i18n) {
return value => { return value => {
if (typeof value === 'number') { if (typeof value === 'number') {
if (!Number.isInteger(value)) { if (!Number.isInteger(value)) {
return i18n._(t`This field must an integer`); return i18n._(t`This field must be an integer`);
} }
if (value < 1) { if (value < 1) {
return i18n._(t`This field must be greater than 0`); return i18n._(t`This field must be greater than 0`);
@@ -141,7 +141,11 @@ const FrequencyDetailSubform = ({ i18n }) => {
value: 7, value: 7,
label: i18n._(t`July`), label: i18n._(t`July`),
}, },
{ key: 'august', value: 8, label: i18n._(t`August`) }, {
key: 'august',
value: 8,
label: i18n._(t`August`),
},
{ {
key: 'september', key: 'september',
value: 9, value: 9,
@@ -344,8 +348,11 @@ const FrequencyDetailSubform = ({ i18n }) => {
label={ label={
<div css="display: flex;align-items: center;"> <div css="display: flex;align-items: center;">
{frequency?.value === 'month' && ( {frequency?.value === 'month' && (
<span id="foobar" css="margin-right: 10px;"> <span
Day id="radio-schedule-run-on-day"
css="margin-right: 10px;"
>
<Trans>Day</Trans>
</span> </span>
)} )}
{frequency?.value === 'year' && ( {frequency?.value === 'year' && (
@@ -383,8 +390,11 @@ const FrequencyDetailSubform = ({ i18n }) => {
name="runOn" name="runOn"
label={ label={
<div css="display: flex;align-items: center;"> <div css="display: flex;align-items: center;">
<span id="foobar" css="margin-right: 10px;"> <span
The id="radio-schedule-run-on-the"
css="margin-right: 10px;"
>
<Trans>The</Trans>
</span> </span>
<AnsibleSelect <AnsibleSelect
id="schedule-run-on-the-occurrence" id="schedule-run-on-the-occurrence"
@@ -461,12 +471,20 @@ const FrequencyDetailSubform = ({ i18n }) => {
{...runOnTheDay} {...runOnTheDay}
/> />
{frequency?.value === 'year' && ( {frequency?.value === 'year' && (
<AnsibleSelect <>
id="schedule-run-on-the-month" <span
isDisabled={runOn.value !== 'the'} id="of-schedule-run-on-the-month"
data={monthOptions} css="margin-left: 10px;"
{...runOnTheMonth} >
/> <Trans>of</Trans>
</span>
<AnsibleSelect
id="schedule-run-on-the-month"
isDisabled={runOn.value !== 'the'}
data={monthOptions}
{...runOnTheMonth}
/>
</>
)} )}
</div> </div>
} }