Removed most fancy search features for now while I add an SQL console.

This commit is contained in:
Andrew Lalis 2024-07-09 18:40:58 -04:00
parent 72d624afdc
commit 411f384775
2 changed files with 7 additions and 76 deletions

View File

@ -24,8 +24,6 @@ import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.value.ObservableValue; import javafx.beans.value.ObservableValue;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.Node; import javafx.scene.Node;
import javafx.scene.control.TabPane;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane; import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox; import javafx.scene.layout.HBox;
@ -33,7 +31,6 @@ import javafx.scene.layout.VBox;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.List; import java.util.List;
import static com.andrewlalis.perfin.PerfinApp.router; import static com.andrewlalis.perfin.PerfinApp.router;
@ -53,10 +50,8 @@ public class TransactionsViewController implements RouteSelectionListener {
public record RouteContext(Long selectedTransactionId) {} public record RouteContext(Long selectedTransactionId) {}
@FXML public BorderPane transactionsListBorderPane; @FXML public BorderPane transactionsListBorderPane;
@FXML public TabPane searchTabPane;
@FXML public TextField searchField; @FXML public TextField searchField;
@FXML public AccountSelectionBox filterByAccountComboBox; @FXML public AccountSelectionBox filterByAccountComboBox;
@FXML public TextArea customSearchSqlTextArea;
@FXML public VBox transactionsVBox; @FXML public VBox transactionsVBox;
@ -80,12 +75,6 @@ public class TransactionsViewController implements RouteSelectionListener {
selectedTransaction.set(null); selectedTransaction.set(null);
}); });
// Add listener to reset search when a different search tab is selected.
searchTabPane.getSelectionModel().selectedIndexProperty().addListener((observable, oldValue, newValue) -> {
paginationControls.setPage(1);
selectedTransaction.set(null);
});
this.paginationControls = new DataSourcePaginationControls( this.paginationControls = new DataSourcePaginationControls(
transactionsVBox.getChildren(), transactionsVBox.getChildren(),
new DataSourcePaginationControls.PageFetcherFunction() { new DataSourcePaginationControls.PageFetcherFunction() {
@ -173,24 +162,7 @@ public class TransactionsViewController implements RouteSelectionListener {
Popups.message(transactionsListBorderPane, "Exporting transactions is not yet supported."); Popups.message(transactionsListBorderPane, "Exporting transactions is not yet supported.");
} }
@FXML public void executeSqlQuery() {
paginationControls.setPage(1);
selectedTransaction.set(null);
}
private List<SearchFilter> getCurrentSearchFilters() { private List<SearchFilter> getCurrentSearchFilters() {
if (searchTabPane.getSelectionModel().isSelected(0)) {
return getBasicSearchFilters();
} else if (searchTabPane.getSelectionModel().isSelected(1)) {
return Collections.emptyList();
} else if (searchTabPane.getSelectionModel().isSelected(2) && !customSearchSqlTextArea.getText().isBlank()) {
var filter = new SearchFilter.Builder().where(customSearchSqlTextArea.getText().strip()).build();
return List.of(filter);
}
return Collections.emptyList();
}
private List<SearchFilter> getBasicSearchFilters() {
List<SearchFilter> filters = new ArrayList<>(); List<SearchFilter> filters = new ArrayList<>();
if (searchField.getText() != null && !searchField.getText().isBlank()) { if (searchField.getText() != null && !searchField.getText().isBlank()) {
final String text = searchField.getText().strip(); final String text = searchField.getText().strip();

View File

@ -21,54 +21,13 @@
<HBox> <HBox>
<BorderPane fx:id="transactionsListBorderPane" HBox.hgrow="ALWAYS"> <BorderPane fx:id="transactionsListBorderPane" HBox.hgrow="ALWAYS">
<top> <top>
<TabPane fx:id="searchTabPane"> <VBox styleClass="padding-extra,std-spacing">
<Tab text="Basic Search" closable="false"> <TextField fx:id="searchField" promptText="Search" maxWidth="300" prefWidth="200" minWidth="100"/>
<VBox styleClass="padding-extra,std-spacing"> <PropertiesPane hgap="5" vgap="5">
<TextField fx:id="searchField" promptText="Search" maxWidth="300" prefWidth="300" minWidth="100"/> <Label text="Filter by Account"/>
<PropertiesPane hgap="5" vgap="5"> <AccountSelectionBox fx:id="filterByAccountComboBox" allowNone="true" showBalance="false"/>
<Label text="Filter by Account"/> </PropertiesPane>
<AccountSelectionBox fx:id="filterByAccountComboBox" allowNone="true" showBalance="false"/> </VBox>
</PropertiesPane>
</VBox>
</Tab>
<Tab text="Advanced Search" closable="false">
<Label text="Advanced search filters will go here once they're ready."/>
</Tab>
<Tab text="Custom Search" closable="false">
<HBox styleClass="std-spacing,std-padding" maxWidth="600">
<VBox styleClass="std-spacing" HBox.hgrow="ALWAYS">
<ScrollPane VBox.vgrow="ALWAYS" fitToHeight="true" fitToWidth="true">
<TextArea
fx:id="customSearchSqlTextArea"
promptText="Write your SQL query here..."
styleClass="mono-font"
maxWidth="Infinity"
minHeight="50"
prefHeight="150"
/>
</ScrollPane>
<HBox styleClass="std-spacing">
<Button text="Execute" onAction="#executeSqlQuery"/>
<Button text="View Schema"/>
<Button text="Save Query"/>
</HBox>
</VBox>
<VBox HBox.hgrow="NEVER" minWidth="200">
<Label text="Saved Queries"/>
<ScrollPane VBox.vgrow="ALWAYS">
<VBox>
<Label text="Query A"/>
<Label text="Query B"/>
<Label text="Query C"/>
<Label text="Query D"/>
</VBox>
</ScrollPane>
</VBox>
</HBox>
</Tab>
</TabPane>
</top> </top>
<center> <center>
<ScrollPane styleClass="tile-container-scroll"> <ScrollPane styleClass="tile-container-scroll">