From 2e9a4a649a0ab78bb9bf0bce157e64abdba978b8 Mon Sep 17 00:00:00 2001 From: Heiko Kernbach Date: Fri, 7 Nov 2014 14:49:25 +0100 Subject: [PATCH 1/2] added feature for truncating a collection --- .../frontend/js/models/arangoCollectionModel.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/js/apps/system/aardvark/frontend/js/models/arangoCollectionModel.js b/js/apps/system/aardvark/frontend/js/models/arangoCollectionModel.js index 4dd7d147d7..399d88c59d 100644 --- a/js/apps/system/aardvark/frontend/js/models/arangoCollectionModel.js +++ b/js/apps/system/aardvark/frontend/js/models/arangoCollectionModel.js @@ -129,10 +129,25 @@ return returnval; }, + truncateCollection: function () { + $.ajax({ + async: false, + cache: false, + type: 'PUT', + url: "/_api/collection/" + this.get("id") + "/truncate", + success: function () { + arangoHelper.arangoNotification('Collection truncated'); + }, + error: function () { + arangoHelper.arangoError('Collection error'); + } + }); + }, + loadCollection: function () { var self = this; $.ajax({ - async:false, + async: false, cache: false, type: 'PUT', url: "/_api/collection/" + this.get("id") + "/load", From 10368540ad15aa8b5bed5e8d6da81bee26c8d08a Mon Sep 17 00:00:00 2001 From: Heiko Kernbach Date: Fri, 7 Nov 2014 14:49:45 +0100 Subject: [PATCH 2/2] added feature for truncating a collection --- .../frontend/js/views/collectionsItemView.js | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/js/apps/system/aardvark/frontend/js/views/collectionsItemView.js b/js/apps/system/aardvark/frontend/js/views/collectionsItemView.js index e622e821d8..7f2ad0108c 100644 --- a/js/apps/system/aardvark/frontend/js/views/collectionsItemView.js +++ b/js/apps/system/aardvark/frontend/js/views/collectionsItemView.js @@ -74,6 +74,12 @@ window.modalView.hide(); }, + truncateCollection: function () { + this.model.truncateCollection(); + this.render(); + window.modalView.hide(); + }, + deleteCollection: function () { this.model.destroy( { @@ -249,6 +255,18 @@ "change-collection-status", "Status", this.model.get('status'), "" ) ); + buttons.push( + window.modalView.createDeleteButton( + "Delete", + this.deleteCollection.bind(this) + ) + ); + buttons.push( + window.modalView.createDeleteButton( + "Truncate", + this.truncateCollection.bind(this) + ) + ); if(collectionIsLoaded) { buttons.push( window.modalView.createNotificationButton( @@ -265,12 +283,6 @@ ); } - buttons.push( - window.modalView.createDeleteButton( - "Delete", - this.deleteCollection.bind(this) - ) - ); buttons.push( window.modalView.createSuccessButton( "Save",