Compare commits
6 Commits
604025179c
...
main
Author | SHA1 | Date | |
---|---|---|---|
cf4641c8fb | |||
|
512f7f169e | ||
7e0eeb9c42 | |||
e4384f53a4 | |||
c00d631e9f | |||
03dab84224 |
17
.woodpecker.yml
Normal file
17
.woodpecker.yml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
steps:
|
||||||
|
test:
|
||||||
|
image: node:24
|
||||||
|
commands:
|
||||||
|
- npm install
|
||||||
|
- npm run test
|
||||||
|
|
||||||
|
gitea_release:
|
||||||
|
image: plugins/gitea-release
|
||||||
|
settings:
|
||||||
|
api_key:
|
||||||
|
from_secret: gitea_api_key
|
||||||
|
base_url: https://git.metaunix.net
|
||||||
|
title: "${CI_COMMIT_TAG}"
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
- tag
|
22
Gruntfile.js
22
Gruntfile.js
@@ -35,6 +35,17 @@ module.exports = function (grunt) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
copy: {
|
||||||
|
images: {
|
||||||
|
files: [{
|
||||||
|
expand: true,
|
||||||
|
cwd: 'assets/img/',
|
||||||
|
src: '**/*',
|
||||||
|
dest: 'public/img/'
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
css: {
|
css: {
|
||||||
files: ["assets/styles/**/*.scss"],
|
files: ["assets/styles/**/*.scss"],
|
||||||
@@ -52,6 +63,14 @@ module.exports = function (grunt) {
|
|||||||
spawn: false,
|
spawn: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
img: {
|
||||||
|
files: ["assets/img/**/*"],
|
||||||
|
tasks: ["copy:images"],
|
||||||
|
options: {
|
||||||
|
atBegin: true,
|
||||||
|
spawn: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -59,7 +78,8 @@ module.exports = function (grunt) {
|
|||||||
grunt.loadNpmTasks("grunt-contrib-watch");
|
grunt.loadNpmTasks("grunt-contrib-watch");
|
||||||
grunt.loadNpmTasks("grunt-contrib-sass");
|
grunt.loadNpmTasks("grunt-contrib-sass");
|
||||||
grunt.loadNpmTasks("grunt-contrib-uglify");
|
grunt.loadNpmTasks("grunt-contrib-uglify");
|
||||||
|
grunt.loadNpmTasks("grunt-contrib-copy");
|
||||||
|
|
||||||
// CLI tasks.
|
// CLI tasks.
|
||||||
grunt.registerTask("default", ["sass", "uglify"]);
|
grunt.registerTask("default", ["sass", "uglify", "copy:images"]);
|
||||||
};
|
};
|
||||||
|
BIN
assets/img/leviathan-favicon-nobg.png
Executable file
BIN
assets/img/leviathan-favicon-nobg.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 279 KiB |
BIN
assets/img/leviathan-logo-nobg.png
Executable file
BIN
assets/img/leviathan-logo-nobg.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 368 KiB |
@@ -1,19 +1,17 @@
|
|||||||
const testId = $("#results-table").data("test-id");
|
const testId = $("#results-table").data("test-id");
|
||||||
|
|
||||||
$(function () {
|
$("#test-result-form").on("submit", function (e) {
|
||||||
$("#test-result-form").on("submit", function (e) {
|
e.preventDefault();
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
const form = $(this);
|
const form = $(this);
|
||||||
const formData = form.serialize();
|
const formData = form.serialize();
|
||||||
const benchmarkId = form.find('[name="result_benchmark"]').val();
|
const benchmarkId = form.find('[name="result_benchmark"]').val();
|
||||||
|
|
||||||
$.post("/api/v1/result/add", formData, function (response) {
|
$.post("/api/v1/result/add", formData, function (response) {
|
||||||
if (response === "success") {
|
if (response === "success") {
|
||||||
fetchTestBenchmarkResults(testId, benchmarkId);
|
fetchTestBenchmarkResults(testId, benchmarkId);
|
||||||
form[0].reset();
|
form[0].reset();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -75,8 +73,10 @@ async function fetchTestBenchmarkResults(testId, benchmarkId) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#results-table tbody tr").each(function (index, tr) {
|
$(document).ready(function() {
|
||||||
const benchmarkId = $(tr).data("benchmark-id");
|
$("#results-table tbody tr").each(function (index, tr) {
|
||||||
console.log("Fetching results for benchmark id: " + benchmarkId);
|
const benchmarkId = $(tr).data("benchmark-id");
|
||||||
fetchTestBenchmarkResults(testId, benchmarkId);
|
console.log("Fetching results for benchmark id: " + benchmarkId);
|
||||||
|
fetchTestBenchmarkResults(testId, benchmarkId);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,71 +0,0 @@
|
|||||||
html,
|
|
||||||
body
|
|
||||||
width: 100%
|
|
||||||
height: 100%
|
|
||||||
margin: 0
|
|
||||||
padding: 0
|
|
||||||
body
|
|
||||||
height: auto
|
|
||||||
min-height: 100%
|
|
||||||
box-sizing: border-box
|
|
||||||
padding-top: 80px
|
|
||||||
padding-bottom: 80px
|
|
||||||
background: #eee
|
|
||||||
a
|
|
||||||
color: teal
|
|
||||||
transition: all 200ms ease-in-out
|
|
||||||
&:hover
|
|
||||||
color: #007070
|
|
||||||
textarea
|
|
||||||
max-width: 100%
|
|
||||||
min-width: 100%
|
|
||||||
height: 100px
|
|
||||||
.container
|
|
||||||
max-width: 1024px
|
|
||||||
select[multiple]
|
|
||||||
min-height: 125px
|
|
||||||
#main-nav
|
|
||||||
position: fixed
|
|
||||||
top: 0
|
|
||||||
left: 0
|
|
||||||
width: 100%
|
|
||||||
height: 64px
|
|
||||||
background: teal
|
|
||||||
color: white
|
|
||||||
z-index: 20
|
|
||||||
ul
|
|
||||||
list-style: none
|
|
||||||
display: inline-block
|
|
||||||
li
|
|
||||||
display: inline-block
|
|
||||||
margin-left: 15px
|
|
||||||
h4
|
|
||||||
display: inline-block
|
|
||||||
margin-left: 25px
|
|
||||||
line-height: 64px
|
|
||||||
a
|
|
||||||
color: white
|
|
||||||
font-size: 2.25rem
|
|
||||||
line-height: 64px
|
|
||||||
transition: all 200ms ease-in-out
|
|
||||||
&:hover
|
|
||||||
color: #eee
|
|
||||||
font-size: 2.5rem
|
|
||||||
#main-content
|
|
||||||
padding: 14px 20px
|
|
||||||
background: white
|
|
||||||
border-radius: 8px
|
|
||||||
z-index: 10
|
|
||||||
#main-footer
|
|
||||||
position: fixed
|
|
||||||
bottom: 0
|
|
||||||
left: 0
|
|
||||||
width: 100%
|
|
||||||
height: 64px
|
|
||||||
p
|
|
||||||
margin-bottom: 5px
|
|
||||||
text-align: center
|
|
||||||
#result_form
|
|
||||||
margin-bottom: 0
|
|
||||||
*
|
|
||||||
margin-bottom: 0
|
|
@@ -1,5 +1,28 @@
|
|||||||
$primary-color: teal;
|
$primary-color: teal;
|
||||||
|
|
||||||
body {
|
html{
|
||||||
background: #eee;
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
body{
|
||||||
|
background: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
table{
|
||||||
|
border: 1px solid #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
#main-nav{
|
||||||
|
img{
|
||||||
|
max-height: 40px;
|
||||||
|
margin-right: 15px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#main-content{
|
||||||
|
padding: 1.5rem 2rem;
|
||||||
|
background: white;
|
||||||
|
border: 1px solid #bbb;
|
||||||
|
border-radius: 12px;
|
||||||
}
|
}
|
||||||
|
46
index.js
46
index.js
@@ -1,44 +1,6 @@
|
|||||||
const express = require('express');
|
const app = require('./src/app');
|
||||||
const app = express();
|
|
||||||
const port = 3000;
|
|
||||||
|
|
||||||
// grab app and node.js process data
|
const PORT = process.env.PORT || 3000;
|
||||||
const pjson = require('./package.json');
|
app.listen(PORT, () => {
|
||||||
const { versions } = require('node:process');
|
console.log(`Listening on port ${PORT}`);
|
||||||
|
|
||||||
// register app and node.js versions with views;
|
|
||||||
app.locals.app_version = pjson.version;
|
|
||||||
app.locals.node_version = versions.node;
|
|
||||||
|
|
||||||
// initialize database
|
|
||||||
const sequelize = require('./src/models');
|
|
||||||
sequelize.sync({}).then(function(){
|
|
||||||
console.log('database has been synced');
|
|
||||||
}).catch(function(){
|
|
||||||
console.log('unable to sync database');
|
|
||||||
});
|
|
||||||
|
|
||||||
// enable sessions
|
|
||||||
const session = require("express-session");
|
|
||||||
app.use(session({ resave: true, secret: "123456", saveUninitialized: true }));
|
|
||||||
|
|
||||||
// enable body-parser to read form data
|
|
||||||
const bodyParser = require('body-parser');
|
|
||||||
app.use(bodyParser.urlencoded({ extended: true }));
|
|
||||||
|
|
||||||
// enable the Twig template engine
|
|
||||||
app.set('view engine', 'twig');
|
|
||||||
app.set('twig options', {
|
|
||||||
allowAsync: true,
|
|
||||||
strict_variables: false
|
|
||||||
});
|
|
||||||
|
|
||||||
// enable serving static files
|
|
||||||
app.use(express.static('public'));
|
|
||||||
|
|
||||||
// load routes to express
|
|
||||||
require('./src/routes')(app);
|
|
||||||
|
|
||||||
app.listen(port, () => {
|
|
||||||
console.log(`Leviathan listening on port ${port}`);
|
|
||||||
});
|
});
|
||||||
|
1468
package-lock.json
generated
1468
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node index.js",
|
"start": "node index.js",
|
||||||
"dev": "nodemon ./index.js",
|
"dev": "nodemon ./index.js",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "mocha \"test/**/*.test.js\"",
|
||||||
"grunt": "grunt"
|
"grunt": "grunt"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -28,12 +28,16 @@
|
|||||||
"twig": "^1.17.1"
|
"twig": "^1.17.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"chai": "^5.3.1",
|
||||||
"grunt": "^1.6.1",
|
"grunt": "^1.6.1",
|
||||||
"grunt-cli": "^1.5.0",
|
"grunt-cli": "^1.5.0",
|
||||||
|
"grunt-contrib-copy": "^1.0.0",
|
||||||
"grunt-contrib-sass": "^2.0.0",
|
"grunt-contrib-sass": "^2.0.0",
|
||||||
"grunt-contrib-uglify": "^5.2.2",
|
"grunt-contrib-uglify": "^5.2.2",
|
||||||
"grunt-contrib-watch": "^1.1.0",
|
"grunt-contrib-watch": "^1.1.0",
|
||||||
|
"mocha": "^11.7.1",
|
||||||
"nodemon": "^3.1.10",
|
"nodemon": "^3.1.10",
|
||||||
"sass": "^1.89.2"
|
"sass": "^1.89.2",
|
||||||
|
"supertest": "^7.1.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BIN
public/img/leviathan-favicon-nobg.png
Normal file
BIN
public/img/leviathan-favicon-nobg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 279 KiB |
BIN
public/img/leviathan-logo-nobg.png
Normal file
BIN
public/img/leviathan-logo-nobg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 368 KiB |
41
src/app.js
Normal file
41
src/app.js
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
const express = require('express');
|
||||||
|
const app = express();
|
||||||
|
|
||||||
|
// grab app and node.js process data
|
||||||
|
const pjson = require('../package.json');
|
||||||
|
const { versions } = require('node:process');
|
||||||
|
|
||||||
|
// register app and node.js versions with views;
|
||||||
|
app.locals.app_version = pjson.version;
|
||||||
|
app.locals.node_version = versions.node;
|
||||||
|
|
||||||
|
// initialize database
|
||||||
|
const sequelize = require('./models');
|
||||||
|
sequelize.sync({}).then(function(){
|
||||||
|
console.log('database has been synced');
|
||||||
|
}).catch(function(){
|
||||||
|
console.log('unable to sync database');
|
||||||
|
});
|
||||||
|
|
||||||
|
// enable sessions
|
||||||
|
const session = require("express-session");
|
||||||
|
app.use(session({ resave: true, secret: "123456", saveUninitialized: true }));
|
||||||
|
|
||||||
|
// enable body-parser to read form data
|
||||||
|
const bodyParser = require('body-parser');
|
||||||
|
app.use(bodyParser.urlencoded({ extended: true }));
|
||||||
|
|
||||||
|
// enable the Twig template engine
|
||||||
|
app.set('view engine', 'twig');
|
||||||
|
app.set('twig options', {
|
||||||
|
allowAsync: true,
|
||||||
|
strict_variables: false
|
||||||
|
});
|
||||||
|
|
||||||
|
// enable serving static files
|
||||||
|
app.use(express.static('public'));
|
||||||
|
|
||||||
|
// load routes to express
|
||||||
|
require('./routes')(app);
|
||||||
|
|
||||||
|
module.exports = app;
|
18
test/app.test.js
Normal file
18
test/app.test.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
const request = require('supertest');
|
||||||
|
const { expect } = require('chai');
|
||||||
|
const app = require('../src/app');
|
||||||
|
|
||||||
|
describe('GET /', () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
const res = await request(app).get('/');
|
||||||
|
this.res = res;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should run the app server', async () => {
|
||||||
|
expect(this.res.status).to.equal(200);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return an HTML response', async () => {
|
||||||
|
expect(this.res.headers['content-type']).match(/text\/html/);
|
||||||
|
});
|
||||||
|
});
|
60
test/routes/benchmark.test.js
Normal file
60
test/routes/benchmark.test.js
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
const request = require('supertest');
|
||||||
|
const { expect } = require('chai');
|
||||||
|
const app = require('../../src/app');
|
||||||
|
|
||||||
|
describe('GET /benchmark', () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
const res = await request(app).get('/benchmark');
|
||||||
|
this.res = res;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Benchmark base route should return a redirect', async () => {
|
||||||
|
expect(this.res.status).to.equal(302);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Benchmark base route should return an HTML response', async () => {
|
||||||
|
expect(this.res.headers['content-type']).contains('text/plain');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Benchmark base route should redirect to /benchmark/list', async () => {
|
||||||
|
expect(this.res.headers['location']).contains('/benchmark/list');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('GET /benchmark/list', () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
const res = await request(app).get('/benchmark/list');
|
||||||
|
this.res = res;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Benchmark list route should return a 200 status', async () => {
|
||||||
|
expect(this.res.status).to.equal(200);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Benchmark list route should return an HTML response', async () => {
|
||||||
|
expect(this.res.headers['content-type']).contains('text/html');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Benchmark list route should contain "List of Benchmarks" in body', async() => {
|
||||||
|
expect(this.res.text).contains('List of Benchmarks');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('GET /benchmark/add', () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
const res = await request(app).get('/benchmark/add');
|
||||||
|
this.res = res;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Benchmark add route should return a 200 status', async () => {
|
||||||
|
expect(this.res.status).to.equal(200);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Benchmark add route should return an HTML response', async () => {
|
||||||
|
expect(this.res.headers['content-type']).contains('text/html');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Benchmark add route should contain "Add a Benchmark" in body', async() => {
|
||||||
|
expect(this.res.text).contains('Add a Benchmark');
|
||||||
|
});
|
||||||
|
});
|
60
test/routes/hardware.test.js
Normal file
60
test/routes/hardware.test.js
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
const request = require('supertest');
|
||||||
|
const { expect } = require('chai');
|
||||||
|
const app = require('../../src/app');
|
||||||
|
|
||||||
|
describe('GET /hardware', () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
const res = await request(app).get('/hardware');
|
||||||
|
this.res = res;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Hardware base route should return a redirect', async () => {
|
||||||
|
expect(this.res.status).to.equal(302);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Hardware base route should return an HTML response', async () => {
|
||||||
|
expect(this.res.headers['content-type']).contains('text/plain');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Hardware base route should redirect to /hardware/list', async () => {
|
||||||
|
expect(this.res.headers['location']).contains('/hardware/list');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('GET /hardware/list', () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
const res = await request(app).get('/hardware/list');
|
||||||
|
this.res = res;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Hardware list route should return a 200 status', async () => {
|
||||||
|
expect(this.res.status).to.equal(200);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Hardware list route should return an HTML response', async () => {
|
||||||
|
expect(this.res.headers['content-type']).contains('text/html');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Hardware list route should contain "List of Hardware" in body', async() => {
|
||||||
|
expect(this.res.text).contains('List of Hardware');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('GET /hardware/add', () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
const res = await request(app).get('/hardware/add');
|
||||||
|
this.res = res;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Hardware add route should return a 200 status', async () => {
|
||||||
|
expect(this.res.status).to.equal(200);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Hardware add route should return an HTML response', async () => {
|
||||||
|
expect(this.res.headers['content-type']).contains('text/html');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Hardware add route should contain "Add Hardware" in body', async() => {
|
||||||
|
expect(this.res.text).contains('Add Hardware');
|
||||||
|
});
|
||||||
|
});
|
60
test/routes/test.test.js
Normal file
60
test/routes/test.test.js
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
const request = require('supertest');
|
||||||
|
const { expect } = require('chai');
|
||||||
|
const app = require('../../src/app');
|
||||||
|
|
||||||
|
describe('GET /test', () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
const res = await request(app).get('/test');
|
||||||
|
this.res = res;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Test base route should return a redirect', async () => {
|
||||||
|
expect(this.res.status).to.equal(302);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Test base route should return an HTML response', async () => {
|
||||||
|
expect(this.res.headers['content-type']).contains('text/plain');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Test base route should redirect to /test/list', async () => {
|
||||||
|
expect(this.res.headers['location']).contains('/test/list');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('GET /test/list', () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
const res = await request(app).get('/test/list');
|
||||||
|
this.res = res;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Test list route should return a 200 status', async () => {
|
||||||
|
expect(this.res.status).to.equal(200);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Test list route should return an HTML response', async () => {
|
||||||
|
expect(this.res.headers['content-type']).contains('text/html');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Test list route should contain "List of Tests" in body', async() => {
|
||||||
|
expect(this.res.text).contains('List of Tests');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('GET /test/add', () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
const res = await request(app).get('/test/add');
|
||||||
|
this.res = res;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Test add route should return a 200 status', async () => {
|
||||||
|
expect(this.res.status).to.equal(200);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Test add route should return an HTML response', async () => {
|
||||||
|
expect(this.res.headers['content-type']).contains('text/html');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Test add route should contain "Add a Test" in body', async() => {
|
||||||
|
expect(this.res.text).contains('Add a Test');
|
||||||
|
});
|
||||||
|
});
|
22
test/routes/toplevel.test.js
Normal file
22
test/routes/toplevel.test.js
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
const request = require('supertest');
|
||||||
|
const { expect } = require('chai');
|
||||||
|
const app = require('../../src/app');
|
||||||
|
|
||||||
|
describe('GET /', () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
const res = await request(app).get('/');
|
||||||
|
this.res = res;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Dashboard should return a 200 status', async () => {
|
||||||
|
expect(this.res.status).to.equal(200);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Dashboard should return an HTML response', async () => {
|
||||||
|
expect(this.res.headers['content-type']).match(/text\/html/);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Dashboard should contain "Leviathan" in body', async() => {
|
||||||
|
expect(this.res.text).contains('Leviathan');
|
||||||
|
});
|
||||||
|
});
|
@@ -7,25 +7,27 @@
|
|||||||
<h2>Benchmarks</h2>
|
<h2>Benchmarks</h2>
|
||||||
<a href="/benchmark/add">Add a benchmark</a>
|
<a href="/benchmark/add">Add a benchmark</a>
|
||||||
|
|
||||||
<table class="twelve columns">
|
<div class="col-12">
|
||||||
<thead>
|
<table class="table table-responsive table-hover">
|
||||||
<tr>
|
<thead>
|
||||||
<td>Benchmark name</td>
|
|
||||||
<td>Scoring type</td>
|
|
||||||
<td>Created at</td>
|
|
||||||
<td>Last updated</td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for b in benchmarks %}
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="/benchmark/{{ b.id }}">{{ b.name }}</a></td>
|
<td>Benchmark name</td>
|
||||||
<td>{{ b.scoring }}</td>
|
<td>Scoring type</td>
|
||||||
<td>{{ b.createdAt | date('m/d/Y g:ia') }}</td>
|
<td>Created at</td>
|
||||||
<td>{{ b.updatedAt | date('m/d/Y g:ia') }}</td>
|
<td>Last updated</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
</thead>
|
||||||
</tbody>
|
<tbody>
|
||||||
</table>
|
{% for b in benchmarks %}
|
||||||
|
<tr>
|
||||||
|
<td><a href="/benchmark/{{ b.id }}">{{ b.name }}</a></td>
|
||||||
|
<td>{{ b.scoring }}</td>
|
||||||
|
<td>{{ b.createdAt | date('m/d/Y g:ia') }}</td>
|
||||||
|
<td>{{ b.updatedAt | date('m/d/Y g:ia') }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@@ -7,25 +7,27 @@
|
|||||||
<h2>Hardware</h2>
|
<h2>Hardware</h2>
|
||||||
<a href="/hardware/add">Add new hardware</a>
|
<a href="/hardware/add">Add new hardware</a>
|
||||||
|
|
||||||
<table class="twelve columns">
|
<div class="col-12">
|
||||||
<thead>
|
<table class="table table-responsive table-hover">
|
||||||
<tr>
|
<thead>
|
||||||
<td>Name</td>
|
|
||||||
<td>Type</td>
|
|
||||||
<td>Created at</td>
|
|
||||||
<td>Last updated</td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for h in hardware %}
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="/hardware/{{ h.id }}">{{ h.name }}</a></td>
|
<td>Name</td>
|
||||||
<td>{{ h.type }}</td>
|
<td>Type</td>
|
||||||
<td>{{ p.createdAt | date('m/d/Y g:ia') }}</td>
|
<td>Created at</td>
|
||||||
<td>{{ p.updatedAt | date('m/d/Y g:ia') }}</td>
|
<td>Last updated</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
</thead>
|
||||||
</tbody>
|
<tbody>
|
||||||
</table>
|
{% for h in hardware %}
|
||||||
|
<tr>
|
||||||
|
<td><a href="/hardware/{{ h.id }}">{{ h.name }}</a></td>
|
||||||
|
<td>{{ h.type }}</td>
|
||||||
|
<td>{{ p.createdAt | date('m/d/Y g:ia') }}</td>
|
||||||
|
<td>{{ p.updatedAt | date('m/d/Y g:ia') }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@@ -5,23 +5,26 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<h2>Recently updated tests:</h2>
|
<h2>Recently updated tests:</h2>
|
||||||
<table class="twelve columns">
|
|
||||||
<thead>
|
<div class="col-12">
|
||||||
<tr>
|
<table class="table table-responsive table-hover">
|
||||||
<td>Title</td>
|
<thead>
|
||||||
<td>Last updated</td>
|
|
||||||
<td>Created at</td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for t in tests %}
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="/test/{{ t.id }}">{{ t.title }}</a></td>
|
<td>Title</td>
|
||||||
<td>{{ t.updatedAt | date('m/d/Y g:ia') }}</td>
|
<td>Last updated</td>
|
||||||
<td>{{ t.createdAt | date('m/d/Y g:ia') }}</td>
|
<td>Created at</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
</thead>
|
||||||
</tbody>
|
<tbody>
|
||||||
</table>
|
{% for t in tests %}
|
||||||
|
<tr>
|
||||||
|
<td><a href="/test/{{ t.id }}">{{ t.title }}</a></td>
|
||||||
|
<td>{{ t.updatedAt | date('m/d/Y g:ia') }}</td>
|
||||||
|
<td>{{ t.createdAt | date('m/d/Y g:ia') }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@@ -4,18 +4,23 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
|
<link rel="shortcut icon" href="/img/leviathan-favicon-nobg.png">
|
||||||
<title>{% block title %}{% endblock %} | Leviathan</title>
|
<title>{% block title %}{% endblock %} | Leviathan</title>
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.7/css/bootstrap.min.css">
|
||||||
<link rel="stylesheet" href="/css/eye.css">
|
<link rel="stylesheet" href="/css/eye.css">
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js" charset="utf-8"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.7/js/bootstrap.min.js" charset="utf-8"></script>
|
||||||
|
<script src="/js/scar.js"></script>
|
||||||
{% block scripts %}{% endblock %}
|
{% block scripts %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="d-flex flex-column min-vh-100">
|
||||||
{% include 'partials/navbar.twig' %}
|
{% include 'partials/navbar.twig' %}
|
||||||
|
|
||||||
<div id="main-content" class="container">
|
<main class="flex-grow-1 py-4">
|
||||||
{% block content %}{% endblock %}
|
<div id="main-content" class="container mb-4">
|
||||||
</div>
|
{% block content %}{% endblock %}
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
{% include 'partials/footer.twig' %}
|
{% include 'partials/footer.twig' %}
|
||||||
</body>
|
</body>
|
||||||
|
@@ -1,4 +1,10 @@
|
|||||||
<nav id="main-footer">
|
<footer id="main-footer" class="bg-light border-top py-3 text-center">
|
||||||
<p>Leviathan version v{{ app_version }}</p>
|
<div class="container">
|
||||||
<p>Running node.js version v{{ node_version }}</p>
|
<div class="row">
|
||||||
</nav>
|
<div class="col-12">
|
||||||
|
<p>Leviathan version v{{ app_version }}</p>
|
||||||
|
<p class="mb-0">Running Node.js version v{{ node_version }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
@@ -1,11 +1,31 @@
|
|||||||
<nav id="main-nav">
|
<nav id="main-nav" class="navbar navbar-expand-md" style="background-color: #e3f2fd;" data-bs-theme="light">
|
||||||
<div class="nav-left">
|
<div class="container-fluid">
|
||||||
<h4>Leviathan</h4>
|
<a href="#" class="img-fluid">
|
||||||
<ul>
|
<img src="/img/leviathan-logo-nobg.png" alt="Leviathan">
|
||||||
<li><a href="/">Dashboard</a></li>
|
</a>
|
||||||
<li><a href="/test">Tests</a></li>
|
|
||||||
<li><a href="/hardware">Hardware</a></li>
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
<li><a href="/benchmark">Benchmarks</a></li>
|
<span class="navbar-toggler-icon"></span>
|
||||||
</ul>
|
</button>
|
||||||
|
|
||||||
|
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||||
|
<ul class="navbar-nav me-auto mb-2 mb-md-0">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="/">Dashboard</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="/benchmark">Benchmarks</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="/hardware">Hardware</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="/test">Test</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="/report">Reports</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
@@ -7,23 +7,25 @@
|
|||||||
<h2>Tests</h2>
|
<h2>Tests</h2>
|
||||||
<a href="/test/add">Add a test</a>
|
<a href="/test/add">Add a test</a>
|
||||||
|
|
||||||
<table class="twelve columns">
|
<div class="col-12">
|
||||||
<thead>
|
<table class="table table-responsive table-hover">
|
||||||
<tr>
|
<thead>
|
||||||
<td>Title</td>
|
|
||||||
<td>Created at</td>
|
|
||||||
<td>Last updated</td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for t in tests %}
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="/test/{{ t.id }}">{{ t.title }}</a></td>
|
<td>Title</td>
|
||||||
<td>{{ t.createdAt | date('m/d/Y g:ia') }}</td>
|
<td>Created at</td>
|
||||||
<td>{{ t.updatedAt | date('m/d/Y g:ia') }}</td>
|
<td>Last updated</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
</thead>
|
||||||
</tbody>
|
<tbody>
|
||||||
</table>
|
{% for t in tests %}
|
||||||
|
<tr>
|
||||||
|
<td><a href="/test/{{ t.id }}">{{ t.title }}</a></td>
|
||||||
|
<td>{{ t.createdAt | date('m/d/Y g:ia') }}</td>
|
||||||
|
<td>{{ t.updatedAt | date('m/d/Y g:ia') }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@@ -8,51 +8,47 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<h2>Test: {{ test.title }}</h2>
|
<div class="col-12">
|
||||||
|
<h2>Test: {{ test.title }}</h2>
|
||||||
|
|
||||||
<h4>Hardware tested: <a href="/hardware/{{ test.getHardware().id }}">{{ test.getHardware().name }}</a></h4>
|
<h4>Hardware tested: <a href="/hardware/{{ test.getHardware().id }}">{{ test.getHardware().name }}</a></h4>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<form id="test-result-form" class="twelve columns" action="/api/v1/result/add" method="post">
|
<form id="test-result-form" class="col-12" action="/api/v1/result/add" method="post">
|
||||||
<input type="hidden" name="result_test" value="{{ test.id }}">
|
<input type="hidden" name="result_test" value="{{ test.id }}">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="four columns">
|
<div class="col-4">
|
||||||
<label for="result_benchmark">
|
<label class="form-label" for="result_benchmark">Benchmark:</label>
|
||||||
Benchmark:
|
<select id="result_benchmark" class="form-select" name="result_benchmark">
|
||||||
<select class="u-full-width" id="result_benchmark" name="result_benchmark">
|
{% for b in test.getBenchmarks() %}
|
||||||
{% for b in test.getBenchmarks() %}
|
<option value="{{ b.id }}">{{ b.name }}</option>
|
||||||
<option value="{{ b.id }}">{{ b.name }}</option>
|
{% endfor %}
|
||||||
{% endfor %}
|
</select>
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="two columns">
|
<div class="col-2">
|
||||||
<label for="result_avg">
|
<label class="form-label" for="result_avg">Average:</label>
|
||||||
Average:
|
<input id="result_avg" class="form-control" type="number" name="result_avg" step="0.01" required>
|
||||||
<input type="number" id="result_avg" class="u-full-width" name="result_avg" step="0.01" required>
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="two columns">
|
<div class="col-2">
|
||||||
<label for="result_min">
|
<label class="form-label" for="result_min">Minimum:</label>
|
||||||
Minimum:
|
<input id="result_min" class="form-control" type="number" name="result_min" step="0.01">
|
||||||
<input type="number" id="result_min" class="u-full-width" name="result_min" step="0.01">
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="two columns">
|
<div class="col-2">
|
||||||
<label for="result_max">
|
<label class="form-label" for="result_max">Maximum:</label>
|
||||||
Maximum:
|
<input id="result_max" class="form-control" type="number" name="result_max" step="0.01">
|
||||||
<input type="number" id="result_max" class="u-full-width" name="result_max" step="0.01">
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input type="submit" class="two columns" value="Submit">
|
<div class="col-2">
|
||||||
|
<input type="submit" class="btn btn-primary" value="Add Result">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -60,10 +56,10 @@
|
|||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="twelve columns">
|
<div class="col-12">
|
||||||
<h3>Benchmarks</h3>
|
<h3 class="mb-3">Benchmarks</h3>
|
||||||
<table id="results-table" data-test-id="{{ test.id }}" class="u-full-width">
|
<table id="results-table" class="table table-hover table-responsive" data-test-id="{{ test.id }}">
|
||||||
<thead>
|
<thead class="table-light">
|
||||||
<tr>
|
<tr>
|
||||||
<td>Benchmark</td>
|
<td>Benchmark</td>
|
||||||
<td>Scoring type</td>
|
<td>Scoring type</td>
|
||||||
|
Reference in New Issue
Block a user