mirror of https://gitee.com/bigwinds/arangodb
added dolphin test suite (incl. jslint) for webinterface
This commit is contained in:
parent
a10c802c07
commit
771b6873e5
|
@ -1,3 +1,7 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
||||||
|
/*global require, exports, Backbone, window, arangoCollection, $, arangoHelper, data */
|
||||||
|
/*global arrayContainer:true, SliderInstance:true, DomObjects:true */
|
||||||
|
|
||||||
arangoHelper = {
|
arangoHelper = {
|
||||||
CollectionTypes: {},
|
CollectionTypes: {},
|
||||||
systemAttributes: function () {
|
systemAttributes: function () {
|
||||||
|
@ -5,8 +9,6 @@ arangoHelper = {
|
||||||
'_id' : true,
|
'_id' : true,
|
||||||
'_rev' : true,
|
'_rev' : true,
|
||||||
'_key' : true,
|
'_key' : true,
|
||||||
'_from' : true,
|
|
||||||
'_to' : true,
|
|
||||||
'_bidirectional' : true,
|
'_bidirectional' : true,
|
||||||
'_vertices' : true,
|
'_vertices' : true,
|
||||||
'_from' : true,
|
'_from' : true,
|
||||||
|
@ -43,25 +45,26 @@ arangoHelper = {
|
||||||
},
|
},
|
||||||
|
|
||||||
collectionApiType: function (identifier) {
|
collectionApiType: function (identifier) {
|
||||||
if (this.CollectionTypes[identifier] == undefined) {
|
if (this.CollectionTypes[identifier] === undefined) {
|
||||||
this.CollectionTypes[identifier] = window.arangoDocumentStore.getCollectionInfo(identifier).type;
|
this.CollectionTypes[identifier] = window.arangoDocumentStore
|
||||||
|
.getCollectionInfo(identifier).type;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.CollectionTypes[identifier] == 3) {
|
if (this.CollectionTypes[identifier] === 3) {
|
||||||
return "edge";
|
return "edge";
|
||||||
}
|
}
|
||||||
return "document";
|
return "document";
|
||||||
},
|
},
|
||||||
|
|
||||||
collectionType: function (val) {
|
collectionType: function (val) {
|
||||||
if (! val || val.name == '') {
|
if (! val || val.name === '') {
|
||||||
return "-";
|
return "-";
|
||||||
}
|
}
|
||||||
var type;
|
var type;
|
||||||
if (val.type == 2) {
|
if (val.type === 2) {
|
||||||
type = "document";
|
type = "document";
|
||||||
}
|
}
|
||||||
else if (val.type == 3) {
|
else if (val.type === 3) {
|
||||||
type = "edge";
|
type = "edge";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -73,6 +76,104 @@ arangoHelper = {
|
||||||
}
|
}
|
||||||
|
|
||||||
return type;
|
return type;
|
||||||
|
},
|
||||||
|
|
||||||
|
FormatJSON: function (oData, sIndent) {
|
||||||
|
var self = this;
|
||||||
|
var sHTML, iCount;
|
||||||
|
if (sIndent === undefined) {
|
||||||
|
sIndent = "";
|
||||||
|
}
|
||||||
|
var sIndentStyle = " ";
|
||||||
|
var sDataType = arangoHelper.RealTypeOf(oData);
|
||||||
|
|
||||||
|
if (sDataType === "array") {
|
||||||
|
if (oData.length === 0) {
|
||||||
|
return "[]";
|
||||||
|
}
|
||||||
|
sHTML = "[";
|
||||||
|
} else {
|
||||||
|
iCount = 0;
|
||||||
|
$.each(oData, function() {
|
||||||
|
iCount++;
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
if (iCount === 0) { // object is empty
|
||||||
|
return "{}";
|
||||||
|
}
|
||||||
|
sHTML = "{";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
iCount = 0;
|
||||||
|
$.each(oData, function(sKey, vValue) {
|
||||||
|
if (iCount > 0) {
|
||||||
|
sHTML += ",";
|
||||||
|
}
|
||||||
|
if (sDataType === "array") {
|
||||||
|
sHTML += ("\n" + sIndent + sIndentStyle);
|
||||||
|
} else {
|
||||||
|
sHTML += ("\n" + sIndent + sIndentStyle + JSON.stringify(sKey) + ": ");
|
||||||
|
}
|
||||||
|
|
||||||
|
// display relevant data type
|
||||||
|
switch (arangoHelper.RealTypeOf(vValue)) {
|
||||||
|
case "array":
|
||||||
|
case "object":
|
||||||
|
sHTML += self.FormatJSON(vValue, (sIndent + sIndentStyle));
|
||||||
|
break;
|
||||||
|
case "boolean":
|
||||||
|
case "number":
|
||||||
|
sHTML += vValue.toString();
|
||||||
|
break;
|
||||||
|
case "null":
|
||||||
|
sHTML += "null";
|
||||||
|
break;
|
||||||
|
case "string":
|
||||||
|
sHTML += "\"" + vValue.replace(/\\/g, "\\\\").replace(/"/g, "\\\"") + "\"";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sHTML += ("TYPEOF: " + typeof vValue);
|
||||||
|
}
|
||||||
|
// loop
|
||||||
|
iCount++;
|
||||||
|
});
|
||||||
|
|
||||||
|
// close object
|
||||||
|
if (sDataType === "array") {
|
||||||
|
sHTML += ("\n" + sIndent + "]");
|
||||||
|
} else {
|
||||||
|
sHTML += ("\n" + sIndent + "}");
|
||||||
|
}
|
||||||
|
|
||||||
|
// return
|
||||||
|
return sHTML;
|
||||||
|
},
|
||||||
|
|
||||||
|
RealTypeOf: function (v) {
|
||||||
|
if (typeof v === "object") {
|
||||||
|
if (v === null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
var array = [];
|
||||||
|
if (v.constructor === array.constructor) {
|
||||||
|
return "array";
|
||||||
|
}
|
||||||
|
var date = new Date();
|
||||||
|
if (v.constructor === date.constructor) {
|
||||||
|
return "date";
|
||||||
|
}
|
||||||
|
var regexp = new RegExp();
|
||||||
|
if (v.constructor === regexp.constructor) {
|
||||||
|
return "regex";
|
||||||
|
}
|
||||||
|
return "object";
|
||||||
|
}
|
||||||
|
return typeof v;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
||||||
/*global require, exports */
|
/*global require, exports, Backbone, window, arangoCollection, $, arangoHelper, data */
|
||||||
|
|
||||||
window.arangoCollections = Backbone.Collection.extend({
|
window.arangoCollections = Backbone.Collection.extend({
|
||||||
url: '/_api/collection',
|
url: '/_api/collection',
|
||||||
|
|
||||||
|
@ -17,38 +18,42 @@ window.arangoCollections = Backbone.Collection.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
translateStatus : function (status) {
|
translateStatus : function (status) {
|
||||||
if (status == 0) {
|
var returnString;
|
||||||
return 'corrupted';
|
if (status === 0) {
|
||||||
|
returnString = 'corrupted';
|
||||||
}
|
}
|
||||||
if (status == 1) {
|
if (status === 1) {
|
||||||
return 'new born collection';
|
returnString = 'new born collection';
|
||||||
}
|
}
|
||||||
else if (status == 2) {
|
else if (status === 2) {
|
||||||
return 'unloaded';
|
returnString = 'unloaded';
|
||||||
}
|
}
|
||||||
else if (status == 3) {
|
else if (status === 3) {
|
||||||
return 'loaded';
|
returnString = 'loaded';
|
||||||
}
|
}
|
||||||
else if (status == 4) {
|
else if (status === 4) {
|
||||||
return 'in the process of being unloaded';
|
returnString = 'in the process of being unloaded';
|
||||||
}
|
}
|
||||||
else if (status == 5) {
|
else if (status === 5) {
|
||||||
return 'deleted';
|
returnString = 'deleted';
|
||||||
}
|
}
|
||||||
|
return returnString;
|
||||||
},
|
},
|
||||||
translateTypePicture : function (type) {
|
translateTypePicture : function (type) {
|
||||||
|
var returnString;
|
||||||
if (type === 'document') {
|
if (type === 'document') {
|
||||||
return "img/icon_document.png";
|
returnString = "img/icon_document.png";
|
||||||
}
|
}
|
||||||
else if (type === 'edge') {
|
else if (type === 'edge') {
|
||||||
return "img/icon_node.png";
|
returnString = "img/icon_node.png";
|
||||||
}
|
}
|
||||||
else if (type === 'unknown') {
|
else if (type === 'unknown') {
|
||||||
return "img/icon_unknown.png";
|
returnString = "img/icon_unknown.png";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return "img/icon_arango.png";
|
returnString = "img/icon_arango.png";
|
||||||
}
|
}
|
||||||
|
return returnString;
|
||||||
},
|
},
|
||||||
parse: function(response) {
|
parse: function(response) {
|
||||||
var that = this;
|
var that = this;
|
||||||
|
@ -137,7 +142,7 @@ window.arangoCollections = Backbone.Collection.extend({
|
||||||
lValue = l.get('name').toLowerCase();
|
lValue = l.get('name').toLowerCase();
|
||||||
rValue = r.get('name').toLowerCase();
|
rValue = r.get('name').toLowerCase();
|
||||||
}
|
}
|
||||||
if (lValue != rValue) {
|
if (lValue !== rValue) {
|
||||||
return options.sortOrder * (lValue < rValue ? -1 : 1);
|
return options.sortOrder * (lValue < rValue ? -1 : 1);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -173,7 +178,14 @@ window.arangoCollections = Backbone.Collection.extend({
|
||||||
cache: false,
|
cache: false,
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "/_api/collection",
|
url: "/_api/collection",
|
||||||
data: '{"name":' + JSON.stringify(collName) + ',"waitForSync":' + JSON.stringify(wfs) + ',"isSystem":' + JSON.stringify(isSystem) + journalSizeString + ',"type":' + collType + '}',
|
data:
|
||||||
|
'{"name":' + JSON.stringify(collName) +
|
||||||
|
',"waitForSync":'+
|
||||||
|
JSON.stringify(wfs)+
|
||||||
|
',"isSystem":'+
|
||||||
|
JSON.stringify(isSystem)+
|
||||||
|
',"type":'+
|
||||||
|
collType + '}',
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
processData: false,
|
processData: false,
|
||||||
async: false,
|
async: false,
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
||||||
|
/*global require, exports, Backbone, window, arangoDocument, $, arangoHelper */
|
||||||
window.arangoDocument = Backbone.Collection.extend({
|
window.arangoDocument = Backbone.Collection.extend({
|
||||||
url: '/_api/document/',
|
url: '/_api/document/',
|
||||||
model: arangoDocument,
|
model: arangoDocument,
|
||||||
|
@ -139,8 +141,6 @@ window.arangoDocument = Backbone.Collection.extend({
|
||||||
processData: false,
|
processData: false,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
window.arangoDocumentStore.add(data);
|
window.arangoDocumentStore.add(data);
|
||||||
//TODO: move this to view!
|
|
||||||
//window.documentSourceView.fillSourceBox();
|
|
||||||
result = true;
|
result = true;
|
||||||
},
|
},
|
||||||
error: function(data) {
|
error: function(data) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
||||||
/*global require, exports, window */
|
/*global require, exports, window, Backbone, arangoDocument, $*/
|
||||||
|
|
||||||
window.arangoDocuments = Backbone.Collection.extend({
|
window.arangoDocuments = Backbone.Collection.extend({
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
|
@ -12,28 +12,28 @@ window.arangoDocuments = Backbone.Collection.extend({
|
||||||
url: '/_api/documents',
|
url: '/_api/documents',
|
||||||
model: arangoDocument,
|
model: arangoDocument,
|
||||||
getFirstDocuments: function () {
|
getFirstDocuments: function () {
|
||||||
if (this.currentPage != 1) {
|
if (this.currentPage !== 1) {
|
||||||
var link = window.location.hash.split("/");
|
var link = window.location.hash.split("/");
|
||||||
window.location.hash = link[0]+"/"+link[1]+"/"+link[2]+"/1";
|
window.location.hash = link[0]+"/"+link[1]+"/"+link[2]+"/1";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getLastDocuments: function () {
|
getLastDocuments: function () {
|
||||||
if (this.currentPage != this.totalPages) {
|
if (this.currentPage !== this.totalPages) {
|
||||||
var link = window.location.hash.split("/");
|
var link = window.location.hash.split("/");
|
||||||
window.location.hash = link[0]+"/"+link[1]+"/"+link[2]+"/"+this.totalPages;
|
window.location.hash = link[0]+"/"+link[1]+"/"+link[2]+"/"+this.totalPages;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getPrevDocuments: function () {
|
getPrevDocuments: function () {
|
||||||
if (this.currentPage != 1) {
|
if (this.currentPage !== 1) {
|
||||||
var link = window.location.hash.split("/");
|
var link = window.location.hash.split("/");
|
||||||
var page = parseInt(this.currentPage) - 1;
|
var page = parseInt(this.currentPage, null) - 1;
|
||||||
window.location.hash = link[0]+"/"+link[1]+"/"+link[2]+"/"+page;
|
window.location.hash = link[0]+"/"+link[1]+"/"+link[2]+"/"+page;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getNextDocuments: function () {
|
getNextDocuments: function () {
|
||||||
if (this.currentPage != this.totalPages) {
|
if (this.currentPage !== this.totalPages) {
|
||||||
var link = window.location.hash.split("/");
|
var link = window.location.hash.split("/");
|
||||||
var page = parseInt(this.currentPage) + 1;
|
var page = parseInt(this.currentPage, null) + 1;
|
||||||
window.location.hash = link[0]+"/"+link[1]+"/"+link[2]+"/"+page;
|
window.location.hash = link[0]+"/"+link[1]+"/"+link[2]+"/"+page;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -58,11 +58,10 @@ window.arangoDocuments = Backbone.Collection.extend({
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if (isNaN(this.currentPage) || this.currentPage == undefined || this.currentPage < 1) {
|
if (isNaN(this.currentPage) || this.currentPage === undefined || this.currentPage < 1) {
|
||||||
this.currentPage = 1;
|
this.currentPage = 1;
|
||||||
}
|
}
|
||||||
|
if (this.totalPages === 0) {
|
||||||
if (this.totalPages == 0) {
|
|
||||||
this.totalPages = 1;
|
this.totalPages = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,11 +72,13 @@ window.arangoDocuments = Backbone.Collection.extend({
|
||||||
type: 'PUT',
|
type: 'PUT',
|
||||||
async: false,
|
async: false,
|
||||||
url: '/_api/simple/all/',
|
url: '/_api/simple/all/',
|
||||||
data: '{"collection":"' + this.collectionID + '","skip":' + this.offset + ',"limit":' + String(this.documentsPerPage) + '}',
|
data:
|
||||||
|
'{"collection":"' + this.collectionID + '","skip":'+
|
||||||
|
this.offset + ',"limit":' + String(this.documentsPerPage) + '}',
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
self.clearDocuments();
|
self.clearDocuments();
|
||||||
if (self.documentsCount != 0) {
|
if (self.documentsCount !== 0) {
|
||||||
$.each(data.result, function(k, v) {
|
$.each(data.result, function(k, v) {
|
||||||
window.arangoDocumentsStore.add({
|
window.arangoDocumentsStore.add({
|
||||||
"id": v._id,
|
"id": v._id,
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
||||||
|
/*global require, exports, Backbone, window, $, arangoLog*/
|
||||||
|
|
||||||
window.arangoLogs = Backbone.Collection.extend({
|
window.arangoLogs = Backbone.Collection.extend({
|
||||||
url: '/_admin/log?upto=4&size=10&offset=0',
|
url: '/_admin/log?upto=4&size=10&offset=0',
|
||||||
parse: function(response) {
|
parse: function(response) {
|
||||||
|
@ -9,7 +12,7 @@ window.arangoLogs = Backbone.Collection.extend({
|
||||||
"lid":response.lid[i],
|
"lid":response.lid[i],
|
||||||
"text":response.text[i],
|
"text":response.text[i],
|
||||||
"timestamp":response.timestamp[i],
|
"timestamp":response.timestamp[i],
|
||||||
"totalAmount":response.totalAmount,
|
"totalAmount":response.totalAmount
|
||||||
});
|
});
|
||||||
i++;
|
i++;
|
||||||
});
|
});
|
||||||
|
@ -35,9 +38,9 @@ window.arangoLogs = Backbone.Collection.extend({
|
||||||
offset = 0;
|
offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
loglevel = this.showLogLevel(table);
|
var loglevel = this.showLogLevel(table);
|
||||||
var url = "";
|
var url = "";
|
||||||
if (loglevel == 5) {
|
if (loglevel === 5) {
|
||||||
url = "/_admin/log?upto=4&size="+size+"&offset="+offset;
|
url = "/_admin/log?upto=4&size="+size+"&offset="+offset;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -61,10 +64,22 @@ window.arangoLogs = Backbone.Collection.extend({
|
||||||
},
|
},
|
||||||
showLogLevel: function (tableid) {
|
showLogLevel: function (tableid) {
|
||||||
tableid = '#'+tableid;
|
tableid = '#'+tableid;
|
||||||
if (tableid == "#critTableID") { return 1 ;}
|
var returnVal = 0;
|
||||||
else if (tableid == "#warnTableID") { return 2 ;}
|
if (tableid === "#critTableID") {
|
||||||
else if (tableid == "#infoTableID") { return 3 ;}
|
returnVal = 1;
|
||||||
else if (tableid == "#debugTableID") { return 4 ;}
|
}
|
||||||
else if (tableid == "#logTableID") { return 5 ;}
|
else if (tableid === "#warnTableID") {
|
||||||
|
returnVal = 2;
|
||||||
|
}
|
||||||
|
else if (tableid === "#infoTableID") {
|
||||||
|
returnVal = 3;
|
||||||
|
}
|
||||||
|
else if (tableid === "#debugTableID") {
|
||||||
|
returnVal = 4;
|
||||||
|
}
|
||||||
|
else if (tableid === "#logTableID") {
|
||||||
|
returnVal = 5;
|
||||||
|
}
|
||||||
|
return returnVal;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
||||||
|
/*global require, exports, Backbone, window */
|
||||||
window.StatisticsCollection = Backbone.Collection.extend({
|
window.StatisticsCollection = Backbone.Collection.extend({
|
||||||
model: window.Statistics,
|
model: window.Statistics,
|
||||||
url: "../statistics"
|
url: "../statistics"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
||||||
|
/*global require, exports, Backbone, window */
|
||||||
window.StatisticsDescription = Backbone.Collection.extend({
|
window.StatisticsDescription = Backbone.Collection.extend({
|
||||||
model: window.StatisticsDescription,
|
model: window.StatisticsDescription,
|
||||||
url: "../statistics-description",
|
url: "../statistics-description",
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
||||||
|
/*global window, Backbone*/
|
||||||
|
|
||||||
window.arangoCollection = Backbone.Model.extend({
|
window.arangoCollection = Backbone.Model.extend({
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
||||||
|
/*global window, Backbone*/
|
||||||
|
|
||||||
window.arangoDocument = Backbone.Model.extend({
|
window.arangoDocument = Backbone.Model.extend({
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
},
|
},
|
||||||
urlRoot: "/_api/document",
|
urlRoot: "/_api/document",
|
||||||
defaults: {
|
defaults: {
|
||||||
_id: "",
|
_id: "",
|
||||||
_rev: "",
|
_rev: ""
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
||||||
|
/*global window, Backbone*/
|
||||||
|
|
||||||
window.arangoLog = Backbone.Model.extend({
|
window.arangoLog = Backbone.Model.extend({
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
||||||
|
/*global window, Backbone*/
|
||||||
|
|
||||||
window.Statistics = Backbone.Model.extend({
|
window.Statistics = Backbone.Model.extend({
|
||||||
defaults: {
|
defaults: {
|
||||||
},
|
},
|
||||||
|
|
||||||
url: function() {
|
url: function() {
|
||||||
return "../statistics";
|
return "../statistics";
|
||||||
},
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
||||||
|
/*global window, Backbone*/
|
||||||
|
|
||||||
window.StatisticsDescription = Backbone.Model.extend({
|
window.StatisticsDescription = Backbone.Model.extend({
|
||||||
defaults: {
|
defaults: {
|
||||||
"figures" : "",
|
"figures" : "",
|
||||||
"groups" : ""
|
"groups" : ""
|
||||||
},
|
},
|
||||||
|
|
||||||
url: function() {
|
url: function() {
|
||||||
return "../statistics-description";
|
return "../statistics-description";
|
||||||
},
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true, newcap: true */
|
||||||
|
/*global window, $, Backbone, document, arangoCollection, arangoHelper, dashboardView */
|
||||||
|
/*global FoxxInstalledListView, FoxxActiveListView*/
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
window.Router = Backbone.Router.extend({
|
window.Router = Backbone.Router.extend({
|
||||||
|
@ -37,20 +41,18 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
window.documentsView = new window.documentsView({
|
window.documentsView = new window.documentsView({
|
||||||
collection: window.arangoDocuments,
|
collection: window.arangoDocuments
|
||||||
});
|
});
|
||||||
window.documentView = new window.documentView({
|
window.documentView = new window.documentView({
|
||||||
collection: window.arangoDocument,
|
collection: window.arangoDocument
|
||||||
});
|
});
|
||||||
window.documentSourceView = new window.documentSourceView({
|
window.documentSourceView = new window.documentSourceView({
|
||||||
collection: window.arangoDocument,
|
collection: window.arangoDocument
|
||||||
});
|
});
|
||||||
|
|
||||||
window.arangoLogsStore = new window.arangoLogs();
|
window.arangoLogsStore = new window.arangoLogs();
|
||||||
window.arangoLogsStore.fetch({
|
window.arangoLogsStore.fetch({
|
||||||
success: function () {
|
success: function () {
|
||||||
if (!window.logsView) {
|
|
||||||
}
|
|
||||||
window.logsView = new window.logsView({
|
window.logsView = new window.logsView({
|
||||||
collection: window.arangoLogsStore
|
collection: window.arangoLogsStore
|
||||||
});
|
});
|
||||||
|
@ -156,13 +158,13 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
if (this.statisticsDescription === undefined) {
|
if (this.statisticsDescription === undefined) {
|
||||||
this.statisticsDescription = new window.StatisticsDescription;
|
this.statisticsDescription = new window.StatisticsDescription();
|
||||||
this.statisticsDescription.fetch({
|
this.statisticsDescription.fetch({
|
||||||
async:false
|
async:false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (this.statistics === undefined) {
|
if (this.statistics === undefined) {
|
||||||
this.statisticsCollection = new window.StatisticsCollection;
|
this.statisticsCollection = new window.StatisticsCollection();
|
||||||
//this.statisticsCollection.fetch();
|
//this.statisticsCollection.fetch();
|
||||||
}
|
}
|
||||||
if (this.dashboardView === undefined) {
|
if (this.dashboardView === undefined) {
|
||||||
|
@ -171,7 +173,6 @@ $(document).ready(function() {
|
||||||
description: this.statisticsDescription
|
description: this.statisticsDescription
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dashboardView.render();
|
this.dashboardView.render();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -212,7 +213,9 @@ $(document).ready(function() {
|
||||||
this.foxxList = new window.FoxxCollection();
|
this.foxxList = new window.FoxxCollection();
|
||||||
this.foxxList.fetch({
|
this.foxxList.fetch({
|
||||||
success: function() {
|
success: function() {
|
||||||
var editAppView = new window.foxxEditView({model: self.foxxList.findWhere({_key: appkey})});
|
var editAppView = new window.foxxEditView({
|
||||||
|
model: self.foxxList.findWhere({_key: appkey})
|
||||||
|
});
|
||||||
editAppView.render();
|
editAppView.render();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -228,12 +231,16 @@ $(document).ready(function() {
|
||||||
this.foxxList = new window.FoxxCollection();
|
this.foxxList = new window.FoxxCollection();
|
||||||
this.foxxList.fetch({
|
this.foxxList.fetch({
|
||||||
success: function() {
|
success: function() {
|
||||||
var installAppView = new window.foxxMountView({model: self.foxxList.findWhere({_key: appkey})});
|
var installAppView = new window.foxxMountView({
|
||||||
|
model: self.foxxList.findWhere({_key: appkey})
|
||||||
|
});
|
||||||
installAppView.render();
|
installAppView.render();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
var installAppView = new window.foxxMountView({model: this.foxxList.findWhere({_key: appkey})});
|
var installAppView = new window.foxxMountView({
|
||||||
|
model: this.foxxList.findWhere({_key: appkey})
|
||||||
|
});
|
||||||
installAppView.render();
|
installAppView.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
||||||
|
/*global require, exports, Backbone, EJS, $*/
|
||||||
|
|
||||||
var aboutView = Backbone.View.extend({
|
var aboutView = Backbone.View.extend({
|
||||||
el: '#content',
|
el: '#content',
|
||||||
init: function () {
|
init: function () {
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
||||||
|
/*global require, exports, Backbone, EJS, $*/
|
||||||
|
|
||||||
window.AppDocumentationView = Backbone.View.extend({
|
window.AppDocumentationView = Backbone.View.extend({
|
||||||
|
|
||||||
el: '#content',
|
el: '#content',
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
/*jslint indent: 2, stupid: true, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
||||||
|
/*global require, window, exports, Backbone, EJS, $, arangoHelper */
|
||||||
|
|
||||||
var collectionView = Backbone.View.extend({
|
var collectionView = Backbone.View.extend({
|
||||||
el: '#modalPlaceholder',
|
el: '#modalPlaceholder',
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
|
@ -30,7 +33,7 @@ var collectionView = Backbone.View.extend({
|
||||||
"keydown #change-collection-size" : "listenKey"
|
"keydown #change-collection-size" : "listenKey"
|
||||||
},
|
},
|
||||||
listenKey: function(e) {
|
listenKey: function(e) {
|
||||||
if (e.keyCode == 13) {
|
if (e.keyCode === 13) {
|
||||||
this.saveModifiedCollection();
|
this.saveModifiedCollection();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -52,13 +55,18 @@ var collectionView = Backbone.View.extend({
|
||||||
$('#change-collection-type').text(this.myCollection.type);
|
$('#change-collection-type').text(this.myCollection.type);
|
||||||
$('#change-collection-status').text(this.myCollection.status);
|
$('#change-collection-status').text(this.myCollection.status);
|
||||||
|
|
||||||
if (this.myCollection.status == 'unloaded') {
|
if (this.myCollection.status === 'unloaded') {
|
||||||
$('#colFooter').append('<button id="load-modified-collection" class="btn" style="margin-right: 10px">Load</button>');
|
$('#colFooter').append(
|
||||||
|
'<button id="load-modified-collection" class="btn" style="margin-right: 10px">Load</button>'
|
||||||
|
);
|
||||||
$('#collectionSizeBox').hide();
|
$('#collectionSizeBox').hide();
|
||||||
$('#collectionSyncBox').hide();
|
$('#collectionSyncBox').hide();
|
||||||
}
|
}
|
||||||
else if (this.myCollection.status == 'loaded') {
|
else if (this.myCollection.status === 'loaded') {
|
||||||
$('#colFooter').append('<button id="unload-modified-collection" class="btn" style="margin-right: 10px">Unload</button>');
|
$('#colFooter').append(
|
||||||
|
'<button id="unload-modified-collection"'+
|
||||||
|
'class="btn" style="margin-right: 10px">Unload</button>'
|
||||||
|
);
|
||||||
var data = window.arangoCollectionsStore.getProperties(this.options.colId, true);
|
var data = window.arangoCollectionsStore.getProperties(this.options.colId, true);
|
||||||
this.fillLoadedModal(data);
|
this.fillLoadedModal(data);
|
||||||
}
|
}
|
||||||
|
@ -66,7 +74,7 @@ var collectionView = Backbone.View.extend({
|
||||||
fillLoadedModal: function (data) {
|
fillLoadedModal: function (data) {
|
||||||
$('#collectionSizeBox').show();
|
$('#collectionSizeBox').show();
|
||||||
$('#collectionSyncBox').show();
|
$('#collectionSyncBox').show();
|
||||||
if (data.waitForSync == false) {
|
if (data.waitForSync === false) {
|
||||||
$('#change-collection-sync').val('false');
|
$('#change-collection-sync').val('false');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -74,7 +82,7 @@ var collectionView = Backbone.View.extend({
|
||||||
}
|
}
|
||||||
var calculatedSize = data.journalSize / 1024 / 1024;
|
var calculatedSize = data.journalSize / 1024 / 1024;
|
||||||
$('#change-collection-size').val(calculatedSize);
|
$('#change-collection-size').val(calculatedSize);
|
||||||
$('#change-collection').modal('show')
|
$('#change-collection').modal('show');
|
||||||
},
|
},
|
||||||
saveModifiedCollection: function() {
|
saveModifiedCollection: function() {
|
||||||
var newname = $('#change-collection-name').val();
|
var newname = $('#change-collection-name').val();
|
||||||
|
@ -87,8 +95,9 @@ var collectionView = Backbone.View.extend({
|
||||||
var status = this.getCollectionStatus();
|
var status = this.getCollectionStatus();
|
||||||
|
|
||||||
if (status === 'loaded') {
|
if (status === 'loaded') {
|
||||||
|
var result;
|
||||||
if (this.myCollection.name !== newname) {
|
if (this.myCollection.name !== newname) {
|
||||||
var result = window.arangoCollectionsStore.renameCollection(collid, newname);
|
result = window.arangoCollectionsStore.renameCollection(collid, newname);
|
||||||
}
|
}
|
||||||
|
|
||||||
var wfs = $('#change-collection-sync').val();
|
var wfs = $('#change-collection-sync').val();
|
||||||
|
@ -107,9 +116,7 @@ var collectionView = Backbone.View.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result !== true) {
|
if (result !== true) {
|
||||||
if (result === undefined) {
|
if (result !== undefined) {
|
||||||
}
|
|
||||||
else {
|
|
||||||
arangoHelper.arangoError("Collection error: " + result);
|
arangoHelper.arangoError("Collection error: " + result);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
||||||
|
/*global require, window, exports, Backbone, EJS, $*/
|
||||||
|
|
||||||
window.CollectionListItemView = Backbone.View.extend({
|
window.CollectionListItemView = Backbone.View.extend({
|
||||||
|
|
||||||
tagName: "li",
|
tagName: "li",
|
||||||
|
@ -24,7 +27,9 @@ window.CollectionListItemView = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
selectCollection: function() {
|
selectCollection: function() {
|
||||||
window.App.navigate("collection/" + encodeURIComponent(this.model.get("name")) + "/documents/1", {trigger: true});
|
window.App.navigate(
|
||||||
|
"collection/" + encodeURIComponent(this.model.get("name")) + "/documents/1", {trigger: true}
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
noop: function(event) {
|
noop: function(event) {
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
||||||
|
/*global require, exports, Backbone, EJS, window, setTimeout, clearTimeout, $*/
|
||||||
|
|
||||||
var collectionsView = Backbone.View.extend({
|
var collectionsView = Backbone.View.extend({
|
||||||
el: '#content',
|
el: '#content',
|
||||||
el2: '.thumbnails',
|
el2: '.thumbnails',
|
||||||
|
@ -15,9 +18,14 @@ var collectionsView = Backbone.View.extend({
|
||||||
|
|
||||||
var searchOptions = this.collection.searchOptions;
|
var searchOptions = this.collection.searchOptions;
|
||||||
|
|
||||||
$('.thumbnails', this.el).append('<li class="span3"><a href="#new" class="add"><img id="newCollection" src="img/plus_icon.png" class="pull-left" />Add Collection</a></li>');
|
$('.thumbnails', this.el).append(
|
||||||
|
'<li class="span3"><a href="#new" class="add"><img id="newCollection"'+
|
||||||
|
'src="img/plus_icon.png" class="pull-left" />Add Collection</a></li>'
|
||||||
|
);
|
||||||
this.collection.getFiltered(searchOptions).forEach(function (arango_collection) {
|
this.collection.getFiltered(searchOptions).forEach(function (arango_collection) {
|
||||||
$('.thumbnails', this.el).append(new window.CollectionListItemView({model: arango_collection}).render().el);
|
$('.thumbnails', this.el).append(new window.CollectionListItemView({
|
||||||
|
model: arango_collection
|
||||||
|
}).render().el);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,7 +57,7 @@ var collectionsView = Backbone.View.extend({
|
||||||
|
|
||||||
searchOptions.includeSystem = ($('#checkSystem').is(":checked") === true);
|
searchOptions.includeSystem = ($('#checkSystem').is(":checked") === true);
|
||||||
|
|
||||||
if (oldValue != searchOptions.includeSystem) {
|
if (oldValue !== searchOptions.includeSystem) {
|
||||||
this.render();
|
this.render();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -59,7 +67,7 @@ var collectionsView = Backbone.View.extend({
|
||||||
|
|
||||||
searchOptions.includeEdge = ($('#checkEdge').is(":checked") === true);
|
searchOptions.includeEdge = ($('#checkEdge').is(":checked") === true);
|
||||||
|
|
||||||
if (oldValue != searchOptions.includeEdge) {
|
if (oldValue !== searchOptions.includeEdge) {
|
||||||
this.render();
|
this.render();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -69,7 +77,7 @@ var collectionsView = Backbone.View.extend({
|
||||||
|
|
||||||
searchOptions.includeDocument = ($('#checkDocument').is(":checked") === true);
|
searchOptions.includeDocument = ($('#checkDocument').is(":checked") === true);
|
||||||
|
|
||||||
if (oldValue != searchOptions.includeDocument) {
|
if (oldValue !== searchOptions.includeDocument) {
|
||||||
this.render();
|
this.render();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -79,7 +87,7 @@ var collectionsView = Backbone.View.extend({
|
||||||
|
|
||||||
searchOptions.includeLoaded = ($('#checkLoaded').is(":checked") === true);
|
searchOptions.includeLoaded = ($('#checkLoaded').is(":checked") === true);
|
||||||
|
|
||||||
if (oldValue != searchOptions.includeLoaded) {
|
if (oldValue !== searchOptions.includeLoaded) {
|
||||||
this.render();
|
this.render();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -89,7 +97,7 @@ var collectionsView = Backbone.View.extend({
|
||||||
|
|
||||||
searchOptions.includeUnloaded = ($('#checkUnloaded').is(":checked") === true);
|
searchOptions.includeUnloaded = ($('#checkUnloaded').is(":checked") === true);
|
||||||
|
|
||||||
if (oldValue != searchOptions.includeUnloaded) {
|
if (oldValue !== searchOptions.includeUnloaded) {
|
||||||
this.render();
|
this.render();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -99,7 +107,7 @@ var collectionsView = Backbone.View.extend({
|
||||||
|
|
||||||
searchOptions.sortBy = (($('#sortName').is(":checked") === true) ? 'name' : 'type');
|
searchOptions.sortBy = (($('#sortName').is(":checked") === true) ? 'name' : 'type');
|
||||||
|
|
||||||
if (oldValue != searchOptions.sortBy) {
|
if (oldValue !== searchOptions.sortBy) {
|
||||||
this.render();
|
this.render();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -109,7 +117,7 @@ var collectionsView = Backbone.View.extend({
|
||||||
|
|
||||||
searchOptions.sortBy = (($('#sortType').is(":checked") === true) ? 'type' : 'name');
|
searchOptions.sortBy = (($('#sortType').is(":checked") === true) ? 'type' : 'name');
|
||||||
|
|
||||||
if (oldValue != searchOptions.sortBy) {
|
if (oldValue !== searchOptions.sortBy) {
|
||||||
this.render();
|
this.render();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -119,7 +127,7 @@ var collectionsView = Backbone.View.extend({
|
||||||
|
|
||||||
searchOptions.sortOrder = (($('#sortOrder').is(":checked") === true) ? -1 : 1);
|
searchOptions.sortOrder = (($('#sortOrder').is(":checked") === true) ? -1 : 1);
|
||||||
|
|
||||||
if (oldValue != searchOptions.sortOrder) {
|
if (oldValue !== searchOptions.sortOrder) {
|
||||||
this.render();
|
this.render();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
||||||
|
/*global require, exports, Backbone, EJS, $, flush, window, arangoHelper, nv, d3*/
|
||||||
|
|
||||||
var dashboardView = Backbone.View.extend({
|
var dashboardView = Backbone.View.extend({
|
||||||
el: '#content',
|
el: '#content',
|
||||||
updateInterval: 500, // 0.5 second, constant
|
updateInterval: 500, // 0.5 second, constant
|
||||||
|
@ -164,7 +167,7 @@ var dashboardView = Backbone.View.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (addGroup == true) {
|
if (addGroup === true) {
|
||||||
self.options.description.models[0].attributes.groups.push({
|
self.options.description.models[0].attributes.groups.push({
|
||||||
"description" : "custom",
|
"description" : "custom",
|
||||||
"group" : "custom",
|
"group" : "custom",
|
||||||
|
@ -201,7 +204,6 @@ var dashboardView = Backbone.View.extend({
|
||||||
var scale = 0.0001;
|
var scale = 0.0001;
|
||||||
|
|
||||||
for (i = 0; i < 12; ++i) {
|
for (i = 0; i < 12; ++i) {
|
||||||
this.units.push(scale * 1);
|
|
||||||
this.units.push(scale * 2);
|
this.units.push(scale * 2);
|
||||||
this.units.push(scale * 2.5);
|
this.units.push(scale * 2.5);
|
||||||
this.units.push(scale * 4);
|
this.units.push(scale * 4);
|
||||||
|
@ -216,14 +218,13 @@ var dashboardView = Backbone.View.extend({
|
||||||
var i = 0, n = this.units.length;
|
var i = 0, n = this.units.length;
|
||||||
while (i < n) {
|
while (i < n) {
|
||||||
var unit = this.units[i++];
|
var unit = this.units[i++];
|
||||||
if (max > unit) {
|
if (max === unit) {
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (max == unit) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (max < unit) {
|
||||||
return unit;
|
return unit;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return max;
|
return max;
|
||||||
},
|
},
|
||||||
|
@ -285,8 +286,8 @@ var dashboardView = Backbone.View.extend({
|
||||||
var self = this;
|
var self = this;
|
||||||
nv.addGraph(function() {
|
nv.addGraph(function() {
|
||||||
var chart = nv.models.pieChart()
|
var chart = nv.models.pieChart()
|
||||||
.x(function(d) { return d.label })
|
.x(function(d) { return d.label; })
|
||||||
.y(function(d) { return d.value })
|
.y(function(d) { return d.value; })
|
||||||
.showLabels(true);
|
.showLabels(true);
|
||||||
|
|
||||||
d3.select("#detailCollectionsChart svg")
|
d3.select("#detailCollectionsChart svg")
|
||||||
|
@ -305,7 +306,7 @@ var dashboardView = Backbone.View.extend({
|
||||||
$.each(self.collectionsStats, function(k,v) {
|
$.each(self.collectionsStats, function(k,v) {
|
||||||
collValues.push({
|
collValues.push({
|
||||||
"label" : k,
|
"label" : k,
|
||||||
"value" : v,
|
"value" : v
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -368,14 +369,15 @@ var dashboardView = Backbone.View.extend({
|
||||||
if (self.detailGraph === identifier) {
|
if (self.detailGraph === identifier) {
|
||||||
d3.select("#detailGraphChart svg")
|
d3.select("#detailGraphChart svg")
|
||||||
.call(chart)
|
.call(chart)
|
||||||
.datum([ { values: self.seriesData[identifier].values, key: identifier, color: "#8AA051" } ])
|
.datum([{
|
||||||
|
values: self.seriesData[identifier].values,
|
||||||
|
key: identifier,
|
||||||
|
color: "#8AA051"
|
||||||
|
}])
|
||||||
.transition().duration(500);
|
.transition().duration(500);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
//disable ticks for small charts
|
//disable ticks/label for small charts
|
||||||
//disable label for small charts
|
|
||||||
|
|
||||||
d3.select("#" + identifier + "Chart svg")
|
d3.select("#" + identifier + "Chart svg")
|
||||||
.call(chart)
|
.call(chart)
|
||||||
|
@ -466,7 +468,8 @@ var dashboardView = Backbone.View.extend({
|
||||||
'<div class="boxHeader"><h6 class="dashboardH6">' + figure.name +
|
'<div class="boxHeader"><h6 class="dashboardH6">' + figure.name +
|
||||||
'</h6>'+
|
'</h6>'+
|
||||||
'<i class="icon-remove icon-white db-hide" value="'+figure.identifier+'"></i>' +
|
'<i class="icon-remove icon-white db-hide" value="'+figure.identifier+'"></i>' +
|
||||||
'<i class="icon-info-sign icon-white db-info" value="'+figure.identifier+'" title="'+figure.description+'"></i>' +
|
'<i class="icon-info-sign icon-white db-info" value="'+figure.identifier+
|
||||||
|
'" title="'+figure.description+'"></i>' +
|
||||||
'<i class="icon-zoom-in icon-white db-zoom" value="'+figure.identifier+'"></i>' +
|
'<i class="icon-zoom-in icon-white db-zoom" value="'+figure.identifier+'"></i>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'<div class="statChart" id="' + figure.identifier + 'Chart"><svg class="svgClass"/></div>' +
|
'<div class="statChart" id="' + figure.identifier + 'Chart"><svg class="svgClass"/></div>' +
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
||||||
|
/*global require, exports, Backbone, EJS, $, window, arangoHelper, ace, arangoDocumentStore */
|
||||||
|
|
||||||
var documentSourceView = Backbone.View.extend({
|
var documentSourceView = Backbone.View.extend({
|
||||||
el: '#content',
|
el: '#content',
|
||||||
init: function () {
|
init: function () {
|
||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
"click #tableView" : "tableView",
|
"click #tableView" : "tableView",
|
||||||
"click #saveSourceDoc" : "saveSourceDoc",
|
"click #saveSourceDoc" : "saveSourceDoc"
|
||||||
},
|
},
|
||||||
|
|
||||||
template: new EJS({url: 'js/templates/documentSourceView.ejs'}),
|
template: new EJS({url: 'js/templates/documentSourceView.ejs'}),
|
||||||
|
@ -46,10 +49,11 @@ var documentSourceView = Backbone.View.extend({
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
saveSourceDoc: function() {
|
saveSourceDoc: function() {
|
||||||
|
var editor, model, result;
|
||||||
if (this.type === 'document') {
|
if (this.type === 'document') {
|
||||||
var editor = ace.edit("sourceEditor");
|
editor = ace.edit("sourceEditor");
|
||||||
var model = editor.getValue();
|
model = editor.getValue();
|
||||||
var result = window.arangoDocumentStore.saveDocument(this.colid, this.docid, model);
|
result = window.arangoDocumentStore.saveDocument(this.colid, this.docid, model);
|
||||||
if (result === true) {
|
if (result === true) {
|
||||||
arangoHelper.arangoNotification('Document saved');
|
arangoHelper.arangoNotification('Document saved');
|
||||||
}
|
}
|
||||||
|
@ -58,9 +62,9 @@ var documentSourceView = Backbone.View.extend({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (this.type === 'edge') {
|
else if (this.type === 'edge') {
|
||||||
var editor = ace.edit("sourceEditor");
|
editor = ace.edit("sourceEditor");
|
||||||
var model = editor.getValue();
|
model = editor.getValue();
|
||||||
var result = window.arangoDocumentStore.saveEdge(this.colid, this.docid, model);
|
result = window.arangoDocumentStore.saveEdge(this.colid, this.docid, model);
|
||||||
if (result === true) {
|
if (result === true) {
|
||||||
arangoHelper.arangoNotification('Edge saved');
|
arangoHelper.arangoNotification('Edge saved');
|
||||||
}
|
}
|
||||||
|
@ -82,7 +86,7 @@ var documentSourceView = Backbone.View.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var editor = ace.edit("sourceEditor");
|
var editor = ace.edit("sourceEditor");
|
||||||
editor.setValue(this.FormatJSON(data));
|
editor.setValue(arangoHelper.FormatJSON(data));
|
||||||
},
|
},
|
||||||
stateReplace: function (value) {
|
stateReplace: function (value) {
|
||||||
var inString = false;
|
var inString = false;
|
||||||
|
@ -154,86 +158,5 @@ var documentSourceView = Backbone.View.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
},
|
|
||||||
FormatJSON: function (oData, sIndent) {
|
|
||||||
var self = this;
|
|
||||||
if (arguments.length < 2) {
|
|
||||||
var sIndent = "";
|
|
||||||
}
|
}
|
||||||
var sIndentStyle = " ";
|
|
||||||
var sDataType = self.RealTypeOf(oData);
|
|
||||||
|
|
||||||
if (sDataType == "array") {
|
|
||||||
if (oData.length == 0) {
|
|
||||||
return "[]";
|
|
||||||
}
|
|
||||||
var sHTML = "[";
|
|
||||||
} else {
|
|
||||||
var iCount = 0;
|
|
||||||
$.each(oData, function() {
|
|
||||||
iCount++;
|
|
||||||
return;
|
|
||||||
});
|
|
||||||
if (iCount == 0) { // object is empty
|
|
||||||
return "{}";
|
|
||||||
}
|
|
||||||
var sHTML = "{";
|
|
||||||
}
|
|
||||||
|
|
||||||
var iCount = 0;
|
|
||||||
$.each(oData, function(sKey, vValue) {
|
|
||||||
if (iCount > 0) {
|
|
||||||
sHTML += ",";
|
|
||||||
}
|
|
||||||
if (sDataType == "array") {
|
|
||||||
sHTML += ("\n" + sIndent + sIndentStyle);
|
|
||||||
} else {
|
|
||||||
sHTML += ("\n" + sIndent + sIndentStyle + JSON.stringify(sKey) + ": ");
|
|
||||||
}
|
|
||||||
|
|
||||||
// display relevant data type
|
|
||||||
switch (self.RealTypeOf(vValue)) {
|
|
||||||
case "array":
|
|
||||||
case "object":
|
|
||||||
sHTML += self.FormatJSON(vValue, (sIndent + sIndentStyle));
|
|
||||||
break;
|
|
||||||
case "boolean":
|
|
||||||
case "number":
|
|
||||||
sHTML += vValue.toString();
|
|
||||||
break;
|
|
||||||
case "null":
|
|
||||||
sHTML += "null";
|
|
||||||
break;
|
|
||||||
case "string":
|
|
||||||
sHTML += "\"" + vValue.replace(/\\/g, "\\\\").replace(/"/g, "\\\"") + "\"";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
sHTML += ("TYPEOF: " + typeof(vValue));
|
|
||||||
}
|
|
||||||
|
|
||||||
// loop
|
|
||||||
iCount++;
|
|
||||||
});
|
|
||||||
|
|
||||||
// close object
|
|
||||||
if (sDataType == "array") {
|
|
||||||
sHTML += ("\n" + sIndent + "]");
|
|
||||||
} else {
|
|
||||||
sHTML += ("\n" + sIndent + "}");
|
|
||||||
}
|
|
||||||
|
|
||||||
// return
|
|
||||||
return sHTML;
|
|
||||||
},
|
|
||||||
RealTypeOf: function (v) {
|
|
||||||
if (typeof(v) == "object") {
|
|
||||||
if (v === null) return "null";
|
|
||||||
if (v.constructor == (new Array).constructor) return "array";
|
|
||||||
if (v.constructor == (new Date).constructor) return "date";
|
|
||||||
if (v.constructor == (new RegExp).constructor) return "regex";
|
|
||||||
return "object";
|
|
||||||
}
|
|
||||||
return typeof(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true, forin: true */
|
||||||
|
/*global require, exports, Backbone, EJS, $, window, arangoHelper, value2html */
|
||||||
|
|
||||||
var documentView = Backbone.View.extend({
|
var documentView = Backbone.View.extend({
|
||||||
el: '#content',
|
el: '#content',
|
||||||
table: '#documentTableID',
|
table: '#documentTableID',
|
||||||
|
@ -19,7 +22,7 @@ var documentView = Backbone.View.extend({
|
||||||
"click #editSecondRow" : "editSecond",
|
"click #editSecondRow" : "editSecond",
|
||||||
"keydown .sorting_1" : "listenKey",
|
"keydown .sorting_1" : "listenKey",
|
||||||
"keydown" : "listenGlobalKey",
|
"keydown" : "listenGlobalKey",
|
||||||
"blur textarea" : "checkFocus",
|
"blur textarea" : "checkFocus"
|
||||||
},
|
},
|
||||||
|
|
||||||
checkFocus: function(e) {
|
checkFocus: function(e) {
|
||||||
|
@ -52,23 +55,20 @@ var documentView = Backbone.View.extend({
|
||||||
template: new EJS({url: 'js/templates/documentView.ejs'}),
|
template: new EJS({url: 'js/templates/documentView.ejs'}),
|
||||||
|
|
||||||
typeCheck: function (type) {
|
typeCheck: function (type) {
|
||||||
|
var result;
|
||||||
if (type === 'edge') {
|
if (type === 'edge') {
|
||||||
var result = window.arangoDocumentStore.getEdge(this.colid, this.docid);
|
result = window.arangoDocumentStore.getEdge(this.colid, this.docid);
|
||||||
if (result === true) {
|
if (result === true) {
|
||||||
this.initTable();
|
this.initTable();
|
||||||
this.drawTable();
|
this.drawTable();
|
||||||
}
|
}
|
||||||
else if (result === false) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (type === 'document') {
|
else if (type === 'document') {
|
||||||
var result = window.arangoDocumentStore.getDocument(this.colid, this.docid);
|
result = window.arangoDocumentStore.getDocument(this.colid, this.docid);
|
||||||
if (result === true) {
|
if (result === true) {
|
||||||
this.initTable();
|
this.initTable();
|
||||||
this.drawTable();
|
this.drawTable();
|
||||||
}
|
}
|
||||||
else if (result === false) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
clicked: function (a) {
|
clicked: function (a) {
|
||||||
|
@ -103,10 +103,11 @@ var documentView = Backbone.View.extend({
|
||||||
window.location.hash = window.location.hash + "/source";
|
window.location.hash = window.location.hash + "/source";
|
||||||
},
|
},
|
||||||
saveDocument: function () {
|
saveDocument: function () {
|
||||||
|
var model, result;
|
||||||
if (this.type === 'document') {
|
if (this.type === 'document') {
|
||||||
var model = window.arangoDocumentStore.models[0].attributes;
|
model = window.arangoDocumentStore.models[0].attributes;
|
||||||
model = JSON.stringify(model);
|
model = JSON.stringify(model);
|
||||||
var result = window.arangoDocumentStore.saveDocument(this.colid, this.docid, model);
|
result = window.arangoDocumentStore.saveDocument(this.colid, this.docid, model);
|
||||||
if (result === true) {
|
if (result === true) {
|
||||||
arangoHelper.arangoNotification('Document saved');
|
arangoHelper.arangoNotification('Document saved');
|
||||||
$('#addRow').removeClass('disabledBtn');
|
$('#addRow').removeClass('disabledBtn');
|
||||||
|
@ -117,9 +118,9 @@ var documentView = Backbone.View.extend({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (this.type === 'edge') {
|
else if (this.type === 'edge') {
|
||||||
var model = window.arangoDocumentStore.models[0].attributes;
|
model = window.arangoDocumentStore.models[0].attributes;
|
||||||
model = JSON.stringify(model);
|
model = JSON.stringify(model);
|
||||||
var result = window.arangoDocumentStore.saveEdge(this.colid, this.docid, model);
|
result = window.arangoDocumentStore.saveEdge(this.colid, this.docid, model);
|
||||||
if (result === true) {
|
if (result === true) {
|
||||||
arangoHelper.arangoNotification('Edge saved');
|
arangoHelper.arangoNotification('Edge saved');
|
||||||
$('#addRow').removeClass('disabledBtn');
|
$('#addRow').removeClass('disabledBtn');
|
||||||
|
@ -150,7 +151,8 @@ var documentView = Backbone.View.extend({
|
||||||
'<a class="add" class="notwriteable" id="addDocumentLine"> </a>',
|
'<a class="add" class="notwriteable" id="addDocumentLine"> </a>',
|
||||||
'<div class="notwriteable"></div>',
|
'<div class="notwriteable"></div>',
|
||||||
'<div class="notwriteable"></div>',
|
'<div class="notwriteable"></div>',
|
||||||
'<button class="enabled" id="addRow"><img id="addDocumentLine" class="plusIcon" src="img/plus_icon.png"></button>'
|
'<button class="enabled" id="addRow"><img id="addDocumentLine"'+
|
||||||
|
'class="plusIcon" src="img/plus_icon.png"></button>'
|
||||||
]);
|
]);
|
||||||
$.each(window.arangoDocumentStore.models[0].attributes, function(key, value) {
|
$.each(window.arangoDocumentStore.models[0].attributes, function(key, value) {
|
||||||
if (arangoHelper.isSystemAttribute(key)) {
|
if (arangoHelper.isSystemAttribute(key)) {
|
||||||
|
@ -171,7 +173,8 @@ var documentView = Backbone.View.extend({
|
||||||
self.value2html(value),
|
self.value2html(value),
|
||||||
JSON.stringify(value),
|
JSON.stringify(value),
|
||||||
'<i class="icon-edit" id="editSecondRow"></i>',
|
'<i class="icon-edit" id="editSecondRow"></i>',
|
||||||
'<button class="enabled" id="deleteRow"><img src="img/icon_delete.png" width="16" height="16"></button>'
|
'<button class="enabled" id="deleteRow"><img src="img/icon_delete.png"'+
|
||||||
|
'width="16" height="16"></button>'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -196,7 +199,8 @@ var documentView = Backbone.View.extend({
|
||||||
this.value2html("editme"),
|
this.value2html("editme"),
|
||||||
JSON.stringify("editme"),
|
JSON.stringify("editme"),
|
||||||
'<i class="icon-edit" id="editSecondRow"></i>',
|
'<i class="icon-edit" id="editSecondRow"></i>',
|
||||||
'<button class="enabled" id="deleteRow"><img src="img/icon_delete.png" width="16" height="16"></button>'
|
'<button class="enabled" id="deleteRow"><img src="img/icon_delete.png"'+
|
||||||
|
'width="16" height="16"></button>'
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
this.makeEditable();
|
this.makeEditable();
|
||||||
|
@ -241,7 +245,7 @@ var documentView = Backbone.View.extend({
|
||||||
value2html: function (value, isReadOnly) {
|
value2html: function (value, isReadOnly) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var typify = function (value) {
|
var typify = function (value) {
|
||||||
var checked = typeof(value);
|
var checked = typeof value;
|
||||||
switch(checked) {
|
switch(checked) {
|
||||||
case 'number':
|
case 'number':
|
||||||
return ("<a class=\"sh_number\">" + value + "</a>");
|
return ("<a class=\"sh_number\">" + value + "</a>");
|
||||||
|
@ -253,21 +257,21 @@ var documentView = Backbone.View.extend({
|
||||||
if (value instanceof Array) {
|
if (value instanceof Array) {
|
||||||
return ("<a class=\"sh_array\">" + self.escaped(JSON.stringify(value)) + "</a>");
|
return ("<a class=\"sh_array\">" + self.escaped(JSON.stringify(value)) + "</a>");
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return ("<a class=\"sh_object\">"+ self.escaped(JSON.stringify(value)) + "</a>");
|
return ("<a class=\"sh_object\">"+ self.escaped(JSON.stringify(value)) + "</a>");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
return (isReadOnly ? "(read-only) " : "") + typify(value);
|
return (isReadOnly ? "(read-only) " : "") + typify(value);
|
||||||
},
|
},
|
||||||
|
|
||||||
escaped: function (value) {
|
escaped: function (value) {
|
||||||
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")
|
||||||
|
.replace(/"/g, """).replace(/'/g, "'");
|
||||||
},
|
},
|
||||||
|
|
||||||
updateLocalDocumentStorage: function () {
|
updateLocalDocumentStorage: function () {
|
||||||
var data = $(this.table).dataTable().fnGetData();
|
var data = $(this.table).dataTable().fnGetData();
|
||||||
var result = {};
|
var result = {};
|
||||||
|
var row;
|
||||||
|
|
||||||
for (row in data) {
|
for (row in data) {
|
||||||
//Exclude "add-collection" row
|
//Exclude "add-collection" row
|
||||||
|
@ -303,48 +307,44 @@ var documentView = Backbone.View.extend({
|
||||||
});
|
});
|
||||||
$('.writeable', documentEditTable.fnGetNodes()).editable(function(value, settings) {
|
$('.writeable', documentEditTable.fnGetNodes()).editable(function(value, settings) {
|
||||||
var aPos = documentEditTable.fnGetPosition(this);
|
var aPos = documentEditTable.fnGetPosition(this);
|
||||||
if (aPos[1] == 0) {
|
if (aPos[1] === 0) {
|
||||||
documentEditTable.fnUpdate(self.escaped(value), aPos[0], aPos[1]);
|
documentEditTable.fnUpdate(self.escaped(value), aPos[0], aPos[1]);
|
||||||
self.updateLocalDocumentStorage();
|
self.updateLocalDocumentStorage();
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
if (aPos[1] == 2) {
|
if (aPos[1] === 2) {
|
||||||
var oldContent = JSON.parse(documentEditTable.fnGetData(aPos[0], aPos[1] + 1));
|
var oldContent = JSON.parse(documentEditTable.fnGetData(aPos[0], aPos[1] + 1));
|
||||||
var test = self.getTypedValue(value);
|
var test = self.getTypedValue(value);
|
||||||
if (String(value) == String(oldContent)) {
|
if (String(value) === String(oldContent)) {
|
||||||
// no change
|
// no change
|
||||||
return self.value2html(oldContent);
|
return self.value2html(oldContent);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
// change update hidden row
|
// change update hidden row
|
||||||
documentEditTable.fnUpdate(JSON.stringify(test), aPos[0], aPos[1] + 1);
|
documentEditTable.fnUpdate(JSON.stringify(test), aPos[0], aPos[1] + 1);
|
||||||
self.updateLocalDocumentStorage();
|
self.updateLocalDocumentStorage();
|
||||||
// return visible row
|
// return visible row
|
||||||
return self.value2html(test);
|
return self.value2html(test);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},{
|
},{
|
||||||
data: function() {
|
data: function() {
|
||||||
$(".btn-success").click()
|
$(".btn-success").click();
|
||||||
var aPos = documentEditTable.fnGetPosition(this);
|
var aPos = documentEditTable.fnGetPosition(this);
|
||||||
var value = documentEditTable.fnGetData(aPos[0], aPos[1]);
|
var value = documentEditTable.fnGetData(aPos[0], aPos[1]);
|
||||||
if (aPos[1] == 0) {
|
if (aPos[1] === 0) {
|
||||||
//check if this row was newly created
|
//check if this row was newly created
|
||||||
if (value === self.currentKey) {
|
if (value === self.currentKey) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
if (aPos[1] == 2) {
|
if (aPos[1] === 2) {
|
||||||
var oldContent = documentEditTable.fnGetData(aPos[0], aPos[1] + 1);
|
var oldContent = documentEditTable.fnGetData(aPos[0], aPos[1] + 1);
|
||||||
if (typeof(oldContent) == 'object') {
|
if (typeof oldContent === 'object') {
|
||||||
//grep hidden row and paste in visible row
|
//grep hidden row and paste in visible row
|
||||||
return value2html(oldContent);
|
return value2html(oldContent);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return oldContent;
|
return oldContent;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
width: "none", // if not set, each row will get bigger & bigger (Safari & Firefox)
|
width: "none", // if not set, each row will get bigger & bigger (Safari & Firefox)
|
||||||
type: "autogrow",
|
type: "autogrow",
|
||||||
|
@ -364,7 +364,7 @@ var documentView = Backbone.View.extend({
|
||||||
var currentKey2 = window.documentView.currentKey;
|
var currentKey2 = window.documentView.currentKey;
|
||||||
var data = $('#documentTableID').dataTable().fnGetData();
|
var data = $('#documentTableID').dataTable().fnGetData();
|
||||||
$.each(data, function(key, val) {
|
$.each(data, function(key, val) {
|
||||||
if (val[0] == currentKey2) {
|
if (val[0] === currentKey2) {
|
||||||
$('#documentTableID').dataTable().fnDeleteRow(key);
|
$('#documentTableID').dataTable().fnDeleteRow(key);
|
||||||
$('#addRow').removeClass('disabledBtn');
|
$('#addRow').removeClass('disabledBtn');
|
||||||
}
|
}
|
||||||
|
@ -395,23 +395,21 @@ var documentView = Backbone.View.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if ($(td).hasClass('rightCell') === true) {
|
|
||||||
}
|
|
||||||
return returnval;
|
return returnval;
|
||||||
},
|
},
|
||||||
getTypedValue: function (value) {
|
getTypedValue: function (value) {
|
||||||
value = value.replace(/(^\s+|\s+$)/g, '');
|
value = value.replace(/(^\s+|\s+$)/g, '');
|
||||||
if (value == 'true') {
|
if (value === 'true') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (value == 'false') {
|
if (value === 'false') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (value == 'null') {
|
if (value === 'null') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (value.match(/^-?((\d+)?\.)?\d+$/)) {
|
if (value.match(/^-?((\d+)?\.)?\d+$/)) {
|
||||||
// TODO: support exp notation
|
//support exp notation
|
||||||
return parseFloat(value);
|
return parseFloat(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,7 +420,7 @@ var documentView = Backbone.View.extend({
|
||||||
// value is an array
|
// value is an array
|
||||||
return test;
|
return test;
|
||||||
}
|
}
|
||||||
if (typeof(test) == 'object') {
|
if (typeof test === 'object') {
|
||||||
// value is an object
|
// value is an object
|
||||||
return test;
|
return test;
|
||||||
}
|
}
|
||||||
|
@ -431,10 +429,12 @@ var documentView = Backbone.View.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
// fallback: value is a string
|
// fallback: value is a string
|
||||||
value = value + '';
|
value = String(value);
|
||||||
|
|
||||||
if (value !== '' && (value.substr(0, 1) != '"' || value.substr(-1) != '"')) {
|
if (value !== '' && (value.substr(0, 1) !== '"' || value.substr(-1) !== '"')) {
|
||||||
arangoHelper.arangoNotification('You have entered an invalid string value. Please review and adjust it.');
|
arangoHelper.arangoNotification(
|
||||||
|
'You have entered an invalid string value. Please review and adjust it.'
|
||||||
|
);
|
||||||
throw "error";
|
throw "error";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,7 +442,9 @@ var documentView = Backbone.View.extend({
|
||||||
value = JSON.parse(value);
|
value = JSON.parse(value);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
arangoHelper.arangoNotification('You have entered an invalid string value. Please review and adjust it.');
|
arangoHelper.arangoNotification(
|
||||||
|
'You have entered an invalid string value. Please review and adjust it.'
|
||||||
|
);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
||||||
|
/*global require, exports, Backbone, EJS, $, window, arangoHelper */
|
||||||
|
|
||||||
var documentsView = Backbone.View.extend({
|
var documentsView = Backbone.View.extend({
|
||||||
collectionID: 0,
|
collectionID: 0,
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
|
@ -140,8 +143,9 @@ var documentsView = Backbone.View.extend({
|
||||||
var deleted = false;
|
var deleted = false;
|
||||||
this.docid = $(self.idelement).next().text();
|
this.docid = $(self.idelement).next().text();
|
||||||
|
|
||||||
|
var result;
|
||||||
if (this.type === 'document') {
|
if (this.type === 'document') {
|
||||||
var result = window.arangoDocumentStore.deleteDocument(this.colid, this.docid);
|
result = window.arangoDocumentStore.deleteDocument(this.colid, this.docid);
|
||||||
if (result === true) {
|
if (result === true) {
|
||||||
//on success
|
//on success
|
||||||
arangoHelper.arangoNotification('Document deleted');
|
arangoHelper.arangoNotification('Document deleted');
|
||||||
|
@ -152,7 +156,7 @@ var documentsView = Backbone.View.extend({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (this.type === 'edge') {
|
else if (this.type === 'edge') {
|
||||||
var result = window.arangoDocumentStore.deleteEdge(this.colid, this.docid);
|
result = window.arangoDocumentStore.deleteEdge(this.colid, this.docid);
|
||||||
if (result === true) {
|
if (result === true) {
|
||||||
//on success
|
//on success
|
||||||
arangoHelper.arangoNotification('Edge deleted');
|
arangoHelper.arangoNotification('Edge deleted');
|
||||||
|
@ -164,7 +168,9 @@ var documentsView = Backbone.View.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
if (deleted === true) {
|
if (deleted === true) {
|
||||||
$('#documentsTableID').dataTable().fnDeleteRow($('#documentsTableID').dataTable().fnGetPosition(row));
|
$('#documentsTableID').dataTable().fnDeleteRow(
|
||||||
|
$('#documentsTableID').dataTable().fnGetPosition(row)
|
||||||
|
);
|
||||||
$('#documentsTableID').dataTable().fnClearTable();
|
$('#documentsTableID').dataTable().fnClearTable();
|
||||||
window.arangoDocumentsStore.getDocuments(this.colid, page);
|
window.arangoDocumentsStore.getDocuments(this.colid, page);
|
||||||
$('#docDeleteModal').modal('hide');
|
$('#docDeleteModal').modal('hide');
|
||||||
|
@ -172,7 +178,7 @@ var documentsView = Backbone.View.extend({
|
||||||
|
|
||||||
},
|
},
|
||||||
clicked: function (event) {
|
clicked: function (event) {
|
||||||
if (this.alreadyClicked == true) {
|
if (this.alreadyClicked === true) {
|
||||||
this.alreadyClicked = false;
|
this.alreadyClicked = false;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -231,9 +237,7 @@ var documentsView = Backbone.View.extend({
|
||||||
|
|
||||||
var tempObj = {};
|
var tempObj = {};
|
||||||
$.each(value.attributes.content, function(k, v) {
|
$.each(value.attributes.content, function(k, v) {
|
||||||
if (k === '_id' || k === '_rev' || k === '_key') {
|
if (k !== '_id' || k !== '_rev' || k !== '_key') {
|
||||||
}
|
|
||||||
else {
|
|
||||||
tempObj[k] = v;
|
tempObj[k] = v;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -254,17 +258,17 @@ var documentsView = Backbone.View.extend({
|
||||||
+ '<img src="img/icon_delete.png" width="16" height="16"></button>'
|
+ '<img src="img/icon_delete.png" width="16" height="16"></button>'
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
$(".prettify").snippet("javascript", {style: "nedit", menu: false, startText: false, transparent: true, showNum: false});
|
$(".prettify").snippet("javascript", {
|
||||||
/* $(".prettify").tooltip({
|
style: "nedit",
|
||||||
html: true,
|
menu: false,
|
||||||
placement: "top"
|
startText: false,
|
||||||
});*/
|
transparent: true,
|
||||||
|
showNum: false
|
||||||
|
});
|
||||||
this.totalPages = window.arangoDocumentsStore.totalPages;
|
this.totalPages = window.arangoDocumentsStore.totalPages;
|
||||||
this.currentPage = window.arangoDocumentsStore.currentPage;
|
this.currentPage = window.arangoDocumentsStore.currentPage;
|
||||||
this.documentsCount = window.arangoDocumentsStore.documentsCount;
|
this.documentsCount = window.arangoDocumentsStore.documentsCount;
|
||||||
if (this.documentsCount === 0) {
|
if (this.documentsCount !== 0) {
|
||||||
}
|
|
||||||
else {
|
|
||||||
$('#documentsStatus').html(
|
$('#documentsStatus').html(
|
||||||
'Showing Page '+this.currentPage+' of '+this.totalPages+
|
'Showing Page '+this.currentPage+' of '+this.totalPages+
|
||||||
', '+this.documentsCount+' entries'
|
', '+this.documentsCount+' entries'
|
||||||
|
@ -305,13 +309,19 @@ var documentsView = Backbone.View.extend({
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
target.pagination(options);
|
target.pagination(options);
|
||||||
$('#documentsToolbarF').prepend('<ul class="prePagi"><li><a id="documents_first"><i class="icon icon-step-backward"></i></a></li></ul>');
|
$('#documentsToolbarF').prepend(
|
||||||
$('#documentsToolbarF').append('<ul class="lasPagi"><li><a id="documents_last"><i class="icon icon-step-forward"></i></a></li></ul>');
|
'<ul class="prePagi"><li><a id="documents_first">'+
|
||||||
|
'<i class="icon icon-step-backward"></i></a></li></ul>');
|
||||||
|
$('#documentsToolbarF').append(
|
||||||
|
'<ul class="lasPagi"><li><a id="documents_last">'+
|
||||||
|
'<i class="icon icon-step-forward"></i></a></li></ul>');
|
||||||
var total = $('#totalDocuments');
|
var total = $('#totalDocuments');
|
||||||
if (total.length > 0) {
|
if (total.length > 0) {
|
||||||
total.html("Total: " + this.documentsCount + " documents");
|
total.html("Total: " + this.documentsCount + " documents");
|
||||||
} else {
|
} else {
|
||||||
$('#documentsToolbarFL').append('<a id="totalDocuments">Total: ' + this.documentsCount + ' document(s) </a>');
|
$('#documentsToolbarFL').append(
|
||||||
|
'<a id="totalDocuments">Total: ' + this.documentsCount + ' document(s) </a>'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
breadcrumb: function () {
|
breadcrumb: function () {
|
||||||
|
@ -331,7 +341,8 @@ var documentsView = Backbone.View.extend({
|
||||||
return this.escaped(string);
|
return this.escaped(string);
|
||||||
},
|
},
|
||||||
escaped: function (value) {
|
escaped: function (value) {
|
||||||
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")
|
||||||
|
.replace(/"/g, """).replace(/'/g, "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
||||||
|
/*global require, exports, Backbone, EJS, $*/
|
||||||
|
|
||||||
var footerView = Backbone.View.extend({
|
var footerView = Backbone.View.extend({
|
||||||
el: '.footer',
|
el: '.footer',
|
||||||
init: function () {
|
init: function () {
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
||||||
|
/*global require, exports, Backbone, EJS, $, window*/
|
||||||
|
|
||||||
var logsView = Backbone.View.extend({
|
var logsView = Backbone.View.extend({
|
||||||
el: '#content',
|
el: '#content',
|
||||||
offset: 0,
|
offset: 0,
|
||||||
|
@ -21,12 +24,10 @@ var logsView = Backbone.View.extend({
|
||||||
"click #logTableID_first" : "firstTable",
|
"click #logTableID_first" : "firstTable",
|
||||||
"click #logTableID_last" : "lastTable",
|
"click #logTableID_last" : "lastTable",
|
||||||
"click #logTableID_prev" : "prevTable",
|
"click #logTableID_prev" : "prevTable",
|
||||||
"click #logTableID_next" : "nextTable",
|
"click #logTableID_next" : "nextTable"
|
||||||
},
|
},
|
||||||
firstTable: function () {
|
firstTable: function () {
|
||||||
if (this.offset == 0) {
|
if (this.offset !== 0) {
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.offset = 0;
|
this.offset = 0;
|
||||||
this.page = 1;
|
this.page = 1;
|
||||||
this.clearTable();
|
this.clearTable();
|
||||||
|
@ -34,9 +35,7 @@ var logsView = Backbone.View.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
lastTable: function () {
|
lastTable: function () {
|
||||||
if (this.page == this.totalPages) {
|
if (this.page !== this.totalPages) {
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.totalPages = Math.ceil(this.totalAmount / this.size);
|
this.totalPages = Math.ceil(this.totalAmount / this.size);
|
||||||
this.page = this.totalPages;
|
this.page = this.totalPages;
|
||||||
this.offset = (this.totalPages * this.size) - this.size;
|
this.offset = (this.totalPages * this.size) - this.size;
|
||||||
|
@ -45,9 +44,7 @@ var logsView = Backbone.View.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
prevTable: function () {
|
prevTable: function () {
|
||||||
if (this.offset == 0) {
|
if (this.offset !== 0) {
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.offset = this.offset - this.size;
|
this.offset = this.offset - this.size;
|
||||||
this.page = this.page - 1;
|
this.page = this.page - 1;
|
||||||
this.clearTable();
|
this.clearTable();
|
||||||
|
@ -55,9 +52,7 @@ var logsView = Backbone.View.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
nextTable: function () {
|
nextTable: function () {
|
||||||
if (this.page == this.totalPages) {
|
if (this.page !== this.totalPages) {
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.page = this.page + 1;
|
this.page = this.page + 1;
|
||||||
this.offset = this.offset + this.size;
|
this.offset = this.offset + this.size;
|
||||||
this.clearTable();
|
this.clearTable();
|
||||||
|
@ -160,15 +155,21 @@ var logsView = Backbone.View.extend({
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
target.pagination(options);
|
target.pagination(options);
|
||||||
$('#logtestdiv').prepend('<ul class="prePagi"><li><a id="logTableID_first"><i class="icon icon-step-backward"></i></a></li></ul>');
|
$('#logtestdiv').prepend(
|
||||||
$('#logtestdiv').append('<ul class="lasPagi"><li><a id="logTableID_last"><i class="icon icon-step-forward"></i></a></li></ul>');
|
'<ul class="prePagi"><li><a id="logTableID_first">'+
|
||||||
|
'<i class="icon icon-step-backward"></i></a></li></ul>'
|
||||||
|
);
|
||||||
|
$('#logtestdiv').append(
|
||||||
|
'<ul class="lasPagi"><li><a id="logTableID_last">'+
|
||||||
|
'<i class="icon icon-step-forward"></i></a></li></ul>'
|
||||||
|
);
|
||||||
},
|
},
|
||||||
drawTable: function () {
|
drawTable: function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
function format (dt) {
|
function format (dt) {
|
||||||
var pad = function (n) {
|
var pad = function (n) {
|
||||||
return n < 10 ? '0' + n : n
|
return n < 10 ? '0' + n : n;
|
||||||
};
|
};
|
||||||
|
|
||||||
return dt.getUTCFullYear() + '-'
|
return dt.getUTCFullYear() + '-'
|
||||||
|
@ -197,10 +198,22 @@ var logsView = Backbone.View.extend({
|
||||||
$('#'+this.table).dataTable().fnClearTable();
|
$('#'+this.table).dataTable().fnClearTable();
|
||||||
},
|
},
|
||||||
convertLogStatus: function (status) {
|
convertLogStatus: function (status) {
|
||||||
if (status === 1) { return "Error" ;}
|
var returnString;
|
||||||
else if (status === 2) { return "Warning" ;}
|
if (status === 1) {
|
||||||
else if (status === 3) { return "Info" ;}
|
returnString = "Error";
|
||||||
else if (status === 4) { return "Debug" ;}
|
}
|
||||||
else { return "Unknown";}
|
else if (status === 2) {
|
||||||
|
returnString = "Warning";
|
||||||
|
}
|
||||||
|
else if (status === 3) {
|
||||||
|
returnString = "Info";
|
||||||
|
}
|
||||||
|
else if (status === 4) {
|
||||||
|
returnString = "Debug";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
returnString = "Unknown";
|
||||||
|
}
|
||||||
|
return returnString;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
||||||
|
/*global require, exports, Backbone, EJS, $*/
|
||||||
|
|
||||||
var navigationView = Backbone.View.extend({
|
var navigationView = Backbone.View.extend({
|
||||||
el: '.header',
|
el: '.header',
|
||||||
init: function () {
|
init: function () {
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
||||||
|
/*global require, exports, Backbone, EJS, $, window, arangoHelper*/
|
||||||
|
|
||||||
var newCollectionView = Backbone.View.extend({
|
var newCollectionView = Backbone.View.extend({
|
||||||
el: '#modalPlaceholder',
|
el: '#modalPlaceholder',
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
|
@ -32,7 +35,7 @@ var newCollectionView = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
listenKey: function(e) {
|
listenKey: function(e) {
|
||||||
if (e.keyCode == 13) {
|
if (e.keyCode === 13) {
|
||||||
this.saveNewCollection();
|
this.saveNewCollection();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -41,7 +44,6 @@ var newCollectionView = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
saveNewCollection: function(a) {
|
saveNewCollection: function(a) {
|
||||||
//TODO: other solution
|
|
||||||
if (window.location.hash !== '#new') {
|
if (window.location.hash !== '#new') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -53,9 +55,10 @@ var newCollectionView = Backbone.View.extend({
|
||||||
var collType = $('#new-collection-type').val();
|
var collType = $('#new-collection-type').val();
|
||||||
var collSync = $('#new-collection-sync').val();
|
var collSync = $('#new-collection-sync').val();
|
||||||
var isSystem = (collName.substr(0, 1) === '_');
|
var isSystem = (collName.substr(0, 1) === '_');
|
||||||
var wfs = (collSync == "true");
|
var wfs = (collSync === "true");
|
||||||
|
var journalSizeString;
|
||||||
|
|
||||||
if (collSize == '') {
|
if (collSize === '') {
|
||||||
journalSizeString = '';
|
journalSizeString = '';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -68,12 +71,14 @@ var newCollectionView = Backbone.View.extend({
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (collName == '') {
|
if (collName === '') {
|
||||||
arangoHelper.arangoError('No collection name entered!');
|
arangoHelper.arangoError('No collection name entered!');
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
var returnobj = window.arangoCollectionsStore.newCollection(collName, wfs, isSystem, journalSizeString, collType);
|
var returnobj = window.arangoCollectionsStore.newCollection(
|
||||||
|
collName, wfs, isSystem, journalSizeString, collType
|
||||||
|
);
|
||||||
if (returnobj.status === true) {
|
if (returnobj.status === true) {
|
||||||
self.hidden();
|
self.hidden();
|
||||||
$("#add-collection").modal('hide');
|
$("#add-collection").modal('hide');
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
|
||||||
|
/*global require, exports, Backbone, EJS, $, localStorage, ace, Storage, window, arangoHelper*/
|
||||||
|
|
||||||
var queryView = Backbone.View.extend({
|
var queryView = Backbone.View.extend({
|
||||||
el: '#content',
|
el: '#content',
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
|
@ -7,7 +10,7 @@ var queryView = Backbone.View.extend({
|
||||||
events: {
|
events: {
|
||||||
'click #submitQueryIcon' : 'submitQuery',
|
'click #submitQueryIcon' : 'submitQuery',
|
||||||
'click #submitQueryButton' : 'submitQuery',
|
'click #submitQueryButton' : 'submitQuery',
|
||||||
'click .clearicon': 'clearOutput',
|
'click .clearicon': 'clearOutput'
|
||||||
},
|
},
|
||||||
clearOutput: function() {
|
clearOutput: function() {
|
||||||
$('#queryOutput').empty();
|
$('#queryOutput').empty();
|
||||||
|
@ -50,7 +53,7 @@ var queryView = Backbone.View.extend({
|
||||||
$('#aqlEditor .ace_text-input').focus();
|
$('#aqlEditor .ace_text-input').focus();
|
||||||
$.gritter.removeAll();
|
$.gritter.removeAll();
|
||||||
|
|
||||||
if(typeof(Storage)!=="undefined") {
|
if(typeof Storage) {
|
||||||
var queryContent = localStorage.getItem("queryContent");
|
var queryContent = localStorage.getItem("queryContent");
|
||||||
var queryOutput = localStorage.getItem("queryOutput");
|
var queryOutput = localStorage.getItem("queryOutput");
|
||||||
editor.setValue(queryContent);
|
editor.setValue(queryContent);
|
||||||
|
@ -80,8 +83,8 @@ var queryView = Backbone.View.extend({
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
processData: false,
|
processData: false,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
editor2.setValue(self.FormatJSON(data.result));
|
editor2.setValue(arangoHelper.FormatJSON(data.result));
|
||||||
if(typeof(Storage) !== "undefined") {
|
if(typeof Storage) {
|
||||||
localStorage.setItem("queryContent", editor.getValue());
|
localStorage.setItem("queryContent", editor.getValue());
|
||||||
localStorage.setItem("queryOutput", editor2.getValue());
|
localStorage.setItem("queryOutput", editor2.getValue());
|
||||||
}
|
}
|
||||||
|
@ -91,7 +94,7 @@ var queryView = Backbone.View.extend({
|
||||||
var temp = JSON.parse(data.responseText);
|
var temp = JSON.parse(data.responseText);
|
||||||
editor2.setValue('[' + temp.errorNum + '] ' + temp.errorMessage);
|
editor2.setValue('[' + temp.errorNum + '] ' + temp.errorMessage);
|
||||||
|
|
||||||
if(typeof(Storage) !== "undefined") {
|
if(typeof Storage) {
|
||||||
localStorage.setItem("queryContent", editor.getValue());
|
localStorage.setItem("queryContent", editor.getValue());
|
||||||
localStorage.setItem("queryOutput", editor2.getValue());
|
localStorage.setItem("queryOutput", editor2.getValue());
|
||||||
}
|
}
|
||||||
|
@ -103,87 +106,6 @@ var queryView = Backbone.View.extend({
|
||||||
});
|
});
|
||||||
editor2.resize();
|
editor2.resize();
|
||||||
|
|
||||||
},
|
|
||||||
FormatJSON: function(oData, sIndent) {
|
|
||||||
var self = this;
|
|
||||||
if (arguments.length < 2) {
|
|
||||||
var sIndent = "";
|
|
||||||
}
|
|
||||||
var sIndentStyle = " ";
|
|
||||||
var sDataType = self.RealTypeOf(oData);
|
|
||||||
|
|
||||||
if (sDataType == "array") {
|
|
||||||
if (oData.length == 0) {
|
|
||||||
return "[]";
|
|
||||||
}
|
|
||||||
var sHTML = "[";
|
|
||||||
} else {
|
|
||||||
var iCount = 0;
|
|
||||||
$.each(oData, function() {
|
|
||||||
iCount++;
|
|
||||||
return;
|
|
||||||
});
|
|
||||||
if (iCount == 0) { // object is empty
|
|
||||||
return "{}";
|
|
||||||
}
|
|
||||||
var sHTML = "{";
|
|
||||||
}
|
|
||||||
|
|
||||||
// loop through items
|
|
||||||
var iCount = 0;
|
|
||||||
$.each(oData, function(sKey, vValue) {
|
|
||||||
if (iCount > 0) {
|
|
||||||
sHTML += ",";
|
|
||||||
}
|
|
||||||
if (sDataType == "array") {
|
|
||||||
sHTML += ("\n" + sIndent + sIndentStyle);
|
|
||||||
} else {
|
|
||||||
sHTML += ("\n" + sIndent + sIndentStyle + JSON.stringify(sKey) + ": ");
|
|
||||||
}
|
|
||||||
|
|
||||||
// display relevant data type
|
|
||||||
switch (self.RealTypeOf(vValue)) {
|
|
||||||
case "array":
|
|
||||||
case "object":
|
|
||||||
sHTML += self.FormatJSON(vValue, (sIndent + sIndentStyle));
|
|
||||||
break;
|
|
||||||
case "boolean":
|
|
||||||
case "number":
|
|
||||||
sHTML += vValue.toString();
|
|
||||||
break;
|
|
||||||
case "null":
|
|
||||||
sHTML += "null";
|
|
||||||
break;
|
|
||||||
case "string":
|
|
||||||
sHTML += "\"" + vValue.replace(/\\/g, "\\\\").replace(/"/g, "\\\"") + "\"";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
sHTML += ("TYPEOF: " + typeof(vValue));
|
|
||||||
}
|
|
||||||
|
|
||||||
// loop
|
|
||||||
iCount++;
|
|
||||||
});
|
|
||||||
|
|
||||||
// close object
|
|
||||||
if (sDataType == "array") {
|
|
||||||
sHTML += ("\n" + sIndent + "]");
|
|
||||||
} else {
|
|
||||||
sHTML += ("\n" + sIndent + "}");
|
|
||||||
}
|
|
||||||
|
|
||||||
// return
|
|
||||||
return sHTML;
|
|
||||||
},
|
|
||||||
RealTypeOf: function(v) {
|
|
||||||
if (typeof(v) == "object") {
|
|
||||||
if (v === null) return "null";
|
|
||||||
if (v.constructor == (new Array).constructor) return "array";
|
|
||||||
if (v.constructor == (new Date).constructor) return "date";
|
|
||||||
if (v.constructor == (new RegExp).constructor) return "regex";
|
|
||||||
return "object";
|
|
||||||
}
|
|
||||||
return typeof(v);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true, evil: true, es5:true */
|
||||||
|
/*global require, exports, Backbone, EJS, $, window, ace, jqconsole, handler, help, location*/
|
||||||
|
|
||||||
var shellView = Backbone.View.extend({
|
var shellView = Backbone.View.extend({
|
||||||
el: '#content',
|
el: '#content',
|
||||||
events: {
|
events: {
|
||||||
|
@ -28,7 +31,7 @@ var shellView = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
renderEditor: function () {
|
renderEditor: function () {
|
||||||
var editor = ace.edit("editor");
|
var editor = ace.edit("editor");
|
||||||
editor.resize()
|
editor.resize();
|
||||||
},
|
},
|
||||||
editor: function () {
|
editor: function () {
|
||||||
var editor = ace.edit("editor");
|
var editor = ace.edit("editor");
|
||||||
|
@ -93,13 +96,13 @@ var shellView = Backbone.View.extend({
|
||||||
jqconsole.Prompt(true, handler, function(command) {
|
jqconsole.Prompt(true, handler, function(command) {
|
||||||
// Continue line if can't compile the command.
|
// Continue line if can't compile the command.
|
||||||
try {
|
try {
|
||||||
Function(command);
|
var test = new Function(command);
|
||||||
} catch (e) {
|
}
|
||||||
|
catch (e) {
|
||||||
if (/[\[\{\(]$/.test(command)) {
|
if (/[\[\{\(]$/.test(command)) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Jasmine Test JSLint</title>
|
||||||
|
|
||||||
|
<link rel="shortcut icon" type="image/png" href="lib/jasmine-1.3.1/jasmine_favicon.png">
|
||||||
|
<link rel="stylesheet" type="text/css" href="lib/jasmine-1.3.1/jasmine.css">
|
||||||
|
<script type="text/javascript" src="lib/jasmine-1.3.1/jasmine.js"></script>
|
||||||
|
<script type="text/javascript" src="lib/jasmine-1.3.1/jasmine-html.js"></script>
|
||||||
|
<script type="text/javascript" src="lib/underscore.js"></script>
|
||||||
|
<script type="text/javascript" src="lib/jslint.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- include scripts to check here -->
|
||||||
|
<script type="text/javascript" src="../js/views/aboutView.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/views/collectionView.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/views/collectionsItemView.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/views/collectionsView.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/views/dashboardView.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/views/documentSourceView.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/views/documentView.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/views/documentsView.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/views/footerView.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/views/logsView.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/views/navigationView.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/views/newCollectionView.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/views/queryView.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/views/shellView.js"></script>
|
||||||
|
|
||||||
|
<!-- models --!>
|
||||||
|
<script type="text/javascript" src="../js/views/aboutView.js"></script>
|
||||||
|
<!-- collections --!>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- include spec files here... -->
|
||||||
|
<script type="text/javascript" src="specJSLint/jsLintSpec.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
(function() {
|
||||||
|
var jasmineEnv = jasmine.getEnv();
|
||||||
|
jasmineEnv.updateInterval = 1000;
|
||||||
|
|
||||||
|
var htmlReporter = new jasmine.HtmlReporter();
|
||||||
|
|
||||||
|
jasmineEnv.addReporter(htmlReporter);
|
||||||
|
|
||||||
|
jasmineEnv.specFilter = function(spec) {
|
||||||
|
return htmlReporter.specFilter(spec);
|
||||||
|
};
|
||||||
|
|
||||||
|
var currentWindowOnload = window.onload;
|
||||||
|
|
||||||
|
window.onload = function() {
|
||||||
|
if (currentWindowOnload) {
|
||||||
|
currentWindowOnload();
|
||||||
|
}
|
||||||
|
execJasmine();
|
||||||
|
};
|
||||||
|
|
||||||
|
function execJasmine() {
|
||||||
|
jasmineEnv.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,20 @@
|
||||||
|
Copyright (c) 2008-2011 Pivotal Labs
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,681 @@
|
||||||
|
jasmine.HtmlReporterHelpers = {};
|
||||||
|
|
||||||
|
jasmine.HtmlReporterHelpers.createDom = function(type, attrs, childrenVarArgs) {
|
||||||
|
var el = document.createElement(type);
|
||||||
|
|
||||||
|
for (var i = 2; i < arguments.length; i++) {
|
||||||
|
var child = arguments[i];
|
||||||
|
|
||||||
|
if (typeof child === 'string') {
|
||||||
|
el.appendChild(document.createTextNode(child));
|
||||||
|
} else {
|
||||||
|
if (child) {
|
||||||
|
el.appendChild(child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var attr in attrs) {
|
||||||
|
if (attr == "className") {
|
||||||
|
el[attr] = attrs[attr];
|
||||||
|
} else {
|
||||||
|
el.setAttribute(attr, attrs[attr]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return el;
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.HtmlReporterHelpers.getSpecStatus = function(child) {
|
||||||
|
var results = child.results();
|
||||||
|
var status = results.passed() ? 'passed' : 'failed';
|
||||||
|
if (results.skipped) {
|
||||||
|
status = 'skipped';
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.HtmlReporterHelpers.appendToSummary = function(child, childElement) {
|
||||||
|
var parentDiv = this.dom.summary;
|
||||||
|
var parentSuite = (typeof child.parentSuite == 'undefined') ? 'suite' : 'parentSuite';
|
||||||
|
var parent = child[parentSuite];
|
||||||
|
|
||||||
|
if (parent) {
|
||||||
|
if (typeof this.views.suites[parent.id] == 'undefined') {
|
||||||
|
this.views.suites[parent.id] = new jasmine.HtmlReporter.SuiteView(parent, this.dom, this.views);
|
||||||
|
}
|
||||||
|
parentDiv = this.views.suites[parent.id].element;
|
||||||
|
}
|
||||||
|
|
||||||
|
parentDiv.appendChild(childElement);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
jasmine.HtmlReporterHelpers.addHelpers = function(ctor) {
|
||||||
|
for(var fn in jasmine.HtmlReporterHelpers) {
|
||||||
|
ctor.prototype[fn] = jasmine.HtmlReporterHelpers[fn];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.HtmlReporter = function(_doc) {
|
||||||
|
var self = this;
|
||||||
|
var doc = _doc || window.document;
|
||||||
|
|
||||||
|
var reporterView;
|
||||||
|
|
||||||
|
var dom = {};
|
||||||
|
|
||||||
|
// Jasmine Reporter Public Interface
|
||||||
|
self.logRunningSpecs = false;
|
||||||
|
|
||||||
|
self.reportRunnerStarting = function(runner) {
|
||||||
|
var specs = runner.specs() || [];
|
||||||
|
|
||||||
|
if (specs.length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
createReporterDom(runner.env.versionString());
|
||||||
|
doc.body.appendChild(dom.reporter);
|
||||||
|
setExceptionHandling();
|
||||||
|
|
||||||
|
reporterView = new jasmine.HtmlReporter.ReporterView(dom);
|
||||||
|
reporterView.addSpecs(specs, self.specFilter);
|
||||||
|
};
|
||||||
|
|
||||||
|
self.reportRunnerResults = function(runner) {
|
||||||
|
reporterView && reporterView.complete();
|
||||||
|
};
|
||||||
|
|
||||||
|
self.reportSuiteResults = function(suite) {
|
||||||
|
reporterView.suiteComplete(suite);
|
||||||
|
};
|
||||||
|
|
||||||
|
self.reportSpecStarting = function(spec) {
|
||||||
|
if (self.logRunningSpecs) {
|
||||||
|
self.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
self.reportSpecResults = function(spec) {
|
||||||
|
reporterView.specComplete(spec);
|
||||||
|
};
|
||||||
|
|
||||||
|
self.log = function() {
|
||||||
|
var console = jasmine.getGlobal().console;
|
||||||
|
if (console && console.log) {
|
||||||
|
if (console.log.apply) {
|
||||||
|
console.log.apply(console, arguments);
|
||||||
|
} else {
|
||||||
|
console.log(arguments); // ie fix: console.log.apply doesn't exist on ie
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
self.specFilter = function(spec) {
|
||||||
|
if (!focusedSpecName()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return spec.getFullName().indexOf(focusedSpecName()) === 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
return self;
|
||||||
|
|
||||||
|
function focusedSpecName() {
|
||||||
|
var specName;
|
||||||
|
|
||||||
|
(function memoizeFocusedSpec() {
|
||||||
|
if (specName) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var paramMap = [];
|
||||||
|
var params = jasmine.HtmlReporter.parameters(doc);
|
||||||
|
|
||||||
|
for (var i = 0; i < params.length; i++) {
|
||||||
|
var p = params[i].split('=');
|
||||||
|
paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
specName = paramMap.spec;
|
||||||
|
})();
|
||||||
|
|
||||||
|
return specName;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createReporterDom(version) {
|
||||||
|
dom.reporter = self.createDom('div', { id: 'HTMLReporter', className: 'jasmine_reporter' },
|
||||||
|
dom.banner = self.createDom('div', { className: 'banner' },
|
||||||
|
self.createDom('span', { className: 'title' }, "Jasmine "),
|
||||||
|
self.createDom('span', { className: 'version' }, version)),
|
||||||
|
|
||||||
|
dom.symbolSummary = self.createDom('ul', {className: 'symbolSummary'}),
|
||||||
|
dom.alert = self.createDom('div', {className: 'alert'},
|
||||||
|
self.createDom('span', { className: 'exceptions' },
|
||||||
|
self.createDom('label', { className: 'label', 'for': 'no_try_catch' }, 'No try/catch'),
|
||||||
|
self.createDom('input', { id: 'no_try_catch', type: 'checkbox' }))),
|
||||||
|
dom.results = self.createDom('div', {className: 'results'},
|
||||||
|
dom.summary = self.createDom('div', { className: 'summary' }),
|
||||||
|
dom.details = self.createDom('div', { id: 'details' }))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function noTryCatch() {
|
||||||
|
return window.location.search.match(/catch=false/);
|
||||||
|
}
|
||||||
|
|
||||||
|
function searchWithCatch() {
|
||||||
|
var params = jasmine.HtmlReporter.parameters(window.document);
|
||||||
|
var removed = false;
|
||||||
|
var i = 0;
|
||||||
|
|
||||||
|
while (!removed && i < params.length) {
|
||||||
|
if (params[i].match(/catch=/)) {
|
||||||
|
params.splice(i, 1);
|
||||||
|
removed = true;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
if (jasmine.CATCH_EXCEPTIONS) {
|
||||||
|
params.push("catch=false");
|
||||||
|
}
|
||||||
|
|
||||||
|
return params.join("&");
|
||||||
|
}
|
||||||
|
|
||||||
|
function setExceptionHandling() {
|
||||||
|
var chxCatch = document.getElementById('no_try_catch');
|
||||||
|
|
||||||
|
if (noTryCatch()) {
|
||||||
|
chxCatch.setAttribute('checked', true);
|
||||||
|
jasmine.CATCH_EXCEPTIONS = false;
|
||||||
|
}
|
||||||
|
chxCatch.onclick = function() {
|
||||||
|
window.location.search = searchWithCatch();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
jasmine.HtmlReporter.parameters = function(doc) {
|
||||||
|
var paramStr = doc.location.search.substring(1);
|
||||||
|
var params = [];
|
||||||
|
|
||||||
|
if (paramStr.length > 0) {
|
||||||
|
params = paramStr.split('&');
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
jasmine.HtmlReporter.sectionLink = function(sectionName) {
|
||||||
|
var link = '?';
|
||||||
|
var params = [];
|
||||||
|
|
||||||
|
if (sectionName) {
|
||||||
|
params.push('spec=' + encodeURIComponent(sectionName));
|
||||||
|
}
|
||||||
|
if (!jasmine.CATCH_EXCEPTIONS) {
|
||||||
|
params.push("catch=false");
|
||||||
|
}
|
||||||
|
if (params.length > 0) {
|
||||||
|
link += params.join("&");
|
||||||
|
}
|
||||||
|
|
||||||
|
return link;
|
||||||
|
};
|
||||||
|
jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter);
|
||||||
|
jasmine.HtmlReporter.ReporterView = function(dom) {
|
||||||
|
this.startedAt = new Date();
|
||||||
|
this.runningSpecCount = 0;
|
||||||
|
this.completeSpecCount = 0;
|
||||||
|
this.passedCount = 0;
|
||||||
|
this.failedCount = 0;
|
||||||
|
this.skippedCount = 0;
|
||||||
|
|
||||||
|
this.createResultsMenu = function() {
|
||||||
|
this.resultsMenu = this.createDom('span', {className: 'resultsMenu bar'},
|
||||||
|
this.summaryMenuItem = this.createDom('a', {className: 'summaryMenuItem', href: "#"}, '0 specs'),
|
||||||
|
' | ',
|
||||||
|
this.detailsMenuItem = this.createDom('a', {className: 'detailsMenuItem', href: "#"}, '0 failing'));
|
||||||
|
|
||||||
|
this.summaryMenuItem.onclick = function() {
|
||||||
|
dom.reporter.className = dom.reporter.className.replace(/ showDetails/g, '');
|
||||||
|
};
|
||||||
|
|
||||||
|
this.detailsMenuItem.onclick = function() {
|
||||||
|
showDetails();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
this.addSpecs = function(specs, specFilter) {
|
||||||
|
this.totalSpecCount = specs.length;
|
||||||
|
|
||||||
|
this.views = {
|
||||||
|
specs: {},
|
||||||
|
suites: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
for (var i = 0; i < specs.length; i++) {
|
||||||
|
var spec = specs[i];
|
||||||
|
this.views.specs[spec.id] = new jasmine.HtmlReporter.SpecView(spec, dom, this.views);
|
||||||
|
if (specFilter(spec)) {
|
||||||
|
this.runningSpecCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.specComplete = function(spec) {
|
||||||
|
this.completeSpecCount++;
|
||||||
|
|
||||||
|
if (isUndefined(this.views.specs[spec.id])) {
|
||||||
|
this.views.specs[spec.id] = new jasmine.HtmlReporter.SpecView(spec, dom);
|
||||||
|
}
|
||||||
|
|
||||||
|
var specView = this.views.specs[spec.id];
|
||||||
|
|
||||||
|
switch (specView.status()) {
|
||||||
|
case 'passed':
|
||||||
|
this.passedCount++;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'failed':
|
||||||
|
this.failedCount++;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'skipped':
|
||||||
|
this.skippedCount++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
specView.refresh();
|
||||||
|
this.refresh();
|
||||||
|
};
|
||||||
|
|
||||||
|
this.suiteComplete = function(suite) {
|
||||||
|
var suiteView = this.views.suites[suite.id];
|
||||||
|
if (isUndefined(suiteView)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
suiteView.refresh();
|
||||||
|
};
|
||||||
|
|
||||||
|
this.refresh = function() {
|
||||||
|
|
||||||
|
if (isUndefined(this.resultsMenu)) {
|
||||||
|
this.createResultsMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
// currently running UI
|
||||||
|
if (isUndefined(this.runningAlert)) {
|
||||||
|
this.runningAlert = this.createDom('a', { href: jasmine.HtmlReporter.sectionLink(), className: "runningAlert bar" });
|
||||||
|
dom.alert.appendChild(this.runningAlert);
|
||||||
|
}
|
||||||
|
this.runningAlert.innerHTML = "Running " + this.completeSpecCount + " of " + specPluralizedFor(this.totalSpecCount);
|
||||||
|
|
||||||
|
// skipped specs UI
|
||||||
|
if (isUndefined(this.skippedAlert)) {
|
||||||
|
this.skippedAlert = this.createDom('a', { href: jasmine.HtmlReporter.sectionLink(), className: "skippedAlert bar" });
|
||||||
|
}
|
||||||
|
|
||||||
|
this.skippedAlert.innerHTML = "Skipping " + this.skippedCount + " of " + specPluralizedFor(this.totalSpecCount) + " - run all";
|
||||||
|
|
||||||
|
if (this.skippedCount === 1 && isDefined(dom.alert)) {
|
||||||
|
dom.alert.appendChild(this.skippedAlert);
|
||||||
|
}
|
||||||
|
|
||||||
|
// passing specs UI
|
||||||
|
if (isUndefined(this.passedAlert)) {
|
||||||
|
this.passedAlert = this.createDom('span', { href: jasmine.HtmlReporter.sectionLink(), className: "passingAlert bar" });
|
||||||
|
}
|
||||||
|
this.passedAlert.innerHTML = "Passing " + specPluralizedFor(this.passedCount);
|
||||||
|
|
||||||
|
// failing specs UI
|
||||||
|
if (isUndefined(this.failedAlert)) {
|
||||||
|
this.failedAlert = this.createDom('span', {href: "?", className: "failingAlert bar"});
|
||||||
|
}
|
||||||
|
this.failedAlert.innerHTML = "Failing " + specPluralizedFor(this.failedCount);
|
||||||
|
|
||||||
|
if (this.failedCount === 1 && isDefined(dom.alert)) {
|
||||||
|
dom.alert.appendChild(this.failedAlert);
|
||||||
|
dom.alert.appendChild(this.resultsMenu);
|
||||||
|
}
|
||||||
|
|
||||||
|
// summary info
|
||||||
|
this.summaryMenuItem.innerHTML = "" + specPluralizedFor(this.runningSpecCount);
|
||||||
|
this.detailsMenuItem.innerHTML = "" + this.failedCount + " failing";
|
||||||
|
};
|
||||||
|
|
||||||
|
this.complete = function() {
|
||||||
|
dom.alert.removeChild(this.runningAlert);
|
||||||
|
|
||||||
|
this.skippedAlert.innerHTML = "Ran " + this.runningSpecCount + " of " + specPluralizedFor(this.totalSpecCount) + " - run all";
|
||||||
|
|
||||||
|
if (this.failedCount === 0) {
|
||||||
|
dom.alert.appendChild(this.createDom('span', {className: 'passingAlert bar'}, "Passing " + specPluralizedFor(this.passedCount)));
|
||||||
|
} else {
|
||||||
|
showDetails();
|
||||||
|
}
|
||||||
|
|
||||||
|
dom.banner.appendChild(this.createDom('span', {className: 'duration'}, "finished in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s"));
|
||||||
|
};
|
||||||
|
|
||||||
|
return this;
|
||||||
|
|
||||||
|
function showDetails() {
|
||||||
|
if (dom.reporter.className.search(/showDetails/) === -1) {
|
||||||
|
dom.reporter.className += " showDetails";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function isUndefined(obj) {
|
||||||
|
return typeof obj === 'undefined';
|
||||||
|
}
|
||||||
|
|
||||||
|
function isDefined(obj) {
|
||||||
|
return !isUndefined(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
function specPluralizedFor(count) {
|
||||||
|
var str = count + " spec";
|
||||||
|
if (count > 1) {
|
||||||
|
str += "s"
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.ReporterView);
|
||||||
|
|
||||||
|
|
||||||
|
jasmine.HtmlReporter.SpecView = function(spec, dom, views) {
|
||||||
|
this.spec = spec;
|
||||||
|
this.dom = dom;
|
||||||
|
this.views = views;
|
||||||
|
|
||||||
|
this.symbol = this.createDom('li', { className: 'pending' });
|
||||||
|
this.dom.symbolSummary.appendChild(this.symbol);
|
||||||
|
|
||||||
|
this.summary = this.createDom('div', { className: 'specSummary' },
|
||||||
|
this.createDom('a', {
|
||||||
|
className: 'description',
|
||||||
|
href: jasmine.HtmlReporter.sectionLink(this.spec.getFullName()),
|
||||||
|
title: this.spec.getFullName()
|
||||||
|
}, this.spec.description)
|
||||||
|
);
|
||||||
|
|
||||||
|
this.detail = this.createDom('div', { className: 'specDetail' },
|
||||||
|
this.createDom('a', {
|
||||||
|
className: 'description',
|
||||||
|
href: '?spec=' + encodeURIComponent(this.spec.getFullName()),
|
||||||
|
title: this.spec.getFullName()
|
||||||
|
}, this.spec.getFullName())
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.HtmlReporter.SpecView.prototype.status = function() {
|
||||||
|
return this.getSpecStatus(this.spec);
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.HtmlReporter.SpecView.prototype.refresh = function() {
|
||||||
|
this.symbol.className = this.status();
|
||||||
|
|
||||||
|
switch (this.status()) {
|
||||||
|
case 'skipped':
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'passed':
|
||||||
|
this.appendSummaryToSuiteDiv();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'failed':
|
||||||
|
this.appendSummaryToSuiteDiv();
|
||||||
|
this.appendFailureDetail();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.HtmlReporter.SpecView.prototype.appendSummaryToSuiteDiv = function() {
|
||||||
|
this.summary.className += ' ' + this.status();
|
||||||
|
this.appendToSummary(this.spec, this.summary);
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.HtmlReporter.SpecView.prototype.appendFailureDetail = function() {
|
||||||
|
this.detail.className += ' ' + this.status();
|
||||||
|
|
||||||
|
var resultItems = this.spec.results().getItems();
|
||||||
|
var messagesDiv = this.createDom('div', { className: 'messages' });
|
||||||
|
|
||||||
|
for (var i = 0; i < resultItems.length; i++) {
|
||||||
|
var result = resultItems[i];
|
||||||
|
|
||||||
|
if (result.type == 'log') {
|
||||||
|
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString()));
|
||||||
|
} else if (result.type == 'expect' && result.passed && !result.passed()) {
|
||||||
|
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));
|
||||||
|
|
||||||
|
if (result.trace.stack) {
|
||||||
|
messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (messagesDiv.childNodes.length > 0) {
|
||||||
|
this.detail.appendChild(messagesDiv);
|
||||||
|
this.dom.details.appendChild(this.detail);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SpecView);jasmine.HtmlReporter.SuiteView = function(suite, dom, views) {
|
||||||
|
this.suite = suite;
|
||||||
|
this.dom = dom;
|
||||||
|
this.views = views;
|
||||||
|
|
||||||
|
this.element = this.createDom('div', { className: 'suite' },
|
||||||
|
this.createDom('a', { className: 'description', href: jasmine.HtmlReporter.sectionLink(this.suite.getFullName()) }, this.suite.description)
|
||||||
|
);
|
||||||
|
|
||||||
|
this.appendToSummary(this.suite, this.element);
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.HtmlReporter.SuiteView.prototype.status = function() {
|
||||||
|
return this.getSpecStatus(this.suite);
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.HtmlReporter.SuiteView.prototype.refresh = function() {
|
||||||
|
this.element.className += " " + this.status();
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SuiteView);
|
||||||
|
|
||||||
|
/* @deprecated Use jasmine.HtmlReporter instead
|
||||||
|
*/
|
||||||
|
jasmine.TrivialReporter = function(doc) {
|
||||||
|
this.document = doc || document;
|
||||||
|
this.suiteDivs = {};
|
||||||
|
this.logRunningSpecs = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarArgs) {
|
||||||
|
var el = document.createElement(type);
|
||||||
|
|
||||||
|
for (var i = 2; i < arguments.length; i++) {
|
||||||
|
var child = arguments[i];
|
||||||
|
|
||||||
|
if (typeof child === 'string') {
|
||||||
|
el.appendChild(document.createTextNode(child));
|
||||||
|
} else {
|
||||||
|
if (child) { el.appendChild(child); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var attr in attrs) {
|
||||||
|
if (attr == "className") {
|
||||||
|
el[attr] = attrs[attr];
|
||||||
|
} else {
|
||||||
|
el.setAttribute(attr, attrs[attr]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return el;
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) {
|
||||||
|
var showPassed, showSkipped;
|
||||||
|
|
||||||
|
this.outerDiv = this.createDom('div', { id: 'TrivialReporter', className: 'jasmine_reporter' },
|
||||||
|
this.createDom('div', { className: 'banner' },
|
||||||
|
this.createDom('div', { className: 'logo' },
|
||||||
|
this.createDom('span', { className: 'title' }, "Jasmine"),
|
||||||
|
this.createDom('span', { className: 'version' }, runner.env.versionString())),
|
||||||
|
this.createDom('div', { className: 'options' },
|
||||||
|
"Show ",
|
||||||
|
showPassed = this.createDom('input', { id: "__jasmine_TrivialReporter_showPassed__", type: 'checkbox' }),
|
||||||
|
this.createDom('label', { "for": "__jasmine_TrivialReporter_showPassed__" }, " passed "),
|
||||||
|
showSkipped = this.createDom('input', { id: "__jasmine_TrivialReporter_showSkipped__", type: 'checkbox' }),
|
||||||
|
this.createDom('label', { "for": "__jasmine_TrivialReporter_showSkipped__" }, " skipped")
|
||||||
|
)
|
||||||
|
),
|
||||||
|
|
||||||
|
this.runnerDiv = this.createDom('div', { className: 'runner running' },
|
||||||
|
this.createDom('a', { className: 'run_spec', href: '?' }, "run all"),
|
||||||
|
this.runnerMessageSpan = this.createDom('span', {}, "Running..."),
|
||||||
|
this.finishedAtSpan = this.createDom('span', { className: 'finished-at' }, ""))
|
||||||
|
);
|
||||||
|
|
||||||
|
this.document.body.appendChild(this.outerDiv);
|
||||||
|
|
||||||
|
var suites = runner.suites();
|
||||||
|
for (var i = 0; i < suites.length; i++) {
|
||||||
|
var suite = suites[i];
|
||||||
|
var suiteDiv = this.createDom('div', { className: 'suite' },
|
||||||
|
this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"),
|
||||||
|
this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description));
|
||||||
|
this.suiteDivs[suite.id] = suiteDiv;
|
||||||
|
var parentDiv = this.outerDiv;
|
||||||
|
if (suite.parentSuite) {
|
||||||
|
parentDiv = this.suiteDivs[suite.parentSuite.id];
|
||||||
|
}
|
||||||
|
parentDiv.appendChild(suiteDiv);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.startedAt = new Date();
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
showPassed.onclick = function(evt) {
|
||||||
|
if (showPassed.checked) {
|
||||||
|
self.outerDiv.className += ' show-passed';
|
||||||
|
} else {
|
||||||
|
self.outerDiv.className = self.outerDiv.className.replace(/ show-passed/, '');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
showSkipped.onclick = function(evt) {
|
||||||
|
if (showSkipped.checked) {
|
||||||
|
self.outerDiv.className += ' show-skipped';
|
||||||
|
} else {
|
||||||
|
self.outerDiv.className = self.outerDiv.className.replace(/ show-skipped/, '');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) {
|
||||||
|
var results = runner.results();
|
||||||
|
var className = (results.failedCount > 0) ? "runner failed" : "runner passed";
|
||||||
|
this.runnerDiv.setAttribute("class", className);
|
||||||
|
//do it twice for IE
|
||||||
|
this.runnerDiv.setAttribute("className", className);
|
||||||
|
var specs = runner.specs();
|
||||||
|
var specCount = 0;
|
||||||
|
for (var i = 0; i < specs.length; i++) {
|
||||||
|
if (this.specFilter(specs[i])) {
|
||||||
|
specCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var message = "" + specCount + " spec" + (specCount == 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s");
|
||||||
|
message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s";
|
||||||
|
this.runnerMessageSpan.replaceChild(this.createDom('a', { className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild);
|
||||||
|
|
||||||
|
this.finishedAtSpan.appendChild(document.createTextNode("Finished at " + new Date().toString()));
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) {
|
||||||
|
var results = suite.results();
|
||||||
|
var status = results.passed() ? 'passed' : 'failed';
|
||||||
|
if (results.totalCount === 0) { // todo: change this to check results.skipped
|
||||||
|
status = 'skipped';
|
||||||
|
}
|
||||||
|
this.suiteDivs[suite.id].className += " " + status;
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.TrivialReporter.prototype.reportSpecStarting = function(spec) {
|
||||||
|
if (this.logRunningSpecs) {
|
||||||
|
this.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) {
|
||||||
|
var results = spec.results();
|
||||||
|
var status = results.passed() ? 'passed' : 'failed';
|
||||||
|
if (results.skipped) {
|
||||||
|
status = 'skipped';
|
||||||
|
}
|
||||||
|
var specDiv = this.createDom('div', { className: 'spec ' + status },
|
||||||
|
this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"),
|
||||||
|
this.createDom('a', {
|
||||||
|
className: 'description',
|
||||||
|
href: '?spec=' + encodeURIComponent(spec.getFullName()),
|
||||||
|
title: spec.getFullName()
|
||||||
|
}, spec.description));
|
||||||
|
|
||||||
|
|
||||||
|
var resultItems = results.getItems();
|
||||||
|
var messagesDiv = this.createDom('div', { className: 'messages' });
|
||||||
|
for (var i = 0; i < resultItems.length; i++) {
|
||||||
|
var result = resultItems[i];
|
||||||
|
|
||||||
|
if (result.type == 'log') {
|
||||||
|
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString()));
|
||||||
|
} else if (result.type == 'expect' && result.passed && !result.passed()) {
|
||||||
|
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));
|
||||||
|
|
||||||
|
if (result.trace.stack) {
|
||||||
|
messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (messagesDiv.childNodes.length > 0) {
|
||||||
|
specDiv.appendChild(messagesDiv);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.suiteDivs[spec.suite.id].appendChild(specDiv);
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.TrivialReporter.prototype.log = function() {
|
||||||
|
var console = jasmine.getGlobal().console;
|
||||||
|
if (console && console.log) {
|
||||||
|
if (console.log.apply) {
|
||||||
|
console.log.apply(console, arguments);
|
||||||
|
} else {
|
||||||
|
console.log(arguments); // ie fix: console.log.apply doesn't exist on ie
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.TrivialReporter.prototype.getLocation = function() {
|
||||||
|
return this.document.location;
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.TrivialReporter.prototype.specFilter = function(spec) {
|
||||||
|
var paramMap = {};
|
||||||
|
var params = this.getLocation().search.substring(1).split('&');
|
||||||
|
for (var i = 0; i < params.length; i++) {
|
||||||
|
var p = params[i].split('=');
|
||||||
|
paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!paramMap.spec) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return spec.getFullName().indexOf(paramMap.spec) === 0;
|
||||||
|
};
|
|
@ -0,0 +1,82 @@
|
||||||
|
body { background-color: #eeeeee; padding: 0; margin: 5px; overflow-y: scroll; }
|
||||||
|
|
||||||
|
#HTMLReporter { font-size: 11px; font-family: Monaco, "Lucida Console", monospace; line-height: 14px; color: #333333; }
|
||||||
|
#HTMLReporter a { text-decoration: none; }
|
||||||
|
#HTMLReporter a:hover { text-decoration: underline; }
|
||||||
|
#HTMLReporter p, #HTMLReporter h1, #HTMLReporter h2, #HTMLReporter h3, #HTMLReporter h4, #HTMLReporter h5, #HTMLReporter h6 { margin: 0; line-height: 14px; }
|
||||||
|
#HTMLReporter .banner, #HTMLReporter .symbolSummary, #HTMLReporter .summary, #HTMLReporter .resultMessage, #HTMLReporter .specDetail .description, #HTMLReporter .alert .bar, #HTMLReporter .stackTrace { padding-left: 9px; padding-right: 9px; }
|
||||||
|
#HTMLReporter #jasmine_content { position: fixed; right: 100%; }
|
||||||
|
#HTMLReporter .version { color: #aaaaaa; }
|
||||||
|
#HTMLReporter .banner { margin-top: 14px; }
|
||||||
|
#HTMLReporter .duration { color: #aaaaaa; float: right; }
|
||||||
|
#HTMLReporter .symbolSummary { overflow: hidden; *zoom: 1; margin: 14px 0; }
|
||||||
|
#HTMLReporter .symbolSummary li { display: block; float: left; height: 7px; width: 14px; margin-bottom: 7px; font-size: 16px; }
|
||||||
|
#HTMLReporter .symbolSummary li.passed { font-size: 14px; }
|
||||||
|
#HTMLReporter .symbolSummary li.passed:before { color: #5e7d00; content: "\02022"; }
|
||||||
|
#HTMLReporter .symbolSummary li.failed { line-height: 9px; }
|
||||||
|
#HTMLReporter .symbolSummary li.failed:before { color: #b03911; content: "x"; font-weight: bold; margin-left: -1px; }
|
||||||
|
#HTMLReporter .symbolSummary li.skipped { font-size: 14px; }
|
||||||
|
#HTMLReporter .symbolSummary li.skipped:before { color: #bababa; content: "\02022"; }
|
||||||
|
#HTMLReporter .symbolSummary li.pending { line-height: 11px; }
|
||||||
|
#HTMLReporter .symbolSummary li.pending:before { color: #aaaaaa; content: "-"; }
|
||||||
|
#HTMLReporter .exceptions { color: #fff; float: right; margin-top: 5px; margin-right: 5px; }
|
||||||
|
#HTMLReporter .bar { line-height: 28px; font-size: 14px; display: block; color: #eee; }
|
||||||
|
#HTMLReporter .runningAlert { background-color: #666666; }
|
||||||
|
#HTMLReporter .skippedAlert { background-color: #aaaaaa; }
|
||||||
|
#HTMLReporter .skippedAlert:first-child { background-color: #333333; }
|
||||||
|
#HTMLReporter .skippedAlert:hover { text-decoration: none; color: white; text-decoration: underline; }
|
||||||
|
#HTMLReporter .passingAlert { background-color: #a6b779; }
|
||||||
|
#HTMLReporter .passingAlert:first-child { background-color: #5e7d00; }
|
||||||
|
#HTMLReporter .failingAlert { background-color: #cf867e; }
|
||||||
|
#HTMLReporter .failingAlert:first-child { background-color: #b03911; }
|
||||||
|
#HTMLReporter .results { margin-top: 14px; }
|
||||||
|
#HTMLReporter #details { display: none; }
|
||||||
|
#HTMLReporter .resultsMenu, #HTMLReporter .resultsMenu a { background-color: #fff; color: #333333; }
|
||||||
|
#HTMLReporter.showDetails .summaryMenuItem { font-weight: normal; text-decoration: inherit; }
|
||||||
|
#HTMLReporter.showDetails .summaryMenuItem:hover { text-decoration: underline; }
|
||||||
|
#HTMLReporter.showDetails .detailsMenuItem { font-weight: bold; text-decoration: underline; }
|
||||||
|
#HTMLReporter.showDetails .summary { display: none; }
|
||||||
|
#HTMLReporter.showDetails #details { display: block; }
|
||||||
|
#HTMLReporter .summaryMenuItem { font-weight: bold; text-decoration: underline; }
|
||||||
|
#HTMLReporter .summary { margin-top: 14px; }
|
||||||
|
#HTMLReporter .summary .suite .suite, #HTMLReporter .summary .specSummary { margin-left: 14px; }
|
||||||
|
#HTMLReporter .summary .specSummary.passed a { color: #5e7d00; }
|
||||||
|
#HTMLReporter .summary .specSummary.failed a { color: #b03911; }
|
||||||
|
#HTMLReporter .description + .suite { margin-top: 0; }
|
||||||
|
#HTMLReporter .suite { margin-top: 14px; }
|
||||||
|
#HTMLReporter .suite a { color: #333333; }
|
||||||
|
#HTMLReporter #details .specDetail { margin-bottom: 28px; }
|
||||||
|
#HTMLReporter #details .specDetail .description { display: block; color: white; background-color: #b03911; }
|
||||||
|
#HTMLReporter .resultMessage { padding-top: 14px; color: #333333; }
|
||||||
|
#HTMLReporter .resultMessage span.result { display: block; }
|
||||||
|
#HTMLReporter .stackTrace { margin: 5px 0 0 0; max-height: 224px; overflow: auto; line-height: 18px; color: #666666; border: 1px solid #ddd; background: white; white-space: pre; }
|
||||||
|
|
||||||
|
#TrivialReporter { padding: 8px 13px; position: absolute; top: 0; bottom: 0; left: 0; right: 0; overflow-y: scroll; background-color: white; font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif; /*.resultMessage {*/ /*white-space: pre;*/ /*}*/ }
|
||||||
|
#TrivialReporter a:visited, #TrivialReporter a { color: #303; }
|
||||||
|
#TrivialReporter a:hover, #TrivialReporter a:active { color: blue; }
|
||||||
|
#TrivialReporter .run_spec { float: right; padding-right: 5px; font-size: .8em; text-decoration: none; }
|
||||||
|
#TrivialReporter .banner { color: #303; background-color: #fef; padding: 5px; }
|
||||||
|
#TrivialReporter .logo { float: left; font-size: 1.1em; padding-left: 5px; }
|
||||||
|
#TrivialReporter .logo .version { font-size: .6em; padding-left: 1em; }
|
||||||
|
#TrivialReporter .runner.running { background-color: yellow; }
|
||||||
|
#TrivialReporter .options { text-align: right; font-size: .8em; }
|
||||||
|
#TrivialReporter .suite { border: 1px outset gray; margin: 5px 0; padding-left: 1em; }
|
||||||
|
#TrivialReporter .suite .suite { margin: 5px; }
|
||||||
|
#TrivialReporter .suite.passed { background-color: #dfd; }
|
||||||
|
#TrivialReporter .suite.failed { background-color: #fdd; }
|
||||||
|
#TrivialReporter .spec { margin: 5px; padding-left: 1em; clear: both; }
|
||||||
|
#TrivialReporter .spec.failed, #TrivialReporter .spec.passed, #TrivialReporter .spec.skipped { padding-bottom: 5px; border: 1px solid gray; }
|
||||||
|
#TrivialReporter .spec.failed { background-color: #fbb; border-color: red; }
|
||||||
|
#TrivialReporter .spec.passed { background-color: #bfb; border-color: green; }
|
||||||
|
#TrivialReporter .spec.skipped { background-color: #bbb; }
|
||||||
|
#TrivialReporter .messages { border-left: 1px dashed gray; padding-left: 1em; padding-right: 1em; }
|
||||||
|
#TrivialReporter .passed { background-color: #cfc; display: none; }
|
||||||
|
#TrivialReporter .failed { background-color: #fbb; }
|
||||||
|
#TrivialReporter .skipped { color: #777; background-color: #eee; display: none; }
|
||||||
|
#TrivialReporter .resultMessage span.result { display: block; line-height: 2em; color: black; }
|
||||||
|
#TrivialReporter .resultMessage .mismatch { color: black; }
|
||||||
|
#TrivialReporter .stackTrace { white-space: pre; font-size: .8em; margin-left: 10px; max-height: 5em; overflow: auto; border: 1px inset red; padding: 1em; background: #eef; }
|
||||||
|
#TrivialReporter .finished-at { padding-left: 1em; font-size: .6em; }
|
||||||
|
#TrivialReporter.show-passed .passed, #TrivialReporter.show-skipped .skipped { display: block; }
|
||||||
|
#TrivialReporter #jasmine_content { position: fixed; right: 100%; }
|
||||||
|
#TrivialReporter .runner { border: 1px solid gray; display: block; margin: 5px 0; padding: 2px 0 2px 10px; }
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,86 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Jasmine Test JSLint</title>
|
||||||
|
|
||||||
|
<link rel="shortcut icon" type="image/png" href="lib/jasmine-1.3.1/jasmine_favicon.png">
|
||||||
|
<link rel="stylesheet" type="text/css" href="lib/jasmine-1.3.1/jasmine.css">
|
||||||
|
<script type="text/javascript" src="lib/jasmine-1.3.1/jasmine.js"></script>
|
||||||
|
<script type="text/javascript" src="lib/jasmine-1.3.1/jasmine-html.js"></script>
|
||||||
|
<script type="text/javascript" src="lib/underscore.js"></script>
|
||||||
|
<script type="text/javascript" src="lib/jslint.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- views -->
|
||||||
|
<script type="text/javascript" src="../js/views/aboutView.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/views/collectionView.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/views/collectionsItemView.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/views/collectionsView.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/views/dashboardView.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/views/documentSourceView.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/views/documentView.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/views/documentsView.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/views/footerView.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/views/logsView.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/views/navigationView.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/views/newCollectionView.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/views/queryView.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/views/shellView.js"></script>
|
||||||
|
|
||||||
|
<!-- helper: checked @ 31.05.2013 --!>
|
||||||
|
<!--<script type="text/javascript" src="../js/arango/arango.js"></script> --!>
|
||||||
|
<!-- routers --!>
|
||||||
|
<script type="text/javascript" src="../js/routers/router.js"></script>
|
||||||
|
<!-- models --!>
|
||||||
|
<script type="text/javascript" src="../js/models/arangoCollection.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/models/arangoDocument.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/models/arangoLog.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/models/arangoStatistics.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/models/arangoStatisticsDescription.js"></script>
|
||||||
|
<!-- collections --!>
|
||||||
|
<script type="text/javascript" src="../js/collections/arangoCollections.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/collections/arangoDocument.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/collections/arangoDocuments.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/collections/arangoDocuments.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/collections/arangoLogs.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/collections/arangoStatisticsCollection.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/collections/arangoStatisticsDescriptionCollection.js"></script>
|
||||||
|
<!-- include spec files here... -->
|
||||||
|
<script type="text/javascript" src="specJSLint/jsLintSpec.js"></script>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
(function() {
|
||||||
|
var jasmineEnv = jasmine.getEnv();
|
||||||
|
jasmineEnv.updateInterval = 1000;
|
||||||
|
|
||||||
|
var htmlReporter = new jasmine.HtmlReporter();
|
||||||
|
|
||||||
|
jasmineEnv.addReporter(htmlReporter);
|
||||||
|
|
||||||
|
jasmineEnv.specFilter = function(spec) {
|
||||||
|
return htmlReporter.specFilter(spec);
|
||||||
|
};
|
||||||
|
|
||||||
|
var currentWindowOnload = window.onload;
|
||||||
|
|
||||||
|
window.onload = function() {
|
||||||
|
if (currentWindowOnload) {
|
||||||
|
currentWindowOnload();
|
||||||
|
}
|
||||||
|
execJasmine();
|
||||||
|
};
|
||||||
|
|
||||||
|
function execJasmine() {
|
||||||
|
jasmineEnv.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,68 @@
|
||||||
|
describe('JSLint', function () {
|
||||||
|
var options = {},
|
||||||
|
lint = /^\/specJSLint|.jsLintSpec\.js$/;
|
||||||
|
|
||||||
|
function get(path) {
|
||||||
|
path = path + "?" + new Date().getTime();
|
||||||
|
|
||||||
|
var xhr;
|
||||||
|
try {
|
||||||
|
xhr = new jasmine.XmlHttpRequest();
|
||||||
|
xhr.open("GET", path, false);
|
||||||
|
xhr.send(null);
|
||||||
|
} catch (e) {
|
||||||
|
throw new Error("couldn't fetch " + path + ": " + e);
|
||||||
|
}
|
||||||
|
if (xhr.status < 200 || xhr.status > 299) {
|
||||||
|
throw new Error("Could not load '" + path + "'.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return xhr.responseText;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('checking codeFiles', function() {
|
||||||
|
var files = /^(.*lib\/.*)|(.*Spec\.js)$/;
|
||||||
|
|
||||||
|
_.each(document.getElementsByTagName('script'), function (element) {
|
||||||
|
var script = element.getAttribute('src');
|
||||||
|
if (files.test(script)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
it(script, function () {
|
||||||
|
var self = this;
|
||||||
|
var source = get(script);
|
||||||
|
var result = JSLINT(source, options);
|
||||||
|
_.each(JSLINT.errors, function (error) {
|
||||||
|
self.addMatcherResult(new jasmine.ExpectationResult({
|
||||||
|
passed: false,
|
||||||
|
message: "line " + error.line + ' - ' + error.reason + ' - ' + error.evidence
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
expect(true).toBe(true); // force spec to show up if there are no errors
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('checking specFiles', function() {
|
||||||
|
var files = /^\/spec*|.*Spec\.js$/;
|
||||||
|
|
||||||
|
_.each(document.getElementsByTagName('script'), function (element) {
|
||||||
|
var script = element.getAttribute('src');
|
||||||
|
if (!files.test(script) || lint.test(script)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
it(script, function () {
|
||||||
|
var self = this;
|
||||||
|
var source = get(script);
|
||||||
|
var result = JSLINT(source, options);
|
||||||
|
_.each(JSLINT.errors, function (error) {
|
||||||
|
self.addMatcherResult(new jasmine.ExpectationResult({
|
||||||
|
passed: false,
|
||||||
|
message: "line " + error.line + ' - ' + error.reason + ' - ' + error.evidence
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
expect(true).toBe(true); // force spec to show up if there are no errors
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue