From 9fa57f4af0a788a632eeebf535c51a30144568e7 Mon Sep 17 00:00:00 2001 From: Heiko Kernbach Date: Mon, 18 Feb 2013 14:44:16 +0100 Subject: [PATCH] logs pages --- frontend/css/documentSourceView.css | 24 +++++++++++++++- frontend/css/documentView.css | 24 ++++++++++++++++ frontend/css/documentsView.css | 6 ++++ frontend/css/logsView.css | 14 ++++++++-- frontend/js/templates/documentSourceView.ejs | 13 +++++++-- frontend/js/templates/documentView.ejs | 29 ++++++++++---------- frontend/js/templates/documentsView.ejs | 2 +- frontend/js/templates/logsView.ejs | 8 ++++-- frontend/js/views/collectionsView.js | 5 +++- frontend/js/views/documentView.js | 4 ++- frontend/js/views/documentsView.js | 6 ++-- frontend/js/views/logsView.js | 11 +++++++- 12 files changed, 115 insertions(+), 31 deletions(-) diff --git a/frontend/css/documentSourceView.css b/frontend/css/documentSourceView.css index 8ff8c82faa..98c26dc3fe 100644 --- a/frontend/css/documentSourceView.css +++ b/frontend/css/documentSourceView.css @@ -1,5 +1,27 @@ #documentSourceBox { - width: 100%; min-height: 400px; + width: 885px; border: 1px solid black; + border-radius: 0; +} + +#saveSourceDoc, #tableView { + float:right; + margin-right: 10px; + margin-top: 11px; + margin-right: 22px; + opacity: 0.3; +} + +#saveSourceDoc:hover, #tableView:hover{ + opacity: 0.8; + cursor: pointer; +} + +#sourceDiv { + margin-top: 10px; + padding: 20px 20px 20px 20px; + min-height: 400px; + background-color: rgba(0, 0, 0, 0.05); + } diff --git a/frontend/css/documentView.css b/frontend/css/documentView.css index e69de29bb2..41c94a27ef 100644 --- a/frontend/css/documentView.css +++ b/frontend/css/documentView.css @@ -0,0 +1,24 @@ +#tableDiv { + margin-top: 10px; + padding: 20px 20px 20px 20px; + background-color: rgba(0, 0, 0, 0.05); +} + +#addDocumentLine, #sourceView { + float:right; + margin-right: 10px; + margin-top: 11px; + margin-right: 22px; + opacity: 0.3; +} + +#addDocumentLine:hover, #sourceView:hover{ + opacity: 0.8; + cursor: pointer; +} + +#deleteRow { + border: medium none; + padding-left: 10px; + background-color: transparent; +} diff --git a/frontend/css/documentsView.css b/frontend/css/documentsView.css index 3232656b86..258cabdd44 100644 --- a/frontend/css/documentsView.css +++ b/frontend/css/documentsView.css @@ -1,3 +1,9 @@ +#deleteDoc, #documentsToolbar button { + border: medium none; + padding-left: 10px; + background-color: transparent; +} + #documentsPlaceholder { } diff --git a/frontend/css/logsView.css b/frontend/css/logsView.css index 80d6c9ff19..cd10783218 100644 --- a/frontend/css/logsView.css +++ b/frontend/css/logsView.css @@ -6,6 +6,10 @@ padding-bottom: 25px; } +#logPages { + float:left; +} + .tab-content { min-height: 290px; } @@ -27,7 +31,6 @@ } #logToolbar { - background-color: rgba(0, 0, 0, 0.05); } .tab-content { @@ -51,11 +54,18 @@ } #logToolbar { + background-color: rgba(0, 0, 0, 0.05); padding-top: 10px; - float:right; background-color: rgba(255, 255, 255, 0) !important; } +#logToolbar button { + float:right; + border: medium none; + padding-left: 10px; + background-color: transparent; +} + #logTableID thead, #infoTableID thead, #debugTableID thead, #critTableID thead, #warnTableID thead { background-color: rgba(255, 255, 255, 0.8) !important; border-bottom: 0 !important; diff --git a/frontend/js/templates/documentSourceView.ejs b/frontend/js/templates/documentSourceView.ejs index 37b5a4eb9b..f311cd3fb0 100644 --- a/frontend/js/templates/documentSourceView.ejs +++ b/frontend/js/templates/documentSourceView.ejs @@ -1,3 +1,10 @@ - - - + + +
+ +
diff --git a/frontend/js/templates/documentView.ejs b/frontend/js/templates/documentView.ejs index bdd2a55892..510b3d6b52 100644 --- a/frontend/js/templates/documentView.ejs +++ b/frontend/js/templates/documentView.ejs @@ -1,20 +1,19 @@ - - - - - - - - - - - - - -
KeyValuetype
+
+ + + + + + + + + +
KeyValuetype
+
diff --git a/frontend/js/templates/documentsView.ejs b/frontend/js/templates/documentsView.ejs index 58680c4e1a..a5f036390f 100644 --- a/frontend/js/templates/documentsView.ejs +++ b/frontend/js/templates/documentsView.ejs @@ -8,11 +8,11 @@ + -
_id _key _rev Content
diff --git a/frontend/js/templates/logsView.ejs b/frontend/js/templates/logsView.ejs index 06b51341cf..f33cbb4dad 100644 --- a/frontend/js/templates/logsView.ejs +++ b/frontend/js/templates/logsView.ejs @@ -67,10 +67,12 @@
- - - +
+
+ + +
diff --git a/frontend/js/views/collectionsView.js b/frontend/js/views/collectionsView.js index 77861343f8..dfaa06ec82 100644 --- a/frontend/js/views/collectionsView.js +++ b/frontend/js/views/collectionsView.js @@ -39,9 +39,12 @@ var collectionsView = Backbone.View.extend({ this.render(); } }, - restrictToSearchPhrase: function() { + var searchPhrase = this.searchPhrase; this.searchPhrase = $('#searchInput').val().replace(/(^\s+|\s+$)/g, ''); + if (searchPhrase === this.searchPhrase) { + return; + } this.render(); }, diff --git a/frontend/js/views/documentView.js b/frontend/js/views/documentView.js index 5f0e1350d0..835e554be9 100644 --- a/frontend/js/views/documentView.js +++ b/frontend/js/views/documentView.js @@ -119,6 +119,7 @@ var documentView = Backbone.View.extend({ return ("" + value + ""); case 'object': if (value instanceof Array) { + window.arangoDocumentStore.saveDocument(); return ("" + self.escaped(JSON.stringify(value)) + ""); } else { @@ -142,6 +143,7 @@ var documentView = Backbone.View.extend({ result[row_data[1]] = JSON.parse(row_data[3]); } window.arangoDocumentStore.updateLocalDocument(result); + this.saveDocument(); }, makeEditable: function () { @@ -170,7 +172,7 @@ var documentView = Backbone.View.extend({ var test = self.getTypedValue(value); if (String(value) == String(oldContent)) { // no change - return value2html(oldContent); + return self.value2html(oldContent); } else { // change update hidden row diff --git a/frontend/js/views/documentsView.js b/frontend/js/views/documentsView.js index d2df035c48..c567365299 100644 --- a/frontend/js/views/documentsView.js +++ b/frontend/js/views/documentsView.js @@ -75,7 +75,7 @@ var documentsView = Backbone.View.extend({ var self = a.currentTarget; var aPos = $(this.table).dataTable().fnGetPosition(self); var rowContent = $(this.table).dataTable().fnGetData(aPos); - window.location.hash = "#collection/" + rowContent[0]; + window.location.hash = "#collection/" + rowContent[1]; }, initTable: function (colid, pageid) { @@ -107,11 +107,11 @@ var documentsView = Backbone.View.extend({ var self = this; $.each(window.arangoDocumentsStore.models, function(key, value) { $(self.table).dataTable().fnAddData([ + '', value.attributes.id, value.attributes.key, value.attributes.rev, - '
' + self.cutByResolution(JSON.stringify(value.attributes.content)) + '
', - '' + '
' + self.cutByResolution(JSON.stringify(value.attributes.content)) + '
' ]); }); $(".prettify").snippet("javascript", {style: "nedit", menu: false, startText: false, transparent: true, showNum: false}); diff --git a/frontend/js/views/logsView.js b/frontend/js/views/logsView.js index 1c522da3f9..9712171aee 100644 --- a/frontend/js/views/logsView.js +++ b/frontend/js/views/logsView.js @@ -129,10 +129,19 @@ var logsView = Backbone.View.extend({ drawTable: function () { var self = this; $.each(window.arangoLogsStore.models, function(key, value) { - $('#'+self.table).dataTable().fnAddData([value.attributes.level, value.attributes.text]); + var convertedLog = self.convertLogStatus(value.attributes.level); + $('#'+self.table).dataTable().fnAddData([convertedLog, value.attributes.text]); }); + $('#logPages').html('Showing Page: '+this.page+' of '+this.totalPages); }, clearTable: function () { $('#'+this.table).dataTable().fnClearTable(); + }, + convertLogStatus: function (status) { + if (status === 1) { return "Error" ;} + else if (status === 2) { return "Warning" ;} + else if (status === 3) { return "Info" ;} + else if (status === 4) { return "Debug" ;} + else { return "Unknown";} } });