minor fixes

This commit is contained in:
Alexander Nozik 2016-10-13 22:49:01 +03:00
parent ed1ed6b2b6
commit f3ecec7dfc
10 changed files with 66 additions and 31 deletions

View File

@ -0,0 +1,10 @@
apply plugin: 'application'
description = "Joint measurement for vacuum, msp and temperature measurements"
dependencies{
compile project(':numass-control:cryotemp')
compile project(':numass-control:msp')
compile project(':numass-control:vac')
compile project(':numass-storage:numass-server')
}

View File

@ -0,0 +1,18 @@
package inr.numass.control.miranda;/**
* Created by darksnake on 13-Oct-16.
*/
import javafx.application.Application;
import javafx.stage.Stage;
public class MirandaApp extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
}
}

View File

@ -18,7 +18,7 @@ task runClient(type: JavaExec) {
} }
dependencies { dependencies {
compile(project(':numass-storage')) compile project(':numass-storage')
compile 'commons-cli:commons-cli:1.3.1' compile 'commons-cli:commons-cli:1.3.1'
compile 'org.zeroturnaround:zt-zip:1.9' compile 'org.zeroturnaround:zt-zip:1.9'
} }

View File

@ -17,6 +17,7 @@ import java.io.InputStreamReader;
import java.util.Map; import java.util.Map;
/** /**
* CLI interface for numass client
* @author Alexander Nozik * @author Alexander Nozik
*/ */
public class Cli { public class Cli {

View File

@ -40,7 +40,7 @@ public class RemoteNumassStorage extends AbstractStorage {
@Override @Override
public Loader buildLoader(Meta loaderConfiguration) throws StorageException { public Loader buildLoader(Meta loaderConfiguration) throws StorageException {
return null; throw new UnsupportedOperationException();
} }
@Override @Override

View File

@ -6,7 +6,6 @@
package inr.numass.server; package inr.numass.server;
import freemarker.template.Template; import freemarker.template.Template;
import hep.dataforge.exceptions.StorageException;
import hep.dataforge.storage.api.Loader; import hep.dataforge.storage.api.Loader;
import hep.dataforge.storage.api.StateLoader; import hep.dataforge.storage.api.StateLoader;
import hep.dataforge.storage.api.Storage; import hep.dataforge.storage.api.Storage;
@ -17,14 +16,13 @@ import ratpack.handling.Context;
import ratpack.handling.Handler; import ratpack.handling.Handler;
import java.io.StringWriter; import java.io.StringWriter;
import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import static hep.dataforge.storage.servlet.StorageRenderer.renderStorage;
import static inr.numass.server.HandlerUtils.renderStates; import static inr.numass.server.HandlerUtils.renderStates;
/** /**
*
* @author Alexander Nozik * @author Alexander Nozik
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -66,7 +64,9 @@ public class NumassRootHandler implements Handler {
try { try {
StringBuilder b = new StringBuilder(); StringBuilder b = new StringBuilder();
renderStorage(ctx, b, server.getRun().getStorage()); Storage rootStorage = server.getRun().getStorage();
rootStorage.refresh();
renderStorage(b, rootStorage);
data.put("storageContent", b.toString()); data.put("storageContent", b.toString());
} catch (Exception ex) { } catch (Exception ex) {
data.put("storageContent", ex.toString()); data.put("storageContent", ex.toString());
@ -86,24 +86,24 @@ public class NumassRootHandler implements Handler {
} }
} }
private void renderStorage(Context ctx, StringBuilder b, Storage storage){ // private void renderStorage(Context ctx, StringBuilder b, Storage storage){
try { // try {
b.append("<div class=\"shifted\">\n"); // b.append("<div class=\"shifted\">\n");
storage.shelves().values().stream().sorted(Comparator.comparing(it -> it.getName())).forEach(shelf -> { // storage.shelves().values().stream().sorted(Comparator.comparing(it -> it.getName())).forEach(shelf -> {
b.append(String.format("<p><strong>+ %s</strong></p>%n", shelf.getName())); // b.append(String.format("<p><strong>+ %s</strong></p>%n", shelf.getName()));
renderStorage(ctx, b, shelf); // renderStorage(ctx, b, shelf);
}); // });
//
b.append("<div class=\"shifted\">\n"); // b.append("<div class=\"shifted\">\n");
//
storage.loaders().values().stream().sorted(Comparator.comparing(it->it.getName())).forEach(loader -> renderLoader(ctx, b, loader)); // storage.loaders().values().stream().sorted(Comparator.comparing(it->it.getName())).forEach(loader -> renderLoader(ctx, b, loader));
//
b.append("</div>\n"); // b.append("</div>\n");
b.append("</div>\n"); // b.append("</div>\n");
}catch (StorageException ex){ // }catch (StorageException ex){
throw new RuntimeException(ex); // throw new RuntimeException(ex);
} // }
} // }
private void renderLoader(Context ctx, StringBuilder b, Loader loader) { private void renderLoader(Context ctx, StringBuilder b, Loader loader) {
String href = "/storage?path=" + loader.getPath(); String href = "/storage?path=" + loader.getPath();

View File

@ -71,7 +71,7 @@ public class NumassRun implements Annotated, Responder {
public NumassRun(String path, NumassStorage workStorage, MessageFactory factory) throws StorageException { public NumassRun(String path, NumassStorage workStorage, MessageFactory factory) throws StorageException {
this.storage = workStorage; this.storage = workStorage;
this.states = LoaderFactory.buildStateLoder(storage, RUN_STATE, null); this.states = LoaderFactory.buildStateLoder(storage, RUN_STATE, null);
this.noteLoader = LoaderFactory.buildObjectLoder(storage, RUN_NOTES, null); this.noteLoader = (ObjectLoader<NumassNote>) LoaderFactory.buildObjectLoder(storage, RUN_NOTES, null);
this.factory = factory; this.factory = factory;
this.runPath = path; this.runPath = path;
logger = LoggerFactory.getLogger("CURRENT_RUN"); logger = LoggerFactory.getLogger("CURRENT_RUN");

View File

@ -32,7 +32,6 @@ import ratpack.server.RatpackServer;
import ratpack.server.RatpackServerSpec; import ratpack.server.RatpackServerSpec;
import ratpack.server.ServerConfigBuilder; import ratpack.server.ServerConfigBuilder;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.InetAddress; import java.net.InetAddress;
@ -55,11 +54,11 @@ public class NumassServer extends AbstractNetworkListener {
init(storage); init(storage);
} }
public NumassServer(String rootPath, Meta rootConfig, Meta listnerConfig) throws StorageException { // public NumassServer(String rootPath, Meta rootConfig, Meta listnerConfig) throws StorageException {
super(listnerConfig); // super(listnerConfig);
logger.info("Initializing file storage in {}", rootPath); // logger.info("Initializing file storage in {}", rootPath);
init(FileStorage.in(new File(rootPath), rootConfig)); // init(FileStorage.in(new File(rootPath), rootConfig));
} // }
/** /**
* Init the root storage and state loader * Init the root storage and state loader

View File

@ -85,6 +85,7 @@ public class NumassServerDaemon implements Daemon, Annotated {
} }
logger.info("Initializing file storage in {}", repoPath); logger.info("Initializing file storage in {}", repoPath);
root = FileStorage.in(new File(repoPath), repoConfig); root = FileStorage.in(new File(repoPath), repoConfig);
// root.toggleMonitor(true);
} }
@Override @Override

View File

@ -77,6 +77,12 @@ public class NumassStorageHandler extends StorageRatpackHandler {
.putValue("logScale", true) .putValue("logScale", true)
.putValue("format", "scientific") .putValue("format", "scientific")
); );
builder.putNode(new MetaBuilder("hAxis")
.putValue("title", "timestamp")
// .putValue("gridlines.count", -1)
// .putValues("gridlines.units.days.format", "MMM dd")
// .putValues("gridlines.units.hours.format", "HH:mm", "ha")
);
} }
return builder; return builder;
} }