improved diff for journal
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
FROM alpine:3.22
|
||||
LABEL Maintainer "Stephan Richter <s.richter@srsoftware.de>"
|
||||
ARG UID=1000
|
||||
ARG GID=1000
|
||||
RUN apk add bash npm
|
||||
RUN adduser -Dh /home/svelte svelte
|
||||
RUN set -x; addgroup -g $GID svelte
|
||||
RUN adduser -u $UID -G svelte -Dh /home/svelte svelte
|
||||
ADD script /opt
|
||||
USER svelte
|
||||
WORKDIR /home/svelte
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
default: devel
|
||||
|
||||
build: image
|
||||
docker run --name svelte-build \
|
||||
podman run --name svelte-build \
|
||||
--rm \
|
||||
-v ../frontend:/home/svelte/frontend \
|
||||
-ti svelte /opt/svelte-build
|
||||
image:
|
||||
docker build -t svelte .
|
||||
podman build --build-arg UID=$$(id -u) --build-arg GID=$$(id -g) -t svelte .
|
||||
|
||||
devel: image
|
||||
-docker rm -f svelte
|
||||
docker run --name svelte \
|
||||
-podman rm -f svelte
|
||||
podman run --name svelte \
|
||||
-v ../frontend:/home/svelte/frontend \
|
||||
-p 5173:5173 \
|
||||
-ti svelte /opt/svelte-init
|
||||
|
||||
@@ -46,7 +46,7 @@ subprojects {
|
||||
implementation("de.srsoftware:tools.mime:1.1.4")
|
||||
implementation("de.srsoftware:tools.logging:1.3.2")
|
||||
implementation("de.srsoftware:tools.optionals:1.0.0")
|
||||
implementation("de.srsoftware:tools.util:2.0.4")
|
||||
implementation("de.srsoftware:tools.util:2.1.1")
|
||||
implementation("org.json:json:20240303")
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
package de.srsoftware.umbrella.messagebus.events;
|
||||
|
||||
import static de.srsoftware.umbrella.core.Constants.*;
|
||||
import static java.text.MessageFormat.format;
|
||||
import static java.util.Optional.*;
|
||||
|
||||
import de.srsoftware.tools.Diff;
|
||||
import de.srsoftware.tools.Mappable;
|
||||
import de.srsoftware.umbrella.core.model.UmbrellaUser;
|
||||
import java.util.HashMap;
|
||||
@@ -45,11 +45,6 @@ public abstract class Event<Payload extends Mappable> {
|
||||
|
||||
public abstract String describe();
|
||||
|
||||
private String diff(Map<String, Object> a, Map<String, Object> b){
|
||||
// TODO: replace by better implementation
|
||||
return format("{0}\n→\n{1}",dropMarkdown(a),dropMarkdown(b));
|
||||
}
|
||||
|
||||
private Map<String, Object> dropMarkdown(Map<String, Object> map) {
|
||||
var result = new HashMap<String, Object>();
|
||||
for (var entry : map.entrySet()){
|
||||
@@ -61,7 +56,7 @@ public abstract class Event<Payload extends Mappable> {
|
||||
}
|
||||
|
||||
public Optional<String> diff(){
|
||||
return oldData == null ? empty() : of(diff(oldData,payload.toMap()));
|
||||
return oldData == null ? empty() : of(Diff.MapDiff.diff(dropMarkdown(oldData),dropMarkdown(payload.toMap())));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,4 +9,5 @@ tasks.processResources {
|
||||
from("../frontend/dist") {
|
||||
into("web")
|
||||
}
|
||||
}
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user