1
0
Fork 0

added dashboard link @navigation

This commit is contained in:
Heiko Kernbach 2013-06-20 12:59:24 +02:00
parent f64c227b16
commit 97ce6c80fc
5 changed files with 182 additions and 20 deletions

View File

@ -34,12 +34,32 @@ var arangodb = require("org/arangodb"),
Edge, Edge,
Graph, Graph,
Vertex, Vertex,
GraphArray; GraphArray,
Iterator;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- module "org/arangodb/graph" // --SECTION-- module "org/arangodb/graph"
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
Iterator = function (wrapper, cursor, stringRepresentation) {
this.next = function next() {
if (cursor.hasNext()) {
return wrapper(cursor.next());
}
return undefined;
};
this.hasNext = function hasNext() {
return cursor.hasNext();
};
this._PRINT = function (context) {
context.output += stringRepresentation;
};
};
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- GraphArray // --SECTION-- GraphArray
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -319,6 +339,74 @@ Edge.prototype.properties = function () {
return this._properties._shallowCopy; return this._properties._shallowCopy;
}; };
////////////////////////////////////////////////////////////////////////////////
/// @brief returns the to vertex
///
/// @FUN{@FA{edge}.getInVertex()}
///
/// Returns the vertex at the head of the @FA{edge}.
///
/// @EXAMPLES
///
/// @verbinclude graph-edge-get-in-vertex
////////////////////////////////////////////////////////////////////////////////
Edge.prototype.getInVertex = function () {
return this._graph.getVertex(this._properties._to);
};
////////////////////////////////////////////////////////////////////////////////
/// @brief returns the from vertex
///
/// @FUN{@FA{edge}.getOutVertex()}
///
/// Returns the vertex at the tail of the @FA{edge}.
///
/// @EXAMPLES
///
/// @verbinclude graph-edge-get-out-vertex
////////////////////////////////////////////////////////////////////////////////
Edge.prototype.getOutVertex = function () {
return this._graph.getVertex(this._properties._from);
};
////////////////////////////////////////////////////////////////////////////////
/// @brief returns the other vertex
///
/// @FUN{@FA{edge}.getPeerVertex(@FA{vertex})}
///
/// Returns the peer vertex of the @FA{edge} and the @FA{vertex}.
///
/// @EXAMPLES
///
/// @code
/// arango> v1 = g.addVertex("1");
/// Vertex("1")
///
/// arango> v2 = g.addVertex("2");
/// Vertex("2")
///
/// arango> e = g.addEdge(v1, v2, "1->2", "knows");
/// Edge("1->2")
///
/// arango> e.getPeerVertex(v1);
/// Vertex(2)
/// @endcode
////////////////////////////////////////////////////////////////////////////////
Edge.prototype.getPeerVertex = function (vertex) {
if (vertex._properties._id === this._properties._to) {
return this._graph.getVertex(this._properties._from);
}
if (vertex._properties._id === this._properties._from) {
return this._graph.getVertex(this._properties._to);
}
return null;
};
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @} /// @}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -547,6 +635,45 @@ Graph = function (name, vertices, edges, waitForSync) {
this.initialize(name, vertices, edges, waitForSync); this.initialize(name, vertices, edges, waitForSync);
}; };
// -----------------------------------------------------------------------------
// --SECTION-- private methods
// -----------------------------------------------------------------------------
Graph.prototype._prepareEdgeData = function (data, label) {
var edgeData;
if (is.notExisty(data) && is.object(label)) {
data = label;
label = null;
}
if (is.notExisty(label) && is.existy(data) && is.existy(data.$label)) {
label = data.$label;
}
if (is.notExisty(data) || is.noObject(data)) {
edgeData = {};
} else {
edgeData = data._shallowCopy || {};
}
edgeData.$label = label;
return edgeData;
};
Graph.prototype._prepareVertexData = function (data) {
var vertexData;
if (is.notExisty(data) || is.noObject(data)) {
vertexData = {};
} else {
vertexData = data._shallowCopy || {};
}
return vertexData;
};
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- public methods // --SECTION-- public methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -556,6 +683,7 @@ Graph = function (name, vertices, edges, waitForSync) {
/// @{ /// @{
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief get a vertex from the graph, create it if it doesn't exist /// @brief get a vertex from the graph, create it if it doesn't exist
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -601,26 +729,55 @@ Graph.prototype.getOrAddVertex = function (id) {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Graph.prototype.addEdge = function (out_vertex, in_vertex, id, label, data, waitForSync) { Graph.prototype.addEdge = function (out_vertex, in_vertex, id, label, data, waitForSync) {
var params; return this._saveEdge(id, out_vertex, in_vertex, this._prepareEdgeData(data, label), waitForSync);
};
if (is.notExisty(data) && typeof label === 'object') { ////////////////////////////////////////////////////////////////////////////////
data = label; /// @brief adds a vertex to the graph
label = null; ///
} /// @FUN{@FA{graph}.addVertex(@FA{id})}
///
/// Creates a new vertex and returns the vertex object. The identifier
/// @FA{id} must be a unique identifier or null.
///
/// @FUN{@FA{graph}.addVertex(@FA{id}, @FA{data})}
///
/// Creates a new vertex and returns the vertex object. The vertex contains
/// the properties defined in @FA{data}.
///
/// @EXAMPLES
///
/// Without any properties:
///
/// @verbinclude graph-graph-add-vertex
///
/// With given properties:
///
/// @verbinclude graph-graph-add-vertex2
////////////////////////////////////////////////////////////////////////////////
if (is.notExisty(label) && is.existy(data) && is.existy(data.$label)) { Graph.prototype.addVertex = function (id, data, waitForSync) {
label = data.$label; return this._saveVertex(id, this._prepareVertexData(data), waitForSync);
} };
if (data === null || typeof data !== "object") { ////////////////////////////////////////////////////////////////////////////////
params = {}; /// @brief returns the number of vertices
} else { ///
params = data._shallowCopy || {}; /// @FUN{@FA{graph}.order()}
} ////////////////////////////////////////////////////////////////////////////////
params.$label = label; Graph.prototype.order = function () {
return this._vertices.count();
};
return this._saveEdge(id, out_vertex, in_vertex, params, waitForSync); ////////////////////////////////////////////////////////////////////////////////
/// @brief returns the number of edges
///
/// @FUN{@FA{graph}.size()}
////////////////////////////////////////////////////////////////////////////////
Graph.prototype.size = function () {
return this._edges.count();
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -661,6 +818,7 @@ exports.Edge = Edge;
exports.Graph = Graph; exports.Graph = Graph;
exports.Vertex = Vertex; exports.Vertex = Vertex;
exports.GraphArray = GraphArray; exports.GraphArray = GraphArray;
exports.Iterator = Iterator;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @} /// @}

View File

@ -35,7 +35,7 @@
</ul> </ul>
<ul class="thumbnails"> <ul class="thumbnails">
<li id="detailCollections" class="statSingleClient" style="margin-bottom: 13px !important;"> <li id="detailCollections" class="statSingleClient" style="margin-bottom: 13px !important; display:none;">
<div class="boxHeader"> <div class="boxHeader">
<h6 id="detailCollectionsHeader" class="dashboardH6">Collections</h6> <h6 id="detailCollectionsHeader" class="dashboardH6">Collections</h6>
<i id="db-collectionMinimize" class="icon-white icon-minus"></i> <i id="db-collectionMinimize" class="icon-white icon-minus"></i>

View File

@ -15,6 +15,7 @@
<li><a href="#applications/installed">Installed</a></li> <li><a href="#applications/installed">Installed</a></li>
<li><a href="#applications/available">Available</a></li> <li><a href="#applications/available">Available</a></li>
</ul> </ul>
<li class="dashboard-menu"><a href="#dashboard">Dash</a></li>
<li class="collections-menu"><a href="#">Collections</a></li> <li class="collections-menu"><a href="#">Collections</a></li>
<li class="query-menu"><a href="#query">AQL Editor</a></li> <li class="query-menu"><a href="#query">AQL Editor</a></li>
<li class="shell-menu"><a href="#shell">JS Shell</a></li> <li class="shell-menu"><a href="#shell">JS Shell</a></li>

View File

@ -319,7 +319,7 @@ var dashboardView = Backbone.View.extend({
renderCharts: function () { renderCharts: function () {
var self = this; var self = this;
$('#every'+self.updateFrequency+'seconds').prop('checked',true); $('#every'+self.updateFrequency+'seconds').prop('checked',true);
self.renderCollectionsChart(); //self.renderCollectionsChart();
$.each(self.options.description.models[0].attributes.figures, function () { $.each(self.options.description.models[0].attributes.figures, function () {
var figure = this; var figure = this;

View File

@ -44,6 +44,9 @@ var shellView = Backbone.View.extend({
$("#shell_workspace").trigger("resize", [ 200 ]); $("#shell_workspace").trigger("resize", [ 200 ]);
this.resizing = false; this.resizing = false;
} }
else {
console.log("test");
}
}, },
renderEditor: function () { renderEditor: function () {
var editor = ace.edit("editor"); var editor = ace.edit("editor");