Skip to content

Commit

Permalink
Implement review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SugaryLump committed Dec 5, 2024
1 parent 673d269 commit b5f8f7f
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ private IndexResult<ViewerDatabase> getCrossViewerDatabaseIndexResult(FindReques
simpleFacetParameter.setMinCount(1);
simpleFacetParameter.setLimit(findRequest.sublist.getMaximumElementCount());
simpleFacetParameter.setOffset(findRequest.sublist.getFirstElementIndex());
simpleFacetParameter.setOffset(findRequest.sublist.getFirstElementIndex());

final IndexResult<ViewerDatabase> facetsSearch = ViewerFactory.getSolrManager().findHits(ViewerDatabase.class,
collectionAlias, findRequest.filter, findRequest.sorter, findRequest.sublist, new Facets(simpleFacetParameter));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -575,10 +575,10 @@ public class ViewerConstants {
/**
* Search all
*/
public static final String LOCAL_STORAGE_SEARCHALL_SELECTION = "searchAllSelection";
public static final String SEARCHALL_SELECTEDALL = "all";
public static final String SEARCHALL_SELECTEDNONE = "none";
public static final String PROPERTY_SEARCHALL_DEFAULTSELECTION = "ui.searchAll.defaultSelection";
public static final String LOCAL_STORAGE_SEARCH_ALL_SELECTION = "searchAllSelection";
public static final String SEARCH_ALL_SELECTED_ALL = "all";
public static final String SEARCH_ALL_SELECTED_NONE = "none";
public static final String PROPERTY_SEARCH_ALL_DEFAULT_SELECTION = "ui.searchAll.defaultSelection";

/**
* Header
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void init(Filter defaultFilter, String allFilter, ClientMessages messages
SearchPanelWithSearchAll parentSearchPanel) {
setAutoHideEnabled(true);
setModal(true);
setText("Select databases to search");
setText(messages.manageDatabaseSearchAllSelectDatabases());

FlowPanel layout = new FlowPanel();

Expand Down Expand Up @@ -166,10 +166,11 @@ public void writeSelectedObjectsToLocalStorage() {
if (localStorage != null) {
SelectedItems<ViewerDatabase> selectedItems = this.list.getSelected();
if (selectedItems instanceof SelectedItemsList<?>) {
localStorage.setItem(ViewerConstants.LOCAL_STORAGE_SEARCHALL_SELECTION,
localStorage.setItem(ViewerConstants.LOCAL_STORAGE_SEARCH_ALL_SELECTION,
String.join(",", ((SelectedItemsList<ViewerDatabase>) selectedItems).getIds()));
} else if (selectedItems instanceof SelectedItemsFilter<?>) {
localStorage.setItem(ViewerConstants.LOCAL_STORAGE_SEARCHALL_SELECTION, ViewerConstants.SEARCHALL_SELECTEDALL);
localStorage.setItem(ViewerConstants.LOCAL_STORAGE_SEARCH_ALL_SELECTION,
ViewerConstants.SEARCH_ALL_SELECTED_ALL);
}
}
}
Expand All @@ -193,9 +194,9 @@ private void doParentSearch() {
List<String> selectedUUIDs = null;
boolean selectedAll = false;
if (localStorage != null) {
String uuidsString = localStorage.getItem(ViewerConstants.LOCAL_STORAGE_SEARCHALL_SELECTION);
String uuidsString = localStorage.getItem(ViewerConstants.LOCAL_STORAGE_SEARCH_ALL_SELECTION);
if (uuidsString != null) {
if (uuidsString.equals(ViewerConstants.SEARCHALL_SELECTEDALL)) {
if (uuidsString.equals(ViewerConstants.SEARCH_ALL_SELECTED_ALL)) {
selectedAll = true;
} else {
selectedUUIDs = new ArrayList<>();
Expand All @@ -211,9 +212,8 @@ private void doParentSearch() {
this.parentSearchPanel.setSearchAllTotalDatabases(String.valueOf(selectedUUIDs.size()));
this.parentSearchPanel.setDefaultFilter(newFilter);
this.parentSearchPanel.doSearch();
} else if (selectedAll || ClientConfigurationManager
.getStringWithDefault(ViewerConstants.SEARCHALL_SELECTEDALL, ViewerConstants.PROPERTY_SEARCHALL_DEFAULTSELECTION)
.equals(ViewerConstants.SEARCHALL_SELECTEDALL)) {
} else if (selectedAll || ClientConfigurationManager.getStringWithDefault(ViewerConstants.SEARCH_ALL_SELECTED_ALL,
ViewerConstants.PROPERTY_SEARCH_ALL_DEFAULT_SELECTION).equals(ViewerConstants.SEARCH_ALL_SELECTED_ALL)) {
this.parentSearchPanel.setSearchAllTotalDatabases("all");
this.parentSearchPanel.setDefaultFilter(defaultFilter);
this.parentSearchPanel.doSearch();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,12 @@
import config.i18n.client.ClientMessages;

/**
* @author Bruno Ferreira <bferreira@keep.pt>
* @author Alexandre Flores <aflores@keep.pt>
*/
public class DatabaseSelectList extends BasicAsyncTableCell<ViewerDatabase> {
private static final ClientMessages messages = GWT.create(ClientMessages.class);
private final ClientLogger logger = new ClientLogger(getClass().getName());

private static final String OPEN_VALIDATED_SPAN = "<span>&#10004;</span>";
private static final String OPEN_NOT_VALIDATED_SPAN = "<span>&#10006;</span>";

public DatabaseSelectList() {
this(new Filter(), null, null, false, false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,13 @@
*/
package com.databasepreservation.common.client.common.search;

import java.util.ArrayList;
import java.util.List;

import com.databasepreservation.common.client.common.lists.utils.AsyncTableCell;
import com.databasepreservation.common.client.common.search.panel.SearchFieldPanel;
import com.databasepreservation.common.client.index.filter.BasicSearchFilterParameter;
import com.databasepreservation.common.client.index.filter.Filter;
import com.databasepreservation.common.client.index.filter.FilterParameter;
import com.databasepreservation.common.client.models.structure.ViewerDatabase;
import com.databasepreservation.common.client.tools.FontAwesomeIconManager;
import com.databasepreservation.common.client.tools.HistoryManager;
import com.databasepreservation.common.client.widgets.wcag.AccessibleFocusPanel;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.logical.shared.HasValueChangeHandlers;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;

import config.i18n.client.ClientMessages;

/**
* @author Bruno Ferreira <[email protected]>
*/
Expand All @@ -56,19 +30,21 @@ public void initSearchAll() {
this.selectedDatabasesButtonWrapper.init(defaultFilter, allFilter, messages, this);
}

public SearchPanelWithSearchAll(Filter defaultFilter, String allFilter, String placeholder, boolean showSearchInputListBox,
boolean showSearchAdvancedDisclosureButton) {
public SearchPanelWithSearchAll(Filter defaultFilter, String allFilter, String placeholder,
boolean showSearchInputListBox, boolean showSearchAdvancedDisclosureButton) {
super(defaultFilter, allFilter, placeholder, showSearchInputListBox, showSearchAdvancedDisclosureButton);
}

public SearchPanelWithSearchAll(Filter defaultFilter, String allFilter, String placeholder, String context,
boolean showSearchAdvancedDisclosureButton, final AsyncCallback<Void> saveQueryCallback) {
boolean showSearchAdvancedDisclosureButton, final AsyncCallback<Void> saveQueryCallback) {
super(defaultFilter, allFilter, placeholder, context, showSearchAdvancedDisclosureButton, saveQueryCallback);
}

public SearchPanelWithSearchAll(Filter defaultFilter, String allFilter, String placeholder, boolean showSearchInputListBox,
boolean showSearchAdvancedDisclosureButton, final AsyncCallback<Void> saveQueryCallback) {
super(defaultFilter, allFilter, placeholder, showSearchInputListBox, showSearchAdvancedDisclosureButton, saveQueryCallback);
public SearchPanelWithSearchAll(Filter defaultFilter, String allFilter, String placeholder,
boolean showSearchInputListBox, boolean showSearchAdvancedDisclosureButton,
final AsyncCallback<Void> saveQueryCallback) {
super(defaultFilter, allFilter, placeholder, showSearchInputListBox, showSearchAdvancedDisclosureButton,
saveQueryCallback);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@
*/
package com.databasepreservation.common.client.common.visualization.manager.databasePanel.user;

import java.util.Collections;
import java.util.List;

import org.roda.core.data.v2.index.sublist.Sublist;

import com.databasepreservation.common.client.ViewerConstants;
import com.databasepreservation.common.client.common.ContentPanel;
import com.databasepreservation.common.client.common.breadcrumb.BreadcrumbItem;
Expand All @@ -24,20 +21,11 @@
import com.databasepreservation.common.client.common.search.SearchWrapper;
import com.databasepreservation.common.client.common.utils.ApplicationType;
import com.databasepreservation.common.client.common.utils.CommonClientUtils;
import com.databasepreservation.common.client.index.FindRequest;
import com.databasepreservation.common.client.index.IndexResult;
import com.databasepreservation.common.client.index.facets.Facets;
import com.databasepreservation.common.client.index.filter.Filter;
import com.databasepreservation.common.client.index.filter.SimpleFilterParameter;
import com.databasepreservation.common.client.index.sort.Sorter;
import com.databasepreservation.common.client.models.structure.ViewerDatabase;
import com.databasepreservation.common.client.models.structure.ViewerDatabaseStatus;
import com.databasepreservation.common.client.services.DatabaseService;
import com.databasepreservation.common.client.tools.BreadcrumbManager;
import com.databasepreservation.common.client.tools.FontAwesomeIconManager;
import com.databasepreservation.common.client.tools.HistoryManager;
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.LocaleInfo;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.SimplePanel;
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/config/i18n/client/ClientMessages.java
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,8 @@ public interface ClientMessages extends Messages {

String manageDatabasePageDescription();

String manageDatabaseSearchAllSelectDatabases();

String manageDatabaseSearchAllSearchingOn(String total);

String manageDatabaseSearchAllNoneSelected();
Expand Down
7 changes: 5 additions & 2 deletions src/main/resources/config/dbvtk-viewer.properties
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ ui.iiif_viewer.presentation.service_name=presentation

##############################################
# Search All settings
# ui.searchAll.defaultSelection
# The fallback behavior for cross search if the browser has no stored selection from previous cross searches
# Default: "all"
# Possible values: "all" (search on all available databases), "none" (search on no databases)
##############################################
ui.searchAll.defaultSelection=all
#ui.searchAll.defaultSelection=none
ui.searchAll.defaultSelection=all
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ managePageTableHeaderTextForActions=Actions
managePageTableHeaderTextForSearchHits=Search
managePageTableHeaderTextForDatabaseStatus=Status
manageDatabasePageDescription=Databases available on the application
manageDatabaseSearchAllSelectDatabases=Select databases to search
manageDatabaseSearchAllSearchingOn=Searching on {0} databases
manageDatabaseSearchAllSearchingOn[\=1]=Searching on 1 database
manageDatabaseSearchAllSearchingOn[\=0]=Searching on no databases
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ basicActionClear=Limpar
basicActionBack=Retroceder
basicActionNext=Seguinte
basicActionSkip=Saltar
basicActionSelect=Selecionar
basicActionSelectAll=Selecionar tudo
basicActionSelectNone=Limpar Seleção
basicActionOpen=Abrir
Expand Down Expand Up @@ -254,6 +255,19 @@ managePageTableHeaderTextForSearchHits=Pesquisa
managePageTableHeaderTextForDatabaseStatus=Estado
managePageTableHeaderTextForSIARDValidationStatus=Validação
manageDatabasePageDescription=Bases de dados importadas para a aplicação
manageDatabaseSearchAllSelectDatabases=Selecione em que bases de dados pesquisar
manageDatabaseSearchAllSearchingOn=A pesquisar em {0} bases de dados
manageDatabaseSearchAllSearchingOn[\=1]=A pesquisar em 1 base de dados
manageDatabaseSearchAllSearchingOn[\=0]=A pesquisar em nenhuma base de dados
manageDatabaseSearchAllNoneSelected=Por favor carregue no botão na barra de pesquisa para selecionar em que bases de dados pesquisar.
manageDatabaseSearchAllAllowedInfo=Para pesquisar sobre as bases de dados, elas devem estar carregadas e também permitir pesquisar todo o seu conteúdo nas suas definições de privacidade
manageDatabaseSearchAllExcludedLoaded={startBold,<b>}Atualmente, {0} bases de dados às quais tem acesso foram excluídas porque não estão carregadas
manageDatabaseSearchAllExcludedLoaded[\=1] ={startBold,<b>}Atualmente, 1 base de dados à qual tem acesso foi excluída proque não está carregada
manageDatabaseSearchAllExcludedLoaded[\=0]={startBold,<b>}Atualmente, nenhuma base de dados à qual tem acesso foi excluída proque não está carregada
manageDatabaseSearchAllExcludedPrivacy=e {0} bases de dados às quais tem acesso foram excluídas por causa das suas definições de privacidade.{endBold,</b>}
manageDatabaseSearchAllExcludedPrivacy[\=1]=e 1 base de dados à qual tem acesso foi excluída por causa das suas definições de privacidade.{endBold,</b>}
manageDatabaseSearchAllExcludedPrivacy[\=0]=e nenhuma base de dados à qual tem acesso foi excluída por causa das suas definições de privacidade.{endBold,</b>}
manageDatabaseSearchAllContactInfo=Contacte o seu administrador para carregar bases de dados ou para pedir alterações.
manageDatabaseNotLoadedDescription = Os resultados da pesquisa incluem apenas as bases de dados carregadas, o que exclui {0} bases de dados às quais tem acesso.
manageDatabaseNotSearchableDescription = Excluindo dos resultados {0} bases de dados às quais tem acesso devido às suas definições de privacidade.
manageDatabaseAllLoadedDescription = Os resultados da pesquisa incluem todas as bases de dados disponíveis.
Expand Down

0 comments on commit b5f8f7f

Please sign in to comment.