(control) Move 'new crawl spec' to /node/:id/actions, out of /node/:id/storage
This commit is contained in:
parent
b192373ae7
commit
f29a9d972d
@ -62,9 +62,11 @@ public class ControlNodeActionsService {
|
||||
redirectControl.renderRedirectAcknowledgement("Sideloading", "..")
|
||||
);
|
||||
Spark.post("/public/nodes/:id/actions/new-crawl", this::triggerNewCrawl,
|
||||
redirectControl.renderRedirectAcknowledgement("Crawling", ".."));
|
||||
redirectControl.renderRedirectAcknowledgement("Crawling", "..")
|
||||
);
|
||||
Spark.post("/public/nodes/:id/actions/recrawl", this::triggerAutoRecrawl,
|
||||
redirectControl.renderRedirectAcknowledgement("Recrawling", ".."));
|
||||
redirectControl.renderRedirectAcknowledgement("Recrawling", "..")
|
||||
);
|
||||
Spark.post("/public/nodes/:id/actions/process", this::triggerAutoProcess,
|
||||
redirectControl.renderRedirectAcknowledgement("Processing", "..")
|
||||
);
|
||||
@ -74,6 +76,9 @@ public class ControlNodeActionsService {
|
||||
Spark.post("/public/nodes/:id/actions/restore-backup", this::triggerRestoreBackup,
|
||||
redirectControl.renderRedirectAcknowledgement("Restoring", "..")
|
||||
);
|
||||
Spark.post("/public/nodes/:id/actions/new-crawl-specs", this::createNewSpecsAction,
|
||||
redirectControl.renderRedirectAcknowledgement("Creating", "../actions?view=new-crawl")
|
||||
);
|
||||
}
|
||||
|
||||
public Object sideloadEncyclopedia(Request request, Response response) throws Exception {
|
||||
@ -215,4 +220,13 @@ public class ControlNodeActionsService {
|
||||
}
|
||||
|
||||
|
||||
private Object createNewSpecsAction(Request request, Response response) {
|
||||
final String description = request.queryParams("description");
|
||||
final String url = request.queryParams("url");
|
||||
int nodeId = Integer.parseInt(request.params("id"));
|
||||
|
||||
executorClient.createCrawlSpecFromDownload(Context.fromRequest(request), nodeId, description, url);
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,6 @@ public class ControlNodeService {
|
||||
var storageDetailsRenderer = rendererFactory.renderer("control/node/node-storage-details");
|
||||
var configRenderer = rendererFactory.renderer("control/node/node-config");
|
||||
|
||||
var newSpecsFormRenderer = rendererFactory.renderer("control/node/node-new-specs-form");
|
||||
|
||||
Spark.get("/public/nodes", this::nodeListModel, nodeListRenderer::render);
|
||||
Spark.get("/public/nodes/:id", this::nodeOverviewModel, overviewRenderer::render);
|
||||
@ -89,10 +88,6 @@ public class ControlNodeService {
|
||||
Spark.post("/public/nodes/:id/process/:processBase/stop", this::stopProcess,
|
||||
redirectControl.renderRedirectAcknowledgement("Stopping", "../..")
|
||||
);
|
||||
Spark.get("/public/nodes/:id/storage/new-specs", this::newSpecsModel, newSpecsFormRenderer::render);
|
||||
Spark.post("/public/nodes/:id/storage/new-specs", this::createNewSpecsAction,
|
||||
redirectControl.renderRedirectAcknowledgement("Creating", ".")
|
||||
);
|
||||
|
||||
Spark.get("/public/nodes/:id/storage/:view", this::nodeStorageListModel, storageListRenderer::render);
|
||||
|
||||
@ -168,26 +163,6 @@ public class ControlNodeService {
|
||||
return redirectToOverview(Integer.parseInt(request.params("id")));
|
||||
}
|
||||
|
||||
private Object createNewSpecsAction(Request request, Response response) {
|
||||
final String description = request.queryParams("description");
|
||||
final String url = request.queryParams("url");
|
||||
int nodeId = Integer.parseInt(request.params("id"));
|
||||
|
||||
executorClient.createCrawlSpecFromDownload(Context.fromRequest(request), nodeId, description, url);
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
private Object newSpecsModel(Request request, Response response) throws SQLException {
|
||||
int nodeId = Integer.parseInt(request.params("id"));
|
||||
|
||||
return Map.of(
|
||||
"tab", Map.of("storage", true),
|
||||
"node", nodeConfigurationService.get(nodeId),
|
||||
"view", Map.of("specs", true)
|
||||
);
|
||||
}
|
||||
|
||||
private Object nodeActorsModel(Request request, Response response) throws SQLException {
|
||||
int nodeId = Integer.parseInt(request.params("id"));
|
||||
|
||||
|
@ -0,0 +1,25 @@
|
||||
<h1 class="my-3">Create New Specification</h1>
|
||||
|
||||
<div class="my-3 p-3 border bg-light">
|
||||
<p>A crawling specification is a list of domain names to crawl.</p>
|
||||
<p>
|
||||
If you are just looking to test the software, feel free to use <a href="https://downloads.marginalia.nu/domain-list-test.txt">this
|
||||
short list of marginalia-related websites</a>, that are safe to crawl repeatedly without causing any problems.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<form method="post" action="actions/new-crawl-specs">
|
||||
<div class="form">
|
||||
<label class="form-label" for="description">Description</label>
|
||||
<input class="form-control" type="text" name="description" id="description" maxlength="255">
|
||||
<div class="form-text" id="basic-addon4">This is how you'll be able to find the
|
||||
specification later so give it a good and descriptive name</div>
|
||||
|
||||
<div id="spec-url-options" class="py-3">
|
||||
<label class="form-label" for="url">URL to list of domain names</label>
|
||||
<input class="form-control" type="text" name="url" id="url" />
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary">Create</button>
|
||||
</div>
|
||||
</form>
|
@ -2,13 +2,13 @@
|
||||
|
||||
{{#unless allCrawlSpecs}}
|
||||
No crawling specifications have been created. You must create a crawl spec before you can crawl.
|
||||
<a href="/nodes/{{node.id}}/storage/new-specs">create a crawl spec</a>.
|
||||
<a href="?view=new-crawl-specs">create a crawl spec</a>.
|
||||
{{/unless}}
|
||||
|
||||
{{#if allCrawlSpecs}}
|
||||
<div class="my-3 p-3 border bg-light">
|
||||
This will perform a new crawl on node {{node.id}} based on the crawl spec you select below.
|
||||
Additional specifications can be created <a href="/nodes/{{node.id}}/storage/new-specs">with this form</a>.
|
||||
Additional specifications can be created <a href="?view=new-crawl-specs">with this form</a>.
|
||||
</div>
|
||||
<div class="my-3 p-3 border">
|
||||
<p><em class="text-danger">IMPORTANT!</em> Be sure you've read and understood the
|
||||
|
@ -10,6 +10,7 @@
|
||||
{{> control/node/partial-node-nav }}
|
||||
|
||||
{{#if view.new-crawl}} {{> control/node/actions/partial-new-crawl }} {{/if}}
|
||||
{{#if view.new-crawl-specs}} {{> control/node/actions/partial-new-crawl-specs }} {{/if}}
|
||||
{{#if view.re-crawl}} {{> control/node/actions/partial-recrawl }} {{/if}}
|
||||
{{#if view.process}} {{> control/node/actions/partial-process }} {{/if}}
|
||||
{{#if view.load}} {{> control/node/actions/partial-load }} {{/if}}
|
||||
|
@ -1,47 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
{{> control/partials/head-includes }}
|
||||
<head><title>Control Service: Node {{node.id}}</title></head>
|
||||
<body>
|
||||
{{> control/partials/nav}}
|
||||
|
||||
<div class="container">
|
||||
|
||||
{{> control/node/partial-node-nav }}
|
||||
|
||||
<div class="container">
|
||||
{{>control/partials/storage-types}}
|
||||
|
||||
<div>
|
||||
<h2>Create New Specification</h2>
|
||||
|
||||
<div class="my-3 p-3 border bg-light">
|
||||
<p>A crawling specification is a list of domain names to crawl.</p>
|
||||
<p>
|
||||
If you are just looking to test the software, feel free to use <a href="https://downloads.marginalia.nu/domain-list-test.txt">this
|
||||
short list of marginalia-related websites</a>, that are safe to crawl repeatedly without causing any problems.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<form method="post" action="new-specs">
|
||||
<div class="form">
|
||||
<label class="form-label" for="description">Description</label>
|
||||
<input class="form-control" type="text" name="description" id="description" maxlength="255">
|
||||
<div class="form-text" id="basic-addon4">This is how you'll be able to find the
|
||||
specification later so give it a good and descriptive name</div>
|
||||
|
||||
<div id="spec-url-options" class="py-3">
|
||||
<label class="form-label" for="url">URL to list of domain names</label>
|
||||
<input class="form-control" type="text" name="url" id="url" />
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary">Create</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
{{> control/partials/foot-includes }}
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user