Commit 3fbdfe28 authored by Jasper Koehorst's avatar Jasper Koehorst
Browse files

dashboard and archive update

parent 70d826b0
package nl.fairbydesign.backend.ncbi.objects.esample;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
public class RUNSET{
@JsonProperty("RUN")
public RUN getRUN() {
public ArrayList<RUN> getRUN() {
return this.rUN; }
public void setRUN(RUN rUN) {
public void setRUN(ArrayList<RUN> rUN) {
this.rUN = rUN; }
RUN rUN;
}
}
ArrayList<RUN> rUN = new ArrayList<>();
}
\ No newline at end of file
......@@ -28,6 +28,7 @@ import org.irods.jargon.core.pub.IRODSFileSystem;
import org.irods.jargon.core.pub.domain.AvuData;
import org.irods.jargon.core.pub.io.IRODSFile;
import org.irods.jargon.core.pub.io.IRODSFileFactory;
import org.irods.jargon.core.query.MetaDataAndDomainData;
import org.jboss.logging.Logger;
import java.util.ArrayList;
......@@ -144,6 +145,7 @@ public class Archive extends Div {
});
dual.addClickListener(clicked -> {
// Set metadata to dual store (disk and archive)
Notification.show("Disk & Tape clicked");
sendTo(credentials, grid.getSelectedItems(), "to_dual");
// Force refresh of grid
searchButton.clickInClient();
......@@ -164,12 +166,26 @@ public class Archive extends Div {
IRODSAccessObjectFactory accessObjectFactory = IRODSFileSystem.instance().getIRODSAccessObjectFactory();
for (File file : files) {
IRODSFile irodsFile = fileFactory.instanceIRODSFile(file.getPath());
AvuData avuData = new AvuData();
avuData.setAttribute("RESOURCE");
avuData.setValue(value);
avuData.setUnit("");
AvuData newAvuData = new AvuData();
newAvuData.setAttribute("RESOURCE");
newAvuData.setValue(value);
newAvuData.setUnit("");
DataObjectAO dataObjectAO = accessObjectFactory.getDataObjectAO(credentials.getIrodsAccount());
dataObjectAO.addAVUMetadata(file.getPath(), avuData);
boolean replaced = false;
for (MetaDataAndDomainData metaDataAndDomainData : dataObjectAO.findMetadataValuesForDataObject(irodsFile)) {
AvuData avuDataIrodsFile = metaDataAndDomainData.asAvu();
if (avuDataIrodsFile.getAttribute().contentEquals("RESOURCE")) {
// Replace AVU object by this new one
logger.info("Replacing AVU RESOURCE object");
dataObjectAO.modifyAVUMetadata(irodsFile.getAbsolutePath(), avuDataIrodsFile, newAvuData);
replaced = true;
break;
}
}
if (!replaced) {
logger.info("Adding AVU RESOURCE object");
dataObjectAO.addAVUMetadata(file.getPath(), newAvuData);
}
}
} catch (JargonException e) {
e.printStackTrace();
......
......@@ -27,6 +27,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import static nl.fairbydesign.backend.irods.Data.getDiskUsage;
import static nl.fairbydesign.backend.irods.Data.getJobInformation;
/**
......@@ -51,7 +52,7 @@ public class DashboardView extends Div {
// Drop down menu for projects?
ArrayList<Process> processes = Data.getPIS(credentials.getIrodsAccount());
// Obtain disk usage overview
// Obtain disk usage overview for project and investigation in landingzone and projects
ArrayList<DiskUsage> diskUsages = new ArrayList<>();
HashSet<String> diskUsageAnalysed = new HashSet<>();
for (Process process : processes) {
......@@ -102,10 +103,33 @@ public class DashboardView extends Div {
diskUsageGrid.removeAllColumns();
diskUsageGrid.addColumn(DiskUsage::getProject).setHeader("Project");
diskUsageGrid.addColumn(DiskUsage::getInvestigation).setHeader("Investigation");
diskUsageGrid.addColumn(DiskUsage::getSize).setHeader("Size (GB)");
diskUsageGrid.addColumn(DiskUsage::getTapeSize).setHeader("Tape size (GB)");
diskUsageGrid.addColumn(DiskUsage::getDiskSize).setHeader("Disk size (GB)");
add(diskUsageGrid);
// Obtain overall disk usage
try {
Process process = new Process();
process.setProjectIdentifier("%");
process.setInvestigationIdentifier("%");
ArrayList<DiskUsage> irodsUsages = new ArrayList<>();
irodsUsages.add(getDiskUsage(credentials.getIrodsAccount(), process));
Grid<DiskUsage> iRODSUsageGrid = new Grid<>(DiskUsage.class);
iRODSUsageGrid.setItems(irodsUsages);
iRODSUsageGrid.removeAllColumns();
iRODSUsageGrid.addColumn(DiskUsage::getProject).setHeader("Project");
iRODSUsageGrid.addColumn(DiskUsage::getInvestigation).setHeader("Investigation");
iRODSUsageGrid.addColumn(DiskUsage::getTapeSize).setHeader("Tape size (GB)");
iRODSUsageGrid.addColumn(DiskUsage::getDiskSize).setHeader("Disk size (GB)");
add(iRODSUsageGrid);
} catch (GenQueryBuilderException | JargonException | JargonQueryException e) {
e.printStackTrace();
}
} else {
add(new Label("To use this you need to login first..."));
Button button = new Button("Login", event -> UI.getCurrent().navigate("login"));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment