Skip to content

Flowlord task dashboard UI - #264

Merged
jbsmith7741 merged 7 commits into
mainfrom
flowlord-ui
Sep 1, 2026
Merged

Flowlord task dashboard UI#264
jbsmith7741 merged 7 commits into
mainfrom
flowlord-ui

Conversation

@jbsmith7741

@jbsmith7741 jbsmith7741 commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Quality check

  • Documentation included
  • Test coverage

Summary

Improves the Flowlord task dashboard with server-side sorting, multi-select filters, a click action bar for table cells, and tighter filter/result handling backed by new SQLite query helpers.

  • Tasks UI: server-side table sorting, multi-select filters, click action bar, and updated task template/JS/CSS
  • Alerts UI: links from alerts to related tasks
  • Backend: filter and task query layer in sqlite/ with tests; schema and handler updates
  • Docs: refreshed flowlord_tasks.png and flowlord_alerts.png screenshots

Screenshots

flowlord_tasks

  * Link alert IDs to the Tasks view for that task time and ID.
  * Add right-click copy on Tasks and Alerts; close the menu on scroll or Escape.
  * Sort paginated tasks with sort and direction query params
  * Keep scroll position after sort reloads
  * Support multi-value id, type, job, and result filters with chips and ID token entry
  * Extract TaskFilter query building into filter.go with trial-based tests
  * Replace right-click context menus with inline Copy and Filter actions on task, alert, workflow, and backload tables.
  * Fail fast when the HTTP handler cannot bind its configured port.
  * Store running in SQLite with schema migration; simplify stats and filter result handling.
  * Fix hourly chart for ID filters and polish task table filter and cell actions.
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Enhance Flowlord task dashboard filtering, sorting, and actions

✨ Enhancement 🐞 Bug fix 🧪 Tests 📝 Documentation ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

AI Description

• Adds server-side task sorting and multi-select filters that persist through pagination.
• Introduces reusable cell actions and alert links for faster task investigation.
• Normalizes running task results and tests filtering, queries, charts, and migration.
Diagram

graph TD
  Alerts["Alerts View"] -->|task links| Dashboard["Task Dashboard"] -->|filter and sort query| Handler["HTTP Handler"] -->|normalize request| Filter["Task Filter"] -->|build SQL| Queries["Task Queries"] --> DB[("Task Database")]
  Queries -->|rows and hourly counts| Handler
  Handler -->|render page| Dashboard
  Actions["Cell Actions"] -->|copy and filter| Dashboard
Loading
High-Level Assessment

The server-side query approach is appropriate because sorting and filtering must apply to the complete dataset before pagination. Client-side table operations would only affect the visible page, while a third-party data-grid or query-builder dependency would add unnecessary weight for the fixed filter set; the whitelist and bound-argument implementation should be retained.

Files changed (19) +2128 / -682

Enhancement (8) +1573 / -566
handler.goParse dashboard queries and fail fast on bind errors +43/-28

Parse dashboard queries and fail fast on bind errors

• Parses normalized multi-value task filters, preserves them in pagination links, and selects ID-aware hourly statistics. Starts the HTTP listener synchronously so port binding failures propagate to the task master.

apps/flowlord/handler.go

alert.tmplLink alerts to tasks and enable cell actions +23/-17

Link alerts to tasks and enable cell actions

• Turns known task IDs into date-and-ID links to the task dashboard. Marks alert fields for reusable click actions and improves long-message truncation.

apps/flowlord/handler/alert.tmpl

style.cssStyle task filters, sorting, links, and cell action bars +447/-15

Style task filters, sorting, links, and cell action bars

• Adds visual treatment for sortable headers, filter popups, token inputs, chips, empty results, task links, and inline cell actions. Also tightens dashboard summary and chart spacing.

apps/flowlord/handler/static/style.css

task.jsImplement server-driven sorting and multi-select filtering +470/-269

Implement server-driven sorting and multi-select filtering

• Replaces client-only table sorting and single-value controls with URL-backed sorting, tokenized IDs, searchable multi-select filters, chips, and dependent job pruning. Preserves scroll position across reloads and integrates filter actions from table cells.

apps/flowlord/handler/static/task.js

utils.jsProvide reusable click-to-copy and filter cell actions +266/-95

Provide reusable click-to-copy and filter cell actions

• Replaces the context menu with a shared inline action bar that expands cells, copies robustly across secure and legacy contexts, and optionally filters by cell value. Adds attribute escaping and global dismissal behavior for clicks, scrolling, and Escape.

apps/flowlord/handler/static/utils.js

task.tmplRender sortable, filterable task table controls +116/-89

Render sortable, filterable task table controls

• Adds filterable header controls, active filter and sort chips, persistent pagination queries, actionable cells, and an in-table empty state. Supplies multi-value filter configuration to the task JavaScript and uses the corrected hourly data.

apps/flowlord/handler/task.tmpl

filter.goAdd normalized task filter and safe SQL builders +157/-0

Add normalized task filter and safe SQL builders

