56 Commits

Author SHA1 Message Date
190ae9f302 Fixed typo in Gruntfile; added Make tasks to compile frontend assets; Modernized the gathering of benchmark result data for the test view 2025-07-02 15:58:13 -04:00
771d26ec3b Improved some styles 2024-06-08 10:01:25 -04:00
da6397dd14 [Issue #8] - Licensing project under the BSD 2-Clause license (#10)
Adding license to project

Co-authored-by: Gregory Ballantine <gballantine@bitgoblin.tech>
Reviewed-on: #10
2024-05-31 09:28:23 -04:00
8e20e5e354 3-add-gruntjs (#9)
Adding Grunt.js to compile SASS and CoffeeScript assets

Co-authored-by: Gregory Ballantine <gregory.w.ballantine@nasa.gov>
Co-authored-by: Gregory Ballantine <gballantine555@gmail.com>
Reviewed-on: #9
2024-05-31 09:00:18 -04:00
Gregory Ballantine
533c407183 Updated some styles for tables and links 2024-05-29 15:07:54 -04:00
Gregory Ballantine
fb76f28643 Added tests to hardware page 2024-05-29 12:33:45 -04:00
Gregory Ballantine
06262431da Updated some styles 2024-05-29 12:10:27 -04:00
Gregory Ballantine
e734d4077d Updated some styles 2024-05-29 12:08:58 -04:00
Gregory Ballantine
9617f4280d Fixed results table in test view 2024-05-29 12:04:08 -04:00
Gregory Ballantine
3ec5605c53 Fixed results table in test view 2024-05-29 12:02:45 -04:00
Gregory Ballantine
ed5232371c Fixed results table in test view 2024-05-29 12:00:04 -04:00
Gregory Ballantine
29d9cbc59c Fixed results table in test view 2024-05-29 11:57:49 -04:00
Gregory Ballantine
3eca29c2db Added back reference associations for result; added table of results to test view 2024-05-29 11:52:01 -04:00
Gregory Ballantine
8df9b7684f added missing import 2024-05-29 11:43:42 -04:00
Gregory Ballantine
7282d0a4b6 Fixed result form stuff 2024-05-29 11:43:17 -04:00
Gregory Ballantine
0525838f4b Fixed float variable types 2024-05-29 11:41:53 -04:00
Gregory Ballantine
958c72ee63 Added result creation route 2024-05-29 11:40:42 -04:00
Gregory Ballantine
fa92321176 Added result model; added form to submit results 2024-05-29 11:26:42 -04:00
Gregory Ballantine
458646ee8e Added result model; added form to submit results 2024-05-29 11:26:17 -04:00
Gregory Ballantine
9df8f6c9e1 Added result model; added form to submit results 2024-05-29 11:25:45 -04:00
Gregory Ballantine
7e294c8f72 Cleaned up runtime version 2024-05-29 11:09:55 -04:00
Gregory Ballantine
cefa79a8b8 Added Go runtime version to the layout footer 2024-05-29 11:05:02 -04:00
Gregory Ballantine
1e87466ccb Added Go runtime version to the layout footer 2024-05-29 11:04:31 -04:00
Gregory Ballantine
e3e4e24e56 Fixed associating benchmarks to test 2024-05-29 10:07:15 -04:00
Gregory Ballantine
2be6d216d1 Fixed creating new test 2024-05-29 09:52:41 -04:00
Gregory Ballantine
93170d0935 Fixed creating new test 2024-05-29 09:47:49 -04:00
Gregory Ballantine
2299ac0a93 Added more information to the test view page 2024-05-29 09:23:41 -04:00
Gregory Ballantine
3ec465872e Fixed typo in test view route 2024-05-29 09:19:53 -04:00
Gregory Ballantine
52e4d9c420 Fixed typos in benchmark list view 2024-05-29 09:17:07 -04:00
Gregory Ballantine
9ddf7fa928 Fixed typos in model searches 2024-05-29 09:16:32 -04:00
Gregory Ballantine
ab6b94cb5f Fixed typo in benchmark list view 2024-05-29 09:14:09 -04:00
Gregory Ballantine
39185f1144 Fixed benchmark form submission error 2024-05-29 09:13:10 -04:00
Gregory Ballantine
403ab7f166 Fixed mix up between benchmark and hardware routes files 2024-05-29 09:12:19 -04:00
Gregory Ballantine
ba06a2ea4c Added benchmarks routes and views 2024-05-29 09:11:13 -04:00
Gregory Ballantine
95fe5ab400 Slight tweak to create test view 2024-05-29 09:03:14 -04:00
Gregory Ballantine
9ddc3db48d Fixed form select field styling 2024-05-29 09:02:00 -04:00
Gregory Ballantine
8412163370 Fixed variable capitalization in create test view 2024-05-29 09:00:14 -04:00
Gregory Ballantine
86bf4d37f0 Added description field to Test model 2024-05-29 08:58:30 -04:00
Gregory Ballantine
6cb2ac0263 Passed hardware components and benchmarks to create test view 2024-05-29 08:57:52 -04:00
Gregory Ballantine
dea08d15dd Added route to view test 2024-05-29 08:45:53 -04:00
Gregory Ballantine
cf7623fbb9 Added route to view test 2024-05-29 08:43:57 -04:00
Gregory Ballantine
a51c8aa8a4 Added route to view test 2024-05-29 08:42:53 -04:00
Gregory Ballantine
9fd6ec6b0b Added route to view hardware component 2024-05-29 08:40:02 -04:00
Gregory Ballantine
5b14721b14 Added route to view hardware component 2024-05-29 08:39:27 -04:00
Gregory Ballantine
dcfc6e0115 Added route to view hardware component 2024-05-29 08:37:51 -04:00
4ad9a92306 Added hardware routes and views 2023-12-02 22:37:46 -05:00
c5df026d04 Lots of changes 2023-12-02 22:16:16 -05:00
16704aeeb1 Added ability to create projects 2023-11-28 16:36:11 -05:00
Gregory Ballantine
bae65994f8 Refactored models code to follow a better approach for opening and closing the database connection 2023-11-28 14:40:12 -05:00
19670e9abd Added models; started working on project routes 2023-11-27 23:41:48 -05:00
49925c6d8f Added Gorm to project 2023-11-27 22:36:58 -05:00
0ee3d06f89 Copied some styles from Leviathan 2023-11-27 22:26:36 -05:00
9dceaa8119 Started working on the layout of the app 2023-11-24 23:34:50 -05:00
cbc816ad70 Updated Makefile to auto-define version 2023-11-24 14:28:53 -05:00
92d8e5fa09 Added templating, versioning, middleware, etc 2023-11-24 14:27:23 -05:00
cd7003223a Better start for Flamego 2023-11-24 13:25:24 -05:00
8 changed files with 5 additions and 137 deletions

View File

@@ -1,32 +0,0 @@
pipeline:
build:
image: golang:1.22
commands:
- go mod vendor
- GOOS=linux GOARCH=amd64 go build -o "dist/blt-linux-amd64-${CI_COMMIT_TAG}.bin"
- GOOS=windows GOARCH=amd64 go build -o "dist/blt-windows-amd64-${CI_COMMIT_TAG}.exe"
assets:
image: node:24
commands:
- npm install
- npm run grunt build
package:
image: alpine
commands:
- tar -cvzf "dist/blt-assets-${CI_COMMIT_TAG}.tar.gz" public/
when:
event: tag
gitea_release:
image: plugins/gitea-release
settings:
api_key:
from_secret: gitea_api_key
base_url: https://git.metaunix.net
title: "${CI_COMMIT_TAG}"
files:
- dist/blt-*
when:
event: tag

View File

@@ -60,8 +60,6 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-coffee');
// CLI tasks.
grunt.registerTask('build', ['sass', 'coffee']);
grunt.registerTask('dev', ['watch']);
grunt.registerTask('default', ['build']);
grunt.registerTask('default', ['sass', 'coffee']);
};

12
main.go
View File

@@ -1,7 +1,6 @@
package main
import (
gotemplate "html/template"
"log"
"net/http"
@@ -26,16 +25,7 @@ func main() {
f.Use(flamego.Renderer())
// initialize templating engine
f.Use(template.Templater(template.Options{
FuncMaps: []gotemplate.FuncMap{
{
"contains": web.Contains,
},
},
Directory: "templates",
Extensions: []string{".tmpl", ".html"},
},
))
f.Use(template.Templater())
// inject custom middleware
f.Use(middleware.CustomVars)

View File

@@ -4,8 +4,7 @@
"description": "Self-hosted PC hardware benchmark logging tool",
"main": "index.js",
"scripts": {
"grunt": "grunt",
"nodemon": "nodemon"
"grunt": "grunt"
},
"repository": {
"type": "git",
@@ -28,8 +27,8 @@
"devDependencies": {
"grunt": "^1.5.3",
"grunt-cli": "^1.4.3",
"grunt-contrib-coffee": "^2.1.0",
"grunt-contrib-sass": "^2.0.0",
"grunt-contrib-coffee": "^2.1.0",
"grunt-contrib-watch": "^1.1.0",
"sass": "^1.55.0"
}

View File

@@ -1,53 +0,0 @@
{{ template "header" . }}
<div class="row">
<h2>{{ .title }}</h2>
<form class="twelve columns" action="/test/{{ .test.ID }}/edit" method="POST">
<div class="row">
<div class="columns four">
<label for="test_hardware">
Hardware Component:
<select id="test_hardware" class="u-full-width" name="test_hardware">
{{ $testHardwareID := .test.Hardware.ID }}
{{ range $hw := .hardware }}
<option value="{{ $hw.ID }}" {{ if eq $testHardwareID $hw.ID }}selected{{ end }}>{{ $hw.Name }}</option>
{{ end }}
</select>
</label>
</div>
<div class="columns eight">
<label for="test_name">
Test name:
<input id="test_name" class="u-full-width" type="text" name="test_name" placeholder="My hardware benchmarking test" value="{{ .test.Name }}">
</label>
</div>
</div>
<div class="row">
<div class="columns twelve">
<label for="test_benchmarks">
Benchmarks to Test:
<select id="test_benchmarks" class="u-full-width" name="test_benchmarks" multiple>
{{ $testBenchmarks := .test.Benchmarks }}
{{ range $bm := .benchmarks }}
<option value="{{ $bm.ID }}" {{ if contains $testBenchmarks $bm.ID }}selected{{ end }}>{{ $bm.Name }}</option>
{{ end }}
</select>
</label>
</div>
</div>
<div class="row">
<label for="test_description">
Test description:
<textarea id="test_description" class="twelve columns" cols="30" rows="10" name="test_description"></textarea>
</label>
</div>
<input class="button-primary u-full-width" type="submit" value="Submit">
</form>
</div>
{{ template "footer" . }}

View File

@@ -1,10 +0,0 @@
package web
func Contains(slice []string, val string) bool {
for _, v := range slice {
if v == val {
return true
}
}
return false
}

View File

@@ -51,10 +51,7 @@ func RegisterRoutes(f *flamego.Flame) {
f.Get("/create", routes.TestGetCreate)
f.Post("/create", binding.Form(forms.TestForm{}), routes.TestPostCreate)
f.Group("/{test_id}", func() {
f.Get("", routes.TestGetView)
f.Get("/edit", routes.TestGetEdit)
})
f.Get("/{test_id}", routes.TestGetView)
})
// result routes

View File

@@ -81,24 +81,3 @@ func TestPostCreate(c flamego.Context, form forms.TestForm, errs binding.Errors)
c.Redirect(fmt.Sprintf("/test/%d", test.ID))
}
func TestGetEdit(c flamego.Context, t template.Template, data template.Data) {
// find test in DB
testID := c.Param("test_id")
var test models.Test
models.DB.Preload("Hardware").Preload("Benchmarks").First(&test, testID)
data["test"] = test
// add hardware components to template
var hardware []models.Hardware
models.DB.Find(&hardware)
data["hardware"] = hardware
// add benchmarks to template
var benchmarks []models.Benchmark
models.DB.Find(&benchmarks)
data["benchmarks"] = benchmarks
data["title"] = fmt.Sprintf("Editing Test: %s", test.Name)
t.HTML(http.StatusOK, "test/edit")
}