Skip to content

Commit

Permalink
- ADD: Added dashboard section properties.
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-raubach committed Nov 13, 2023
1 parent 8863f2f commit 4c46f89
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ plausible.hash.mode = <enables tracking based on url hash changes>
plausible.api.host = <plausible's api host to use. Change this if you are self-hosting.>
# The colored boxes at the top of the dashboard/home page can be changed here.
dashboard.categories = <comma separated list of the dashboard categories to show. any of: 'germplasm', 'markers', 'maps', 'traits', 'climates', 'compounds', 'locations', 'datasets', 'datasetsGenotype', 'datasetsTrials', 'datasetsAllelefreq', 'datasetsClimate', 'datasetsCompound', 'experiments', 'groups', 'images', 'fileresources'; don't include the quotes>
# The information sections on the dashboard. Pick which ones to show.
dashboard.sections = <comma separated list of dashboard sections. Any of: 'publications', 'news', 'projects', 'dataupdates', 'datastories'; don't include the quotes>
# Pages can be hidden for example if you don't have that kind of data.
hidden.pages = <names of those pages that should be hidden from the user interface (https://github.com/germinateplatform/germinate-vue/blob/master/src/mixins/pages.js)>
hidden.pages.autodiscover = <set to true to make Germinate auto-discover which pages to show on the client based on what data is available in the database>
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/jhi/germinate/resource/ClientConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class ClientConfiguration
private String colorPrimary;
private Boolean commentsEnabled;
private List<String> dashboardCategories;
private List<String> dashboardSections;
private DataImportMode dataImportMode;
private String externalLinkIdentifier;
private String externalLinkTemplate;
Expand Down Expand Up @@ -222,6 +223,17 @@ public ClientConfiguration setDashboardCategories(List<String> dashboardCategori
return this;
}

public List<String> getDashboardSections()
{
return dashboardSections;
}

public ClientConfiguration setDashboardSections(List<String> dashboardSections)
{
this.dashboardSections = dashboardSections;
return this;
}

public DataImportMode getDataImportMode()
{
return dataImportMode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public enum ServerProperty
COLOR_PRIMARY("color.primary", null, false),
COMMENTS_ENABLED("comments.enabled", "true", false),
DASHBOARD_CATEGORIES("dashboard.categories", "germplasm,markers,traits,locations", false),
DASHBOARD_SECTIONS("dashboard.sections", "publications,news,projects,dataupdates,datastories", false),
DATA_DIRECTORY_EXTERNAL("data.directory.external", null, true),
DATA_IMPORT_MODE("data.import.mode", "NONE", false),
DATABASE_SERVER("database.server", null, true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public Response getSettings()
.setColorsGradient(PropertyWatcher.getPropertyList(ServerProperty.COLORS_GRADIENT, String.class))
.setColorPrimary(PropertyWatcher.get(ServerProperty.COLOR_PRIMARY))
.setDashboardCategories(PropertyWatcher.getPropertyList(ServerProperty.DASHBOARD_CATEGORIES, String.class))
.setDashboardSections(PropertyWatcher.getPropertyList(ServerProperty.DASHBOARD_SECTIONS, String.class))
.setHiddenPages(hiddenPages)
.setAuthMode(PropertyWatcher.get(ServerProperty.AUTHENTICATION_MODE, AuthenticationMode.class))
.setRegistrationEnabled(PropertyWatcher.getBoolean(ServerProperty.GATEKEEPER_REGISTRATION_ENABLED))
Expand Down Expand Up @@ -123,6 +124,7 @@ public ClientAdminConfiguration getAdminSettings()
.setColorsGradient(PropertyWatcher.getPropertyList(ServerProperty.COLORS_GRADIENT, String.class))
.setColorPrimary(PropertyWatcher.get(ServerProperty.COLOR_PRIMARY))
.setDashboardCategories(PropertyWatcher.getPropertyList(ServerProperty.DASHBOARD_CATEGORIES, String.class))
.setDashboardSections(PropertyWatcher.getPropertyList(ServerProperty.DASHBOARD_SECTIONS, String.class))
.setHiddenPages(PropertyWatcher.getPropertyList(ServerProperty.HIDDEN_PAGES, String.class))
.setAuthMode(PropertyWatcher.get(ServerProperty.AUTHENTICATION_MODE, AuthenticationMode.class))
.setRegistrationEnabled(PropertyWatcher.getBoolean(ServerProperty.GATEKEEPER_REGISTRATION_ENABLED))
Expand Down Expand Up @@ -197,6 +199,7 @@ public boolean postAdminSettings(ClientAdminConfiguration config)
PropertyWatcher.setPropertyList(ServerProperty.COLORS_GRADIENT, config.getColorsGradient());
PropertyWatcher.set(ServerProperty.COLOR_PRIMARY, config.getColorPrimary());
PropertyWatcher.setPropertyList(ServerProperty.DASHBOARD_CATEGORIES, config.getDashboardCategories());
PropertyWatcher.setPropertyList(ServerProperty.DASHBOARD_SECTIONS, config.getDashboardSections());
PropertyWatcher.setPropertyList(ServerProperty.HIDDEN_PAGES, config.getHiddenPages());
PropertyWatcher.setBoolean(ServerProperty.HIDDEN_PAGES_AUTODISCOVER, config.getHiddenPagesAutodiscover());
PropertyWatcher.set(ServerProperty.AUTHENTICATION_MODE, config.getAuthMode().name());
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/jhi/germinate/server/util/PropertyWatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,10 @@ public static String get(ServerProperty property)
{
String value = properties.get(property.getKey());

return StringUtils.isEmpty(value) ? property.getDefaultValue() : value.strip();
if (value == null)
return property.getDefaultValue();
else
return StringUtils.isEmpty(value) ? null : value.strip();
}

/**
Expand Down

0 comments on commit 4c46f89

Please sign in to comment.