diff --git a/controllers/apps/list.js b/controllers/apps/list.js index 92e76dc..22e6a82 100644 --- a/controllers/apps/list.js +++ b/controllers/apps/list.js @@ -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) { diff --git a/controllers/signup.js b/controllers/signup.js index e753b45..e90ed67 100644 --- a/controllers/signup.js +++ b/controllers/signup.js @@ -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) { diff --git a/models/app.js b/models/app.js index 51fa4ed..62fca6a 100644 --- a/models/app.js +++ b/models/app.js @@ -21,6 +21,14 @@ module.exports = { "last_name": { "type": "string", "minLength": 1 + }, + "type": { + "type": "string", + "minLength": 1 + }, + "url": { + "type": "string", + "minLength": 1 } }, "required": [ diff --git a/public/configure/css/index.css b/public/configure/css/index.css index 7c70d44..37c1930 100644 --- a/public/configure/css/index.css +++ b/public/configure/css/index.css @@ -17,7 +17,7 @@ body { }*/ .row.container-fluid { - padding-top: 65px; + padding-top: 115px; padding-bottom: 65px; padding-left: 20px; padding-right: 20px; diff --git a/public/configure/index.html b/public/configure/index.html index 714ddaa..39fdcdf 100644 --- a/public/configure/index.html +++ b/public/configure/index.html @@ -45,6 +45,7 @@ OCT Core + +
+ +
+
diff --git a/public/configure/js/Form.js b/public/configure/js/Form.js index e345d6e..c60bf8d 100644 --- a/public/configure/js/Form.js +++ b/public/configure/js/Form.js @@ -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('
'); @@ -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('
'); @@ -51,11 +53,12 @@ Form.prototype.signup = function (callback) { Form.prototype.addingButton = function () { this.empty(); - $space = $('
') + /*$space = $('
') $button = $(''); $("#form").append($space); $("#form").append($button); - $("#form").append($space); + $("#form").append($space);*/ + $('#add-a-query').show(); this.addDatabase(); } diff --git a/public/configure/js/Submit.js b/public/configure/js/Submit.js index e85271f..6687083 100644 --- a/public/configure/js/Submit.js +++ b/public/configure/js/Submit.js @@ -100,7 +100,7 @@ Submit.prototype.submit = function (status, callback) { $('#myModal').modal('hide'); }, error: function (e) { - callback(e); + callback(JSON.stringyfy(e)); } }); /*}, diff --git a/public/configure/js/index.js b/public/configure/js/index.js index 0150fe1..8744de9 100644 --- a/public/configure/js/index.js +++ b/public/configure/js/index.js @@ -16,9 +16,9 @@ $(document).ready(function() { $menu = $(''); $(".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"): diff --git a/public/index.html b/public/index.html index edccc36..0584da4 100644 --- a/public/index.html +++ b/public/index.html @@ -62,11 +62,11 @@ diff --git a/public/js/Table.js b/public/js/Table.js index 224c19a..4701189 100644 --- a/public/js/Table.js +++ b/public/js/Table.js @@ -35,9 +35,10 @@ Table.prototype.draw = function () { { title: "ID" }, { title: "More" }, { title: 'Name' }, - { title: 'Description' }, + { title: 'Description' }, { title: 'Category Search ' }, - { title: 'Dataset Search ' } + { title: 'Dataset Search ' }, + { title: 'App Type' } ]; columnDefs = [ { @@ -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, '', '' + json[index].app_name + '', 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(); diff --git a/public/js/data.js b/public/js/data.js index 977fbb6..9780d1f 100644 --- a/public/js/data.js +++ b/public/js/data.js @@ -63,6 +63,7 @@ var columns = { { title: "More" }, { title: 'Name' }, { title: 'Description' }, + { title: 'App Type' }, { title: 'Category Search ' }, { title: 'Dataset Search ' } ], diff --git a/public/js/index.js b/public/js/index.js index 9e40863..26d3930 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -35,7 +35,7 @@ $(document).ready(function() { $("#btn-table").addClass("active"); $("#btn-graph").removeClass("active"); switch(status) { - case("GetanAPIKey"): + case("RegisteranApp"): signupForm(); break; default: @@ -69,6 +69,58 @@ $(document).ready(function() { $('#content').append($('')); $('#content').append($('')); + $('#content').append($('')); + dropdown = '
' + dropdown += '
' + dropdown += '
' + dropdown += ' ' + dropdown += '
' + dropdown += '
' + dropdown += '
' + dropdown += '
' + dropdown += ' ' + dropdown += '
' + dropdown += '
' + dropdown += '
' + dropdown += '
' + dropdown += ' ' + dropdown += '
' + dropdown += '
' + dropdown += '
' + dropdown += '
' + dropdown += ' ' + dropdown += '
' + dropdown += '
' + dropdown += '
' + /* + dropdown = '
'*/ + $('#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() + ' '); + $div.removeClass('open'); + e.preventDefault(); + type = $(this).text(); + });*/ + + + $('#content').append($('')); $('#content').append($('')); @@ -81,6 +133,9 @@ $(document).ready(function() { $('#content').append($('')); $('#content').append($('')); + $('#content').append($('')); + $('#content').append($('')); + $btn = $('
'); $('#content').append($btn); $btn.click(function () { @@ -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", diff --git a/public/map/index.html b/public/map/index.html index 4a8614b..0c6eb0a 100644 --- a/public/map/index.html +++ b/public/map/index.html @@ -22,9 +22,7 @@