Skip to content

Commit

Permalink
Merge pull request #5 from JonasWissing/master
Browse files Browse the repository at this point in the history
minor changes
  • Loading branch information
JonasWissing committed Oct 13, 2017
2 parents 0b4ed01 + db8ea99 commit f7f0229
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 22 deletions.
2 changes: 0 additions & 2 deletions controllers/submit/submit.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ var validate = ajv.compile(schema);

// POST
exports.request = function(req, res) {
console.log("SUBMIT SOME DATA");
console.log(req.body);
var valid = validate(req.body);
if (!valid) {
res.status(errors.schema.error_1.code).send(_.extend(errors.schema.error_1, {
Expand Down
17 changes: 8 additions & 9 deletions public/configure/js/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,15 @@ Form.prototype.Postgres = function (categories, modify) {
$('#panelQuery').append(this.elements.queryDescription());
//Category
this.Categories(categories);

var that = this;
if(modify) {
this.btnSend("Send", function (e) {
alert(e);
});
} else {
this.btnSend("Send", function (e) {
alert(e);
this.Table.Queries();
that.Table.Queries();
});
}
}
Expand Down Expand Up @@ -194,15 +194,15 @@ Form.prototype.API = function (categories, modify) {
$('#panelQuery').append(this.elements.queryDescription());
//Category
this.Categories(categories);

var that = this;
if(modify) {
this.btnSend("Send", function (e) {
alert(e);
});
} else {
this.btnSend("Send", function (e) {
alert(e);
this.Table.Queries();
that.Table.Queries();
});
}
}
Expand Down Expand Up @@ -234,15 +234,15 @@ Form.prototype.CouchDB = function (categories, modify) {
$('#panelQuery').append(this.elements.queryDescription());
//Category
this.Categories(categories);

var that = this;
if(modify) {
this.btnSend("Send", function (e) {
alert(e);
});
} else {
this.btnSend("Send", function (e) {
alert(e);
this.Table.Queries();
that.Table.Queries();
});
}
}
Expand All @@ -269,14 +269,15 @@ Form.prototype.Parliament = function (categories, modify) {
$('#panelQuery').append(this.elements.queryDescription());
//Category
this.Categories(categories);
var that = this;
if(modify) {
this.btnSend("Send", function (e) {
alert(e);
});
} else {
this.btnSend("Send", function (e) {
alert(e);
this.Table.Queries();
that.Table.Queries();
});
}
}
Expand Down Expand Up @@ -401,8 +402,6 @@ Form.prototype.btnSend = function (text, callback) {

//Listen on Button Clicks
$btnSend.click(function (e) {
console.log(that.status);
console.log(that)
submit = new Submit(that.user, that.categories);
submit.submit(that.status, callback);
//Check which status is active
Expand Down
19 changes: 8 additions & 11 deletions public/configure/js/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ Table.prototype.Queries = function () {
if(json[index].ds_port != null && json[index].ds_port != "") {
_dsUrl += ":" + json[index].ds_port+"/";
}
if(json[index].query_intern.replace("<", "&lt;").replace(">", "&gt;").length > 13) {
if(json[index].query_intern.replace(/\</g, "&lt;").replace(/\>/g, "&gt;").length > 13) {
that.data.push([
json[index].query_id,
json[index].query_extern,
json[index].query_intern.replace("<", "&lt;").replace(">", "&gt;").substring(0,10) + '...',
json[index].query_intern.replace(/\</g, "&lt;").replace(/\>/g, "&gt;").substring(0,10) + '...',
json[index].query_description,
json[index].category_name,
_url,
Expand All @@ -130,7 +130,7 @@ Table.prototype.Queries = function () {
that.data.push([
json[index].query_id,
json[index].query_extern,
json[index].query_intern.replace("<", "&lt;").replace(">", "&gt;"),
json[index].query_intern.replace(/\</g, "&lt;").replace(/\>/g, "&gt;"),
json[index].query_description,
json[index].category_name,
_url,
Expand All @@ -141,7 +141,7 @@ Table.prototype.Queries = function () {
that.data_all.push([
json[index].query_id,
json[index].query_extern,
json[index].query_intern.replace("<", "&lt;").replace(">", "&gt;"),
json[index].query_intern.replace(/\</g, "&lt;").replace(/\>/g, "&gt;"),
json[index].query_description,
json[index].category_name,
_url,
Expand Down Expand Up @@ -192,11 +192,11 @@ Table.prototype.QueriesByUser = function (username, form) {
if(json[index].ds_port != null && json[index].ds_port != "") {
_dsUrl += ":" + json[index].ds_port+"/";
}
if(json[index].query_intern.replace("<", "&lt;").replace(">", "&gt;").length > 13) {
if(json[index].query_intern.replace(/\</g, "&lt;").replace(/\>/g, "&gt;").length > 13) {
that.data.push([
json[index].query_id,
json[index].query_extern,
json[index].query_intern.replace("<", "&lt;").replace(">", "&gt;").substring(0,10) + '...',
json[index].query_intern.replace(/\</g, "&lt;").replace(/\>/g, "&gt;").substring(0,10) + '...',
json[index].query_description,
json[index].category_name,
_url,
Expand All @@ -207,7 +207,7 @@ Table.prototype.QueriesByUser = function (username, form) {
that.data.push([
json[index].query_id,
json[index].query_extern,
json[index].query_intern.replace("<", "&lt;").replace(">", "&gt;"),
json[index].query_intern.replace(/\</g, "&lt;").replace(/\>/g, "&gt;"),
json[index].query_description,
json[index].category_name,
_url,
Expand All @@ -218,7 +218,7 @@ Table.prototype.QueriesByUser = function (username, form) {
that.data_all.push([
json[index].query_id,
json[index].query_extern,
json[index].query_intern.replace("<", "&lt;").replace(">", "&gt;"),
json[index].query_intern.replace(/\</g, "&lt;").replace(/\>/g, "&gt;"),
json[index].query_description,
json[index].category_name,
_url,
Expand Down Expand Up @@ -251,10 +251,7 @@ Table.prototype.QueriesByUser = function (username, form) {
* Expand Table to show more Information
*/
Table.prototype.moreInfo = function (data) {
console.log(this.data_all);
console.log(data);
for(i in this.data_all) {
console.log(this.data_all[i][1])
if(this.data_all[i][1] == data) {
return '<center><code>' + this.data_all[i][2] + '</code></center>';
}
Expand Down

0 comments on commit f7f0229

Please sign in to comment.