Skip to content

Commit

Permalink
Change: Disable start icon for tasks with duration limit
Browse files Browse the repository at this point in the history
If a task has a schedule with a duration limit assigned, the start icon
will be disabled.

This is done because there is currently no distinction between a
scheduled start and a manual one, so the schedule would often stop the
task immediately.
  • Loading branch information
timopollmeier authored and bjoernricks committed Nov 23, 2023
1 parent 248936e commit cc1939d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions public/locales/gsa-de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1918,6 +1918,7 @@
"{{title}} {{filtered}} of {{all}}": "{{title}} {{filtered}} von {{all}}",
"{{type}} owned by {{owner}}": "{{type}} gehört {{owner}}",
"{{type}}:unnamed": "{{type}}:unbenannt",
"{{usageType}} cannot be started manually because the assigned schedule has a duration limit": "{{usageType}} kann nicht manuell gestartet werden, da ein Zeitplan mit Laufzeitbegrenzung zugewiesen ist",
"{{usageType}} is a container": "{{usageType}} ist Container-{{usageType}}",
"{{usageType}} is already active": "{{usageType}} ist bereits aktiv",
"{{usageType}} is not stopped": "{{usageType}} ist nicht gestoppt",
Expand Down
19 changes: 19 additions & 0 deletions src/web/pages/tasks/icons/starticon.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import React from 'react';
import _ from 'gmp/locale';

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

Expand Down Expand Up @@ -47,6 +48,24 @@ const TaskStartIcon = ({
);
}

if (
isDefined(task.schedule) &&
task.schedule?.event?.event?.duration?.toSeconds() > 0
) {
return (
<StartIcon
active={false}
title={_(
'{{usageType}} cannot be started manually' +
' because the assigned schedule has a duration limit',
{
usageType: capitalizeFirstLetter(usageType),
},
)}
/>
);
}

if (!task.isActive()) {
return <StartIcon title={_('Start')} value={task} onClick={onClick} />;
}
Expand Down

0 comments on commit cc1939d

Please sign in to comment.