Skip to content

Conversation

@villfa
Copy link
Contributor

@villfa villfa commented Dec 19, 2025

This PR introduces a new interface TaskWithTemplateSettings that enhances the customization options for task display in the dashboard.

Previously, all tasks shared the same textarea configuration in the dashboard UI. This new interface allows individual tasks to customize their presentation by specifying:

  • Placeholder text: Custom instructional text shown when the textarea is empty
  • Default value: Pre-populated content in the textarea when the task is selected
  • Number of rows: Vertical size of the textarea to accommodate different input requirements

Here's an example of implementation:

package task

import (
	"context"

	"github.com/ankorstore/yokai/fxcore"
)

var _ fxcore.Task = (*DemoTask)(nil)

type DemoTask struct {
}

func NewDemoTask() *DemoTask {
	return &DemoTask{}
}

func (d DemoTask) Name() string {
	return "demo"
}

func (d DemoTask) Run(ctx context.Context, input []byte) fxcore.TaskResult {
	return fxcore.TaskResult{
		Success: true,
		Message: "Hello",
	}
}

func (d DemoTask) TemplateSettings(settings fxcore.TaskTemplateSettings) fxcore.TaskTemplateSettings {
	settings.DefaultValue = "{}"
	settings.Rows = 3

	return settings
}

This enhancement improves the user experience by allowing task-specific customization of the input area, making the dashboard more intuitive and user-friendly.

@villfa villfa force-pushed the feat/task-template-settings branch from ff5b4b6 to 158411f Compare December 19, 2025 17:28
@codecov
Copy link

codecov bot commented Dec 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.96%. Comparing base (d1e22bd) to head (d777479).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #393      +/-   ##
==========================================
+ Coverage   95.16%   96.96%   +1.80%     
==========================================
  Files         216       14     -202     
  Lines        8123      725    -7398     
==========================================
- Hits         7730      703    -7027     
+ Misses        276       15     -261     
+ Partials      117        7     -110     
Flag Coverage Δ
config ?
fxclock ?
fxconfig ?
fxcore 96.96% <100.00%> (+0.06%) ⬆️
fxcron ?
fxgenerate ?
fxgrpcserver ?
fxhealthcheck ?
fxhttpclient ?
fxhttpserver ?
fxlog ?
fxmcpserver ?
fxmetrics ?
fxorm ?
fxsql ?
fxtrace ?
fxvalidator ?
fxworker ?
generate ?
grpcserver ?
healthcheck ?
httpclient ?
httpserver ?
log ?
orm ?
sql ?
trace ?
worker ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@villfa villfa force-pushed the feat/task-template-settings branch from 158411f to 09c69a3 Compare December 19, 2025 17:31
@villfa villfa force-pushed the feat/task-template-settings branch from 09c69a3 to d777479 Compare December 19, 2025 17:33
@villfa villfa marked this pull request as ready for review December 19, 2025 17:35
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