Skip to content

Commit

Permalink
Miscellaneous fixes (#357)
Browse files Browse the repository at this point in the history
* Simplify purge jobs logic

* Fix GraphQL unmarshal of nullable enum

* Improve queue batch UI

* Miscellaneous UI tweaks

* Round estimates to 2 significant figures

* Use default cursor for file sizes

* Add padding to bottom of layout

* Rebuild webui

* Add missing files
  • Loading branch information
mgdigital authored Dec 1, 2024
1 parent a397c47 commit d050649
Show file tree
Hide file tree
Showing 72 changed files with 229 additions and 80 deletions.
5 changes: 4 additions & 1 deletion internal/model/content_type_enum.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion internal/model/enums.gql.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ func (n *Null{{.enum.Name}}) UnmarshalGQL(v any) error {
if !ok {
return errors.New("value is not a string")
}
return n.UnmarshalJSON([]byte(str))
if str == "null" {
return nil
}
return n.UnmarshalJSON([]byte("\""+str+"\""))
}
5 changes: 4 additions & 1 deletion internal/model/facet_logic_enum.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion internal/model/file_type_enum.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion internal/model/files_status_enum.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion internal/model/queue_job_status_enum.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion internal/model/video_3d_enum.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion internal/model/video_codec_enum.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion internal/model/video_modifier_enum.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion internal/model/video_resolution_enum.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion internal/model/video_source_enum.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 2 additions & 9 deletions internal/queue/manager/purge_jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package manager

import (
"context"
"github.com/bitmagnet-io/bitmagnet/internal/model"
)

func (m manager) PurgeJobs(ctx context.Context, req PurgeJobsRequest) error {
Expand All @@ -11,22 +10,16 @@ func (m manager) PurgeJobs(ctx context.Context, req PurgeJobsRequest) error {
return err
}
q := m.dao.QueueJob.WithContext(ctx)
where := false
if len(req.Queues) > 0 {
q = q.Where(m.dao.QueueJob.Queue.In(req.Queues...))
where = true
}
if len(req.Statuses) > 0 {
statuses := make([]string, len(req.Statuses))
for i, s := range req.Statuses {
statuses[i] = string(s)
}
q = q.Where(m.dao.QueueJob.Status.In(statuses...))
where = true
}
db := q.UnderlyingDB()
if !where {
db = db.Where("true")
}
return db.Delete(&model.QueueJob{}).Error
_, err := q.Delete()
return err
}
1 change: 1 addition & 0 deletions webui/dist/bitmagnet/browser/chunk-2CPKEXRV.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion webui/dist/bitmagnet/browser/chunk-2UGY5BM5.js

This file was deleted.

1 change: 1 addition & 0 deletions webui/dist/bitmagnet/browser/chunk-42PJPEMD.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion webui/dist/bitmagnet/browser/chunk-5NUKGQ2Y.js

This file was deleted.

1 change: 0 additions & 1 deletion webui/dist/bitmagnet/browser/chunk-5WNI2BDG.js

This file was deleted.

3 changes: 3 additions & 0 deletions webui/dist/bitmagnet/browser/chunk-772M27O6.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions webui/dist/bitmagnet/browser/chunk-7BG6QBRU.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions webui/dist/bitmagnet/browser/chunk-7GA5RIIW.js

Large diffs are not rendered by default.

Loading

0 comments on commit d050649

Please sign in to comment.