Skip to content

feat (frontend): improve capture UI #5051

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

Merged
merged 54 commits into from
Jan 22, 2025
Merged

feat (frontend): improve capture UI #5051

merged 54 commits into from
Jan 22, 2025

Conversation

Guilhem-lm
Copy link
Contributor

@Guilhem-lm Guilhem-lm commented Jan 13, 2025

Important

Enhances frontend schema management and input handling with schema diff support, improved UI components, and better keyboard event handling.

  • Behavior:
    • Introduces schema diff handling in ArgInput.svelte, EditableSchemaForm.svelte, and SchemaForm.svelte to manage added, removed, and modified schema properties.
    • Adds SideBarTab.svelte for improved navigation in FlowInput.svelte.
    • Enhances input handling with CaptureTable.svelte and FlowPreviewContent.svelte.
  • Components:
    • Adds SideBarTab.svelte for dropdown navigation.
    • Updates EditableSchemaForm.svelte and SchemaForm.svelte to handle schema diffs and dispatch changes.
    • Modifies SimpleEditor.svelte to improve placeholder visibility.
  • Schema Management:
    • Implements schemaUtils.ts for computing and applying schema diffs.
    • Updates AddPropertyV2.svelte and EditableSchemaDrawer.svelte for better schema property management.
  • Misc:
    • Adjusts keyboard event handling in FirstStepInputs.svelte, HistoricInputs.svelte, and SavedInputsPicker.svelte to prevent default actions on Escape key.

This description was created by Ellipsis for 41ea843. It will automatically update as commits are pushed.

Copy link

cloudflare-workers-and-pages bot commented Jan 13, 2025

Deploying windmill with  Cloudflare Pages  Cloudflare Pages

Latest commit: 41ea843
Status: ✅  Deploy successful!
Preview URL: https://e8bf32e9.windmill.pages.dev
Branch Preview URL: https://glm-captures-v3.windmill.pages.dev

View logs

@Guilhem-lm Guilhem-lm marked this pull request as ready for review January 17, 2025 18:21
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to c5e7b0b in 1 minute and 56 seconds

More details
  • Looked at 2296 lines of code in 14 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. frontend/src/lib/components/FirstStepInputs.svelte:30
  • Draft comment:
    Consider adding explicit handling for the case where flowStore or $flowStateStore is undefined to avoid potential runtime errors.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The code in FirstStepInputs.svelte has a potential issue with the loadSchema function. The function is called conditionally based on the presence of flowStore and $flowStateStore, but it does not handle the case where these are undefined. It would be better to handle this case explicitly to avoid potential runtime errors.
2. frontend/src/lib/components/flows/content/FlowInput.svelte:191
  • Draft comment:
    Consider adding explicit handling for the case where payload is an empty object in the updatePreviewSchemaAndArgs function to avoid potential runtime errors.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The code in FlowInput.svelte has a potential issue with the updatePreviewSchemaAndArgs function. The function sets payloadData and selectedSchema to undefined when payload is falsy, but it does not handle the case where payload is an empty object. It would be better to handle this case explicitly to avoid potential runtime errors.

Workflow ID: wflow_QEDw8GaZPhw4CLCl


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 1c940aa in 31 seconds

More details
  • Looked at 33 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. frontend/src/lib/components/flows/content/FlowInput.svelte:230
  • Draft comment:
    Consider using structuredClone consistently or only when necessary. For example, savedPreviewArgs = structuredClone(previewArguments) is used here but not when assigning previewArguments = savedPreviewArgs. Ensure consistency and necessity of deep cloning.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The use of structuredClone is inconsistent and potentially unnecessary in some places.

Workflow ID: wflow_eTxvL8ofq3odA9UV


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 7176d80 in 23 seconds

More details
  • Looked at 12 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. frontend/src/lib/components/ArgInput.svelte:748
  • Draft comment:
    The schemaSkippedValues prop is added but not explained in the PR description. Ensure its purpose and usage are clear and documented.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The added prop schemaSkippedValues is used in two places, but its purpose is not clear from the PR description. It seems to be intended to skip certain schema values, but without further context, it's hard to determine if this is the correct implementation.

Workflow ID: wflow_FolVdjinDKamHwfH


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Incremental review on f114bef in 1 minute and 6 seconds

More details
  • Looked at 33 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_Y7djKKLTzCcUGjjM


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

