Skip to content

Commit

Permalink
Reducing complexity, patch provided by @kmo
Browse files Browse the repository at this point in the history
  • Loading branch information
john-westcott-iv committed Apr 18, 2022
1 parent fdc5898 commit 7528544
Showing 1 changed file with 24 additions and 40 deletions.
64 changes: 24 additions & 40 deletions awx/ui/src/components/Schedule/shared/ScheduleForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,46 +442,30 @@ function ScheduleForm({
if (Object.keys(schedule).length > 0) {
if (schedule.rrule) {
if (schedule.rrule.split(/\s+/).length > 2) {
return(
<Config>
{() => (
<Formik>
<Form autoComplete="off">
<FormColumnLayout>
<Alert
variant="danger"
isInline
ouiaId="form-submit-error-alert"
title={t`Complex schedules are not supported in the UI yet, please use the API to manage this schedule.`}
/>
</FormColumnLayout>
<FormColumnLayout>
<FormFullWidthLayout>
<b>{t`Schedule Rules`}:</b>
<pre style={{marginLeft: '2em'}}>
{ schedule.rrule.replaceAll(/\s+/g, "\n ") }
</pre>
</FormFullWidthLayout>
</FormColumnLayout>
<FormColumnLayout>
<FormFullWidthLayout>
<ActionGroup>
<Button
ouiaId="schedule-form-cancel-button"
aria-label={t`Cancel`}
variant="secondary"
type="button"
onClick={handleCancel}
>
{t`Cancel`}
</Button>
</ActionGroup>
</FormFullWidthLayout>
</FormColumnLayout>
</Form>
</Formik>
)}
</Config>
return (
<Form autoComplete="off">
<Alert
variant="danger"
isInline
ouiaId="form-submit-error-alert"
title={t`Complex schedules are not supported in the UI yet, please use the API to manage this schedule.`}
/>
<b>{t`Schedule Rules`}:</b>
<pre css="white-space: pre; font-family: var(--pf-global--FontFamily--monospace)">
{schedule.rrule}
</pre>
<ActionGroup>
<Button
ouiaId="schedule-form-cancel-button"
aria-label={t`Cancel`}
variant="secondary"
type="button"
onClick={handleCancel}
>
{t`Cancel`}
</Button>
</ActionGroup>
</Form>
);
}

Expand Down

0 comments on commit 7528544

Please sign in to comment.