Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Added the ability to cancel workflows from the workflow detail page. [PR #407](https://github.com/riverqueue/riverui/pull/407).
- Added the ability to retry workflows from the workflow detail page. [PR #430](https://github.com/riverqueue/riverui/pull/430).

### Fixed

- Workflow detail: prevent the viewport from getting stuck zoomed into empty space after navigating between the workflow list and detail pages by remounting the diagram per workflow and enabling fit-to-view on mount. [PR #408](https://github.com/riverqueue/riverui/pull/408)
- Workflow detail: make MiniMap render nodes correctly and respect dark mode by setting explicit node bounds and theme-aware colors. [PR #408](https://github.com/riverqueue/riverui/pull/408)
- Job detail: show correct wait duration for running or completed jobs. [PR #430](https://github.com/riverqueue/riverui/pull/430).

## [v0.12.2] - 2025-08-16

Expand Down
3 changes: 2 additions & 1 deletion common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import (

"github.com/jackc/pgx/v5"
"github.com/stretchr/testify/require"
"riverqueue.com/riverui/internal/uicommontest"

"github.com/riverqueue/river"
"github.com/riverqueue/river/riverdriver"
"github.com/riverqueue/river/riverdriver/riverpgxv5"

"riverqueue.com/riverui/internal/uicommontest"
)

func insertOnlyClient(t *testing.T, logger *slog.Logger) (*river.Client[pgx.Tx], riverdriver.Driver[pgx.Tx]) {
Expand Down
1 change: 1 addition & 0 deletions int64_string_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"testing"

"github.com/stretchr/testify/require"

"riverqueue.com/riverui/internal/uicommontest"
)

Expand Down
1 change: 1 addition & 0 deletions riverproui/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ func (e *endpoints[TTx]) MountEndpoints(archetype *baseservice.Archetype, logger
apiendpoint.Mount(mux, prohandler.NewWorkflowCancelEndpoint(bundle), mountOpts),
apiendpoint.Mount(mux, prohandler.NewWorkflowGetEndpoint(bundle), mountOpts),
apiendpoint.Mount(mux, prohandler.NewWorkflowListEndpoint(bundle), mountOpts),
apiendpoint.Mount(mux, prohandler.NewWorkflowRetryEndpoint(bundle), mountOpts),
)

return endpoints
Expand Down
30 changes: 15 additions & 15 deletions riverproui/go.mod
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
module riverqueue.com/riverui/riverproui

go 1.24
go 1.24.0

toolchain go1.24.4

require (
github.com/google/uuid v1.6.0
github.com/jackc/pgx/v5 v5.7.6
github.com/riverqueue/apiframe v0.0.0-20250708014637-e55c49c01ff7
github.com/riverqueue/river v0.24.0
github.com/riverqueue/river/riverdriver v0.24.0
github.com/riverqueue/river/rivershared v0.24.0
github.com/riverqueue/river/rivertype v0.24.0
github.com/riverqueue/river v0.25.0
github.com/riverqueue/river/riverdriver v0.25.0
github.com/riverqueue/river/rivershared v0.25.0
github.com/riverqueue/river/rivertype v0.25.0
github.com/stretchr/testify v1.11.1
riverqueue.com/riverpro v0.16.0
riverqueue.com/riverpro/driver v0.16.0
riverqueue.com/riverpro/driver/riverpropgxv5 v0.16.0
riverqueue.com/riverpro v0.18.0
riverqueue.com/riverpro/driver v0.18.0
riverqueue.com/riverpro/driver/riverpropgxv5 v0.18.0
riverqueue.com/riverui v0.12.2
)

Expand All @@ -31,21 +31,21 @@ require (
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/riverqueue/river/riverdriver/riverpgxv5 v0.24.0 // indirect
github.com/riverqueue/river/riverdriver/riverpgxv5 v0.25.0 // indirect
github.com/rs/cors v1.11.1 // indirect
github.com/samber/slog-http v1.8.1 // indirect
github.com/tidwall/gjson v1.18.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/match v1.2.0 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/tidwall/sjson v1.2.5 // indirect
go.opentelemetry.io/otel v1.29.0 // indirect
go.opentelemetry.io/otel/trace v1.29.0 // indirect
go.uber.org/goleak v1.3.0 // indirect
golang.org/x/crypto v0.41.0 // indirect
golang.org/x/net v0.42.0 // indirect
golang.org/x/sync v0.16.0 // indirect
golang.org/x/sys v0.35.0 // indirect
golang.org/x/text v0.28.0 // indirect
golang.org/x/crypto v0.42.0 // indirect
golang.org/x/net v0.43.0 // indirect
golang.org/x/sync v0.17.0 // indirect
golang.org/x/sys v0.36.0 // indirect
golang.org/x/text v0.29.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

Expand Down
55 changes: 28 additions & 27 deletions riverproui/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/riverqueue/apiframe v0.0.0-20250708014637-e55c49c01ff7 h1:A16RTdTAQ2cIY++FPjiQ9yL8/2FXR4wYmaN7SpP3yP0=
github.com/riverqueue/apiframe v0.0.0-20250708014637-e55c49c01ff7/go.mod h1:jV49jb/qzxSqwDajmG4N2Cm50KATxblxlSiXMF9Ck1E=
github.com/riverqueue/river v0.24.0 h1:CesL6vymWgz0d+zNwtnSGRWaB+E8Dax+o9cxD7sUmKc=
github.com/riverqueue/river v0.24.0/go.mod h1:UZ3AxU5t6WtyqNssaea/AkRS8h/kJ+E9ImSB3xyb3ns=
github.com/riverqueue/river/riverdriver v0.24.0 h1:HqGgGkls11u+YKDA7cKOdYKlQwRNJyHuGa3UtOvpdT0=
github.com/riverqueue/river/riverdriver v0.24.0/go.mod h1:dEew9DDIKenNvzpm8Edw8+PkqP3c0zl1fKjiQTq2n/w=
github.com/riverqueue/river/riverdriver/riverpgxv5 v0.24.0 h1:yV37OIbRrhRwIiGeRT7P4D3szhAemu87BgCf8gTCoU4=
github.com/riverqueue/river/riverdriver/riverpgxv5 v0.24.0/go.mod h1:QfznySVKC4ljx53syd/bA/LRSsydAyuD3Q9/EbSniKA=
github.com/riverqueue/river/rivershared v0.24.0 h1:KysokksW75pug2a5RTOc6WESOupWmsylVc6VWvAx+4Y=
github.com/riverqueue/river/rivershared v0.24.0/go.mod h1:UIBfSdai0oWFlwFcoqG4DZX83iA/fLWTEBGrj7Oe1ho=
github.com/riverqueue/river/rivertype v0.24.0 h1:xrQZm/h6U8TBPyTsQPYD5leOapuoBAcdz30bdBwTqOg=
github.com/riverqueue/river/rivertype v0.24.0/go.mod h1:lmdl3vLNDfchDWbYdW2uAocIuwIN+ZaXqAukdSCFqWs=
github.com/riverqueue/river v0.25.0 h1:dRnA9ltq9hTYRMmZgBnhqRh3AzBIFVu+qVLpBqy6b+g=
github.com/riverqueue/river v0.25.0/go.mod h1:KetN5MQQu9IjtganQrIt0OFubweeh+qkAqJaCdalwtI=
github.com/riverqueue/river/riverdriver v0.25.0 h1:RkvBWBlybYGaU1DoQ/mSwnWp1hm0FfS8yyksr/dM5tI=
github.com/riverqueue/river/riverdriver v0.25.0/go.mod h1:p2Jvr1N6NfPA+ngIKK8urqxG2vmusX4jO7g/UH/soQY=
github.com/riverqueue/river/riverdriver/riverpgxv5 v0.25.0 h1:Ed6dtSSwsj7VwbquG6Bh+2+271sBOL6WyRbisY/XHiY=
github.com/riverqueue/river/riverdriver/riverpgxv5 v0.25.0/go.mod h1:h77bWaGJyA5GMKEKmANQN9mhsV3XWYt4sRUx6FtQa84=
github.com/riverqueue/river/rivershared v0.25.0 h1:grjuTHJEVvi4srzcspQ2UXWjISxdqbubQl+9DDg3agQ=
github.com/riverqueue/river/rivershared v0.25.0/go.mod h1:ZdVeOnT8X8PiAZRUfWHc+Ne6fNXqe1oYb2eioZb6URM=
github.com/riverqueue/river/rivertype v0.25.0 h1:DPwd0DGqajLIv9zsB+BOwlum0D1/4Iiqz34+nwIZaZ0=
github.com/riverqueue/river/rivertype v0.25.0/go.mod h1:9bbWVYkr1B/YzW43lUs/Vk/tEYqLrabrZWrtUWQ+Goo=
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
Expand All @@ -61,8 +61,9 @@ github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/match v1.2.0 h1:0pt8FlkOwjN2fPt4bIl4BoNxb98gGHN2ObFEDkrfZnM=
github.com/tidwall/match v1.2.0/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
Expand All @@ -74,25 +75,25 @@ go.opentelemetry.io/otel/trace v1.29.0 h1:J/8ZNK4XgR7a21DZUAsbF8pZ5Jcw1VhACmnYt3
go.opentelemetry.io/otel/trace v1.29.0/go.mod h1:eHl3w0sp3paPkYstJOmAimxhiFXPg+MMTlEh3nsQgWQ=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs=
golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8=
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI=
golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8=
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
riverqueue.com/riverpro v0.16.0 h1:y6w5TaC9gNkIFDZJgDbrnaeiqo5weTSAgWOvHGsoDdk=
riverqueue.com/riverpro v0.16.0/go.mod h1:d70DhPfPjUKy+SkDmPUkU0vuOtLWxNmB4T+sE2w2/Jo=
riverqueue.com/riverpro/driver v0.16.0 h1:yhFnXcX9PDCu3chGuLLR6Jx3EuPYUoK20gFv31DR6c4=
riverqueue.com/riverpro/driver v0.16.0/go.mod h1:MrbBVCcEQWWKeQiDMJEXAP6fuEyN1UqQ5CXd+m4rWrQ=
riverqueue.com/riverpro/driver/riverpropgxv5 v0.16.0 h1:iC+9a7mVVaJH/El4Z/MmzFaxMoIAn+QGEDlFLST0gVs=
riverqueue.com/riverpro/driver/riverpropgxv5 v0.16.0/go.mod h1:TKQGLJyfOwCq133ttA4i8TI90uF4C4zTqEArAHOD37g=
riverqueue.com/riverpro v0.18.0 h1:cGIU7rIeAS2OYRVN5fTtf0SuSwg0AldlGjFdGJGtCpo=
riverqueue.com/riverpro v0.18.0/go.mod h1:7FmhsAcTaL8pwJtIN17aU5VjAnP46zJ3+9RrJvx4pDQ=
riverqueue.com/riverpro/driver v0.18.0 h1:+UxiZn++M9dNX5iDFNPqEQ+67QOA2cqXF7IgpCruR2E=
riverqueue.com/riverpro/driver v0.18.0/go.mod h1:T1G/XM9H/Ccs5FaHICpVXWP0+qN4m8+hruyLRgorKzU=
riverqueue.com/riverpro/driver/riverpropgxv5 v0.18.0 h1:vFuinoXIVetyK2bAs8Dom0+uW2O0vJ0sMDnx8yFQXJI=
riverqueue.com/riverpro/driver/riverpropgxv5 v0.18.0/go.mod h1:oGVzU7TAG9clY9IykAbVE1eugXS+YKh5Pk29K8bvstQ=
71 changes: 71 additions & 0 deletions riverproui/internal/prohandler/pro_handler_api_endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,77 @@ func (a *workflowListEndpoint[TTx]) Execute(ctx context.Context, req *workflowLi
}
}

//
// workflowRetryEndpoint
//

type workflowRetryEndpoint[TTx any] struct {
ProAPIBundle[TTx]
apiendpoint.Endpoint[workflowRetryRequest, workflowRetryResponse]
}

func NewWorkflowRetryEndpoint[TTx any](apiBundle ProAPIBundle[TTx]) *workflowRetryEndpoint[TTx] {
return &workflowRetryEndpoint[TTx]{ProAPIBundle: apiBundle}
}

func (*workflowRetryEndpoint[TTx]) Meta() *apiendpoint.EndpointMeta {
return &apiendpoint.EndpointMeta{
Pattern: "POST /api/pro/workflows/{id}/retry",
StatusCode: http.StatusOK,
}
}

type workflowRetryRequest struct {
ID string `json:"-" validate:"required"` // from ExtractRaw
Mode string `json:"mode" validate:"omitempty,oneof=all failed_only failed_and_downstream"`
ResetHistory bool `json:"reset_history"`
}

func (req *workflowRetryRequest) ExtractRaw(r *http.Request) error {
req.ID = r.PathValue("id")
return nil
}

type workflowRetryResponse struct {
RetriedJobs []*riverJobMinimal `json:"retried_jobs"`
}

func (a *workflowRetryEndpoint[TTx]) Execute(ctx context.Context, req *workflowRetryRequest) (*workflowRetryResponse, error) {
return dbutil.WithTxV(ctx, a.DB, func(ctx context.Context, execTx riverdriver.ExecutorTx) (*workflowRetryResponse, error) {
tx := a.Driver.UnwrapTx(execTx)

// Build workflow wrapper from existing workflow ID
workflow := a.Client.NewWorkflow(&riverpro.WorkflowOpts{ID: req.ID})

// Determine retry mode (defaults to "all")
var mode riverpro.WorkflowRetryMode
switch req.Mode {
case "failed_only":
mode = riverpro.WorkflowRetryModeFailedOnly
case "failed_and_downstream":
mode = riverpro.WorkflowRetryModeFailedAndDownstream
case "", "all":
mode = riverpro.WorkflowRetryModeAll
default:
// validator should prevent this path; keep safe default
mode = riverpro.WorkflowRetryModeAll
}

result, err := workflow.RetryTx(ctx, tx, &riverpro.WorkflowRetryOpts{
Mode: mode,
ResetHistory: req.ResetHistory,
})
if err != nil {
return nil, err
}

// consistent ordering
slices.SortFunc(result.Jobs, func(a, b *rivertype.JobRow) int { return int(a.ID - b.ID) })

return &workflowRetryResponse{RetriedJobs: sliceutil.Map(result.Jobs, internalJobToJobMinimal)}, nil
})
}

type riverJobMinimal struct {
ID int64 `json:"id"`
Args json.RawMessage `json:"args"`
Expand Down
Loading