Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add suggested values for variable dropdown #9437

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

thomtrp
Copy link
Contributor

@thomtrp thomtrp commented Jan 7, 2025

Capture d’écran 2025-01-07 à 15 37 20

Here is a first version:

  • simple fields have a suggested value
  • composite do not, but sub values of composite do
  • json, arrays or complex values do not

@@ -13,8 +13,7 @@ export type ServerlessFunctionTestData = {
height: number;
};

export const DEFAULT_OUTPUT_VALUE =
'Enter an input above then press "run Function"';
export const DEFAULT_OUTPUT_VALUE = 'Enter an input above then press "Test"';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated since button is named Test

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR adds suggested values for workflow variable dropdowns, displaying contextual preview values for simple fields while maintaining a clean hierarchical structure for composite fields.

  • Added contextual preview values in WorkflowVariablesDropdownFieldItems.tsx using subStep?.value?.toString() for leaf nodes
  • Modified generate-fake-value.ts to provide realistic example values like "Tim Cook" for FULL_NAME and "123 Main St" for ADDRESS fields
  • Updated MenuItemSelect and MenuItemLeftContent components to support contextual text display with proper text overflow handling
  • Changed default output message in serverlessFunctionTestDataFamilyState.ts to "Enter an input above then press 'Test'"
  • Fixed non-breaking space character issue in MenuItemLeftContent.tsx template literal

6 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile

return objData;
} else if (valueType === FieldMetadataType.TEXT) {
return 'My text';
return objData.toString();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't get the toString either...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe can we use JSON.stringify() instead of toString() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope this is a mistake. At some point I was trying to convert on backend side


export const generateFakeValue = (valueType: string): FakeValueTypes => {
type TypeClassification = 'primitive' | 'FieldMetadataType';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
type TypeClassification = 'primitive' | 'FieldMetadataType';
type TypeClassification = 'primitive' | 'fieldMetadataType';


export const generateFakeValue = (valueType: string): FakeValueTypes => {
type TypeClassification = 'primitive' | 'FieldMetadataType';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or

Suggested change
type TypeClassification = 'primitive' | 'FieldMetadataType';
type TypeClassification = 'Primitive' | 'FieldMetadataType';

Copy link
Contributor

@Devessier Devessier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting implementation! I add some comments on top of @martmull's review.

return objData;
} else if (valueType === FieldMetadataType.TEXT) {
return 'My text';
return objData.toString();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe can we use JSON.stringify() instead of toString() ?

Copy link
Contributor

@martmull martmull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants