Skip to content

Commit

Permalink
Merge pull request #7 from JonasWissing/master
Browse files Browse the repository at this point in the history
changes
  • Loading branch information
JonasWissing committed Dec 10, 2017
2 parents 05049c9 + a67c0ba commit e46934b
Show file tree
Hide file tree
Showing 13 changed files with 100 additions and 20 deletions.
2 changes: 1 addition & 1 deletion controllers/apps/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var _ = require('underscore');

// LIST
exports.request = function(req, res) {
var queryStr = "SELECT apps.app_hash, apps.app_name, apps.app_description, (SELECT count FROM public.logs_count WHERE logs_count.app_hash = apps.app_hash and logs_count.type='App_Category') AS Searches, (SELECT count FROM public.logs_count WHERE logs_count.app_hash = apps.app_hash AND logs_count.type='App_Dataset') AS API_Calls FROM public.apps;";
var queryStr = "SELECT apps.app_hash, apps.app_name, apps.app_description, apps.type, apps.url, (SELECT count FROM public.logs_count WHERE logs_count.app_hash = apps.app_hash and logs_count.type='App_Category') AS Searches, (SELECT count FROM public.logs_count WHERE logs_count.app_hash = apps.app_hash AND logs_count.type='App_Dataset') AS API_Calls FROM public.apps;";
var params = [];

client.query(queryStr, params, function (err, result) {
Expand Down
6 changes: 4 additions & 2 deletions controllers/signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ exports.request = function(req, res) {
}, secret.key);

// Database Query
client.query('INSERT INTO Apps VALUES(now(), now(), $1, $2, $3, $4, $5, $6);', [
client.query('INSERT INTO Apps VALUES(now(), now(), $1, $2, $3, $4, $5, $6, $7, $8);', [
req.body.app_name,
accessToken,
req.body.app_description,
req.body.email_address,
req.body.first_name,
req.body.last_name
req.body.last_name,
req.body.url,
req.body.type
], function(err, result) {

if (err) {
Expand Down
8 changes: 8 additions & 0 deletions models/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ module.exports = {
"last_name": {
"type": "string",
"minLength": 1
},
"type": {
"type": "string",
"minLength": 1
},
"url": {
"type": "string",
"minLength": 1
}
},
"required": [
Expand Down
2 changes: 1 addition & 1 deletion public/configure/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ body {
}*/

.row.container-fluid {
padding-top: 65px;
padding-top: 115px;
padding-bottom: 65px;
padding-left: 20px;
padding-right: 20px;
Expand Down
5 changes: 5 additions & 0 deletions public/configure/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
</button>
<a class="navbar-brand" href="http:https://giv-oct.uni-muenster.de:8080/">OCT Core</a>
</div>

<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a id="tab2" class="active" href="#">Login</a></li>
Expand All @@ -54,6 +55,10 @@
</div>
</nav>

<div style="top:60px; left:20px; z-index:10; position:fixed;">
<button type="button" id="add-a-query" class="btn btn-success" data-toggle="modal" data-target="#myModal"><span class="glyphicon glyphicon-plus"></span> Add a Dataset</button>
</div>

<div class="row container-fluid">
<div class="col-md-12 col-sm-12" id="content">
<table id="table" class="display" width="100%"></table>
Expand Down
7 changes: 5 additions & 2 deletions public/configure/js/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Form.prototype.emptyForm = function () {
* Show Fields for Login
*/
Form.prototype.login = function (callback) {
$('#add-a-query').hide();
this.status = "login";
this.empty();
$("#form").append('<div id=inputForm></div>');
Expand All @@ -38,6 +39,7 @@ Form.prototype.login = function (callback) {
* Show Fields for Signup
*/
Form.prototype.signup = function (callback) {
$('#add-a-query').hide();
this.status = "signup";
this.empty();
$("#form").append('<div id=inputForm></div>');
Expand All @@ -51,11 +53,12 @@ Form.prototype.signup = function (callback) {

Form.prototype.addingButton = function () {
this.empty();
$space = $('<br>')
/*$space = $('<br>')
$button = $('<button type="button" class="btn btn-success btn-lg" data-toggle="modal" data-target="#myModal"><span class="glyphicon glyphicon-plus"></span>Add a Query</button>');
$("#form").append($space);
$("#form").append($button);
$("#form").append($space);
$("#form").append($space);*/
$('#add-a-query').show();

this.addDatabase();
}
Expand Down
2 changes: 1 addition & 1 deletion public/configure/js/Submit.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Submit.prototype.submit = function (status, callback) {
$('#myModal').modal('hide');
},
error: function (e) {
callback(e);
callback(JSON.stringyfy(e));
}
});
/*},
Expand Down
4 changes: 2 additions & 2 deletions public/configure/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ $(document).ready(function() {
$menu = $('<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-user" aria-hidden="true"></span> '+username+'</a><ul class="dropdown-menu"><li><a href="#">All Datasets</a></li><li><a href="#">My Datasets</a></li><li role="separator" class="divider"></li><li><a href="#">Logout</a></li></ul></li>');
$(".navbar-right").append($menu);

table.Queries();
form.addingButton();

table.Queries();

$(".navbar-right .dropdown ul li a").on("click", function (e) {
switch($(this).text()) {
case("Logout"):
Expand Down
6 changes: 3 additions & 3 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@
<ul class="nav navbar-nav navbar-left">
<li class="active"><a id="tab0" href="#">Apps</a></li>
<li><a id="tab1" href="#">Categories</a></li>
<li><a id="tab2" href="#">Usage</a></li>
<li><a id="tab3" href="#">Datasets</a></li>
<li><a id="tab2" href="#">Datasets</a></li>
<li><a id="tab3" href="#">Usage</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="#"><span class="glyphicon glyphicon-log-in"></span> Get an API Key</a></li>
<li><a href="#"><span class="glyphicon glyphicon-log-in"></span> Register an App</a></li>
<li><a id="tab3" href="/configure"><span class="glyphicon glyphicon-cog" aria-hidden="true"></span> Configure</a></li>
</ul>

Expand Down
11 changes: 8 additions & 3 deletions public/js/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ Table.prototype.draw = function () {
{ title: "ID" },
{ title: "More" },
{ title: 'Name' },
{ title: 'Description' },
{ title: 'Description' },
{ title: 'Category Search <a id="help-search"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span><a>' },
{ title: 'Dataset Search <a id="help-api"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span><a>' }
{ title: 'Dataset Search <a id="help-api"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span><a>' },
{ title: 'App Type' }
];
columnDefs = [
{
Expand Down Expand Up @@ -139,7 +140,11 @@ Table.prototype.Apps = function () {
if(this.data.apps.length==0) {
$.getJSON(new API().endpoint + "apps", function(json){
for(index in json) {
that.data.apps.push([json[index].app_hash, index, '', json[index].app_name, json[index].app_description, json[index].searches, json[index].api_calls]);
//if(json[index].url != "" && json[index.url]) {
that.data.apps.push([json[index].app_hash, index, '', '<a href="' + json[index].url + '">' + json[index].app_name + '</a>', json[index].app_description, json[index].searches, json[index].api_calls, json[index].type]);
//} else {
// that.data.apps.push([json[index].app_hash, index, '', json[index].app_name , json[index].app_description, json[index].searches, json[index].api_calls]);
//}
}
that.draw();

Expand Down
1 change: 1 addition & 0 deletions public/js/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ var columns = {
{ title: "More" },
{ title: 'Name' },
{ title: 'Description' },
{ title: 'App Type' },
{ title: 'Category Search <a id="help-search"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span><a>' },
{ title: 'Dataset Search <a id="help-api"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span><a>' }
],
Expand Down
62 changes: 60 additions & 2 deletions public/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ $(document).ready(function() {
$("#btn-table").addClass("active");
$("#btn-graph").removeClass("active");
switch(status) {
case("GetanAPIKey"):
case("RegisteranApp"):
signupForm();
break;
default:
Expand Down Expand Up @@ -69,6 +69,58 @@ $(document).ready(function() {
$('#content').append($('<label for="appname-label">App Name (required)</label>'));
$('#content').append($('<input type="text" class="form-control" id="appname" aria-describedby="basic-addon3">'));

$('#content').append($('<label for="description-label">Type of component</label>'));
dropdown = '<div class="row">'
dropdown += ' <div class="col-md-3">'
dropdown += ' <div class="radio">'
dropdown += ' <label><input type="radio" name="optradio">MobileApp</label>'
dropdown += ' </div>'
dropdown += ' </div>'
dropdown += ' <div class="col-md-3">'
dropdown += ' <div class="radio">'
dropdown += ' <label><input type="radio" name="optradio">WebApp</label>'
dropdown += ' </div>'
dropdown += ' </div>'
dropdown += ' <div class="col-md-3">'
dropdown += ' <div class="radio">'
dropdown += ' <label><input type="radio" name="optradio">Service</label>'
dropdown += ' </div>'
dropdown += ' </div>'
dropdown += ' <div class="col-md-3">'
dropdown += ' <div class="radio">'
dropdown += ' <label><input type="radio" name="optradio">Guideline</label>'
dropdown += ' </div>'
dropdown += ' </div>'
dropdown += '</div>'
/*
dropdown = '<div class="dropdown">'
dropdown += '<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">'
dropdown += 'App'
dropdown += '<span class="caret"></span>'
dropdown += '</button>'
dropdown += '<ul class="dropdown-menu" aria-labelledby="dropdownMenu">'
dropdown += '<li><a href="#">App</a></li>'
dropdown += '<li><a href="#">Service</a></li>'
dropdown += '<li><a href="#">Guideline</a></li>'
dropdown += '</ul>'
dropdown += '</div>'*/
$('#content').append($(dropdown));

var type = "App";
$('.radio').click(function(e) {
type = $(this).children().text();
});
/*$('ul.dropdown-menu li a').click(function (e) {
var $div = $(this).parent().parent().parent();
var $btn = $div.find('button');
$btn.html($(this).text() + ' <span class="caret"></span>');
$div.removeClass('open');
e.preventDefault();
type = $(this).text();
});*/



$('#content').append($('<label for="description-label">Description</label>'));
$('#content').append($('<input type="text" class="form-control" id="description" aria-describedby="basic-addon3">'));

Expand All @@ -81,6 +133,9 @@ $(document).ready(function() {
$('#content').append($('<label for="lastname-label">Last Name (required)</label>'));
$('#content').append($('<input type="text" class="form-control" id="lastname" aria-describedby="basic-addon3">'));

$('#content').append($('<label for="lastname-label">Website</label>'));
$('#content').append($('<input type="text" class="form-control" id="website" aria-describedby="basic-addon3">'));

$btn = $('<br><button type="button" class="btn btn-primary right">Signup</button>');
$('#content').append($btn);
$btn.click(function () {
Expand All @@ -89,9 +144,12 @@ $(document).ready(function() {
"app_description": $('#description').val(),
"email_address": $('#email').val(),
"first_name": $('#firstname').val(),
"last_name": $('#lastname').val()
"last_name": $('#lastname').val(),
"url": $("#website").val(),
"type": type
}
console.log(data);

if(data.app_name != "" || data.email_address != "" || data.first_name != "" || data.last_name != "") {
$.ajax({
type: "POST",
Expand Down
4 changes: 1 addition & 3 deletions public/map/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">
OCT Core
</a>
<a class="navbar-brand" href="http:https://giv-oct.uni-muenster.de:8080/">OCT Core</a>
</div>
</div>
</nav>
Expand Down

0 comments on commit e46934b

Please sign in to comment.