-
Notifications
You must be signed in to change notification settings - Fork 60
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
feat(coral): Improve promotion information for schema #1513
feat(coral): Improve promotion information for schema #1513
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few comments ^^ Not sure if adding support for connector promotion is premature optimisation or forward thinking haha
coral/src/app/features/topics/details/components/PromotionBanner.tsx
Outdated
Show resolved
Hide resolved
coral/src/app/features/topics/details/overview/components/TopicPromotionBanner.tsx
Outdated
Show resolved
Hide resolved
coral/src/app/features/topics/details/components/PromotionBanner.tsx
Outdated
Show resolved
Hide resolved
e7501e1
to
8136405
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
92acc19
to
b6237e4
Compare
Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
…nternally Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
b6237e4
to
5fbad29
Compare
@@ -14,6 +14,8 @@ interface PromotionBannerProps { | |||
type: "schema" | "topic"; | |||
promoteElement: ReactElement; | |||
hasOpenRequest: boolean; | |||
hasError: boolean; | |||
errorMessage: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I expect errorMessage
is not optional because we often store error messages in a local state initialized with ""
? I'm thinking that often this could be avoided by using directly the error
and isError
returned by useMutation
, and would maybe be a bit clearer?
This is definitely not in scope of this PR, but maybe it would be nice as a folow up? "Standardized mutation error handling"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"errorMessage" in this case is optional because for example TopicPromotionBanner
does not have the need to show an error message. And if we use update this promotion banner to be more generic (e.g. also be used for claim) there may be cases where we need to be able to show an error here, but in most cases the "button" links to a form, which has it's own error handling.
"Standardized mutation error handling"?
We could do that, but for this component I don't think that we should assume that the error shown here is a mutation error. It is currently in the one use case, but it could also be a different kind of error. And tying or components too closely to structures of libs we're using may restrict us a bit. What if we want to / need to get rid of react-query -> or console wants to use components from us and they don't use react-query.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
About this change - What it does
PromotionBanner
to be used for topics as well as schemasPromotionStatus
as well ashasOpenRequest
and based on that decides what to show. It's up to the components usingPromotionBanner
to decide if it should not be rendered at all because the user is not topicOwnertopicName
as explicit prop. ThetopicName
is available on promotion details for topics, but not for schemas.TopicPromotionBanner
to usePromotionBanner
internally.TopicPromotionBanner
is responsible for passing the right promote element (which differs for topic and schema) as well as passing the right properties through. I left this as a separate component because that way it is easier to tests this well without making the tests forTopicOverview
more complex. I used adata-testid
to enable easier testing inTopicOverview
.TopicOverview
to not only use snapshots but confirm the rendering/absence of banner explicitly.SchemaPromotionBanner
with use ofPromotionBanner
internally (same explanation as above)TopicDetailsSchema
to use the new componentNote:
There will be a follow up by backend to add
hasOpenSchemaRequests
to topicInfos, matching the existing properties. For now, we can check forhasOpenRequest && !hasOpenACLRequest && !hasOpenTopicReques
-> ifhasOpenRequest
is true buthasOpenAclRequest
andhasOpenTopicRequest
are both false, the only open request is a schema request.Doing a small follow up for this change does remove pressure from backend to do that urgently. We also don't need to wait for the BE change to be merged (and for testing stating to be updated).