Skip to content

Ocultando etiqueta #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Ocultando etiqueta #9

wants to merge 5 commits into from

Conversation

germankay
Copy link
Collaborator

@germankay germankay commented Jul 31, 2025

Allow changing the dashboard title with a sysadmin config option

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements functionality to hide/customize the dashboard label by making the dashboard title configurable through CKAN configuration. The changes allow administrators to customize the dashboard section title instead of using a hardcoded "Dashboard" label.

  • Adds a new helper function to retrieve dashboard title from configuration
  • Makes the dashboard title display conditional and configurable
  • Updates the template to use the configurable title and conditionally show description

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
ckanext/dashboard/templates/package/read.html Updates template to use configurable dashboard title and conditionally display description
ckanext/dashboard/plugin.py Adds configuration for dashboard title and registers new helper function
ckanext/dashboard/helpers.py Implements helper function to retrieve dashboard title from configuration

Comment on lines 22 to 23
except Exception:
pass
Copy link
Preview

Copilot AI Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a bare except Exception: is too broad and can mask unexpected errors. Consider catching specific exceptions like KeyError, AttributeError, or ValidationError that might be raised by the config_option_show action.

Suggested change
except Exception:
pass
except (KeyError, AttributeError, t.ValidationError) as e:
t.log.error(f"Error retrieving dashboard title from config: {e}")

Copilot uses AI. Check for mistakes.



def get_dashboard_title_from_config():
"""Obtiene el título del dashboard desde la configuración del .ini"""
Copy link
Preview

Copilot AI Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The docstring is in Spanish while the codebase appears to use English for documentation. Consider using English for consistency: 'Gets the dashboard title from the .ini configuration'.

Suggested change
"""Obtiene el título del dashboard desde la configuración del .ini"""
"""Gets the dashboard title from the .ini configuration"""

Copilot uses AI. Check for mistakes.

@@ -25,6 +25,10 @@ def update_config(self, config_):
toolkit.add_template_directory(config_, "templates")
toolkit.add_public_directory(config_, "public")
toolkit.add_resource("assets", "dashboard")
# Opción para personalizar el título del dashboard
Copy link
Preview

Copilot AI Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The comment is in Spanish while the codebase appears to use English for documentation. Consider using English for consistency: '# Option to customize the dashboard title'.

Suggested change
# Opción para personalizar el título del dashboard
# Option to customize the dashboard title

Copilot uses AI. Check for mistakes.

return {
'get_dataset_dashboard': h.get_dataset_dashboard,
'get_dashboard_title_from_config': h.get_dashboard_title_from_config
}

def i18n_locales(self):
"""Lanaguages this plugin has translations for."""
Copy link
Preview

Copilot AI Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a typo in the docstring: 'Lanaguages' should be 'Languages'.

Suggested change
"""Lanaguages this plugin has translations for."""
"""Languages this plugin has translations for."""

Copilot uses AI. Check for mistakes.

@@ -25,6 +25,10 @@ def update_config(self, config_):
toolkit.add_template_directory(config_, "templates")
toolkit.add_public_directory(config_, "public")
toolkit.add_resource("assets", "dashboard")
# Option to customize the dashboard title
config_['ckanext.bcie.dashboard_title'] = config_.get(
'ckanext.bcie.dashboard_title', 'Tablero'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'ckanext.bcie.dashboard_title', 'Tablero'
'ckanext.bcie.dashboard_title', 'Dashboard'

Default in english for this extension

def get_dashboard_title_from_config():
"""Gets the dashboard title from the .ini configuration"""
try:
result = t.get_action('config_option_show')(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This action do not exist
You just need to get the config option from config.get('ckanext.bcie.dashboard_title')
Check examples in other extensions

@@ -25,6 +25,10 @@ def update_config(self, config_):
toolkit.add_template_directory(config_, "templates")
toolkit.add_public_directory(config_, "public")
toolkit.add_resource("assets", "dashboard")
# Option to customize the dashboard title
config_['ckanext.bcie.dashboard_title'] = config_.get(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we usually define the config validator to use later in sysadmin config form.
This is not required here as this.
Check other extensions usage

@avdata99
Copy link
Member

avdata99 commented Aug 1, 2025

Add a reference in README.md for this new config
Also, override the sysadmin config for to allow users to change this title

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants