Skip to content

Commit a251f37

Browse files
committed
collection management: delete collection
1 parent 9fb71ba commit a251f37

File tree

5 files changed

+23
-4
lines changed

5 files changed

+23
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ ArangoDB-view is a poc webinterface for [ArangoDB](http://github.com/arangodb/ar
3131
* compaction y/n
3232
* journal size
3333
* index buckets
34+
* delete collections
3435

3536
#### whats next?
3637
* link _from / _to

public/manage/collectionsController.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,15 @@ define(['app'], function (_app) {
151151
scope.loadColDetails(col, true);
152152
});
153153
};
154+
155+
scope.dropCol = function (col, ev) {
156+
ev.stopPropagation();
157+
if (!confirm('delete collection ' + col.name + '?')) return;
158+
http.delete('/_db/' + params.currentDatabase + '/_api/collection/' + col.name).then(function () {
159+
scope.reloadCollections();
160+
messageBroker.pub('collections.reload');
161+
});
162+
};
154163
});
155164

156165
_app2.default.controller('collectionsController', angularModule);

public/manage/collectionsView.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
</div>
9696
</form>
9797

98-
<table class="table table-sm">
98+
<table class="table table-sm table-hover">
9999
<tbody>
100100
<tr data-ng-repeat-start="col in collections | orderBy:orderCollection" data-ng-click="loadColDetails(col, col.expanded = !col.expanded)" style="cursor: pointer;">
101101
<td>
@@ -112,7 +112,7 @@
112112
<i data-ng-if="col.isVolatile" class="fa fa-cloud" title="volatile"></i>
113113
</td> -->
114114
<td>{{col.name}}</td>
115-
<td></td>
115+
<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>
116116
</tr>
117117
<tr data-ng-repeat-end data-ng-if="col.expanded">
118118
<td colspan="100%">

src/src/manage/collectionsController.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,15 @@ angularModule.push((scope, http, params, messageBroker, formatService, q) => {
124124
scope.loadColDetails(col, true);
125125
});
126126
};
127+
128+
scope.dropCol = (col, ev) => {
129+
ev.stopPropagation();
130+
if (! confirm(`delete collection ${col.name}?`)) return;
131+
http.delete(`/_db/${params.currentDatabase}/_api/collection/${col.name}`).then(() => {
132+
scope.reloadCollections();
133+
messageBroker.pub('collections.reload');
134+
});
135+
}
127136
});
128137

129138
app.controller('collectionsController', angularModule);

src/src/manage/collectionsView.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
</div>
9696
</form>
9797

98-
<table class="table table-sm">
98+
<table class="table table-sm table-hover">
9999
<tbody>
100100
<tr data-ng-repeat-start="col in collections | orderBy:orderCollection" data-ng-click="loadColDetails(col, col.expanded = !col.expanded)" style="cursor: pointer;">
101101
<td>
@@ -112,7 +112,7 @@
112112
<i data-ng-if="col.isVolatile" class="fa fa-cloud" title="volatile"></i>
113113
</td> -->
114114
<td>{{col.name}}</td>
115-
<td></td>
115+
<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>
116116
</tr>
117117
<tr data-ng-repeat-end data-ng-if="col.expanded">
118118
<td colspan="100%">

0 commit comments

Comments
 (0)