Skip to content

Commit

Permalink
collection management: delete collection
Browse files Browse the repository at this point in the history
  • Loading branch information
baslr committed Feb 25, 2016
1 parent 9fb71ba commit a251f37
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ ArangoDB-view is a poc webinterface for [ArangoDB](http://github.com/arangodb/ar
* compaction y/n
* journal size
* index buckets
* delete collections

#### whats next?
* link _from / _to
Expand Down
9 changes: 9 additions & 0 deletions public/manage/collectionsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,15 @@ define(['app'], function (_app) {
scope.loadColDetails(col, true);
});
};

scope.dropCol = function (col, ev) {
ev.stopPropagation();
if (!confirm('delete collection ' + col.name + '?')) return;
http.delete('/_db/' + params.currentDatabase + '/_api/collection/' + col.name).then(function () {
scope.reloadCollections();
messageBroker.pub('collections.reload');
});
};
});

_app2.default.controller('collectionsController', angularModule);
Expand Down
4 changes: 2 additions & 2 deletions public/manage/collectionsView.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
</div>
</form>

<table class="table table-sm">
<table class="table table-sm table-hover">
<tbody>
<tr data-ng-repeat-start="col in collections | orderBy:orderCollection" data-ng-click="loadColDetails(col, col.expanded = !col.expanded)" style="cursor: pointer;">
<td>
Expand All @@ -112,7 +112,7 @@
<i data-ng-if="col.isVolatile" class="fa fa-cloud" title="volatile"></i>
</td> -->
<td>{{col.name}}</td>
<td></td>
<td><button class="btn btn-secondary btn-sm" title="delete collection {{col.name}}" data-ng-click="dropCol(col, $event)"><i class="fa fa-trash"></i></button></td>
</tr>
<tr data-ng-repeat-end data-ng-if="col.expanded">
<td colspan="100%">
Expand Down
9 changes: 9 additions & 0 deletions src/src/manage/collectionsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@ angularModule.push((scope, http, params, messageBroker, formatService, q) => {
scope.loadColDetails(col, true);
});
};

scope.dropCol = (col, ev) => {
ev.stopPropagation();
if (! confirm(`delete collection ${col.name}?`)) return;
http.delete(`/_db/${params.currentDatabase}/_api/collection/${col.name}`).then(() => {
scope.reloadCollections();
messageBroker.pub('collections.reload');
});
}
});

app.controller('collectionsController', angularModule);
4 changes: 2 additions & 2 deletions src/src/manage/collectionsView.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
</div>
</form>

<table class="table table-sm">
<table class="table table-sm table-hover">
<tbody>
<tr data-ng-repeat-start="col in collections | orderBy:orderCollection" data-ng-click="loadColDetails(col, col.expanded = !col.expanded)" style="cursor: pointer;">
<td>
Expand All @@ -112,7 +112,7 @@
<i data-ng-if="col.isVolatile" class="fa fa-cloud" title="volatile"></i>
</td> -->
<td>{{col.name}}</td>
<td></td>
<td><button class="btn btn-secondary btn-sm" title="delete collection {{col.name}}" data-ng-click="dropCol(col, $event)"><i class="fa fa-trash"></i></button></td>
</tr>
<tr data-ng-repeat-end data-ng-if="col.expanded">
<td colspan="100%">
Expand Down

0 comments on commit a251f37

Please sign in to comment.