• Defines multi-value task filters, result constants, pagination query encoding, whitelisted sorting, and bound WHERE-clause construction. Centralizes the query semantics used by task rows and hourly counts.

apps/flowlord/sqlite/filter.go

tasks.goSupport multi-filtered and sorted task queries +51/-53

Support multi-filtered and sorted task queries

• Stores explicit running states, updates incomplete-task checks, and delegates task retrieval to safe shared filter builders. Adds direct database hourly aggregation so ID filters are reflected accurately in charts.

apps/flowlord/sqlite/tasks.go

Bug fix (3) +90 / -82
sqlite.goMigrate legacy running task results +16/-1

Migrate legacy running task results

• Advances the schema to version 3 and converts null or empty task results to the explicit running status.

apps/flowlord/sqlite/sqlite.go

stats.goUnify multi-result hourly statistics +71/-80

Unify multi-result hourly statistics

• Refactors result classification and hourly increments around shared helpers and explicit result constants. Supports multi-value type, job, and result filters while directing ID-filtered charts to SQLite.

apps/flowlord/sqlite/stats.go

taskmaster.goPropagate HTTP listener startup failures +3/-1

Propagate HTTP listener startup failures

• Starts handler setup synchronously and returns listener binding errors instead of allowing the task master to continue without its configured dashboard.

apps/flowlord/taskmaster.go

Refactor (2) +15 / -31
backload.jsReuse shared escaping and cell actions in backload previews +11/-21

Reuse shared escaping and cell actions in backload previews

• Routes dynamic HTML escaping through FlowlordUtils and enables shared copy/expand actions on preview table cells. Removes the duplicate local escaping helper.

apps/flowlord/handler/static/backload.js

workflow.tmplRemove legacy workflow cell context handlers +4/-10

Remove legacy workflow cell context handlers

• Removes deprecated inline click, double-click, and context-menu behavior from long rule and template cells while retaining truncated values and full-value tooltips.

apps/flowlord/handler/workflow.tmpl

Tests (4) +446 / -1
handler_test.goAdapt task HTML test to explicit hourly counts +2/-1

Adapt task HTML test to explicit hourly counts

• Builds hourly statistics before rendering so the HTML test follows the expanded taskHTML contract.

apps/flowlord/handler_test.go

filter_test.goTest task filter parsing and SQL construction +194/-0

Test task filter parsing and SQL construction

• Adds table-driven coverage for sort normalization, safe ordering, pagination query strings, repeated and comma-separated parameters, and bound WHERE clauses.

apps/flowlord/sqlite/filter_test.go

sqlite_test.goVerify running-result migration +29/-0

Verify running-result migration

• Adds an in-memory migration test proving legacy empty task results become the running constant.

apps/flowlord/sqlite/sqlite_test.go

tasks_test.goTest task sorting, filtering, hourly counts, and running storage +221/-0

Test task sorting, filtering, hourly counts, and running storage

• Adds in-memory coverage for default and requested ordering, combined multi-select filters, ID-aware hourly counts, and running-to-complete result transitions.

apps/flowlord/sqlite/tasks_test.go

Other (2) +4 / -2
.gitignoreIgnore SQLite sidecar files +3/-1

Ignore SQLite sidecar files

• Adds SQLite shared-memory and write-ahead-log sidecar patterns while retaining the task database exclusion.

.gitignore

schema.sqlDocument explicit running task results +1/-1

Document explicit running task results

• Updates the task_records result field contract to identify running tasks with the running value rather than an empty value.

apps/flowlord/sqlite/schema.sql

@jbsmith7741
jbsmith7741 requested a review from zJeremiah August 31, 2026 20:23
@qodo-code-review

qodo-code-review Bot commented Aug 31, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Serve error exits process ✓ Resolved 🐞 Bug ☼ Reliability
Description
An unexpected http.Server.Serve error now calls log.Fatalf inside the server goroutine,
immediately terminating the whole process and bypassing Run's HTTP, cron, and cache cleanup. The
failure cannot be propagated to the caller or handled gracefully.
Code

apps/flowlord/handler.go[R163-164]

