diff --git a/src/datadoc/frontend/callbacks/register_callbacks.py b/src/datadoc/frontend/callbacks/register_callbacks.py index a38918e8..5339ccd8 100644 --- a/src/datadoc/frontend/callbacks/register_callbacks.py +++ b/src/datadoc/frontend/callbacks/register_callbacks.py @@ -15,7 +15,6 @@ from dash import Output from dash import State from dash import ctx -from dash import no_update from datadoc import state from datadoc.enums import SupportedLanguages @@ -162,7 +161,7 @@ def callback_populate_variables_workspace( @app.callback( Output(SECTION_WRAPPER_ID, "children"), Input("language-dropdown", "value"), - Input("open-button", "n_clicks"), + State("open-button", "n_clicks"), prevent_initial_call=True, ) def callback_populate_dataset_workspace( @@ -171,32 +170,40 @@ def callback_populate_dataset_workspace( ) -> list: """Create dataset workspace with sections.""" update_global_language_state(SupportedLanguages(language)) + logger.debug("Populating dataset workspace") - if n_clicks: - return [ - build_dataset_edit_section( - "Obligatorisk", - OBLIGATORY_EDITABLE_DATASET_METADATA, - state.current_metadata_language, - state.metadata.dataset, - {"type": "dataset-edit-section", "id": f"obligatory-{language}"}, - ), - build_dataset_edit_section( - "Anbefalt", - OPTIONAL_DATASET_METADATA, - state.current_metadata_language, - state.metadata.dataset, - {"type": "dataset-edit-section", "id": f"recommended-{language}"}, - ), - build_dataset_edit_section( - "Maskingenerert", - NON_EDITABLE_DATASET_METADATA, - state.current_metadata_language, - state.metadata.dataset, - {"type": "dataset-edit-section", "id": f"machine-{language}"}, - ), - ] - return no_update + return [ + build_dataset_edit_section( + "Obligatorisk", + OBLIGATORY_EDITABLE_DATASET_METADATA, + state.current_metadata_language, + state.metadata.dataset, + { + "type": "dataset-edit-section", + "id": f"obligatory-{language}-{n_clicks}", + }, + ), + build_dataset_edit_section( + "Anbefalt", + OPTIONAL_DATASET_METADATA, + state.current_metadata_language, + state.metadata.dataset, + { + "type": "dataset-edit-section", + "id": f"recommended-{language}-{n_clicks}", + }, + ), + build_dataset_edit_section( + "Maskingenerert", + NON_EDITABLE_DATASET_METADATA, + state.current_metadata_language, + state.metadata.dataset, + { + "type": "dataset-edit-section", + "id": f"machine-{language}-{n_clicks}", + }, + ), + ] @app.callback( Output( diff --git a/src/datadoc/frontend/components/control_bars.py b/src/datadoc/frontend/components/control_bars.py index f981fc9e..ec047750 100644 --- a/src/datadoc/frontend/components/control_bars.py +++ b/src/datadoc/frontend/components/control_bars.py @@ -15,7 +15,7 @@ COLORS = {"dark_1": "#F0F8F9", "green_1": "#ECFEED", "green_4": "#00824D"} header = ssb.Header( - [ssb.Title("DataDoc", size=1, id="main-title", className="main-title")], + [ssb.Title("Datadoc", size=1, id="main-title", className="main-title")], className="datadoc-header", ) diff --git a/src/datadoc/frontend/fields/display_base.py b/src/datadoc/frontend/fields/display_base.py index 1193bd81..62321987 100644 --- a/src/datadoc/frontend/fields/display_base.py +++ b/src/datadoc/frontend/fields/display_base.py @@ -101,7 +101,7 @@ def get_comma_separated_string(metadata: BaseModel, identifier: str) -> str: try: return ", ".join(value) except TypeError: - logger.exception("Type error") + # This just means we got None return ""