Commit 64215ac0 authored by Porter Libby's avatar Porter Libby
Browse files

aesthetic changes, readability

parent 4d22041d
# IFS Datavis Tool 2
## v0.1.5
Project details have been migrated to the wiki located [HERE](https://code.cs.earlham.edu/field-science/datavis/-/wikis/home)
console.log("\n==================================");
console.log("| IFS DATAVIS 2 |");
console.log("==================================\n");
const express = require('express');
const app = express();
const q = require('./queries');
var pjson = require('./package.json');
var path = require('path');
var rest = new require('restful-api')(app);
var favicon = require('serve-favicon');
const app = express();
var rest = new require('restful-api')(app);
console.log("================================================================================");
console.log("| |");
console.log("|██ ██████ ██████ ██████ █████ ██████ █████ ██ ██ ██ ██████ ██████ |");
console.log("|██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ |");
console.log("|██ █████ ██████ ██ ██ ███████ ██ ███████ ██ ██ ██ ██████ █████ |");
console.log("|██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ |");
console.log("|██ ██ ██████ ██████ ██ ██ ██ ██ ██ ████ ██ ██████ ███████ |");
console.log("| |");
console.log("====================================================================== v" + pjson.version + " ==");
console.log("\n");
app.set('view engine', 'ejs');
app.get('/', function(req, res) {
......@@ -30,6 +38,9 @@ app.get('/streamingshosts', q.getStreamingsHosts);
app.get('/streamingsplatforms', q.getStreamingsPlatforms);
app.get('/streamingsdates', q.getStreamingsDates);
app.get('/streamings', q.getStreamings);
app.get('/v', function (res, req){
req.status(200).json(pjson.version);
});
// LISTEN
......@@ -38,6 +49,6 @@ app.listen(9900, '0.0.0.0', function (err) {
console.log(err)
return
}
console.log('Listening at http://localhost:' + "9900" + '\n')
console.log('SERVER: Listening at http://localhost:' + "9900" + '\n')
})
{
"name": "datavis",
"version": "0.1.5",
"version": "0.1.6",
"description": "A tool for visualizing the data collected from the IFS Earlham trip",
"main": "index.js",
"scripts": {
......
......@@ -9,6 +9,16 @@
function ready(){
switchToData() // set screen to data
$.ajax({
type: 'GET',
url: '/v',
success: function(response) {
document.getElementById("version-tag").innerText = "IFS Datavis Tool v" + response;
},
error: function(xhr, status, err) {
console.log(xhr.responseText);
}
});
base_url = document.location.href; // get base url
......
......@@ -2,6 +2,7 @@
#
# Datavis 2.0
# Porter Libby - 2019 - initial setup
# Porter Libby - 2021 - improve some systems for more flexibility
# pelibby16@earlham.edu
#
# Query functions for database
......@@ -9,18 +10,36 @@
*/
// IMPORTANT: The .ENV file must be setup before running, see README for template
const dotenv = require('dotenv');
dotenv.config();
const Pool = require('pg').Pool
var pool = null;
if (process.env.DB_NAME != null && process.env.DB_HOST != null && process.env.DB_DATABASE != null && process.env.DB_PASSWORD != null && process.env.DB_PORT != null){
pool = new Pool({
user: `${process.env.DB_NAME}`,
host: `${process.env.DB_HOST}`,
database: `${process.env.DB_DATABASE}`,
password: `${process.env.DB_PASSWORD}`,
port: `${process.env.DB_PORT}`,
})
}
const pool = new Pool({
user: `${process.env.DB_NAME}`,
host: `${process.env.DB_HOST}`,
database: `${process.env.DB_DATABASE}`,
password: `${process.env.DB_PASSWORD}`,
port: `${process.env.DB_PORT}`,
})
function updatePool(user, host, database, password, port){
if (user != null && host != null && database != null && password != null && port != null){
pool = new Pool({
user: `${process.env.DB_NAME}`,
host: `${process.env.DB_HOST}`,
database: `${process.env.DB_DATABASE}`,
password: `${process.env.DB_PASSWORD}`,
port: `${process.env.DB_PORT}`,
})
console.log("DATABASE: Updating DB pool...");
}
}
const getTrips = (request, response) => {
var query = "SELECT tripName, tripID, "
......@@ -213,11 +232,11 @@ function serverOut(querytext){
console.info("DATABASE: " + querytext + "\n");
}
function checkConnection(){
console.log('Database: starting connection...');
console.log('DATABASE: starting connection...');
pool.query("SELECT * FROM fieldday_trip;", (error, results) => {
if (error) {
console.log('Database: connection to database failed, check .ENV file.');
console.log('Halting...');
console.log('DATABASE: connection to database failed, check .ENV file.');
console.log('SERVER: Halting...');
process.exit(1);
}else{
console.log('Database: connection successful!\n');
......
......@@ -113,7 +113,7 @@
<div id='dataView'>
<div id='title'>
<span style='font-size:20px;'>IFS Datavis Tool v0.1.5</span><br>
<span id='version-tag' style='font-size:20px;'></span><br>
</div>
<div id='data'>
<div class='data-catagory' id='query_type'>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment