From fd76fc4cc138f4744188b4af42b233897208d3ec Mon Sep 17 00:00:00 2001 From: Abhinav Rastogi Date: Mon, 16 Jun 2025 13:06:46 -0700 Subject: [PATCH 1/5] Update template.ts to include Layout schema Adds an optional Layout schema for controlling the UI ordering and grouping of inputs --- schema/template.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/schema/template.ts b/schema/template.ts index 4a55426..aee9bbf 100644 --- a/schema/template.ts +++ b/schema/template.ts @@ -10,4 +10,20 @@ export interface Template { inputs?: Record stage?: Stage; step?: Step; + /** + * Provide a Layout to control ordering and grouping of inputs in the UI + */ + layout?: Layout +} + +type Layout = Array +type InputName = string + +/* + * InputGroups will be shown as accordions in the UI if a title is provided + */ +interface InputGroup { + items: Layout // you can have nested groups within groups + title?: string + open?: boolean } From 6193a8c3fd76d1e0b3d1d0accf77d3d02d100006 Mon Sep 17 00:00:00 2001 From: Abhinav Rastogi Date: Mon, 7 Jul 2025 12:24:03 -0700 Subject: [PATCH 2/5] add UI config for inputs --- schema/input.ts | 34 +++++++++++++--------------------- schema/ui.ts | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 21 deletions(-) create mode 100644 schema/ui.ts diff --git a/schema/input.ts b/schema/input.ts index 2d1ce97..7cd9c77 100644 --- a/schema/input.ts +++ b/schema/input.ts @@ -1,3 +1,5 @@ +import { UiConfig } from "./ui"; + /** * @x-go-file input.go */ @@ -23,6 +25,7 @@ export interface Input { /** * @go-type: interface{} + * Default value populated for this input */ default?: any @@ -46,27 +49,6 @@ export interface Input { */ pattern?: string; - /** - * Component defines the form element that should be used to - * render the input. - */ - component?: "dropdown" | "text" | "number" | "date" | "datetime" | string; - - /** - * Autofocus configures the form element autofocus attribute. - */ - autofocus?: boolean; - - /** - * Placeholder configures the form element placeholder attribute. - */ - placeholder?: string; - - /** - * Tooltip configures the form element alt attribute. - */ - tooltip?: string; - /** * Options defines a list of accepted input values. * This is an alias for enum. @@ -79,4 +61,14 @@ export interface Input { * @deprecated */ mask?: boolean + + /** + * Label to be displayed in the UI for this input + */ + label?: string + + /** + * Config to override default UI rendering behaviour + */ + ui?: UiConfig } diff --git a/schema/ui.ts b/schema/ui.ts new file mode 100644 index 0000000..c54666c --- /dev/null +++ b/schema/ui.ts @@ -0,0 +1,42 @@ +export interface UiConfig { + /** + * CEL expression to add dynamic behaviour. + * This input will be displayed only when this condition is true. + * All inputs in this template are available to reference here. + */ + visible?: string + + /** + * Component defines the form element that should be used to + * override the default renderer for the input. + */ + component?: "dropdown" | "text" | "number" | "date" | "datetime" | "select" | string; + + /** + * Autofocus configures the form element autofocus attribute. + */ + autofocus?: boolean; + + /** + * Placeholder configures the form element placeholder attribute. + */ + placeholder?: string; + + /** + * Tooltip configures the form element alt attribute. + */ + tooltip?: string; + + /** + * Types of values allowed for this input. + * Fixed: User must enter value when configuring the pipeline + * Runtime: User must enter value when running the pipeline + * Expression: Value will be derived by evaluating this CEL / JEXL expression + */ + allowedValueTypes?: Array<'fixed' | 'runtime' | 'expression'> + + /** + * Options to populate the dropdown if the `component` is "select" + */ + options?: string[] +} \ No newline at end of file From 225b076c49a7e1f08004d12e28b03afa92352a31 Mon Sep 17 00:00:00 2001 From: Abhinav Rastogi Date: Mon, 7 Jul 2025 14:08:12 -0700 Subject: [PATCH 3/5] add template logo props --- schema/template.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/schema/template.ts b/schema/template.ts index aee9bbf..d3921b5 100644 --- a/schema/template.ts +++ b/schema/template.ts @@ -10,10 +10,27 @@ export interface Template { inputs?: Record stage?: Stage; step?: Step; + /** * Provide a Layout to control ordering and grouping of inputs in the UI */ layout?: Layout + + /** + * Base64 encoded image to be shown in the list of templates + */ + icon?: string + + /** + * enum of supported logo names from Harness Design System + * https://harness-design.netlify.app/components/logo/#available-logos + */ + iconName?: string + + /** + * Absolute URL to a hosted image + */ + iconUrl?: string } type Layout = Array From 26598c706c72b141d31de20ac2207100c560a3a3 Mon Sep 17 00:00:00 2001 From: Abhinav Rastogi Date: Mon, 7 Jul 2025 14:11:19 -0700 Subject: [PATCH 4/5] add basic info for templates --- schema/template.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/schema/template.ts b/schema/template.ts index d3921b5..681292b 100644 --- a/schema/template.ts +++ b/schema/template.ts @@ -31,6 +31,15 @@ export interface Template { * Absolute URL to a hosted image */ iconUrl?: string + + id?: string + name?: string + description?: string + version?: string + author?: "harness" | string + alias?: "build" | "deploy" + module?: Array<"cd" | "ci"> + tags?: Record } type Layout = Array From 26b3a7cd57b981fa460aab442c4979e6f73daae4 Mon Sep 17 00:00:00 2001 From: shaurya-harness Date: Tue, 8 Jul 2025 21:28:22 +0530 Subject: [PATCH 5/5] fix: options only at input not ui --- schema/input.ts | 113 ++++++++++++++++++++++++------------------------ schema/ui.ts | 5 --- 2 files changed, 56 insertions(+), 62 deletions(-) diff --git a/schema/input.ts b/schema/input.ts index 7cd9c77..d01024f 100644 --- a/schema/input.ts +++ b/schema/input.ts @@ -4,71 +4,70 @@ import { UiConfig } from "./ui"; * @x-go-file input.go */ export interface Input { + /** + * Type defines the input type. + */ + type: + | "string" + | "number" + | "boolean" + | "array" + | "duration" + | "choice" // GitHub compatibility + | "environment" // GitHub compatibility + | "secret"; - /** - * Type defines the input type. - */ - type: - "string" - | "number" - | "boolean" - | "array" - | "duration" - | "choice" // GitHub compatibility - | "environment" // GitHub compatibility - | "secret" + /** + * Description defines the input description. + */ + description?: string; - /** - * Description defines the input description. - */ - description?: string + /** + * @go-type: interface{} + * Default value populated for this input + */ + default?: any; - /** - * @go-type: interface{} - * Default value populated for this input - */ - default?: any + /** + * Required indicates the input is required. + */ + required?: boolean; - /** - * Required indicates the input is required. - */ - required?: boolean; + /** + * Items defines an array type. + */ + items?: any[]; - /** - * Items defines an array type. - */ - items?: any[] + /** + * Enum defines a list of accepted input values. + */ + enum?: any[]; - /** - * Enum defines a list of accepted input values. - */ - enum?: any[] + /** + * Options defines a list of accepted input values. + * This is an alias for enum. + * @github + */ + options?: any[]; - /** - * Pattern defines a regular expression input constraint. - */ - pattern?: string; + /** + * Pattern defines a regular expression input constraint. + */ + pattern?: string; - /** - * Options defines a list of accepted input values. - * This is an alias for enum. - * @github - */ - options?: any[] + /** + * Mask indicates the input should be masked. + * @deprecated + */ + mask?: boolean; - /** - * Mask indicates the input should be masked. - * @deprecated - */ - mask?: boolean + /** + * Label to be displayed in the UI for this input + */ + label?: string; - /** - * Label to be displayed in the UI for this input - */ - label?: string - - /** - * Config to override default UI rendering behaviour - */ - ui?: UiConfig + /** + * Config to override default UI rendering behaviour + */ + ui?: UiConfig; } diff --git a/schema/ui.ts b/schema/ui.ts index c54666c..77f39f0 100644 --- a/schema/ui.ts +++ b/schema/ui.ts @@ -34,9 +34,4 @@ export interface UiConfig { * Expression: Value will be derived by evaluating this CEL / JEXL expression */ allowedValueTypes?: Array<'fixed' | 'runtime' | 'expression'> - - /** - * Options to populate the dropdown if the `component` is "select" - */ - options?: string[] } \ No newline at end of file