Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(control) UX-improvements for control service
This commit overhauls a lot of the UX for the control service, adding a new actions menu to the nodes views. It has many small tweaks to make the work flow better. It also adds a new /uploads directory in each index node, from which sideloaded data can be selected. This is a bit of a breaking change, as this directory needs to exist in each index node.
- Loading branch information
Showing
46 changed files
with
807 additions
and
755 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
code/api/executor-api/src/main/java/nu/marginalia/executor/upload/UploadDirContents.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package nu.marginalia.executor.upload; | ||
|
||
import java.util.List; | ||
|
||
public record UploadDirContents(String path, List<UploadDirItem> items) { | ||
} |
29 changes: 29 additions & 0 deletions
29
code/api/executor-api/src/main/java/nu/marginalia/executor/upload/UploadDirItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package nu.marginalia.executor.upload; | ||
|
||
import lombok.SneakyThrows; | ||
|
||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.time.LocalDateTime; | ||
import java.time.ZoneId; | ||
import java.time.format.DateTimeFormatter; | ||
|
||
public record UploadDirItem ( | ||
String name, | ||
String lastModifiedTime, | ||
boolean isDirectory, | ||
long size | ||
) { | ||
|
||
@SneakyThrows | ||
public static UploadDirItem fromPath(Path path) { | ||
boolean isDir = Files.isDirectory(path); | ||
long size = isDir ? 0 : Files.size(path); | ||
var mtime = Files.getLastModifiedTime(path); | ||
|
||
|
||
return new UploadDirItem(path.toString(), | ||
LocalDateTime.ofInstant(mtime.toInstant(), ZoneId.systemDefault()).format(DateTimeFormatter.ISO_DATE_TIME), isDir, size); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...re/control-service/src/main/java/nu/marginalia/control/ControlHandlebarsConfigurator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...ices-core/control-service/src/main/java/nu/marginalia/control/ControlRendererFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package nu.marginalia.control; | ||
|
||
import com.google.inject.Inject; | ||
import lombok.SneakyThrows; | ||
import nu.marginalia.nodecfg.NodeConfigurationService; | ||
import nu.marginalia.renderer.RendererFactory; | ||
|
||
import java.util.Map; | ||
|
||
/** Wrapper for the renderer factory that adds global context | ||
* with the nodes listing | ||
*/ | ||
public class ControlRendererFactory { | ||
private final RendererFactory rendererFactory; | ||
private final NodeConfigurationService nodeConfigurationService; | ||
|
||
@Inject | ||
public ControlRendererFactory(RendererFactory rendererFactory, | ||
NodeConfigurationService nodeConfigurationService) | ||
{ | ||
this.rendererFactory = rendererFactory; | ||
this.nodeConfigurationService = nodeConfigurationService; | ||
} | ||
|
||
@SneakyThrows | ||
public Renderer renderer(String template) { | ||
Map<String, Object> globalContext = Map.of( | ||
"nodes", nodeConfigurationService.getAll() | ||
); | ||
var baseRenderer = rendererFactory.renderer(template); | ||
|
||
return (context) -> baseRenderer.render(context, Map.of("global-context", globalContext)); | ||
} | ||
|
||
public interface Renderer { | ||
String render(Object context); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
code/services-core/control-service/src/main/java/nu/marginalia/control/RedirectControl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.