+		if err := tm.httpServer.Serve(ln); err != nil && !errors.Is(err, http.ErrServerClosed) {
+			log.Fatalf("http server: %v", err)
Evidence
The new Serve goroutine invokes Fatalf, while the application's resource cleanup only occurs later
in Run after context cancellation; Fatalf bypasses that path.

apps/flowlord/handler.go[162-167]
apps/flowlord/taskmaster.go[289-303]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Unexpected HTTP serving errors call `log.Fatalf` from a goroutine, terminating the process without normal cleanup.

## Issue Context
Return or send the serving error to `Run` so it can stop the server, cron scheduler, and cache before returning the error to its caller. Continue treating `http.ErrServerClosed` as normal shutdown.

## Fix Focus Areas
- apps/flowlord/handler.go[162-167]
- apps/flowlord/taskmaster.go[289-303]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. Workflow cells no longer expand ✓ Resolved 🐞 Bug ≡ Correctness
Description
The workflow rule and template cells remain visually truncated but the PR removes both their
copyable class and all legacy click/copy handlers, without enabling the replacement cell-action
handler on this table. Long rules/templates can therefore no longer be expanded or copied from the
workflow page.
Code

apps/flowlord/handler/workflow.tmpl[R77-80]

+                        <td class="rule-cell truncated" 
                            data-full-text="{{.Rule}}" 
                            data-truncated-text="{{if ge (len .Rule) 120}}{{slice .Rule 0 120}}...{{else}}{{.Rule}}{{end}}"
-                            onclick="window.FlowlordUtils.toggleField(this, '{{.Rule}}')" 
-                            oncontextmenu="window.FlowlordUtils.showContextMenu(event, '{{.Rule}}')"
-                            ondblclick="window.FlowlordUtils.copyToClipboard('{{.Rule}}')"
-                            title="Click to expand/collapse, double-click or right-click to copy">
+                            title="{{.Rule}}">
Evidence
The workflow cells have truncated data but no copyable class or handlers, the workflow
initialization only enables sorting and filters, and the replacement utility only responds to
.copyable cells when explicitly bound to a root.

apps/flowlord/handler/workflow.tmpl[77-90]
apps/flowlord/handler/workflow.tmpl[112-124]
apps/flowlord/handler/static/utils.js[296-315]
apps/flowlord/handler/static/style.css[857-876]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Workflow Rule and Template cells lost their expand/copy interaction while remaining truncated.

## Issue Context
Mark both cells as actionable and initialize `FlowlordUtils.enableCellActions` for the workflow table body, or restore equivalent non-inline interaction behavior.

## Fix Focus Areas
- apps/flowlord/handler/workflow.tmpl[77-88]
- apps/flowlord/handler/workflow.tmpl[112-124]
- apps/flowlord/handler/static/utils.js[296-315]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Bind failure skips cleanup ✓ Resolved 🐞 Bug ☼ Reliability
Description
Run starts tickers, cron, and reader goroutines before the new synchronous StartHandler call,
then returns immediately if net.Listen fails. Callers that handle the returned error without
exiting retain those background resources because the cleanup path is never reached.
Code

apps/flowlord/taskmaster.go[R289-291]

+	if err := tm.StartHandler(); err != nil {
+		return err
+	}
Evidence
The refresh ticker, scheduler, and readers start before StartHandler; the new error return occurs
before the shutdown block that stops the HTTP server and cron and closes the cache.

apps/flowlord/taskmaster.go[259-287]
apps/flowlord/taskmaster.go[289-303]
apps/flowlord/handler.go[152-157]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A listener bind failure returns after background resources have already started, without stopping them.

## Issue Context
Either bind/start HTTP before launching tickers, cron, and reader goroutines, or add a unified cleanup path for every return after those resources start.

## Fix Focus Areas
- apps/flowlord/taskmaster.go[259-303]
- apps/flowlord/handler.go[152-157]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. Preview handlers accumulate ✓ Resolved 🐞 Bug ➹ Performance
Description
Every backload preview render calls enableCellActions on the same table body, and that utility
unconditionally installs another delegated click listener. Repeated previews/execution retain
duplicate closures and make every later cell click traverse all previously registered handlers.
Code

apps/flowlord/handler/static/backload.js[R662-664]

+        if (window.FlowlordUtils) {
+            window.FlowlordUtils.enableCellActions(elements.previewTableBody);
+        }
Evidence
Both dry-run and execution result paths call the renderer, the renderer invokes enableCellActions
each time, and enableCellActions always adds a new anonymous listener with no deduplication or
removal.

apps/flowlord/handler/static/backload.js[645-664]
apps/flowlord/handler/static/backload.js[668-699]
apps/flowlord/handler/static/utils.js[296-315]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Backload rerenders repeatedly register delegated click handlers on the same preview table body.

## Issue Context
Initialize cell actions once during page setup, or make `enableCellActions` idempotent per root and update its options without adding duplicate listeners.

## Fix Focus Areas
- apps/flowlord/handler/static/backload.js[645-664]
- apps/flowlord/handler/static/backload.js[668-699]
- apps/flowlord/handler/static/utils.js[296-315]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
Review mode: ⚖️ Balanced

Grey Divider

Tip of the day
💡 Did you know, you can describe a rule in plain language on the Rules page and Qodo drafts it for you

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread apps/flowlord/handler.go Outdated
Comment thread apps/flowlord/taskmaster.go Outdated
Comment thread apps/flowlord/handler/workflow.tmpl Outdated
Comment thread apps/flowlord/handler/static/backload.js Outdated
  * Bind HTTP before background workers; route serve errors to Run for graceful shutdown instead of log.Fatalf.
  * Make enableCellActions idempotent, init backload copy once, and add copy-only actions to workflow columns.
@jbsmith7741
jbsmith7741 merged commit e134116 into main Sep 1, 2026
3 checks passed
@jbsmith7741
jbsmith7741 deleted the flowlord-ui branch September 2, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants