Upgrades
This document lists all current deprecations, with upgrade steps and planned removal. When the deprecation is removed with a major update, it will be moved under its corresponding header.
This version
U63 - Remove prefix
and suffix
on DateField
- deprecated since: v12.5.0
- planned removal: v13
- automated code fix available: no
Current behaviour + reason for change
A prefix
and / or suffix
can be defined on a DateField, which is not relevant for this type of field. The
attributes will therefore be removed.
New behaviour
It will not be possible to use prefix
and suffix
on a DateField.
Conversion
- DateField('Some date', suffix='XYZ')
+ DateField('Some date (XYZ)')
U62 - Renamed threejs_visualisation()
to visualize_geometry()
- deprecated since: v12.5.0
- planned removal: v13
- automated code fix available: yes
Current behaviour + reason for change
A SoilLayout2D
or SoilLayer2D
can be visualized by calling threejs_visualisation()
on the
corresponding object. The "threejs" part in this name is no longer relevant and might be unclear to the developer.
New behaviour
Both methods return the geometric representation of the object, which can be used in a GeometryView. Therefore the
methods are renamed to visualize_geometry()
:
SoilLayout2D.threejs_visualisation()
->SoilLayout2D.visualize_geometry()
SoilLayer2D.threejs_visualisation()
->SoilLayer2D.visualize_geometry()
Conversion
The following conversion has to be performed, which can be done automatically by using the CLI command
viktor-cli fix -u 62
:
layout = SoilLayout2D(...)
- geometry, labels = layout.threejs_visualisation(...)
+ geometry, labels = layout.visualize_geometry(...)
U61 - Move entity-type information from manifest to Controller
- deprecated since: v12.3.0
- planned removal: v13
- automated code fix available: yes
Current behaviour + reason for change
The entity-type information is currently partly described in the corresponding Controller (parametrization / views / summary),
but some data is defined in the manifest.yml
(label, children, show_children_as). This manifest is a concept which is
often hard to grasp for a starting developer. In order to improve the onboarding of new developers, as well as
consistency of where to define entity-type information, we would like to get rid of the manifest completely.
The first step is to move the definition of the following keys to the corresponding controller:
label
(required)children
(if present)show_children_as
(if present)
New behaviour
The keys will become simple class attributes, similar as parametrization
and summary
:
class EntityTypeController(ViktorController):
label = 'Label of the entity-type'
children = ['SomeType', 'AnotherType']
show_children_as = 'Cards' # or 'Table'
If they are still present in the manifest, you may expect the following warning:
Entity.label is present in manifest.yml but is overwritten by the app logic. Remove entry from manifest.
Note, when you are defining label
on the Controller, the SDK will also try to get children
+ show_children_as
or use the default of "no children" if not found. Therefore you cannot define label
on the Controller, while
keeping children
and show_children_as
in the manifest!
Conversion
The following conversion has to be performed, which can be done automatically by using the CLI command
viktor-cli fix -u 61
:
# manifest.yml
version: '1'
entity_types:
EntityTypeA:
- label: This is A
- show_children_as: Cards
- children:
- - EntityTypeB
...
EntityTypeB:
- label: This is B
...
# entity_type_a/controller.py
class EntityTypeAController(ViktorController):
+ label = 'This is A'
+ children = ['EntityTypeB']
+ show_children_as = 'Cards'
...
# entity_type_b/controller.py
class EntityTypeBController(ViktorController):
+ label = 'This is B'
...