Commit 93f1d1f0 authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Implemented delete node modal dialog and calls

parent 13aecebc
Loading
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@ import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.concurrent.CompletionException;
@@ -27,7 +26,6 @@ import javax.servlet.http.HttpSession;
import javax.xml.bind.JAXB;
import net.ivoa.xml.uws.v1.JobSummary;
import net.ivoa.xml.uws.v1.Jobs;
import net.ivoa.xml.uws.v1.ShortJobDescription;
import net.ivoa.xml.vospace.v2.Node;
import net.ivoa.xml.vospace.v2.Protocol;
import net.ivoa.xml.vospace.v2.Transfer;
@@ -116,6 +114,17 @@ public class VOSpaceClient {
        return call(request, BodyHandlers.ofInputStream(), 200, res -> unmarshal(res, Node.class));
    }
    
    public void deleteNode(String path) {

        HttpRequest request = getRequest("/nodes" + path)
                .header("Accept", useJson ? "application/json" : "text/xml")
                .header("Content-Type", useJson ? "application/json" : "text/xml")
                .DELETE()
                .build();

        call(request, BodyHandlers.ofInputStream(), 200, res -> null);
    }

    public List<Job> getJobs() {

        HttpRequest request = getRequest("/transfers?direction=pullToVoSpace")
+7 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -50,6 +51,12 @@ public class NodesController extends BaseController {
        return nodesService.generateNodesHtml(path);
    }

    @DeleteMapping(value = {"/nodes", "/nodes/**"})
    public void deleteNode() {
        String path = getPath("/nodes/");
        client.deleteNode(path);
    }
    
    @GetMapping(value = "/download/**")
    public ResponseEntity<?> directDownload() {

+1 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ public class NodesService {
        html += "<td>" + nodeInfo.getSize() + "</td>";
        html += "<td>" + nodeInfo.getGroupRead() + "</td>";
        html += "<td>" + nodeInfo.getGroupWrite() + "</td>";
        html += "<td><span class=\"icon trash-icon pointer\" onclick=\"deleteNode('" + nodeInfo.getPath() + "')\"></span></td>";
        html += "</tr>";
        return html;
    }
+3 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@
    <td>0 B</td>
    <td>group1</td>
    <td>group2</td>
    <td></td>
  </tr>
  <tr>
    <td><input type="checkbox" data-node="/folder1/file2" /></td>
@@ -18,6 +19,7 @@
    <td>30 KB</td>
    <td>group1</td>
    <td>group2</td>
    <td></td>
  </tr>
  <tr>
    <td><input type="checkbox" class="async" data-node="/folder1/file3" /></td>
@@ -28,5 +30,6 @@
    <td>12 MB</td>
    <td>group3</td>
    <td>group4</td>
    <td></td>
  </tr>
</tbody>
+2 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@
    <td>10 KB</td>
    <td>group1</td>
    <td>group2</td>
    <td></td>
  </tr>
  <tr>
    <td><input type="checkbox" class="async" data-node="/folder1/folder2/file5" /></td>
@@ -18,5 +19,6 @@
    <td>15 MB</td>
    <td>group3</td>
    <td>group4</td>
    <td></td>
  </tr>
</tbody>
Loading