let compatible = false
if (a.type === b.type) {
if (a.type === 'object' && a.format === b.format) {
if (a.oneOf && b.oneOf) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The logic for checking oneOf in isCompatibleObject is redundant. The else block is unnecessary since it sets compatible = true regardless of the condition. Simplify the logic to avoid redundancy.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 2acc21b in 1 minute and 9 seconds

More details
  • Looked at 115 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 drafted comments based on config settings.
1. frontend/src/lib/components/EditableSchemaForm.svelte:539
  • Draft comment:
    Using setTimeout with a fixed delay can lead to unpredictable behavior. Consider using a more reliable method to ensure the schema update is processed correctly.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The code uses setTimeout as a workaround, with a comment "No better solution than this, needs future rework". This suggests the developers are aware it's not ideal but haven't found a better solution yet. The comment points out a real issue but doesn't provide any concrete alternative solution. In Svelte, state updates and UI synchronization can be tricky, and sometimes setTimeout is used as a last resort.
    The comment could be right that there are better solutions, like using Svelte's tick() function or reactive statements. But without understanding the exact race condition or timing issue being worked around, we can't be certain.
    While the comment identifies a real code smell, it doesn't provide actionable guidance. The existing code comment already acknowledges this is a temporary solution needing rework.
    Delete the comment. While it points out a legitimate concern, it's not actionable enough and the code already acknowledges the issue with a TODO comment.
2. frontend/src/lib/components/schema/schemaUtils.ts:31
  • Draft comment:
    The assumption that oneOf properties are always compatible may not be valid. Consider revisiting this logic to ensure accurate compatibility checks.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The code was actually improved to handle oneOf better than before, adding explicit compatibility checks. While the comment is technically correct that the assumption may not be valid, there's already a TODO acknowledging this limitation. The comment doesn't provide specific guidance on how to improve it.
    The comment identifies a real potential issue, and the code does make an assumption about oneOf compatibility. The TODO suggests the team is already aware of this limitation.
    While the concern is valid, the comment doesn't add value beyond the existing TODO comment. The code has already been improved to handle oneOf cases better than before.
    Delete this comment since it doesn't provide actionable feedback beyond what's already acknowledged in the TODO comment.
3. frontend/src/lib/components/schema/schemaUtils.ts:19
  • Draft comment:
    isCompatibleObject does not account for additional properties in a or b that might affect compatibility. Consider checking for these properties.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The function was significantly refactored to be more structured. While it's true that there could be other properties affecting compatibility, the current implementation seems intentionally focused on specific properties (type, format, oneOf) that matter for schema compatibility. The TODO comment on line 31 suggests this is a known limitation being handled incrementally. The comment is speculative without concrete examples of what properties matter.
    I could be wrong about which properties matter for schema compatibility. There might be important schema properties I'm not considering.
    Without specific examples of which additional properties matter for compatibility, and given the intentional TODO about handling oneOf compatibility, this comment is too vague to be actionable.
    Delete the comment as it's speculative and doesn't provide concrete guidance on which additional properties need checking.
4. frontend/src/lib/components/schema/schemaUtils.ts:72
  • Draft comment:
    Using JSON.stringify for object comparison can be inefficient and may not handle all cases correctly. Consider using a deep comparison utility instead.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    While JSON.stringify can have edge cases with object key ordering and special values like undefined, in this context we're comparing schema objects that should be well-formed JSON. The comparison is just an optimization - if it fails, the code falls back to more detailed compatibility checks. The suggested change would add complexity without clear benefit.
    The comment raises a valid technical point about JSON.stringify limitations. A deep comparison utility could handle edge cases better.
    The current approach is simple and sufficient given the fallback logic and the well-defined schema object structure. The suggested change would add complexity without meaningful benefit in this specific use case.
    Delete the comment. The current implementation is appropriate for this specific use case, and the suggested change would add unnecessary complexity.

Workflow ID: wflow_QYCU0mhlozWZ1TFg


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 6765692 in 1 minute and 7 seconds

More details
  • Looked at 3556 lines of code in 38 files
  • Skipped 1 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. frontend/src/lib/components/RunFormAdvancedPopup.svelte:32
  • Draft comment:
    Consider refactoring the logic for loading worker groups into a reusable function or store action to avoid code duplication. This pattern is repeated in multiple files.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The code in multiple files is fetching worker tags using the same logic. This is a clear case of code duplication, which can lead to maintenance issues. It would be better to refactor this into a reusable function or a store action.

Workflow ID: wflow_3D89IexuMzIvLI1W


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on f107344 in 24 seconds

More details
  • Looked at 18 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. frontend/src/lib/components/schema/EditableSchemaDrawer.svelte:158
  • Draft comment:
    Reassigning schema to itself is unnecessary. Consider removing schema = schema; as it doesn't change the state.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The code uses a pattern where the schema is reassigned to itself, which is unnecessary and can be misleading. This pattern appears in multiple places.

Workflow ID: wflow_6HomwY6oNvwIy3CF


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 80866db in 23 seconds

More details
  • Looked at 17 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. frontend/src/lib/components/schema/schemaUtils.ts:28
  • Draft comment:
    The added check for compatibility between 'number' and 'integer' types is a valid improvement.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The added code in isCompatibleObject correctly handles the compatibility between 'number' and 'integer' types, which is a valid improvement.

Workflow ID: wflow_vjxYZOHLV3heOoCU


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 0282cf4 in 45 seconds

More details
  • Looked at 48 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. frontend/src/lib/components/flows/content/FlowInput.svelte:317
  • Draft comment:
    Duplicate resetArgs function. Consider removing one of the definitions to avoid redundancy.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.

Workflow ID: wflow_o6PCP5jRO0MZGwRZ


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 41ea843 in 29 seconds

More details
  • Looked at 49 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. frontend/src/lib/components/schema/EditableSchemaDrawer.svelte:194
  • Draft comment:
    Consider ensuring that the schema is consistently updated across all components using bind:schema to avoid potential synchronization issues. This applies to other instances of bind:schema in this file and in EditableSchemaWrapper.svelte.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The code in both files uses the bind:schema directive multiple times. This can lead to potential issues if the schema is modified in one place and not updated in others. It would be better to ensure that the schema is consistently updated across all components.

Workflow ID: wflow_PJu5Kf6s1j6qVyxE


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@rubenfiszel rubenfiszel merged commit 59bcce7 into main Jan 22, 2025
3 checks passed
@rubenfiszel rubenfiszel deleted the glm/captures_v3 branch January 22, 2025 11:51
@github-actions github-actions bot locked and limited conversation to collaborators Jan 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants