@@ -36,10 +36,16 @@ interface Props { | |||
export default class ComponentNavBgTaskNotif extends React.PureComponent<Props> { | |||
renderMessage(messageKey: string, status?: string, branch?: string) { | |||
const { component } = this.props; | |||
const { component, currentTask } = this.props; | |||
const canSeeBackgroundTasks = | |||
component.configuration && component.configuration.showBackgroundTasks; | |||
let type; | |||
if (currentTask && hasMessage('background_task.type', currentTask.type)) { | |||
messageKey += '_X'; | |||
type = translate('background_task.type', currentTask.type); | |||
} | |||
let url; | |||
if (canSeeBackgroundTasks) { | |||
messageKey += '.admin'; | |||
@@ -54,7 +60,7 @@ export default class ComponentNavBgTaskNotif extends React.PureComponent<Props> | |||
<FormattedMessage | |||
defaultMessage={translate(messageKey)} | |||
id={messageKey} | |||
values={{ branch, url }} | |||
values={{ branch, url, type }} | |||
/> | |||
); | |||
} |
@@ -6,11 +6,12 @@ exports[`renders background task error correctly 1`] = ` | |||
variant="error" | |||
> | |||
<FormattedMessage | |||
defaultMessage="component_navigation.status.failed" | |||
id="component_navigation.status.failed" | |||
defaultMessage="component_navigation.status.failed_X" | |||
id="component_navigation.status.failed_X" | |||
values={ | |||
Object { | |||
"branch": undefined, | |||
"type": "background_task.type.", | |||
"url": undefined, | |||
} | |||
} | |||
@@ -24,11 +25,12 @@ exports[`renders background task error correctly for a different branch/PR 1`] = | |||
variant="error" | |||
> | |||
<FormattedMessage | |||
defaultMessage="component_navigation.status.failed_branch" | |||
id="component_navigation.status.failed_branch" | |||
defaultMessage="component_navigation.status.failed_branch_X" | |||
id="component_navigation.status.failed_branch_X" | |||
values={ | |||
Object { | |||
"branch": "my/branch", | |||
"type": "background_task.type.", | |||
"url": undefined, | |||
} | |||
} | |||
@@ -42,11 +44,12 @@ exports[`renders background task error correctly for a different branch/PR 2`] = | |||
variant="error" | |||
> | |||
<FormattedMessage | |||
defaultMessage="component_navigation.status.failed_branch" | |||
id="component_navigation.status.failed_branch" | |||
defaultMessage="component_navigation.status.failed_branch_X" | |||
id="component_navigation.status.failed_branch_X" | |||
values={ | |||
Object { | |||
"branch": "650 - feature/my_pr", | |||
"type": "background_task.type.", | |||
"url": undefined, | |||
} | |||
} | |||
@@ -60,11 +63,12 @@ exports[`renders background task in progress info correctly 1`] = ` | |||
variant="info" | |||
> | |||
<FormattedMessage | |||
defaultMessage="component_navigation.status.in_progress" | |||
id="component_navigation.status.in_progress" | |||
defaultMessage="component_navigation.status.in_progress_X" | |||
id="component_navigation.status.in_progress_X" | |||
values={ | |||
Object { | |||
"branch": undefined, | |||
"type": "background_task.type.", | |||
"url": undefined, | |||
} | |||
} | |||
@@ -90,11 +94,12 @@ exports[`renders background task pending info correctly 1`] = ` | |||
variant="info" | |||
> | |||
<FormattedMessage | |||
defaultMessage="component_navigation.status.pending" | |||
id="component_navigation.status.pending" | |||
defaultMessage="component_navigation.status.pending_X" | |||
id="component_navigation.status.pending_X" | |||
values={ | |||
Object { | |||
"branch": undefined, | |||
"type": "background_task.type.", | |||
"url": undefined, | |||
} | |||
} | |||
@@ -108,11 +113,12 @@ exports[`renders background task pending info correctly for admin 1`] = ` | |||
variant="info" | |||
> | |||
<FormattedMessage | |||
defaultMessage="component_navigation.status.pending.admin" | |||
id="component_navigation.status.pending.admin" | |||
defaultMessage="component_navigation.status.pending_X.admin" | |||
id="component_navigation.status.pending_X.admin" | |||
values={ | |||
Object { | |||
"branch": undefined, | |||
"type": "background_task.type.", | |||
"url": <Link | |||
onlyActiveOnIndex={false} | |||
style={Object {}} |
@@ -2562,10 +2562,14 @@ component_navigation.status.failed=The last analysis has failed. | |||
component_navigation.status.failed.admin=The last analysis has failed. More details available on the {url} page. | |||
component_navigation.status.failed_branch=The last analysis on this project ({branch}) failed. | |||
component_navigation.status.failed_branch.admin=The last analysis on this project ({branch}) failed. More details available on the {url} page. | |||
component_navigation.status.pending=There is a pending analysis. | |||
component_navigation.status.pending.admin=There is a pending analysis. More details available on the {url} page. | |||
component_navigation.status.in_progress=The analysis is in progress. | |||
component_navigation.status.in_progress.admin=The analysis is in progress. More details available on the {url} page. | |||
component_navigation.status.pending=There is a pending background task. | |||
component_navigation.status.pending_X=There is a pending {type}. | |||
component_navigation.status.pending.admin=There is a pending background task. More details available on the {url} page. | |||
component_navigation.status.pending_X.admin=There is a pending {type}. More details available on the {url} page. | |||
component_navigation.status.in_progress=A background task is in progress. | |||
component_navigation.status.in_progress_X=The {type} is in progress. | |||
component_navigation.status.in_progress.admin=A background task is in progress. More details available on the {url} page. | |||
component_navigation.status.in_progress_X.admin=The {type} is in progress. More details available on the {url} page. | |||
component_navigation.status.last_blocked_due_to_bad_license=Last analysis blocked due to an invalid license, which has since been corrected. Please reanalyze this project. | |||
component_navigation.last_analysis_had_warnings=Last analysis had {warnings} |