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

chore(CanvasForm): Cleanup and File sorting #1363

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

lordrip
Copy link
Member

@lordrip lordrip commented Aug 29, 2024

Context

Currently, we have a couple of missing bits after implementing the "filter by name" and "filter by category" functionality.

Changes

This commit simplifies the usage of FormTabsModes by removing both enums and relying only on its type.

It also moves the filters to the CanvasFormHeader and renames the CanvasFormTabs component to CanvasFormBody to better convey its purpose.

@lordrip lordrip requested a review from shivamG640 August 29, 2024 14:05
Copy link

codecov bot commented Aug 29, 2024

Codecov Report

Attention: Patch coverage is 97.77778% with 1 line in your changes missing coverage. Please review.

Please upload report for BASE (main@f0c7220). Learn more about missing BASE report.

Files with missing lines Patch % Lines
packages/ui/src/components/Form/NoFieldFound.tsx 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1363   +/-   ##
=======================================
  Coverage        ?   67.24%           
  Complexity      ?       25           
=======================================
  Files           ?      264           
  Lines           ?     7563           
  Branches        ?     1469           
=======================================
  Hits            ?     5086           
  Misses          ?     2474           
  Partials        ?        3           

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

Currently we have a couple missing bits after implementing the "filter by
name" and "filter by category" functionality.

This commit simplifies the usage of `FormTabsModes` by removing both `enum`s and relying only in it's type.

It also moves the filters to the `CanvasFormHeader` and rename the
`CanvasFormTabs` component to `CanvasFormBody` to better convey its
purpose.
@lordrip lordrip force-pushed the chore/canvas-form-cleanup branch from 1d34494 to 7a6295a Compare August 29, 2024 14:15
Copy link

sonarcloud bot commented Aug 29, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
50.5% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

Copy link
Contributor

@shivamG640 shivamG640 left a comment

Choose a reason for hiding this comment

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

Although removing tabname enum and converting the tooltip functionality to object type serves the requirement, Just wanted to check if making tab enum as const was an available option?

@lordrip
Copy link
Member Author

lordrip commented Aug 29, 2024

Although removing tabname enum and converting the tooltip functionality to object type serves the requirement, Just wanted to check if making tab enum as const was an available option?

Unfortunately no, const enum gets inlined in the source code. Here's a more in-depth explanation.

From the docs:

Const enums can only use constant enum expressions and unlike regular enums they are completely removed during compilation. Const enum members are inlined at use sites. This is possible since const enums cannot have computed members.

const enum Direction {
  Up,
  Down,
  Left,
  Right,
}
 
let directions = [
  Direction.Up,
  Direction.Down,
  Direction.Left,
  Direction.Right,
];

in generated code will become

"use strict";
let directions = [
    0 /* Direction.Up */,
    1 /* Direction.Down */,
    2 /* Direction.Left */,
    3 /* Direction.Right */,
];

That's why we can't iterate over a const enum, therefore were not gonna be able to use it to dynamically create new tabs.

@lordrip lordrip merged commit e794ff7 into KaotoIO:main Aug 29, 2024
11 of 12 checks passed
@lordrip lordrip deleted the chore/canvas-form-cleanup branch August 30, 2024 15:01
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