Skip to content

Commit

Permalink
policy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MelsHyrule committed Oct 31, 2022
1 parent 87cc5bc commit 1b0c388
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions app/javascript/components/timeline-options/timeline-options.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ const TimelineOptions = ({ url }) => {
const [key, value] = entry;
policyGroupNames.push({ label: value, value: key });
});
Object.entries(data.MiqEvent.group_levels).forEach((entry) => {
const [key, value] = entry;
policyGroupLevels.push({ label: value, value: key });
});
// NOTE: data.MiqEvent.group_levels does not have the expected `Both` option
policyGroupLevels.push({ label: 'Success', value: 'success' });
policyGroupLevels.push({ label: 'Failure', value: 'failure' });
policyGroupLevels.push({ label: 'Both', value: 'both' });

// TODO: is there a way to make the above more elegant/shorter?
// NOTE: group_names for MiqEvents and MiqEvents includes the 'Other' option,
// this did not exist in previous versions of the timeline
setState((state) => ({
...state,
isLoading: false,
Expand All @@ -60,12 +62,11 @@ const TimelineOptions = ({ url }) => {
miqSparkleOn();
const show = values.timelineEvents === 'EmsEvent' ? 'timeline' : 'policy_timeline';
const categories = values.timelineEvents === 'EmsEvent' ? values.managementGroupNames : values.policyGroupNames;
const result = values.timelineEvents === 'EmsEvent' ? values.managementGroupLevels : values.policyGroupLevels;
const vmData = {
tl_show: show,
tl_categories: categories,
tl_levels: result,
tl_result: 'success',
tl_levels: values.managementGroupLevels ? values.managementGroupLevels : [],
tl_result: values.policyGroupLevels ? values.policyGroupLevels : 'success',
};
window.ManageIQ.calendar.calDateFrom = values.startDate;
window.ManageIQ.calendar.calDateTo = values.endDate;
Expand Down

0 comments on commit 1b0c388

Please sign in to comment.