mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 21:18:58 +00:00
(controller) Additional configuration options for node
This commit is contained in:
parent
1d75b974b5
commit
2b3c167845
@ -39,7 +39,7 @@ public class NodeConfigurationService {
|
||||
public List<NodeConfiguration> getAll() throws SQLException {
|
||||
try (var conn = dataSource.getConnection();
|
||||
var qs = conn.prepareStatement("""
|
||||
SELECT ID, DESCRIPTION, ACCEPT_QUERIES, DISABLED
|
||||
SELECT ID, DESCRIPTION, ACCEPT_QUERIES, AUTO_CLEAN, PRECESSION, DISABLED
|
||||
FROM NODE_CONFIGURATION
|
||||
""")) {
|
||||
var rs = qs.executeQuery();
|
||||
@ -51,6 +51,8 @@ public class NodeConfigurationService {
|
||||
rs.getInt("ID"),
|
||||
rs.getString("DESCRIPTION"),
|
||||
rs.getBoolean("ACCEPT_QUERIES"),
|
||||
rs.getBoolean("AUTO_CLEAN"),
|
||||
rs.getBoolean("PRECESSION"),
|
||||
rs.getBoolean("DISABLED")
|
||||
));
|
||||
}
|
||||
@ -61,7 +63,7 @@ public class NodeConfigurationService {
|
||||
public NodeConfiguration get(int nodeId) throws SQLException {
|
||||
try (var conn = dataSource.getConnection();
|
||||
var qs = conn.prepareStatement("""
|
||||
SELECT ID, DESCRIPTION, ACCEPT_QUERIES, DISABLED
|
||||
SELECT ID, DESCRIPTION, ACCEPT_QUERIES, AUTO_CLEAN, PRECESSION, DISABLED
|
||||
FROM NODE_CONFIGURATION
|
||||
WHERE ID=?
|
||||
""")) {
|
||||
@ -72,6 +74,8 @@ public class NodeConfigurationService {
|
||||
rs.getInt("ID"),
|
||||
rs.getString("DESCRIPTION"),
|
||||
rs.getBoolean("ACCEPT_QUERIES"),
|
||||
rs.getBoolean("AUTO_CLEAN"),
|
||||
rs.getBoolean("PRECESSION"),
|
||||
rs.getBoolean("DISABLED")
|
||||
);
|
||||
}
|
||||
@ -84,14 +88,16 @@ public class NodeConfigurationService {
|
||||
try (var conn = dataSource.getConnection();
|
||||
var us = conn.prepareStatement("""
|
||||
UPDATE NODE_CONFIGURATION
|
||||
SET DESCRIPTION=?, ACCEPT_QUERIES=?, DISABLED=?
|
||||
SET DESCRIPTION=?, ACCEPT_QUERIES=?, AUTO_CLEAN=?, PRECESSION=?, DISABLED=?
|
||||
WHERE ID=?
|
||||
"""))
|
||||
{
|
||||
us.setString(1, config.description());
|
||||
us.setBoolean(2, config.acceptQueries());
|
||||
us.setBoolean(3, config.disabled());
|
||||
us.setInt(4, config.node());
|
||||
us.setBoolean(3, config.autoClean());
|
||||
us.setBoolean(4, config.includeInPrecession());
|
||||
us.setBoolean(5, config.disabled());
|
||||
us.setInt(6, config.node());
|
||||
|
||||
if (us.executeUpdate() <= 0)
|
||||
throw new IllegalStateException("Failed to update configuration");
|
||||
|
@ -3,6 +3,8 @@ package nu.marginalia.nodecfg.model;
|
||||
public record NodeConfiguration(int node,
|
||||
String description,
|
||||
boolean acceptQueries,
|
||||
boolean autoClean,
|
||||
boolean includeInPrecession,
|
||||
boolean disabled
|
||||
)
|
||||
{
|
||||
|
@ -2,5 +2,7 @@ CREATE TABLE NODE_CONFIGURATION (
|
||||
ID INT PRIMARY KEY,
|
||||
DESCRIPTION VARCHAR(255),
|
||||
ACCEPT_QUERIES BOOLEAN,
|
||||
AUTO_CLEAN BOOLEAN DEFAULT TRUE,
|
||||
PRECESSION BOOLEAN DEFAULT TRUE,
|
||||
DISABLED BOOLEAN DEFAULT FALSE
|
||||
);
|
@ -318,6 +318,8 @@ public class ControlNodeService {
|
||||
nodeId,
|
||||
request.queryParams("description"),
|
||||
"on".equalsIgnoreCase(request.queryParams("acceptQueries")),
|
||||
"on".equalsIgnoreCase(request.queryParams("autoClean")),
|
||||
"on".equalsIgnoreCase(request.queryParams("includeInPrecession")),
|
||||
"on".equalsIgnoreCase(request.queryParams("disabled"))
|
||||
);
|
||||
|
||||
|
@ -52,6 +52,22 @@
|
||||
<div class="form-text">Sets whether queries will be routed to this node</div>
|
||||
</div>
|
||||
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" name="autoClean" {{#if config.autoClean}}checked{{/if}}>
|
||||
<label class="form-check-label" for="autoClean">Clean Automatically</label>
|
||||
|
||||
<div class="form-text">If true, the system will automatically purge intermediate stages of data processing.
|
||||
This should probably be on in production and probably off in testing.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" name="includeInPrecession" {{#if config.includeInPrecession}}checked{{/if}}>
|
||||
<label class="form-check-label" for="includeInPrecession">Include in crawling precession</label>
|
||||
|
||||
<div class="form-text">If true, this node will be included in the crawling precession.</div>
|
||||
</div>
|
||||
|
||||
<div class="form-check form-switch mb-3">
|
||||
<input class="form-check-input" type="checkbox" role="switch" name="disabled" {{#if config.disabled}}checked{{/if}}>
|
||||
<label class="form-check-label" for="disabled">Disabled</label>
|
||||
|
Loading…
Reference in New Issue
Block a user