Loading vospace-ui-backend/src/main/java/it/inaf/ia2/vospace/ui/service/NodeInfo.java +19 −6 Original line number Diff line number Diff line Loading @@ -13,24 +13,25 @@ public class NodeInfo { private final String authority; private final Node node; private final String path; private final String name; private final String size; private final String type; private final String groupRead; private final String groupWrite; private final boolean isPublic; private final boolean asyncTrans; public NodeInfo(Node node, String authority) { this.authority = authority; this.node = node; this.path = getPath(node); this.name = path.substring(path.lastIndexOf("/") + 1); this.size = getSize(node); this.type = node.getType(); this.groupRead = getGroupRead(node); this.groupWrite = getGroupWrite(node); this.isPublic = isPublic(node); this.asyncTrans = isAsyncTrans(node); } private String getPath(Node node) { Loading @@ -55,7 +56,11 @@ public class NodeInfo { } private boolean isPublic(Node node) { return Boolean.parseBoolean(getProperty(node, "ivo://ivoa.net/vospace/core#ispublic").orElse("false")); return getProperty(node, "ivo://ivoa.net/vospace/core#ispublic").map(value -> "t".equals(value)).orElse(false); } private boolean isAsyncTrans(Node node) { return getProperty(node, "urn:async_trans").map(value -> "t".equals(value)).orElse(false); } private Optional<String> getProperty(Node node, String uri) { Loading Loading @@ -97,8 +102,12 @@ public class NodeInfo { return String.format("%.1f %cB", bytes / 1024f, " kMGTPE".charAt(u)); } public String getType() { return node.getType(); public boolean isFolder() { return "vos:ContainerNode".equals(type); } public boolean isFile() { return !"vos:ContainerNode".equals(type); } public String getPath() { Loading @@ -124,4 +133,8 @@ public class NodeInfo { public boolean isPublic() { return isPublic; } public boolean isAsyncTrans() { return asyncTrans; } } vospace-ui-backend/src/main/java/it/inaf/ia2/vospace/ui/service/NodesService.java +13 −3 Original line number Diff line number Diff line Loading @@ -54,7 +54,11 @@ public class NodesService { } String html = "<tr>"; html += "<td><input type=\"checkbox\" data-node=\"" + nodeInfo.getPath() + "\" /></td>"; html += "<td><input type=\"checkbox\" data-node=\"" + nodeInfo.getPath() + "\" "; if (nodeInfo.isAsyncTrans()) { html += "class=\"async\""; } html += "/></td>"; html += "<td>" + getIcon(nodeInfo) + getLink(nodeInfo) + "</td>"; html += "<td>" + nodeInfo.getSize() + "</td>"; html += "<td>" + nodeInfo.getGroupRead() + "</td>"; Loading @@ -65,18 +69,21 @@ public class NodesService { private String getIcon(NodeInfo nodeInfo) { String html = "<span class=\"icon "; if ("vos:ContainerNode".equals(nodeInfo.getType())) { if (nodeInfo.isFolder()) { html += "folder"; } else { html += "file"; } if (nodeInfo.isAsyncTrans()) { html += "-x"; } html += "-icon\"></span> "; return html; } private String getLink(NodeInfo nodeInfo) { if (isDownloadable(nodeInfo)) { if ("vos:ContainerNode".equals(nodeInfo.getType())) { if (nodeInfo.isFolder()) { return "<a href=\"#/nodes" + nodeInfo.getPath() + "\">" + nodeInfo.getName() + "</a>"; } else { return "<a href=\"download" + nodeInfo.getPath() + "\" target=\"blank_\">" + nodeInfo.getName() + "</a>"; Loading @@ -86,6 +93,9 @@ public class NodesService { } private boolean isDownloadable(NodeInfo nodeInfo) { if (nodeInfo.isFile() && nodeInfo.isAsyncTrans()) { return false; } if (nodeInfo.isPublic()) { return true; } Loading vospace-ui-frontend/src/api/mock/data/nodes/folder1.html +2 −2 Original line number Diff line number Diff line <tbody id="nodes"> <tr> <td><input type="checkbox" class="tape" data-node="/folder1/folder2" /></td> <td><input type="checkbox" class="async" data-node="/folder1/folder2" /></td> <td> <span class="icon folder-x-icon"></span> <a href="#/nodes/folder1/folder2">folder2</a> Loading @@ -20,7 +20,7 @@ <td>group2</td> </tr> <tr> <td><input type="checkbox" class="tape" data-node="/folder1/file3" /></td> <td><input type="checkbox" class="async" data-node="/folder1/file3" /></td> <td> <span class="icon file-x-icon"></span> file3 Loading vospace-ui-frontend/src/api/mock/data/nodes/folder2.html +2 −2 Original line number Diff line number Diff line <tbody id="nodes"> <tr> <td><input type="checkbox" class="tape" data-node="/folder1/folder2/file4" /></td> <td><input type="checkbox" class="async" data-node="/folder1/folder2/file4" /></td> <td> <span class="icon file-x-icon"></span> file4 Loading @@ -10,7 +10,7 @@ <td>group2</td> </tr> <tr> <td><input type="checkbox" class="tape" data-node="/folder1/folder2/file5" /></td> <td><input type="checkbox" class="async" data-node="/folder1/folder2/file5" /></td> <td> <span class="icon file-x-icon"></span> file5 Loading vospace-ui-frontend/src/api/mock/index.js +1 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ export default { } return fetch(response); }, startRecallFromTapeJob() { startAsyncRecallJob() { return fetch(job); }, loadJobs() { Loading Loading
vospace-ui-backend/src/main/java/it/inaf/ia2/vospace/ui/service/NodeInfo.java +19 −6 Original line number Diff line number Diff line Loading @@ -13,24 +13,25 @@ public class NodeInfo { private final String authority; private final Node node; private final String path; private final String name; private final String size; private final String type; private final String groupRead; private final String groupWrite; private final boolean isPublic; private final boolean asyncTrans; public NodeInfo(Node node, String authority) { this.authority = authority; this.node = node; this.path = getPath(node); this.name = path.substring(path.lastIndexOf("/") + 1); this.size = getSize(node); this.type = node.getType(); this.groupRead = getGroupRead(node); this.groupWrite = getGroupWrite(node); this.isPublic = isPublic(node); this.asyncTrans = isAsyncTrans(node); } private String getPath(Node node) { Loading @@ -55,7 +56,11 @@ public class NodeInfo { } private boolean isPublic(Node node) { return Boolean.parseBoolean(getProperty(node, "ivo://ivoa.net/vospace/core#ispublic").orElse("false")); return getProperty(node, "ivo://ivoa.net/vospace/core#ispublic").map(value -> "t".equals(value)).orElse(false); } private boolean isAsyncTrans(Node node) { return getProperty(node, "urn:async_trans").map(value -> "t".equals(value)).orElse(false); } private Optional<String> getProperty(Node node, String uri) { Loading Loading @@ -97,8 +102,12 @@ public class NodeInfo { return String.format("%.1f %cB", bytes / 1024f, " kMGTPE".charAt(u)); } public String getType() { return node.getType(); public boolean isFolder() { return "vos:ContainerNode".equals(type); } public boolean isFile() { return !"vos:ContainerNode".equals(type); } public String getPath() { Loading @@ -124,4 +133,8 @@ public class NodeInfo { public boolean isPublic() { return isPublic; } public boolean isAsyncTrans() { return asyncTrans; } }
vospace-ui-backend/src/main/java/it/inaf/ia2/vospace/ui/service/NodesService.java +13 −3 Original line number Diff line number Diff line Loading @@ -54,7 +54,11 @@ public class NodesService { } String html = "<tr>"; html += "<td><input type=\"checkbox\" data-node=\"" + nodeInfo.getPath() + "\" /></td>"; html += "<td><input type=\"checkbox\" data-node=\"" + nodeInfo.getPath() + "\" "; if (nodeInfo.isAsyncTrans()) { html += "class=\"async\""; } html += "/></td>"; html += "<td>" + getIcon(nodeInfo) + getLink(nodeInfo) + "</td>"; html += "<td>" + nodeInfo.getSize() + "</td>"; html += "<td>" + nodeInfo.getGroupRead() + "</td>"; Loading @@ -65,18 +69,21 @@ public class NodesService { private String getIcon(NodeInfo nodeInfo) { String html = "<span class=\"icon "; if ("vos:ContainerNode".equals(nodeInfo.getType())) { if (nodeInfo.isFolder()) { html += "folder"; } else { html += "file"; } if (nodeInfo.isAsyncTrans()) { html += "-x"; } html += "-icon\"></span> "; return html; } private String getLink(NodeInfo nodeInfo) { if (isDownloadable(nodeInfo)) { if ("vos:ContainerNode".equals(nodeInfo.getType())) { if (nodeInfo.isFolder()) { return "<a href=\"#/nodes" + nodeInfo.getPath() + "\">" + nodeInfo.getName() + "</a>"; } else { return "<a href=\"download" + nodeInfo.getPath() + "\" target=\"blank_\">" + nodeInfo.getName() + "</a>"; Loading @@ -86,6 +93,9 @@ public class NodesService { } private boolean isDownloadable(NodeInfo nodeInfo) { if (nodeInfo.isFile() && nodeInfo.isAsyncTrans()) { return false; } if (nodeInfo.isPublic()) { return true; } Loading
vospace-ui-frontend/src/api/mock/data/nodes/folder1.html +2 −2 Original line number Diff line number Diff line <tbody id="nodes"> <tr> <td><input type="checkbox" class="tape" data-node="/folder1/folder2" /></td> <td><input type="checkbox" class="async" data-node="/folder1/folder2" /></td> <td> <span class="icon folder-x-icon"></span> <a href="#/nodes/folder1/folder2">folder2</a> Loading @@ -20,7 +20,7 @@ <td>group2</td> </tr> <tr> <td><input type="checkbox" class="tape" data-node="/folder1/file3" /></td> <td><input type="checkbox" class="async" data-node="/folder1/file3" /></td> <td> <span class="icon file-x-icon"></span> file3 Loading
vospace-ui-frontend/src/api/mock/data/nodes/folder2.html +2 −2 Original line number Diff line number Diff line <tbody id="nodes"> <tr> <td><input type="checkbox" class="tape" data-node="/folder1/folder2/file4" /></td> <td><input type="checkbox" class="async" data-node="/folder1/folder2/file4" /></td> <td> <span class="icon file-x-icon"></span> file4 Loading @@ -10,7 +10,7 @@ <td>group2</td> </tr> <tr> <td><input type="checkbox" class="tape" data-node="/folder1/folder2/file5" /></td> <td><input type="checkbox" class="async" data-node="/folder1/folder2/file5" /></td> <td> <span class="icon file-x-icon"></span> file5 Loading
vospace-ui-frontend/src/api/mock/index.js +1 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ export default { } return fetch(response); }, startRecallFromTapeJob() { startAsyncRecallJob() { return fetch(job); }, loadJobs() { Loading