nb endpoint updates for nbui

This commit is contained in:
Jonathan Shook 2020-09-03 12:11:52 -05:00
parent 69e64756d2
commit fc0f1c8dfe
4 changed files with 35 additions and 8 deletions

View File

@ -79,7 +79,7 @@ public class DocServerApp {
String[] markdownFileArray = markdownList.split("\n");
for (String markdownFile : markdownFileArray) {
Path relativePath = dirpath.resolve(Path.of("services/docs/markdown", markdownFile));
Path relativePath = dirpath.resolve(Path.of("services/docs", markdownFile));
logger.info("Creating " + relativePath.toString());
Path path = dds.findPath(markdownFile);

View File

@ -1,5 +1,6 @@
package io.nosqlbench.engine.rest.resources;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.nosqlbench.docsys.api.WebServiceObject;
import io.nosqlbench.nb.annotations.Service;
import io.nosqlbench.virtdata.userlibs.apps.docsapp.AutoDocsWebService;
@ -13,6 +14,8 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Configuration;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.Map;
@Service(WebServiceObject.class)
@Singleton
@ -25,8 +28,32 @@ public class ServiceStatusEndpoint implements WebServiceObject {
@GET
@Produces(MediaType.APPLICATION_JSON)
public boolean isEnabled() {
return true;
public Response isEnabled() {
try {
StatusEncoding status = new StatusEncoding(true, Map.of());
return Response.ok(status).build();
} catch (Exception e) {
return Response.serverError().entity(e.getMessage()).build();
}
}
private final static class StatusEncoding {
@JsonProperty("enabled")
public boolean isEnabled() {
return enabled;
}
@JsonProperty("endpoints")
public Map<String, String> getEndpoints() {
return endpoints;
}
private final boolean enabled;
private final Map<String, String> endpoints;
public StatusEncoding(boolean enabled, Map<String, String> endpoints) {
this.enabled = enabled;
this.endpoints = endpoints;
}
}
}

View File

@ -80,7 +80,7 @@ public class WorkspacesEndpoint implements WebServiceObject {
}
@POST
@Path("/{workspaceName}/{filepath:.*}")
@Path("/{workspaceName}/{filepath:.+}")
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.WILDCARD)
public Response doSomething(@Context HttpServletRequest request, byte[] input) {

View File

@ -38,9 +38,10 @@ then
fi
$JAVA -jar target/nb.jar docserver generate ${GUIDEBOOK}/
$JAVA -jar target/nb.jar virtdata gendocs basedir ${GUIDEBOOK}/services/docs/markdown/bindings
driversdir="${GUIDEBOOK}/services/docs/markdown/drivers"
$JAVA -jar target/nb.jar virtdata gendocs basedir ${GUIDEBOOK}/services/docs/bindings
driversdir="${GUIDEBOOK}/services/docs/drivers"
mkdir -p $driversdir
drivers=$($JAVA -jar target/nb.jar --list-drivers)
@ -55,8 +56,7 @@ do
done
(
cd ${GUIDEBOOK}/services/docs;
( cd markdown && find * -name '*.md' ) | sort > markdown.csv
find .
find * -type f -name '*.md' | sort > markdown.csv
)
#JAVA_HOME=${JAVA_HOME:-JAVA_HOME must be specified if java isn not in the path}