1
0
Fork 0

Merge branch 'devel' of https://github.com/triAGENS/ArangoDB into devel

This commit is contained in:
Heiko Kernbach 2013-02-26 14:10:36 +01:00
commit ada93c9c0e
16 changed files with 158 additions and 90 deletions

View File

@ -424,8 +424,8 @@ unittests-import:
$(VALGRIND) @builddir@/bin/arangosh $(CLIENT_OPT) --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --javascript.unit-tests @top_srcdir@/js/server/tests/import-setup.js || test "x$(FORCE)" == "x1"
for i in 1 2 3 4; do $(VALGRIND) @builddir@/bin/arangoimp --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --file UnitTests/import-$$i.json --collection UnitTestsImportJson$$i --type json || test "x$(FORCE)" == "x1"; done
for i in 1 2; do $(VALGRIND) @builddir@/bin/arangoimp --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --file UnitTests/import-$$i.csv --collection UnitTestsImportCsv$$i --create-collection true --type csv || test "x$(FORCE)" == "x1"; done
for i in 1 2; do $(VALGRIND) @builddir@/bin/arangoimp --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --file UnitTests/import-$$i.tsv --collection UnitTestsImportTsv$$i --create-collection true --type tsv --eol "\r\n" || test "x$(FORCE)" == "x1"; done
$(VALGRIND) @builddir@/bin/arangoimp --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --file UnitTests/import-edges.json --collection UnitTestsImportEdge --create-collection false --type json --eol "\r\n" || test "x$(FORCE)" == "x1"
for i in 1 2; do $(VALGRIND) @builddir@/bin/arangoimp --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --file UnitTests/import-$$i.tsv --collection UnitTestsImportTsv$$i --create-collection true --type tsv || test "x$(FORCE)" == "x1"; done
$(VALGRIND) @builddir@/bin/arangoimp --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --file UnitTests/import-edges.json --collection UnitTestsImportEdge --create-collection false --type json || test "x$(FORCE)" == "x1"
$(VALGRIND) @builddir@/bin/arangosh $(CLIENT_OPT) --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --javascript.unit-tests @top_srcdir@/js/server/tests/import.js || test "x$(FORCE)" == "x1"
$(VALGRIND) @builddir@/bin/arangosh $(CLIENT_OPT) --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --javascript.unit-tests @top_srcdir@/js/server/tests/import-teardown.js || test "x$(FORCE)" == "x1"

View File

@ -20,7 +20,6 @@
}
.span3 a {
color: black;
border: 0;
box-shadow: 0 0 0 !important;
}

View File

@ -59,7 +59,7 @@
margin-top: 3px;
padding: 2px;
vertical-align: middle;
width:280px;
}
#searchSubmit {
@ -106,6 +106,10 @@
margin:5px 0;
}
#transparentHeader .pagination ul > li > a {
font-size:1.8em;
}
#transparentHeader .btn-group {
margin-top:4px;
}

View File

@ -22,9 +22,12 @@
}
#sourceDiv {
margin-top: 10px;
margin-top: -40px;
padding: 20px 20px 20px 20px;
min-height: 400px;
position: relative;
z-index: 900;
/* background-color: rgba(0, 0, 0, 0.05);*/
}

View File

@ -1,17 +1,13 @@
#tableDiv {
margin-top: 10px;
margin-top: -40px;
padding: 20px 20px 20px 20px;
background-color: rgba(0, 0, 0, 0.05);
position: relative;
z-index: 900;
}
#addDocumentLine, #sourceView {
margin-right: 10px;
margin-right: 22px;
opacity: 0.3;
}
#addDocumentLine:hover, #sourceView:hover{
opacity: 0.8;
cursor: pointer;
}

View File

