Skip to content

Commit

Permalink
[WIP] Conditionally render log links
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkro committed Jul 2, 2018
1 parent 2b4f426 commit 61848e7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
9 changes: 9 additions & 0 deletions app/javascript/react/screens/App/Plan/PlanReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ const _formatPlanRequestDetails = data => {
options: {}
};

const progressStates = [];
if (task.options.progress.states) {
for (const state in task.options.progress.states) {
progressStates.push(task.options.progress.states[state].description);
}
}

taskDetails.options.showPreMigrationOption = progressStates.includes('<PRE_MIGRATION_PLAYBOOK_DESCRIPTION>');
taskDetails.options.showPostMigrationOption = progressStates.includes('<POST_MIGRATION_PLAYBOOK_DESCRIPTION>');
taskDetails.options.progress = task.options.progress;
taskDetails.options.virtv2v_wrapper = task.options.virtv2v_wrapper;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,20 +438,18 @@ class PlanRequestDetailList extends React.Component {
</label>
) : (
<DropdownButton
id={`${task.id}-${
task.descriptionPrefix
}_download_log_dropdown`}
id={`${task.id}-${task.descriptionPrefix}_download_log_dropdown`}
title="Download Log"
pullRight
onSelect={eventKey => this.onSelect(eventKey, task)}
>
<MenuItem eventKey="preMigration">
Pre-migration log
</MenuItem>
{task.options.showPreMigrationOption && (
<MenuItem eventKey="preMigration">Pre-migration log</MenuItem>
)}
<MenuItem eventKey="migration">Migration log</MenuItem>
<MenuItem eventKey="postMigration">
Post-migration log
</MenuItem>
{task.options.showPostMigrationOption && (
<MenuItem eventKey="postMigration">Post-migration log</MenuItem>
)}
</DropdownButton>
)
}
Expand Down

0 comments on commit 61848e7

Please sign in to comment.