Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust task icons to work for audits and remove audit icons #2070

Merged
merged 12 commits into from
Mar 27, 2020
Prev Previous commit
Next Next commit
adjust task resume icon to work for audits
sarahd93 committed Mar 27, 2020
commit c71fef35d37674d557f4618cd44e7acd4328e89a
4 changes: 2 additions & 2 deletions gsa/src/web/pages/audits/actions.js
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ import EditIcon from 'web/entity/icon/editicon';
import TrashIcon from 'web/entity/icon/trashicon';
import DownloadIcon from 'web/components/icon/downloadicon';

import ResumeIcon from 'web/pages/audits/icons/resumeicon';
import ResumeIcon from 'web/pages/tasks/icons/resumeicon';
import ScheduleIcon from 'web/pages/tasks/icons/scheduleicon';
import StartIcon from 'web/pages/tasks/icons/starticon';
import StopIcon from 'web/pages/tasks/icons/stopicon';
@@ -59,7 +59,7 @@ const Actions = ({
<StartIcon task={entity} usageType="audit" onClick={onAuditStartClick} />
)}
<StopIcon task={entity} onClick={onAuditStopClick} />
<ResumeIcon audit={entity} onClick={onAuditResumeClick} />
<ResumeIcon task={entity} usageType="audit" onClick={onAuditResumeClick} />
<TrashIcon
entity={entity}
name="task"
8 changes: 6 additions & 2 deletions gsa/src/web/pages/audits/detailspage.js
Original file line number Diff line number Diff line change
@@ -76,7 +76,7 @@ import {
import PropTypes from 'web/utils/proptypes';
import {renderYesNo} from 'web/utils/render';

import ResumeIcon from './icons/resumeicon';
import ResumeIcon from 'web/pages/tasks/icons/resumeicon';
import ScheduleIcon from 'web/pages/tasks/icons/scheduleicon';
import StartIcon from 'web/pages/tasks/icons/starticon';
import StopIcon from 'web/pages/tasks/icons/stopicon';
@@ -163,7 +163,11 @@ export const ToolBarIcons = ({
<StopIcon task={entity} onClick={onAuditStopClick} />

{!entity.isContainer() && (
<ResumeIcon audit={entity} onClick={onAuditResumeClick} />
<ResumeIcon
task={entity}
usageType="audit"
onClick={onAuditResumeClick}
/>
)}
</IconDivider>

18 changes: 13 additions & 5 deletions gsa/src/web/pages/tasks/icons/resumeicon.js
Original file line number Diff line number Diff line change
@@ -22,17 +22,20 @@ import _ from 'gmp/locale';
import {isDefined} from 'gmp/utils/identity';

import PropTypes from 'web/utils/proptypes';
import {capitalizeFirstLetter} from 'gmp/utils/string';
import withCapabilities from 'web/utils/withCapabilities';

import ResumeIcon from 'web/components/icon/resumeicon';

const TaskResumeIcon = ({capabilities, task, onClick}) => {
const TaskResumeIcon = ({capabilities, task, usageType = 'task', onClick}) => {
if (task.isContainer()) {
return (
<ResumeIcon
active={false}
alt={_('Resume')}
title={_('Task is a container')}
title={_('{{usageType}} is a container', {
usageType: capitalizeFirstLetter(usageType),
})}
/>
);
}
@@ -42,7 +45,9 @@ const TaskResumeIcon = ({capabilities, task, onClick}) => {
<ResumeIcon
active={false}
alt={_('Resume')}
title={_('Task is scheduled')}
title={_('{{usageType}} is scheduled', {
usageType: capitalizeFirstLetter(usageType),
})}
/>
);
}
@@ -58,7 +63,7 @@ const TaskResumeIcon = ({capabilities, task, onClick}) => {
<ResumeIcon
active={false}
alt={_('Resume')}
title={_('Permission to resume task denied')}
title={_('Permission to resume {{usageType}} denied', {usageType})}
/>
);
}
@@ -67,14 +72,17 @@ const TaskResumeIcon = ({capabilities, task, onClick}) => {
<ResumeIcon
active={false}
alt={_('Resume')}
title={_('Task is not stopped')}
title={_('{{usageType}} is not stopped', {
usageType: capitalizeFirstLetter(usageType),
})}
/>
);
};

TaskResumeIcon.propTypes = {
capabilities: PropTypes.capabilities.isRequired,
task: PropTypes.model.isRequired,
usageType: PropTypes.string,
onClick: PropTypes.func,
};