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

refactor(entities,resources): Decouple parsing from entities hook into a separate serializer class #1671

Merged
merged 3 commits into from
Dec 13, 2024

Conversation

mmelko
Copy link
Contributor

@mmelko mmelko commented Nov 28, 2024

  • create CamelResourceSerializer interface and YamlCamelResourceSerializer implementantion
  • create CamelResourceFactory and CamelKResourceFactory to creating new resources
  • move parsing out of the entities hook

@mmelko mmelko requested a review from lordrip November 29, 2024 08:31
@lordrip lordrip marked this pull request as draft November 29, 2024 09:40
@lordrip
Copy link
Member

lordrip commented Nov 29, 2024

Thanks @mmelko for putting this together. I'm turning this PR into a draft for now, so we don't consume Chromatic credits until we're ready to merge 😄

Copy link
Member

@lordrip lordrip 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 @mmelko 💪 , let's try to tackle the open comments first

packages/ui/src/hooks/entities.ts Show resolved Hide resolved
packages/ui/src/models/camel/camel-k-resource-factory.ts Outdated Show resolved Hide resolved
packages/ui/src/models/camel/camel-k-resource.ts Outdated Show resolved Hide resolved
packages/ui/src/models/camel/camel-route-resource.ts Outdated Show resolved Hide resolved
packages/ui/src/models/camel/camel-route-resource.ts Outdated Show resolved Hide resolved
packages/ui/src/models/camel/kamelet-resource.ts Outdated Show resolved Hide resolved
@mmelko
Copy link
Contributor Author

mmelko commented Nov 29, 2024

@lordrip thanks for the review! Updated code coming soon.

…o separate serializer class

 * create CamelResourceSerializer interface and YamlCamelResourceSerializer implementantion
 * create CamelResourceFactory and CamelKResourceFactory to creating new resources
 * move parsing out of the entities hook
Copy link

codecov bot commented Dec 2, 2024

Codecov Report

Attention: Patch coverage is 76.00000% with 24 lines in your changes missing coverage. Please review.

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

Files with missing lines Patch % Lines
...i/src/serializers/xml-camel-resource-serializer.ts 30.00% 7 Missing ⚠️
.../src/serializers/yaml-camel-resource-serializer.ts 80.00% 6 Missing ⚠️
packages/ui/src/models/camel/camel-k-resource.ts 50.00% 5 Missing ⚠️
...ckages/ui/src/models/camel/camel-route-resource.ts 61.53% 5 Missing ⚠️
...ages/ui/src/models/camel/camel-resource-factory.ts 91.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1671   +/-   ##
=======================================
  Coverage        ?   78.96%           
  Complexity      ?      365           
=======================================
  Files           ?      464           
  Lines           ?    14541           
  Branches        ?     2780           
=======================================
  Hits            ?    11483           
  Misses          ?     2789           
  Partials        ?      269           

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

@mmelko
Copy link
Contributor Author

mmelko commented Dec 12, 2024

@lordrip I incorporated your suggestions and also added types into the CamelResourceFactory, please check.

Copy link
Member

@lordrip lordrip left a comment

Choose a reason for hiding this comment

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

Just a couple of little touches and we're good to go

packages/ui/src/hooks/entities.test.tsx Show resolved Hide resolved
packages/ui/src/hooks/entities.test.tsx Outdated Show resolved Hide resolved
packages/ui/src/hooks/entities.test.tsx Outdated Show resolved Hide resolved
packages/ui/src/hooks/entities.test.tsx Show resolved Hide resolved
packages/ui/src/models/camel/camel-k-resource.ts Outdated Show resolved Hide resolved
packages/ui/src/models/camel/camel-route-resource.test.ts Outdated Show resolved Hide resolved
packages/ui/src/models/camel/kamelet-resource.test.ts Outdated Show resolved Hide resolved
packages/ui/src/serializers/camel-resource-serializer.ts Outdated Show resolved Hide resolved
@mmelko mmelko force-pushed the serializers branch 2 times, most recently from 53b7840 to 83b70f2 Compare December 13, 2024 14:45
Copy link
Member

@lordrip lordrip 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 🟢 , thanks for taking care @mmelko

@mmelko mmelko changed the title DRAFT: refactor(entities,resources): Decouple parsing from entities hook into a separate serializer class refactor(entities,resources): Decouple parsing from entities hook into a separate serializer class Dec 13, 2024
@lordrip lordrip marked this pull request as ready for review December 13, 2024 15:35
@lordrip lordrip merged commit 9b2e9f9 into KaotoIO:main Dec 13, 2024
12 checks passed
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