63 Commits

Author SHA1 Message Date
Gregory Ballantine
4b98322022 Continued work on the test/edit post routet
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2025-08-12 11:40:56 -04:00
60d8554cf1 Updated the test edit page (still need to do the post page)
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2025-08-10 01:44:33 -04:00
c19bb2108c Adding local tmp directory to git ignore
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2025-07-28 08:00:21 -04:00
27cff3e79b Adding event: tag to the asset packaging step
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline failed
2025-07-14 14:17:12 -04:00
03ef5cc905 Updating Grunt commands 2025-07-14 14:17:11 -04:00
f81879302d Started working on test edit page; removed nodemon because it wasn't working 2025-07-14 14:17:11 -04:00
9ecff3a25d Added nodemon to dev dependencies to automatially reload the app on changes 2025-07-14 14:17:10 -04:00
bef17b5a59 Fixed typo in Gruntfile; added Make tasks to compile frontend assets; Modernized the gathering of benchmark result data for the test view 2025-07-14 14:17:10 -04:00
82f42ecbed Improved some styles 2025-07-14 14:17:09 -04:00
673e2e9634 [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
2025-07-14 14:17:07 -04:00
178894a360 3-add-gruntjs (#9)
Adding Grunt.js to compile SASS and CoffeeScript assets

Co-authored-by: Gregory Ballantine <gballantine555@gmail.com>
Reviewed-on: #9
2025-07-14 14:16:58 -04:00
5fc381c4b9 Updated some styles for tables and links 2025-07-14 13:53:50 -04:00
c9d2f7114a Added tests to hardware page 2025-07-14 13:53:50 -04:00
bce063c5f4 Updated some styles 2025-07-14 13:53:50 -04:00
b54d31213b Updated some styles 2025-07-14 13:53:50 -04:00
ae4198f3cc Fixed results table in test view 2025-07-14 13:53:50 -04:00
9fdf6e2b99 Fixed results table in test view 2025-07-14 13:53:50 -04:00
8f0cce7550 Fixed results table in test view 2025-07-14 13:53:50 -04:00
d97fee0911 Fixed results table in test view 2025-07-14 13:53:50 -04:00
de107761eb Added back reference associations for result; added table of results to test view 2025-07-14 13:53:50 -04:00
26ad420436 added missing import 2025-07-14 13:53:50 -04:00
47f3dcdbd1 Fixed result form stuff 2025-07-14 13:53:50 -04:00
6bb06205b0 Fixed float variable types 2025-07-14 13:53:50 -04:00
b508efd5a8 Added result creation route 2025-07-14 13:53:50 -04:00
e5a18f77f2 Added result model; added form to submit results 2025-07-14 13:53:50 -04:00
db41f0d6bd Added result model; added form to submit results 2025-07-14 13:53:50 -04:00
b93c8a5319 Added result model; added form to submit results 2025-07-14 13:53:50 -04:00
346b9e3911 Cleaned up runtime version 2025-07-14 13:53:50 -04:00
446590acb1 Added Go runtime version to the layout footer 2025-07-14 13:53:50 -04:00
a38ede5187 Added Go runtime version to the layout footer 2025-07-14 13:53:50 -04:00
2b3f24ee5c Fixed associating benchmarks to test 2025-07-14 13:53:50 -04:00
9104125de7 Fixed creating new test 2025-07-14 13:53:50 -04:00
5ad0810d81 Fixed creating new test 2025-07-14 13:53:50 -04:00
e27fd8d214 Added more information to the test view page 2025-07-14 13:53:50 -04:00
3910c4dc9c Fixed typo in test view route 2025-07-14 13:53:50 -04:00
3b8a30c7f8 Fixed typos in benchmark list view 2025-07-14 13:53:50 -04:00
293098e173 Fixed typos in model searches 2025-07-14 13:53:50 -04:00
10298cbf7c Fixed typo in benchmark list view 2025-07-14 13:53:50 -04:00
743a108add Fixed benchmark form submission error 2025-07-14 13:53:50 -04:00
c8a47b270a Fixed mix up between benchmark and hardware routes files 2025-07-14 13:53:50 -04:00
fde8d1dee4 Added benchmarks routes and views 2025-07-14 13:53:50 -04:00
bee64576bc Slight tweak to create test view 2025-07-14 13:53:50 -04:00
3c1d48a9ed Fixed form select field styling 2025-07-14 13:53:50 -04:00
633fc4ac02 Fixed variable capitalization in create test view 2025-07-14 13:53:50 -04:00
79924cd978 Added description field to Test model 2025-07-14 13:53:50 -04:00
e5443fb644 Passed hardware components and benchmarks to create test view 2025-07-14 13:53:50 -04:00
81a87e2761 Added route to view test 2025-07-14 13:53:50 -04:00
65550c983c Added route to view test 2025-07-14 13:53:50 -04:00
f3a2376c19 Added route to view test 2025-07-14 13:53:50 -04:00
99f45b3b3a Added route to view hardware component 2025-07-14 13:53:50 -04:00
4718aeaccd Added route to view hardware component 2025-07-14 13:53:50 -04:00
62654b9a3e Added route to view hardware component 2025-07-14 13:53:50 -04:00
93778274c2 Added hardware routes and views 2025-07-14 13:53:50 -04:00
7c13b1f209 Lots of changes 2025-07-14 13:53:50 -04:00
e09d399c98 Added ability to create projects 2025-07-14 13:53:50 -04:00
c9ad5df2ed Refactored models code to follow a better approach for opening and closing the database connection 2025-07-14 13:53:50 -04:00
0f89087134 Added models; started working on project routes 2025-07-14 13:53:50 -04:00
819baeb0c3 Added Gorm to project 2025-07-14 13:53:50 -04:00
fe303cb778 Copied some styles from Leviathan 2025-07-14 13:53:50 -04:00
98bd1f7eca Started working on the layout of the app 2025-07-14 13:53:50 -04:00
09a2667fc5 Updated Makefile to auto-define version 2025-07-14 13:53:50 -04:00
4020812549 Added templating, versioning, middleware, etc 2025-07-14 13:53:50 -04:00
8bc9849776 Better start for Flamego 2025-07-14 13:53:50 -04:00
7 changed files with 117 additions and 3 deletions

1
.gitignore vendored
View File

@@ -3,6 +3,7 @@ blt
# Local data files
data/
tmp/
# Compiled assets
public/css/

32
.woodpecker.yml Normal file
View File

@@ -0,0 +1,32 @@
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,6 +60,8 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-coffee');
// CLI tasks.
grunt.registerTask('default', ['sass', 'coffee']);
grunt.registerTask('build', ['sass', 'coffee']);
grunt.registerTask('dev', ['watch']);
grunt.registerTask('default', ['build']);
};

View File

@@ -1,6 +1,8 @@
package models
import (
"strconv"
"gorm.io/gorm"
)
@@ -16,3 +18,7 @@ type Benchmark struct {
// has many results
Results []Result
}
func (b *Benchmark) StringID() string {
return strconv.Itoa(int(b.ID))
}

View File

@@ -1,6 +1,9 @@
package models
import (
"fmt"
"strconv"
"gorm.io/gorm"
)
@@ -19,3 +22,29 @@ type Test struct {
// has many results
Results []Result
}
func (t *Test) SelectedBenchmarks() []string {
benchmarks := t.Benchmarks
ids := make([]string, len(benchmarks))
for i, b := range benchmarks {
ids[i] = strconv.Itoa(int(b.ID))
}
return ids
}
func (t *Test) IsBenchmarkSelected(benchmarkID string) bool {
benchmarkConv, err := strconv.ParseUint(benchmarkID, 10, 0)
if err != nil {
fmt.Println("Error parsing Uint: ", err)
}
benchmarkUint := uint(benchmarkConv)
for _, b := range t.Benchmarks {
if b.ID == benchmarkUint {
return true
}
}
return false
}

View File

@@ -30,9 +30,9 @@
<label for="test_benchmarks">
Benchmarks to Test:
<select id="test_benchmarks" class="u-full-width" name="test_benchmarks" multiple>
{{ $testBenchmarks := .test.Benchmarks }}
{{ $selectedBenchmarks := .selectedBenchmarks }}
{{ range $bm := .benchmarks }}
<option value="{{ $bm.ID }}" {{ if contains $testBenchmarks $bm.ID }}selected{{ end }}>{{ $bm.Name }}</option>
<option value="{{ $bm.ID }}" {{ if contains $selectedBenchmarks $bm.StringID }}selected{{ end }}>{{ $bm.Name }}</option>
{{ end }}
</select>
</label>

View File

@@ -99,6 +99,50 @@ func TestGetEdit(c flamego.Context, t template.Template, data template.Data) {
models.DB.Find(&benchmarks)
data["benchmarks"] = benchmarks
// determine which benchmarks are selected in a test
selectedBenchmarks := test.SelectedBenchmarks()
data["selectedBenchmarks"] = selectedBenchmarks
data["title"] = fmt.Sprintf("Editing Test: %s", test.Name)
t.HTML(http.StatusOK, "test/edit")
}
func TestPostEdit(c flamego.Context, form forms.TestForm, errs binding.Errors) {
if len(errs) > 0 {
var err error
switch errs[0].Category {
case binding.ErrorCategoryValidation:
err = errs[0].Err.(validator.ValidationErrors)[0]
default:
err = errs[0].Err
}
log.Fatal(err)
}
// find test ID from request
testID := c.Param("test_id")
// find hardware from DB
var test models.Test
models.DB.Preload("Hardware").Preload("Benchmarks").First(&test, testID)
test.Name = form.Name
test.Description = form.Description
test.HardwareID = form.Hardware
// bind benchmarks to test that aren't already associated
for _, b := range form.Benchmarks {
if ! test.IsBenchmarkSelected(b) {
var benchmark models.Benchmark
models.DB.First(&benchmark, b) // find benchmark
models.DB.Model(&test).Association("Benchmarks").Append(&benchmark)
}
}
// removed associated benchmarks that weren't in the form
for _, b := range test.Benchmarks {
}
c.Redirect(fmt.Sprintf("/test/%d", test.ID))
}