-
Notifications
You must be signed in to change notification settings - Fork 667
Add details card #1696
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
Add details card #1696
Conversation
|
Hi @rawagner. Thanks for your PR. I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
| [RESULTS_TYPE.URL]: ImmutableMap<string, any>; | ||
| }; | ||
|
|
||
| export type FirehoseResource = { |
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.
We should try to move this to a location where this type can be used in other contexts.
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.
moved to module/k8s/index.ts. Im not sure if there is more appropriate place.
Similar type was used in factory/details so I reused it there too.
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.
Yeah, I'm not sure the best place either. @alecmerdler ?
I would like to use this type in other places. We should eventually change firehose to use TypeScript. @alecmerdler has looked at that in the past.
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.
Put it in utils/index.tsx until we have firehose.tsx.
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.
ok, moved to utils/index
frontend/public/components/dashboard/details-card/detail-item.tsx
Outdated
Show resolved
Hide resolved
frontend/public/components/dashboards-page/overview-dashboard/details-card.tsx
Outdated
Show resolved
Hide resolved
frontend/public/components/dashboards-page/overview-dashboard/details-card.tsx
Outdated
Show resolved
Hide resolved
frontend/public/components/dashboards-page/overview-dashboard/details-card.tsx
Outdated
Show resolved
Hide resolved
| return null; | ||
| }; | ||
|
|
||
| const getKubernetesVersion = (kubernetesVersionResponse): 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.
We have this logic in the about dialog. We should try to write it once and use it everywhere.
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.
Extracted the logic into separate functions in about dialog and they are now reused in Details Card. Not sure if there is a better place to move them to ?
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.
Extracted the logic into separate functions in about dialog and they are now reused in Details Card. Not sure if there is a better place to move them to ?
I'd suggest cluster-settings.ts
|
@spadgett please take a look |
|
/assign |
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.
We should make sure we have a consistent implementation with #1721. I'm in favor of using the API server host as-is for the moment since we don't have access to a real cluster name.
@christianvogt fyi
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.
Im good with using API server as-is. Extracted the getClusterName function to cluster-settings.ts so it can be reused by #1721
frontend/public/components/dashboards-page/overview-dashboard/details-card.tsx
Outdated
Show resolved
Hide resolved
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.
| const infrastructureData = _.get(resources, 'infrastructure.data', {}); | |
| const infrastructureData: K8sResourceKind = _.get(resources, 'infrastructure.data', {}); |
although TypeScript will yell since {} isn't a K8sResourceKind. We should fix that though so we have the type checking.
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.
type added
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 haven't seen how this looks, but I suspect having a loading icon for every detail item is too much animation.
Again we should consider skeleton while the widget is loading.
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.
Yes, there is going to be quite a few loadings through the Overview Tab. We will be adding skeletons as a follow up.
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.
Is there a better type we can use? Is this a FirehoseResource[]?
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.
that is actually what Firehose passes down - i've added better type but Im not sure if it is already created somewhere so I could reuse it.
frontend/public/components/dashboards-page/overview-dashboard/details-card.tsx
Outdated
Show resolved
Hide resolved
frontend/public/components/dashboards-page/overview-dashboard/details-card.tsx
Outdated
Show resolved
Hide resolved
frontend/public/components/dashboards-page/overview-dashboard/details-card.tsx
Outdated
Show resolved
Hide resolved
frontend/public/components/dashboards-page/overview-dashboard/details-card.tsx
Outdated
Show resolved
Hide resolved
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.
This seems cleaner to me:
| const clusterVersion = _.get(resources, 'cv'); | |
| const clusterVersion = _.get(resources, 'cv.data') as ClusterVersionKind; | |
| // ... | |
| const openshiftVersion = getOpenShiftVersion(clusterVersion); |
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.
Typescript complains Conversion of type 'FirehoseResult' to type 'ClusterVersionKind' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. . It thinks that cv.data is FirehoseResult but in reality it is K8sResourceKind | K8sResourceKind[] :/ Splitting the expression in a way I do does not result in error. Seems like a bug in TS.
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.
That seems weird. Is this a bug in the lodash typings? How does TypeScript know the type returned by _.get?
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'd say that is an issue of @types/lodash-es but Im not very familiar with it. I tried updating to latest version (4.17.3, console is using 4.17.0) but it didnt help :/
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.
We should update details.tsx to use this:
| export type FirehoseResource = { |
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.
That is already updated - see https://github.com/openshift/console/pull/1696/files#diff-c09a5bef454710fc5ba83321c2e0fe1fR5
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.
We should update overview/index.tsx to use this:
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.
overview/index.tsx is now updated. I've changed FirehoseResult type definition a bit to fit overview/index.tsx better
d5f67e8 to
7b38fb2
Compare
spadgett
left a comment
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.
Thanks, please squash
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.
How is id used for Tooltip? I don't see where it's referenced. If it's not required, we should leave it out.
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.
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.
Can this be {value} or if necessary <React.Fragment>{value}</React.Fragment> to avoid the unnecessary span?
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.
no :/ using {value} results in error in runtime and <React.Fragment>{value}</React.Fragment> does not work either - no error, but tooltip does not appear when hovering over
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.
That seems like a Patternfly bug :/
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.
That seems weird. Is this a bug in the lodash typings? How does TypeScript know the type returned by _.get?
spadgett
left a comment
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.
/lgtm
|
/approve |
|
/ok-to-test |
Connect dashboard cards to K8s resources with Firehose
7b38fb2 to
414e422
Compare
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rawagner, spadgett The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Connect dashboard cards to K8s resources with Firehose.