Skip to content
Snippets Groups Projects
Commit 71ba624a authored by Nicola Fulvio Calabria's avatar Nicola Fulvio Calabria
Browse files

added delete collection

parent 71d2497f
No related branches found
No related tags found
No related merge requests found
......@@ -160,7 +160,7 @@ public class VOSpaceClient {
public void deleteCollection(Long id, Optional<String> token) {
HttpRequest request = getRequest("/collections?id="+id, token)
HttpRequest request = getRequest("/collections/"+id, token)
.header("Accept", useJson ? "application/json" : "text/xml")
.header("Content-Type", useJson ? "application/json" : "text/xml")
.DELETE()
......
......@@ -17,7 +17,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
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.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
......@@ -61,4 +63,19 @@ public class NodeCollectionsController extends BaseController {
return ResponseEntity.noContent().build();
}
@DeleteMapping(value = "/collections/{collectionId}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> deleteNodeCollection(User principal,
@PathVariable Long collectionId)
throws Exception
{
LOG.debug("delete collection {} for user {}",
collectionId, principal.getName());
// Call creation logic
client.deleteCollection(collectionId, tokenProvider.getToken());
return ResponseEntity.noContent().build();
}
}
......@@ -128,7 +128,7 @@ export default {
});
},
deleteCollection(collectionId) {
let url = BASE_API_URL + 'collections?id='+collectionId;
let url = BASE_API_URL + 'collections/'+collectionId;
return apiRequest({
method: 'DELETE',
url: url,
......
......@@ -13,16 +13,17 @@
<div v-if="collections.length > 0" class="mb-3">
<table class="table b-table table-striped table-hover">
<thead>
<tr>
<th>Id</th>
<th>Title</th>
<th></th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr v-for="collection in collections" :key="collection.id">
<td>{{collection.id}}</td>
<td>{{collection.title}}</td>
<td></td>
<td><b-icon-trash color="red" @click="deleteCollection(collection.id)"/></td>
</tr>
</tbody>
</table>
......@@ -41,11 +42,13 @@
</template>
<script>
import { BIconTrash } from 'bootstrap-vue'
import FAQModal from './modal/FAQModal.vue'
import CreateCollectionModal from './modal/CreateCollectionModal.vue'
export default {
components: {
BIconTrash,
FAQModal,
CreateCollectionModal
},
......@@ -60,6 +63,9 @@ export default {
methods: {
loadCollections() {
this.$store.dispatch('loadCollections');
},
deleteCollection(id) {
this.$store.dispatch('deleteCollection', id);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment