async clickOnTaskAction(rowIndex: number, label: string) {
const row = ui.getAllRows()[rowIndex];
expect(row).toBeVisible();
- await user.click(within(row).getByRole('button', { name: 'background_tasks.show_actions' }));
+ await user.click(
+ within(row).getByRole('button', {
+ name: `background_tasks.show_actions_for_task_x_in_list.${rowIndex}`,
+ }),
+ );
await user.click(within(row).getByRole('menuitem', { name: label }));
},
};
const body = (
<Spinner loading={loading}>
- {warnings.map(({ dismissable, key, message }) => (
- <React.Fragment key={key}>
- <div className="sw-flex sw-items-center sw-mt-2">
- <FlagMessage variant="warning">
- <HtmlFormatter>
- <span
- // eslint-disable-next-line react/no-danger
- dangerouslySetInnerHTML={{
- __html: sanitizeStringRestricted(message.trim().replace(/\n/g, '<br />')),
- }}
- />
- </HtmlFormatter>
- </FlagMessage>
- </div>
- <div>
- {dismissable && currentUser.isLoggedIn && (
- <div className="sw-mt-4">
- <Button
- isDisabled={Boolean(dismissedWarning)}
- onClick={() => {
- this.handleDismissMessage(key);
- }}
- variety={ButtonVariety.DangerOutline}
- >
- {translate('dismiss_permanently')}
- </Button>
-
- <Spinner className="sw-ml-2" loading={dismissedWarning === key} />
- </div>
- )}
- </div>
- </React.Fragment>
- ))}
+ <ul>
+ {warnings.map(({ dismissable, key, message }) => (
+ <li key={key}>
+ <div className="sw-flex sw-items-center sw-mt-2">
+ <FlagMessage variant="warning">
+ <HtmlFormatter>
+ <span
+ // eslint-disable-next-line react/no-danger
+ dangerouslySetInnerHTML={{
+ __html: sanitizeStringRestricted(message.trim().replace(/\n/g, '<br />')),
+ }}
+ />
+ </HtmlFormatter>
+ </FlagMessage>
+ </div>
+ <div>
+ {dismissable && currentUser.isLoggedIn && (
+ <div className="sw-mt-4">
+ <Button
+ isDisabled={Boolean(dismissedWarning)}
+ onClick={() => {
+ this.handleDismissMessage(key);
+ }}
+ variety={ButtonVariety.DangerOutline}
+ >
+ {translate('dismiss_permanently')}
+ </Button>
+
+ <Spinner className="sw-ml-2" loading={dismissedWarning === key} />
+ </div>
+ )}
+ </div>
+ </li>
+ ))}
+ </ul>
</Spinner>
);
onCancelTask: (task: ITask) => Promise<void>;
onFilterTask: (task: ITask) => void;
task: ITask;
+ taskIndex: number;
}
export default function Task(props: Readonly<Props>) {
- const { task, component, onCancelTask, onFilterTask } = props;
+ const { task, component, taskIndex, onCancelTask, onFilterTask } = props;
const appState = React.useContext(AppStateContext);
const isDataCenter = appState.edition === EditionKey.datacenter;
<TaskExecutionTime ms={task.executionTimeMs} />
<TaskActions
component={component}
+ taskIndex={taskIndex}
onCancelTask={onCancelTask}
onFilterTask={onFilterTask}
task={task}
onCancelTask: (task: Task) => Promise<void>;
onFilterTask: (task: Task) => void;
task: Task;
+ taskIndex: number;
}
interface State {
};
render() {
- const { component, task } = this.props;
+ const { component, task, taskIndex } = this.props;
const canFilter = component === undefined && task.componentName;
const canCancel = task.status === TaskStatuses.Pending;
<ActionCell>
<ActionsDropdown
id={`task-${task.id}-actions`}
- ariaLabel={translate('background_tasks.show_actions')}
+ ariaLabel={translateWithParameters(
+ 'background_tasks.show_actions_for_task_x_in_list',
+ taskIndex,
+ )}
className="js-task-action"
>
{canFilter && task.componentName && (
</TableRow>
}
>
- {tasks.map((task) => (
+ {tasks.map((task, index) => (
<Task
component={component}
key={task.id}
+ taskIndex={index}
onCancelTask={onCancelTask}
onFilterTask={onFilterTask}
task={task}
background_tasks.cancel_all_tasks.submit=Cancel All
background_tasks.scanner_context=Scanner Context
background_tasks.show_scanner_context=Show Scanner Context
-background_tasks.show_actions=Show actions
+background_tasks.show_actions_for_task_x_in_list=Show actions for task in row {0}
background_tasks.show_stacktrace=Show Error Details
background_tasks.show_warnings=Show Warnings
background_tasks.error_message=Error Message