From 05c434eb8ad02bb8abfdc9fd3e10d145e857be01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Sun, 7 Apr 2024 05:43:48 +0200 Subject: [PATCH] Some minor fixes on generics, order of fields... --- server/src/uds/REST/methods/services.py | 3 ++- .../core/services/generics/fixed/service.py | 26 +++++++++---------- server/src/uds/core/util/fields.py | 2 +- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/server/src/uds/REST/methods/services.py b/server/src/uds/REST/methods/services.py index 0f7e4cc8a..2430a4a4f 100644 --- a/server/src/uds/REST/methods/services.py +++ b/server/src/uds/REST/methods/services.py @@ -303,7 +303,8 @@ class Services(DetailHandler): # pylint: disable=too-many-public-methods 'tooltip': _('Kind of service counting for calculating if MAX is reached'), 'type': types.ui.FieldType.CHOICE, 'readonly': False, - 'order': 101, + 'order': 110, + 'tab': types.ui.Tab.ADVANCED, }, ) diff --git a/server/src/uds/core/services/generics/fixed/service.py b/server/src/uds/core/services/generics/fixed/service.py index 6bee3b825..3d36a6028 100644 --- a/server/src/uds/core/services/generics/fixed/service.py +++ b/server/src/uds/core/services/generics/fixed/service.py @@ -85,10 +85,20 @@ class FixedService(services.Service, abc.ABC): # pylint: disable=too-many-publi readonly=False, ) + # Keep name as "machine" so we can use VCHelpers.getMachines + machines = gui.MultiChoiceField( + label=_("Machines"), + order=30, + tooltip=_('Machines for this service'), + required=True, + tab=types.ui.Tab.MACHINE, + rows=10, + ) + use_snapshots = gui.CheckBoxField( label=_('Use snapshots'), default=False, - order=30, + order=33, tooltip=_( 'If active, UDS will try to create an snapshot (if one already does not exists) before accessing a machine, and restore it after usage.' ), @@ -99,7 +109,7 @@ class FixedService(services.Service, abc.ABC): # pylint: disable=too-many-publi # This one replaces use_snapshots, and is used to select the snapshot type (No snapshot, recover snapshot and stop machine, recover snapshot and start machine) snapshot_type = gui.ChoiceField( label=_('Snapshot type'), - order=31, + order=36, default='0', tooltip=_( 'If active, UDS will try to create an snapshot (if one already does not exists) before accessing a machine, and restore it after usage.' @@ -112,16 +122,6 @@ class FixedService(services.Service, abc.ABC): # pylint: disable=too-many-publi ], ) - # Keep name as "machine" so we can use VCHelpers.getMachines - machines = gui.MultiChoiceField( - label=_("Machines"), - order=32, - tooltip=_('Machines for this service'), - required=True, - tab=types.ui.Tab.MACHINE, - rows=10, - ) - # Randomize machine assignation isntead of linear randomize = gui.CheckBoxField( label=_('Randomize machine assignation'), @@ -131,7 +131,7 @@ class FixedService(services.Service, abc.ABC): # pylint: disable=too-many-publi tab=types.ui.Tab.ADVANCED, ) maintain_on_error = fields.maintain_on_error_field( - order=101, + order=103, tab=types.ui.Tab.ADVANCED, ) diff --git a/server/src/uds/core/util/fields.py b/server/src/uds/core/util/fields.py index 4a5fad31c..25bade3b5 100644 --- a/server/src/uds/core/util/fields.py +++ b/server/src/uds/core/util/fields.py @@ -331,7 +331,7 @@ def remove_duplicates_field( def soft_shutdown_field( order: int = 103, - tab: 'types.ui.Tab|str|None' = None, + tab: 'types.ui.Tab|str|None' = types.ui.Tab.ADVANCED, old_field_name: typing.Optional[str] = None, ) -> ui.gui.CheckBoxField: return ui.gui.CheckBoxField(