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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Install generator — `rails generate solid_stack_web:install` creates `config/initializers/solid_stack_web.rb` with every config option documented inline and injects the mount line into `config/routes.rb`
- `SolidStackWeb.mount_path` — returns the path at which the engine is mounted in the host app, derived automatically from routes; use `link_to "Dashboard", SolidStackWeb.mount_path` to link to the dashboard without hardcoding the path

## [0.8.0] - 2026-05-26

Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,24 @@ end

The `authenticate` block is evaluated in the context of each request's controller instance, so any helper method available to controllers (e.g. `current_user` from Devise) works directly. If the block returns `false` or `nil`, the engine falls back to HTTP Basic authentication. If no `authenticate` block is configured, the dashboard is open.

### Linking to the dashboard

`SolidStackWeb.mount_path` returns the path at which the engine is mounted, derived automatically from your routes. Use it to link to the dashboard from your application layout without hardcoding the path:

```ruby
link_to "Queue Dashboard", SolidStackWeb.mount_path
```

### Install generator

Run the install generator to create a documented initializer and wire up the mount point in one step:

```bash
rails generate solid_stack_web:install
```

This creates `config/initializers/solid_stack_web.rb` with every configuration option commented inline, and injects `mount SolidStackWeb::Engine, at: "/solid_stack"` into `config/routes.rb`.

---

## Requirements
Expand Down
1 change: 0 additions & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ The path to v1.0.0 is staged: first achieve feature parity with `solid_queue_das
> _Make it easy to adopt and easy to contribute to._

### Remaining
- **Configurable mount path helper** — engine-aware path helpers that respect whatever `at:` the host app chose
- **Accessibility pass** — keyboard navigation, ARIA labels on interactive elements, sufficient colour contrast in both themes
- **Query optimisation** — eliminate N+1 queries across all list views; add covering indexes to the dummy app schema
- **Error pages** — engine-scoped 404/500 views so errors stay within the dashboard chrome
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
# Disable for stores that contain sensitive data.
# config.allow_value_preview = false

# Link to the dashboard from anywhere in your app without hardcoding the path:
#
# link_to "Queue Dashboard", SolidStackWeb.mount_path
#
# SolidStackWeb.mount_path is derived automatically from your routes — no
# configuration needed.

# Alert webhook — POST to this URL when a threshold is breached.
# Delivery failures are silently swallowed; configure a cooldown to avoid storms.
#
Expand Down
13 changes: 13 additions & 0 deletions lib/solid_stack_web.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@ def allow_value_preview
@allow_value_preview || false
end

# Returns the path at which the engine is mounted in the host application,
# derived automatically from the host's routes. Host apps can use this to
# build links to the dashboard without hardcoding the mount path.
#
# link_to "Dashboard", SolidStackWeb.mount_path
#
def mount_path
route = Rails.application.routes.routes.find do |r|
r.app.respond_to?(:app) && r.app.app == SolidStackWeb::Engine
end
route&.path&.spec&.to_s&.sub(%r{\(.*\)\z}, "") || "/"
end

def configure
yield self
end
Expand Down
10 changes: 10 additions & 0 deletions spec/solid_stack_web_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@
end
end

describe ".mount_path" do
it "returns the path at which the engine is mounted in the dummy app" do
expect(SolidStackWeb.mount_path).to eq("/solid_stack")
end

it "returns a string with no trailing format suffix" do
expect(SolidStackWeb.mount_path).not_to include("(")
end
end

describe ".search_results_limit" do
it "defaults to 25" do
expect(SolidStackWeb.search_results_limit).to eq(25)
Expand Down