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(cc-tcp-components)!: rework properties to avoid impossible … #1053

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

HeleneAmouzou
Copy link
Contributor

@HeleneAmouzou HeleneAmouzou commented May 7, 2024

What does this PR do?

  • Refactors the cc-tcp-redirection and cc-tcp-redirection-form components to implement our new state structure,
  • Implements TypeChecking within the cc-tcp-redirection and cc-tcp-redirection-form components and their stories,
  • Fixes all data loaded stories (the last redirection item was supposed to be private but was not properly set).

How to review?

  • Check the commits (the diff may not be easy to read so you can review the final result locally if you prefer),
  • If you check it locally, you should not get any Typescript error within the components files or the story files,
  • Compare the cc-tcp-redirection prod stories to the preview stories and the cc-tcp-redirection-form prod stories to the preview stories,
  • Also review the smart component using the demo-smart page.

Copy link
Contributor

github-actions bot commented May 7, 2024

🔎 A preview has been automatically published : https://clever-components-preview.cellar-c2.services.clever-cloud.com/cc-tcp-redirection-form/state-migration/index.html.

This preview will be deleted once this PR is closed.

@HeleneAmouzou HeleneAmouzou changed the title refactor(cc-tcp-redirection-form)!: rework properties to avoid impossible … refactor(cc-tcp-components)!: rework properties to avoid impossible … May 7, 2024
Copy link
Contributor

@pdesoyres-cc pdesoyres-cc left a comment

Choose a reason for hiding this comment

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

Well done. Bellow some questions and nitpicks.

@@ -1,21 +1,21 @@
interface TcpRedirection {
namespace: string;
isPrivate: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

question: I don't see when this property is filled. Is it really needed?

Copy link
Contributor

Choose a reason for hiding this comment

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

We noticed that private was used instead of isPrivate within the stories before and we fixed this issue but we had not thought about checking the API & the smart about this subject.

Turns out the API never gives you this info and the "private" feature of the component is never used. Private namespaces are displayed like normal namespaces:

Within the smart, we could determine that a namespace is private if its name is something other than default or cleverapps but it would be better if the API sent us this info, WDYT?

Pinging @hsablonniere in case he knows more about this subject 👀

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure but it should be used for users that have their own custom load balancer. Can you check with Florentin and look in the cc-admin.

Copy link
Contributor

Choose a reason for hiding this comment

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

An issue has been created on the API side.

We can confirm that right now, this is not used at all within the console because the API does not provide this info in any way.

Copy link
Contributor

Choose a reason for hiding this comment

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

(discussed on Slack)
In the meantime we have decided to handle it within the smart so I'll take care of it

@florian-sanders-cc florian-sanders-cc force-pushed the cc-tcp-redirection-form/state-migration branch from a0e6a4b to f79f365 Compare May 20, 2024 09:19
@florian-sanders-cc florian-sanders-cc removed the request for review from roberttran-cc May 27, 2024 09:32
Copy link
Member

@Galimede Galimede left a comment

Choose a reason for hiding this comment

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

Nice work, congrats! 💪 👏

Apart from Pierre's feedback which I agree and a few nitpicks, LGTM 🙂

…states

BREAKING CHANGE: the properties have changed
- The `redirection` component property has been renamed to `state`
  - The `redirection.state` state property has been renamed to `state.type`
…ible states

BREAKING CHANGE: the properties have changed
- The `redirections` component property has been renamed to `state`
  - The `redirections.state` state property has been renamed to `state.type`
  - The `redirections.value` state property has been renamed to `state.redirections`
@florian-sanders-cc florian-sanders-cc force-pushed the cc-tcp-redirection-form/state-migration branch from 700bcc0 to 9e46eb9 Compare June 3, 2024 13:47
@florian-sanders-cc florian-sanders-cc force-pushed the cc-tcp-redirection-form/state-migration branch from 9e46eb9 to c697d3b Compare June 3, 2024 14:34
Copy link
Member

@hsablonniere hsablonniere left a comment

Choose a reason for hiding this comment

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

Hey @florian-sanders-cc and @HeleneAmouzou, well done on this one. I don't see anything blocking, I just wrote a few notes I wanted to share.

@@ -1,21 +1,21 @@
interface TcpRedirection {
namespace: string;
isPrivate: boolean;
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure but it should be used for users that have their own custom load balancer. Can you check with Florentin and look in the cc-admin.

Copy link
Contributor

@pdesoyres-cc pdesoyres-cc left a comment

Choose a reason for hiding this comment

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

LGTM (with a non blocking nitpick)

<cc-notice intent="warning" message="${i18n('cc-tcp-redirection-form.error')}"></cc-notice>
` : ''}

${this.state.type === 'loading' ? html`
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: You could merge the 'loading' and 'loaded' HTML logic with a unique list of redirections. Where this list of redirection is initialized before, according to the loading/loaded state.

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.

None yet

5 participants