Documentation
¶
Index ¶
- func GenerateUploadIDWithTaskContext(ctx context.Context, formId string) string
- type FileFormTaskBuilder
- func (b *FileFormTaskBuilder) Build(labelOpts ...common_task.LabelOpt) common_task.Task[upload.UploadResult]
- func (b *FileFormTaskBuilder) WithDependencies(dependencies []taskid.UntypedTaskReference) *FileFormTaskBuilder
- func (b *FileFormTaskBuilder) WithDescription(description string) *FileFormTaskBuilder
- type FormTaskBuilderBase
- func (b *FormTaskBuilderBase[T]) SetupBaseFormField(field *inspectionmetadata.ParameterFormFieldBase)
- func (b *FormTaskBuilderBase[T]) WithDependencies(dependencies []taskid.UntypedTaskReference) *FormTaskBuilderBase[T]
- func (b *FormTaskBuilderBase[T]) WithDescription(description string) *FormTaskBuilderBase[T]
- type TextFormDefaultValueGenerator
- type TextFormHintGenerator
- type TextFormReadonlyProvider
- type TextFormSuggestionsProvider
- type TextFormTaskBuilder
- func (b *TextFormTaskBuilder[T]) Build(labelOpts ...common_task.LabelOpt) common_task.Task[T]
- func (b *TextFormTaskBuilder[T]) WithConverter(converter TextFormValueConverter[T]) *TextFormTaskBuilder[T]
- func (b *TextFormTaskBuilder[T]) WithDefaultValueConstant(defValue string, preferPrevValue bool) *TextFormTaskBuilder[T]
- func (b *TextFormTaskBuilder[T]) WithDefaultValueFunc(defFunc TextFormDefaultValueGenerator) *TextFormTaskBuilder[T]
- func (b *TextFormTaskBuilder[T]) WithDependencies(dependencies []taskid.UntypedTaskReference) *TextFormTaskBuilder[T]
- func (b *TextFormTaskBuilder[T]) WithDescription(description string) *TextFormTaskBuilder[T]
- func (b *TextFormTaskBuilder[T]) WithHintFunc(hintFunc TextFormHintGenerator) *TextFormTaskBuilder[T]
- func (b *TextFormTaskBuilder[T]) WithReadonlyFunc(readonlyFunc TextFormReadonlyProvider) *TextFormTaskBuilder[T]
- func (b *TextFormTaskBuilder[T]) WithSuggestionsConstant(suggestions []string) *TextFormTaskBuilder[T]
- func (b *TextFormTaskBuilder[T]) WithSuggestionsFunc(suggestionsFunc TextFormSuggestionsProvider) *TextFormTaskBuilder[T]
- func (b *TextFormTaskBuilder[T]) WithValidatingTiming(timing inspectionmetadata.TextFormValidationTimingType) *TextFormTaskBuilder[T]
- func (b *TextFormTaskBuilder[T]) WithValidator(validator TextFormValidator) *TextFormTaskBuilder[T]
- type TextFormValidator
- type TextFormValueConverter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FileFormTaskBuilder ¶
type FileFormTaskBuilder struct {
FormTaskBuilderBase[upload.UploadResult]
// contains filtered or unexported fields
}
func NewFileFormTaskBuilder ¶
func NewFileFormTaskBuilder(id taskid.TaskImplementationID[upload.UploadResult], priority int, label string, verifier upload.UploadFileVerifier) *FileFormTaskBuilder
func (*FileFormTaskBuilder) Build ¶
func (b *FileFormTaskBuilder) Build(labelOpts ...common_task.LabelOpt) common_task.Task[upload.UploadResult]
func (*FileFormTaskBuilder) WithDependencies ¶
func (b *FileFormTaskBuilder) WithDependencies(dependencies []taskid.UntypedTaskReference) *FileFormTaskBuilder
WithDependencies sets the task dependencies
func (*FileFormTaskBuilder) WithDescription ¶
func (b *FileFormTaskBuilder) WithDescription(description string) *FileFormTaskBuilder
WithDescription sets the description for the form field
type FormTaskBuilderBase ¶
type FormTaskBuilderBase[T any] struct { // contains filtered or unexported fields }
FormTaskBuilderBase provides common functionality for form task builders
func NewFormTaskBuilderBase ¶
func NewFormTaskBuilderBase[T any](id taskid.TaskImplementationID[T], priority int, label string) FormTaskBuilderBase[T]
NewFormTaskBuilderBase creates a new instance of the base builder
func (*FormTaskBuilderBase[T]) SetupBaseFormField ¶
func (b *FormTaskBuilderBase[T]) SetupBaseFormField(field *inspectionmetadata.ParameterFormFieldBase)
SetupBaseFormField configures common form field properties
func (*FormTaskBuilderBase[T]) WithDependencies ¶
func (b *FormTaskBuilderBase[T]) WithDependencies(dependencies []taskid.UntypedTaskReference) *FormTaskBuilderBase[T]
WithDependencies sets the task dependencies
func (*FormTaskBuilderBase[T]) WithDescription ¶
func (b *FormTaskBuilderBase[T]) WithDescription(description string) *FormTaskBuilderBase[T]
WithDescription sets the description for the form field
type TextFormDefaultValueGenerator ¶
type TextFormDefaultValueGenerator = func(ctx context.Context, previousValues []string) (string, error)
TextFormDefaultValueGenerator is a function type to generate the default value.
type TextFormHintGenerator ¶
type TextFormHintGenerator = func(ctx context.Context, value string, convertedValue any) (string, inspectionmetadata.ParameterHintType, error)
TextFormHintGenerator is a function type to generate a hint string
type TextFormReadonlyProvider ¶
TextFormReadonlyProvider is a function type to compute if the field is allowed edit or not.
type TextFormSuggestionsProvider ¶
type TextFormSuggestionsProvider = func(ctx context.Context, value string, previousValues []string) ([]string, error)
TextFormSuggestionsProvider is a function to return the list of strings shown in the autocomplete. Return nil instead of emptry string array means the autocomplete is disabled for the field.
type TextFormTaskBuilder ¶
type TextFormTaskBuilder[T any] struct { FormTaskBuilderBase[T] // contains filtered or unexported fields }
TextFormTaskBuilder is an utility to construct an instance of task for input form field. This will generate the task instance with `Build()` method call after chaining several configuration methods.
func NewTextFormTaskBuilder ¶
func NewTextFormTaskBuilder[T any](id taskid.TaskImplementationID[T], priority int, fieldLabel string) *TextFormTaskBuilder[T]
NewTextFormTaskBuilder constructs an instace of TextFormDefinitionBuilder. id,prioirity and label will be initialized with the value given in the argument. The other values are initialized with the following values. dependencies : Initialized with an empty string array indicating this task is not depending on anything. description: Initialized with an empty string. defaultValue: Initialized with a function to return empty string. validator: Initialized with a function to return empty string that indicates the validation is always passing. allowEditProvider: Initialized with a function to return true. suggestionsProvider: Initialized with a function to return nil. converter: Initialized with a function to return the given value. This means no conversion applied and treated as a string.
func (*TextFormTaskBuilder[T]) Build ¶
func (b *TextFormTaskBuilder[T]) Build(labelOpts ...common_task.LabelOpt) common_task.Task[T]
func (*TextFormTaskBuilder[T]) WithConverter ¶
func (b *TextFormTaskBuilder[T]) WithConverter(converter TextFormValueConverter[T]) *TextFormTaskBuilder[T]
func (*TextFormTaskBuilder[T]) WithDefaultValueConstant ¶
func (b *TextFormTaskBuilder[T]) WithDefaultValueConstant(defValue string, preferPrevValue bool) *TextFormTaskBuilder[T]
func (*TextFormTaskBuilder[T]) WithDefaultValueFunc ¶
func (b *TextFormTaskBuilder[T]) WithDefaultValueFunc(defFunc TextFormDefaultValueGenerator) *TextFormTaskBuilder[T]
func (*TextFormTaskBuilder[T]) WithDependencies ¶
func (b *TextFormTaskBuilder[T]) WithDependencies(dependencies []taskid.UntypedTaskReference) *TextFormTaskBuilder[T]
func (*TextFormTaskBuilder[T]) WithDescription ¶
func (b *TextFormTaskBuilder[T]) WithDescription(description string) *TextFormTaskBuilder[T]
func (*TextFormTaskBuilder[T]) WithHintFunc ¶
func (b *TextFormTaskBuilder[T]) WithHintFunc(hintFunc TextFormHintGenerator) *TextFormTaskBuilder[T]
func (*TextFormTaskBuilder[T]) WithReadonlyFunc ¶
func (b *TextFormTaskBuilder[T]) WithReadonlyFunc(readonlyFunc TextFormReadonlyProvider) *TextFormTaskBuilder[T]
func (*TextFormTaskBuilder[T]) WithSuggestionsConstant ¶
func (b *TextFormTaskBuilder[T]) WithSuggestionsConstant(suggestions []string) *TextFormTaskBuilder[T]
func (*TextFormTaskBuilder[T]) WithSuggestionsFunc ¶
func (b *TextFormTaskBuilder[T]) WithSuggestionsFunc(suggestionsFunc TextFormSuggestionsProvider) *TextFormTaskBuilder[T]
func (*TextFormTaskBuilder[T]) WithValidatingTiming ¶
func (b *TextFormTaskBuilder[T]) WithValidatingTiming(timing inspectionmetadata.TextFormValidationTimingType) *TextFormTaskBuilder[T]
func (*TextFormTaskBuilder[T]) WithValidator ¶
func (b *TextFormTaskBuilder[T]) WithValidator(validator TextFormValidator) *TextFormTaskBuilder[T]
type TextFormValidator ¶
TextFormValidator is a function to check if the given value is valid or not. Returns "" as the result when it has no error, otherwise the returned value is used as an error message on frontend. Returning an error as the 2nd returning value is only when the validator detects an unrecoverble error.