workflow: better target mode/id display (#51245)
This commit is contained in:
parent
e75c8cd976
commit
36febae164
|
@ -14,7 +14,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from ..qommon import _
|
||||
from wcs.qommon import _, N_
|
||||
from quixote import get_publisher
|
||||
|
||||
from wcs.workflows import register_item_class
|
||||
|
@ -28,6 +28,8 @@ class EditCarddataWorkflowStatusItem(CreateCarddataWorkflowStatusItem, ExternalW
|
|||
key = 'edit_carddata'
|
||||
mappings_label = _('Mappings to card fields')
|
||||
accept_empty_value = True
|
||||
automatic_targetting = N_('Action on linked cards')
|
||||
manual_targetting = N_('Specify the identifier of the card on which the action will be applied')
|
||||
|
||||
@classmethod
|
||||
def is_available(cls, workflow=None):
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
|
||||
from quixote import get_publisher
|
||||
|
||||
from wcs.qommon import _
|
||||
from wcs.qommon.form import Form, SingleSelectWidget, ComputedExpressionWidget
|
||||
from wcs.qommon import _, N_
|
||||
from wcs.qommon.form import Form, SingleSelectWidget, ComputedExpressionWidget, RadiobuttonsWidget
|
||||
|
||||
from wcs.workflows import WorkflowStatusItem, perform_items, register_item_class
|
||||
from wcs.workflows import WorkflowGlobalActionWebserviceTrigger, Workflow
|
||||
|
@ -30,6 +30,8 @@ class ExternalWorkflowGlobalAction(WorkflowStatusItem):
|
|||
description = _('External workflow')
|
||||
key = 'external_workflow_global_action'
|
||||
category = 'formdata-action'
|
||||
automatic_targetting = N_('Action on linked cards/forms')
|
||||
manual_targetting = N_('Specify the identifier of the card/form on which the action will be applied')
|
||||
|
||||
slug = None
|
||||
target_mode = None
|
||||
|
@ -94,9 +96,12 @@ class ExternalWorkflowGlobalAction(WorkflowStatusItem):
|
|||
)
|
||||
|
||||
if 'target_mode' in parameters:
|
||||
target_modes = [('all', _('Automatic'), 'all'), ('manual', _('Manual'), 'manual')]
|
||||
target_modes = [
|
||||
('all', _(self.automatic_targetting), 'all'),
|
||||
('manual', _(self.manual_targetting), 'manual'),
|
||||
]
|
||||
form.add(
|
||||
SingleSelectWidget,
|
||||
RadiobuttonsWidget,
|
||||
'%starget_mode' % prefix,
|
||||
title=_('Targeting'),
|
||||
value=self.target_mode or 'all',
|
||||
|
@ -184,7 +189,7 @@ class ExternalWorkflowGlobalAction(WorkflowStatusItem):
|
|||
yield from formdata.iter_target_datas(objectdef=objectdef, object_type=self.slug, status_item=self)
|
||||
|
||||
def get_parameters(self):
|
||||
return ('slug', 'target_mode', 'target_id', 'trigger_id', 'condition')
|
||||
return ('slug', 'trigger_id', 'target_mode', 'target_id', 'condition')
|
||||
|
||||
def perform(self, formdata):
|
||||
objectdef = self.get_object_def()
|
||||
|
|
Loading…
Reference in New Issue