')
.addClass('details')
.append(this.getDOM())
@@ -63,10 +63,9 @@ Entity.prototype.showDetails = function(entity) {
/**
* Show from for new Channel
*
- * @param type
- * @todo
+ * @todo implement/test
*/
-Entity.prototype.getDOM = function(type) {
+Entity.prototype.getDOM = function() {
var properties = $('
')) // avg
.append($('
') // operations
.addClass('ops')
- .append($('')
+ /*.append($('')
.attr('type', 'image')
.attr('src', 'images/information.png')
.attr('alt', 'details')
.bind('click', entity, function(event) { event.data.showDetails(); })
- )
+ )*/
);
if (parent == null) {
@@ -250,14 +250,14 @@ vz.entities.show = function() {
};
/**
- * Load json data with given time window
+ * Load json data from the backend
*/
vz.data.load = function() {
vz.data.clear();
vz.entities.each(function(index, entity) {
entity.each(function(entity, parent) {
if (entity.active && entity.type != 'group') {
- $.getJSON(vz.options.backendUrl + '/data/' + entity.uuid + '.json', { from: vz.from, to: vz.to, tuples: vz.options.tuples }, ajaxWait(function(json) {
+ $.getJSON(vz.options.backendUrl + '/data/' + entity.uuid + '.json', { from: Math.floor(vz.from), to: Math.ceil(vz.to), tuples: vz.options.tuples }, ajaxWait(function(json) {
vz.data.push({
data: json.data[0].tuples, // TODO check uuid
color: entity.color
@@ -268,6 +268,9 @@ vz.data.load = function() {
});
};
+/**
+ * Draws plot to container
+ */
vz.drawPlot = function () {
vz.options.plot.xaxis.min = vz.from;
vz.options.plot.xaxis.max = vz.to;
diff --git a/frontend/javascripts/init.js b/frontend/javascripts/init.js
index 3f77adc..23f3e55 100644
--- a/frontend/javascripts/init.js
+++ b/frontend/javascripts/init.js
@@ -107,6 +107,13 @@ $(document).ready(function() {
vz.uuids.add($.getUrlVar('uuid'));
}
+ if (vz.uuids.length == 0) {
+ $('#addUUID').dialog({
+ title: 'UUID hinzufügen',
+ width: 400
+ });
+ }
+
// start auto refresh timer
window.setInterval(vz.refresh, 5000);
diff --git a/frontend/javascripts/property.js b/frontend/javascripts/property.js
index 9c7d029..c3474de 100644
--- a/frontend/javascripts/property.js
+++ b/frontend/javascripts/property.js
@@ -25,12 +25,18 @@
*/
/**
- * Property
+ * Property constructor
*/
var Property = function(key, value) {
};
+/**
+ * Validate value
+ * @param value
+ * @return boolean
+ * @todo implement/test
+ */
Property.prototype.validate = function(value) {
switch (property.type) {
case 'string':
@@ -60,6 +66,10 @@ Property.prototype.validate = function(value) {
}
};
+/**
+ *
+ * @todo implement/test
+ */
Property.prototype.getDOM = function() {
switch (property.type) {
case 'string':
diff --git a/frontend/javascripts/uuid.js b/frontend/javascripts/uuid.js
index ecd32bc..7b73834 100644
--- a/frontend/javascripts/uuid.js
+++ b/frontend/javascripts/uuid.js
@@ -24,8 +24,8 @@
* volkszaehler.org. If not, see .
*/
-/*
- * Cookie & UUID related functions
+/**
+ * Read UUIDs from cookie and add them to the array
*/
vz.uuids.parseCookie = function() {
if ($.getCookie('uuids')) {
@@ -35,6 +35,9 @@ vz.uuids.parseCookie = function() {
}
};
+/**
+ * Add given UUID and update cookie
+ */
vz.uuids.add = function(uuid) {
if (vz.uuids.validate(uuid)) {
if (!vz.uuids.contains(uuid)) {
@@ -50,9 +53,13 @@ vz.uuids.add = function(uuid) {
}
};
+/**
+ * Remove UUID and update cookie
+ */
vz.uuids.remove = function(uuid) {
+ console.log(vz.uuids.contains(uuid));
if (vz.uuids.contains(uuid)) {
- vz.uuids.remove(uuid);
+ vz.uuids.splice(this.indexOf(uuid), 1); // remove uuid from array
$.setCookie('uuids', JSON.stringify(vz.uuids));
}
else {
@@ -60,6 +67,9 @@ vz.uuids.remove = function(uuid) {
}
};
+/**
+ * Validate UUID
+ */
vz.uuids.validate = function(uuid) {
return new Boolean(uuid.match(/^[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}$/));
};
\ No newline at end of file
|