workflows: give correct URL for variable fields URLs (#88435)
gitea/wcs/pipeline/head This commit looks good Details

This commit is contained in:
Frédéric Péters 2024-03-21 08:10:04 +01:00
parent 3a4b8c9cc7
commit bdb24e21e9
2 changed files with 14 additions and 1 deletions

View File

@ -23,7 +23,12 @@ from wcs.wf.geolocate import GeolocateWorkflowStatusItem
from wcs.wf.jump import JumpWorkflowStatusItem
from wcs.wf.notification import SendNotificationWorkflowStatusItem
from wcs.wf.redirect_to_url import RedirectToUrlWorkflowStatusItem
from wcs.workflows import Workflow, WorkflowBackofficeFieldsFormDef, WorkflowImportError
from wcs.workflows import (
Workflow,
WorkflowBackofficeFieldsFormDef,
WorkflowImportError,
WorkflowVariablesFieldsFormDef,
)
from wcs.wscalls import NamedWsCall, NamedWsCallImportError
from ..utilities import clean_temporary_pub, create_temporary_pub, get_app, login
@ -102,6 +107,10 @@ def test_deprecations(pub):
workflow.backoffice_fields_formdef.fields = [
fields.TableField(id='bo1', label='table field'),
]
workflow.variables_formdef = WorkflowVariablesFieldsFormDef(workflow)
workflow.variables_formdef.fields = [
fields.TableField(id='wfvar1', label='other table field'),
]
st0 = workflow.add_status('Status0', 'st0')
display = st0.add_action('displaymsg')
@ -266,6 +275,7 @@ def test_deprecations(pub):
assert [x.text for x in resp.pyquery('.section--fields li a')] == [
'foobar / Field "table field"',
'foobar / Field "ranked field"',
'Options of workflow "test" / Field "other table field"',
'Backoffice fields of workflow "test" / Field "table field"',
]
assert [x.text for x in resp.pyquery('.section--actions li a')] == [

View File

@ -720,6 +720,9 @@ class WorkflowVariablesFieldsFormDef(FormDef):
base_url = get_publisher().get_backoffice_url()
return '%s/workflows/%s/variables/fields/' % (base_url, self.workflow.id)
def get_field_admin_url(self, field):
return self.get_admin_url() + '%s/' % field.id
def get_new_field_id(self):
return str(uuid.uuid4())