From 4a92fcfc627f4d74c724d0578fe1813a48d8b6c5 Mon Sep 17 00:00:00 2001 From: "Keith J. Grant" Date: Mon, 29 Aug 2022 11:55:32 -0700 Subject: [PATCH] add schedule exceptions to details --- .../ScheduleDetail/FrequencyDetails.js | 13 ++++++-- .../Schedule/ScheduleDetail/ScheduleDetail.js | 32 +++++++++++++++++-- .../Schedule/shared/FrequencyDetailSubform.js | 4 +-- .../Schedule/shared/ScheduleFormFields.js | 1 + 4 files changed, 44 insertions(+), 6 deletions(-) diff --git a/awx/ui/src/components/Schedule/ScheduleDetail/FrequencyDetails.js b/awx/ui/src/components/Schedule/ScheduleDetail/FrequencyDetails.js index 48f55601ed..bb54aa6f62 100644 --- a/awx/ui/src/components/Schedule/ScheduleDetail/FrequencyDetails.js +++ b/awx/ui/src/components/Schedule/ScheduleDetail/FrequencyDetails.js @@ -10,7 +10,13 @@ const Label = styled.div` font-weight: var(--pf-global--FontWeight--bold); `; -export default function FrequencyDetails({ type, label, options, timezone }) { +export default function FrequencyDetails({ + type, + label, + options, + timezone, + isException, +}) { const getRunEveryLabel = () => { const { interval } = options; switch (type) { @@ -81,7 +87,10 @@ export default function FrequencyDetails({ type, label, options, timezone }) {
- + {type === 'week' ? ( frequencies[f]).join(', ') : t`None (Run Once)`; + const exceptionRepeatFrequency = exceptionFrequency.length + ? exceptionFrequency.map((f) => frequencies[f]).join(', ') + : t`None (Run Once)`; const { ask_credential_on_launch, @@ -288,6 +295,10 @@ function ScheduleDetail({ hasDaysToKeepField, schedule, surveyConfig }) { helpText={helpText.localTimeZone(config)} /> + {frequency.length ? ( @@ -305,6 +316,23 @@ function ScheduleDetail({ hasDaysToKeepField, schedule, surveyConfig }) { ))} ) : null} + {exceptionFrequency.length ? ( + +

+ {t`Frequency Exception Details`} +

+ {exceptionFrequency.map((freq) => ( + + ))} +
+ ) : null} {hasDaysToKeepField ? ( diff --git a/awx/ui/src/components/Schedule/shared/FrequencyDetailSubform.js b/awx/ui/src/components/Schedule/shared/FrequencyDetailSubform.js index 69b54ab154..615d814b8d 100644 --- a/awx/ui/src/components/Schedule/shared/FrequencyDetailSubform.js +++ b/awx/ui/src/components/Schedule/shared/FrequencyDetailSubform.js @@ -45,7 +45,7 @@ const Checkbox = styled(_Checkbox)` } `; -const FrequencyDetailSubform = ({ frequency, prefix }) => { +const FrequencyDetailSubform = ({ frequency, prefix, isException }) => { const id = prefix.replace('.', '-'); const [runOnDayMonth] = useField({ name: `${prefix}.runOnDayMonth`, @@ -220,7 +220,7 @@ const FrequencyDetailSubform = ({ frequency, prefix }) => { validated={ !intervalMeta.touched || !intervalMeta.error ? 'default' : 'error' } - label={t`Run every`} + label={isException ? t`Skip every` : t`Run every`} >
))}