Skip to content

Commit

Permalink
Merge pull request 'Migrate Riot/Tag Frontend Plugin to usual Gui Mod…
Browse files Browse the repository at this point in the history
…ule' (#7) from dl/maven-rework into develop

Reviewed-on: https://gitea.intranda.com/goobi-workflow/goobi-plugin-step-ocr-selector/pulls/7
  • Loading branch information
Dominick Leppich committed Jul 5, 2024
2 parents ef19e07 + 46a12fd commit 07effc0
Show file tree
Hide file tree
Showing 19 changed files with 130 additions and 842 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ target/
bin/
build/
node_modules/
tags.js

# Eclipse
.project
Expand Down
52 changes: 0 additions & 52 deletions frontend-dev/Gruntfile.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,55 +1,28 @@
package de.intranda.goobi.plugins;

import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.HashMap;

import org.goobi.beans.Step;
import org.goobi.production.enums.PluginGuiType;
import org.goobi.production.enums.PluginType;
import org.goobi.production.enums.StepReturnValue;
import org.goobi.production.plugin.interfaces.IRestGuiPlugin;

import de.intranda.goobi.plugins.ocrselector.Routes;
import lombok.Data;
import lombok.extern.log4j.Log4j;
import net.xeoh.plugins.base.annotations.PluginImplementation;
import org.goobi.beans.Step;
import org.goobi.production.enums.PluginGuiType;
import org.goobi.production.enums.PluginType;
import org.goobi.production.enums.StepReturnValue;
import org.goobi.production.plugin.interfaces.IGuiPlugin;
import org.goobi.production.plugin.interfaces.IRestPlugin;
import org.goobi.production.plugin.interfaces.IStepPlugin;
import spark.Service;

import java.util.HashMap;

@Log4j
@Data
@PluginImplementation
public class OcrSelector implements IRestGuiPlugin {
public class OcrSelector implements IRestPlugin, IGuiPlugin, IStepPlugin {
private Step step;
private String returnPath;
private String title = "intranda_step_ocrselector";

@Override
public void extractAssets(Path assetsDir) {
String[] paths = new String[] { "css/style.css", "js/app.js", "js/riot.min.js", "js/tags.js", "js/ugh.js" };
for (String p : paths) {
extractFile(p, assetsDir);
}
}

private void extractFile(String filePath, Path assetsDir) {
Path out = assetsDir.resolve("plugins").resolve(title).resolve(filePath);
try (InputStream is = getClass().getClassLoader().getResourceAsStream("/frontend/" + filePath)) {
if (!Files.exists(out.getParent())) {
Files.createDirectories(out.getParent());
}
if (is != null) {
Files.copy(is, out, StandardCopyOption.REPLACE_EXISTING);
}
} catch (IOException e) {
// TODO Auto-generated catch block
log.error(e);
}
}

@Override
public String cancel() {
return "/uii/" + returnPath;
Expand All @@ -67,7 +40,7 @@ public String finish() {

@Override
public String getPagePath() {
return "/uii/guiPlugin.xhtml";
return "/uii/guiPluginNew.xhtml";
}

@Override
Expand Down Expand Up @@ -97,12 +70,16 @@ public PluginType getType() {

@Override
public String[] getJsPaths() {
return new String[] { "js/riot.min.js", "js/tags.js", "js/app.js", "js/ugh.js" };
return new String[] { "riot.min.js", "tags.js", "app.js", "ugh.js" };
}

@Override
public String[] getCssPaths() {
return new String[] { "style.css" };
}

@Override
public void initRoutes(Service http) {
Routes.initRoutes(http);

}
}
Loading

0 comments on commit 07effc0

Please sign in to comment.