From cc1939d86fcecee56e58129eb10e93b7eff14434 Mon Sep 17 00:00:00 2001 From: Timo Pollmeier Date: Wed, 22 Nov 2023 13:58:20 +0100 Subject: [PATCH] Change: Disable start icon for tasks with duration limit 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. --- public/locales/gsa-de.json | 1 + src/web/pages/tasks/icons/starticon.js | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/public/locales/gsa-de.json b/public/locales/gsa-de.json index bf0b41a9d2..7c0510c326 100644 --- a/public/locales/gsa-de.json +++ b/public/locales/gsa-de.json @@ -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", diff --git a/src/web/pages/tasks/icons/starticon.js b/src/web/pages/tasks/icons/starticon.js index c611ea24f5..6b1ffc2a46 100644 --- a/src/web/pages/tasks/icons/starticon.js +++ b/src/web/pages/tasks/icons/starticon.js @@ -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'; @@ -47,6 +48,24 @@ const TaskStartIcon = ({ ); } + if ( + isDefined(task.schedule) && + task.schedule?.event?.event?.duration?.toSeconds() > 0 + ) { + return ( + + ); + } + if (!task.isActive()) { return ; }