@ -46,6 +46,11 @@ body {
width: 100%;
}
.form-actions {
background-color: #FFFFFF;
border:none;
}
/* ICONS */
.icon-info-sign:hover {
cursor: pointer;

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -2,7 +2,16 @@
/*global require, exports */
window.arangoCollections = Backbone.Collection.extend({
url: '/_api/collection',
model: arangoCollection,
searchOptions : {
searchPhrase: null,
includeSystem: false,
includeLoaded: true,
includeUnloaded: true
},
comparator : function(model) {
return model.get('name').toLowerCase();
},
@ -50,6 +59,55 @@ window.arangoCollections = Backbone.Collection.extend({
return response.collections;
},
getPosition : function (name) {
var list = this.getFiltered(this.searchOptions), i;
var prev = null;
var next = null;
for (i = 0; i < list.length; ++i) {
if (list[i].get('name') === name) {
if (i > 0) {
prev = list[i - 1];
}
if (i < list.length - 1) {
next = list[i + 1];
}
}
}
return { prev: prev, next: next };
},
getFiltered : function (options) {
var result = [ ];
var searchPhrase = '';
if (options.searchPhrase !== null) {
searchPhrase = options.searchPhrase.toLowerCase();
}
this.models.forEach(function (model) {
if (searchPhrase !== '' && model.get('name').toLowerCase().indexOf(searchPhrase) === -1) {
// search phrase entered but current collection does not match?
return;
}
if (options.includeSystem === false && model.get('isSystem')) {
// system collection?
return;
}
if (options.includeLoaded === false && model.get('status') === 'loaded') {
return;
}
if (options.includeUnloaded === false && model.get('status') === 'unloaded') {
return;
}
result.push(model);
});
return result;
},
getProperties: function (id) {
var data2;
$.ajax({

View File

@ -84,6 +84,7 @@ $(document).ready(function() {
this.newCollectionView.render();
},
documents: function(colid, pageid) {
window.documentsView.colid = colid;
window.documentsView.render();
window.arangoDocumentsStore.getDocuments(colid, pageid);
if (!window.documentsView) {

View File

@ -1,14 +1,17 @@
<a href="#collection/<%= attributes.name %>/documents/1" class="thumbnail plain">
<img src="<%= attributes.picture %>" height="60" width="60" alt="" class="icon">
<span class="badge badge-success <%= attributes.status %>"><div class="cornered"><%= attributes.status %></div></span>
<h5 class="collectionName">
<a href="#collection/<%= attributes.id %>" class="pull-right" style="width:14px; height:14px;">
<i class="icon-info-sign icon-white"></i>
</a>
<div class="pull-left"><%= attributes.name %></div>
</h5>
<div class="pull-right">
<a href="#collection/<%= attributes.id %>">
<i class="icon-info-sign"></i>
</a>
</div>
<a href="#collection/<%= attributes.name %>/documents/1" class="plain">
<img src="img/icon_arango.png" height="60" width="60" alt="" class="icon">
<span class="badge badge-success"><div class="cornered"><%= attributes.status %></div></span>
<h5 class="collectionName">
<div class="pull-left"><%= attributes.name %></div>
</h5>
</a>
</a>

View File

@ -3,8 +3,8 @@
<!-- /btn-group -->
<div class="btn-group pull-right">
<button class="btn btn-small">Filter:</button>
<button data-toggle="dropdown" class="btn btn-small dropdown-toggle"><span class="caret"></span></button>
<button class="btn btn-inverse btn-small">Filter:</button>
<button data-toggle="dropdown" class="btn btn-inverse btn-small dropdown-toggle"><span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a href="#"><label class="checkbox"><input type="checkbox" id="checkSystem">System</label></a></li>
@ -16,7 +16,7 @@
<div id="transparentPlaceholder">
<input type="text" id="searchInput" class="searchInput" placeholder="Search..."><img id="searchSubmit" width="16" height="16" src="/_admin/html/img/enter_icon.png" style="padding:0;">
<input type="text" id="searchInput" class="searchInput" placeholder="Search..."><img id="searchSubmit" width="16" height="16" src="/_admin/html/img/enter_icon.png">
</div>

View File

@ -12,8 +12,11 @@
</ul>
<div id="sourceEditor">
</div>
<div class="form-actions">
<a href="#" class="btn btn-primary pull-right">Save</a>
</div>
</div>

View File

@ -2,8 +2,8 @@
<div id="transparentHeader">
<div id="documentsToolbar" class="pagination pagination-small pagination-right">
<ul>
<li class="enabled"><a href="#">&lsaquo;</a></li>
<li class="enabled"><a href="#">&rsaquo;</a></li>
<li class="enabled"><a id="collectionPrev">&lsaquo;</a></li>
<li class="enabled"><a id="collectionNext">&rsaquo;</a></li>
</ul>
</div>
</div>

View File

@ -2,13 +2,6 @@ var collectionsView = Backbone.View.extend({
el: '#content',
el2: '.thumbnails',
searchOptions: {
searchPhrase: null,
includeSystem: false,
includeLoaded: true,
includeUnloaded: true
},
init: function () {
},
@ -18,36 +11,14 @@ var collectionsView = Backbone.View.extend({
$(this.el).html(this.template.text);
this.setFilterValues();
var searchPhrase = '';
if (this.searchOptions.searchPhrase !== null) {
searchPhrase = this.searchOptions.searchPhrase.toLowerCase();
}
this.collection.each(function (arango_collection) {
if (arango_collection.get('name').substr(0,1) === "_") {
}
if (searchPhrase !== '' && arango_collection.get('name').toLowerCase().indexOf(searchPhrase) === -1) {
// search phrase entered but current collection does not match?
return;
}
if (this.searchOptions.includeSystem === false && arango_collection.get('isSystem')) {
// system collection?
return;
}
if (this.searchOptions.includeLoaded === false && arango_collection.get('status') === 'loaded') {
return;
}
if (this.searchOptions.includeUnloaded === false && arango_collection.get('status') === 'unloaded') {
return;
}
var searchOptions = this.collection.searchOptions;
this.collection.getFiltered(searchOptions).forEach(function (arango_collection) {
$('.thumbnails', this.el).append(new window.CollectionListItemView({model: arango_collection}).render().el);
}, this);
$('.thumbnails', this.el).append('<li class="span3"><a href="#new" class="add"><img id="newCollection" src="/_admin/html/img/plus_icon.png" class="pull-left"></img>Add Collection</a></li>');
$('#searchInput').val(this.searchOptions.searchPhrase);
$('#searchInput').val(searchOptions.searchPhrase);
$('#searchInput').focus();
var val = $('#searchInput').val();
$('#searchInput').val('');
@ -67,53 +38,50 @@ var collectionsView = Backbone.View.extend({
"click #checkUnloaded" : "checkUnloaded"
},
checkSystem: function () {
var oldValue = this.searchOptions.includeSystem;
if ($('#checkSystem').is(":checked") === true) {
this.searchOptions.includeSystem = true;
}
else {
this.searchOptions.includeSystem = false;
}
if (oldValue != this.searchOptions.includeSystem) {
var searchOptions = this.collection.searchOptions;
var oldValue = searchOptions.includeSystem;
searchOptions.includeSystem = ($('#checkSystem').is(":checked") === true);
if (oldValue != searchOptions.includeSystem) {
this.render();
}
},
checkLoaded: function () {
var oldValue = this.searchOptions.includeLoaded;
if ($('#checkLoaded').is(":checked") === true) {
this.searchOptions.includeLoaded = true;
}
else {
this.searchOptions.includeLoaded = false;
}
if (oldValue != this.searchOptions.includeLoaded) {
var searchOptions = this.collection.searchOptions;
var oldValue = searchOptions.includeLoaded;
searchOptions.includeLoaded = ($('#checkLoaded').is(":checked") === true);
if (oldValue != searchOptions.includeLoaded) {
this.render();
}
},
checkUnloaded: function () {
var oldValue = this.searchOptions.includeUnloaded;
if ($('#checkUnloaded').is(":checked") === true) {
this.searchOptions.includeUnloaded = true;
}
else {
this.searchOptions.includeUnloaded = false;
}
if (oldValue != this.searchOptions.includeUnloaded) {
var searchOptions = this.collection.searchOptions;
var oldValue = searchOptions.includeUnloaded;
searchOptions.includeUnloaded = ($('#checkUnloaded').is(":checked") === true);
if (oldValue != searchOptions.includeUnloaded) {
this.render();
}
},
setFilterValues: function () {
$('#checkLoaded').attr('checked', this.searchOptions.includeLoaded);
$('#checkUnloaded').attr('checked', this.searchOptions.includeUnloaded);
$('#checkSystem').attr('checked', this.searchOptions.includeSystem);
var searchOptions = this.collection.searchOptions;
$('#checkLoaded').attr('checked', searchOptions.includeLoaded);
$('#checkUnloaded').attr('checked', searchOptions.includeUnloaded);
$('#checkSystem').attr('checked', searchOptions.includeSystem);
},
search: function () {
var searchOptions = this.collection.searchOptions;
var searchPhrase = $('#searchInput').val().replace(/(^\s+|\s+$)/g, '');
if (searchPhrase === this.searchOptions.searchPhrase) {
if (searchPhrase === searchOptions.searchPhrase) {
return;
}
this.searchOptions.searchPhrase = searchPhrase;
searchOptions.searchPhrase = searchPhrase;
this.render();
},

View File

@ -4,12 +4,20 @@ var documentsView = Backbone.View.extend({
documentsPerPage: 10,
totalPages: 1,
collectionContext : {
prev: null,
next: null
},
alreadyClicked: false,
el: '#content',
table: '#documentsTableID',
events: {
"click #collectionPrev" : "prevCollection",
"click #collectionNext" : "nextCollection",
"click #documentsTableID tr" : "clicked",
"click #deleteDoc" : "remove",
"click #plusIconDoc" : "addDocument",
@ -20,6 +28,23 @@ var documentsView = Backbone.View.extend({
"click #documents_next" : "nextDocuments",
"click #confirmDeleteBtn" : "confirmDelete"
},
buildCollectionLink : function (collection) {
return "#collection/" + encodeURIComponent(collection.get('name')) + '/documents/1';
},
prevCollection : function () {
if (this.collectionContext.prev !== null) {
window.location.hash = this.buildCollectionLink(this.collectionContext.prev);
}
},
nextCollection : function () {
if (this.collectionContext.next !== null) {
window.location.hash = this.buildCollectionLink(this.collectionContext.next);
}
},
addDocument: function () {
var collid = window.location.hash.split("/")[1];
window.arangoDocumentStore.addDocument(collid);
@ -148,16 +173,19 @@ var documentsView = Backbone.View.extend({
template: new EJS({url: '/_admin/html/js/templates/documentsView.ejs'}),
render: function() {
this.collectionContext = window.arangoCollectionsStore.getPosition(this.colid);
$(this.el).html(this.template.text);
this.breadcrumb();
return this;
},
breadcrumb: function () {
var name = window.location.hash.split("/")[1];
$('#transparentHeader').append(
'<div class="breadcrumb">'+
'<a class="activeBread" href="#">Collections</a>'+
' > '+
' &gt; '+
'<a class="disabledBread">'+name+'</a>'+
'</div>'
);