-
Notifications
You must be signed in to change notification settings - Fork 706
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch Dashboard to use new gRPC client throughout. (#6044)
<!-- Before you open the request please review the following guidelines and tips to help it be more easily integrated: - Describe the scope of your change - i.e. what the change does. - Describe any known limitations with your change. - Please run any tests or examples that can exercise your modified code. Thank you for contributing! --> ### Description of the change This PR switches the dashboard over to use the new connect generated grpc-web client and associated generated classes. It was pretty tedious, with some complexity due to the different generated classes and client. ## Non-tedious actual changes - Updating the way the proto one-of (single choice for different values) work throughout to match the new library (which actually ensures there is only a single value, actually using a `OneOf` concept, whereas the old improbable library just allowed all the options at once). This was quite confusing to change in the actual code functionality as the code is written as if all options may be specified, but I didn't want to change that in this PR, just switch. - Updating the `shared/ResourceRef` class to be a child of the generated `ResourceRef` class so that we can continue to use it in place of the generated one as we're currently doing (compiler won't accept it otherwise now). Created #6062 to track removing our shared one if we can. - Updating the method used in the frontend to stream resources (and changes) for an installed package, since improbable used subscriptions while the connect one uses async iterators (need to verify this works, since I don't think we test it in CI, but it should just fall back to polling if it doesn't). - Update the `KubeappsGRPCClient` to use the new client (and the different way of setting headers/metadata). ## Tedious parts - Any object that is generated from the proto messages now needs to be instantiated with, for example, `new AvailablePackageSummary({...})` to pass the compilation, rather than the previous `{...} as AvailablePackageSummary` as this type assertion fails due to the missing methods. - Updating all the generated class imports with `_pb` to import the new versions (without deleting the old in this PR, as that blows it out by 16k lines). - Updating all the enums to the more sensible names used by the new lib - Update a lot of tests that used jest to spy on the old implementation. - Update all API method names since the connect one uses snake-case with an initial lower case :/ ### Benefits <!-- What benefits will be realized by the code change? --> Let's see what CI says, but possibly removing 16k lines of the old generated code (I'll do that in a follow-up PR). The main benefit is that we'll be using a supported grpc-web typescript client and can remove the old improbable generation in the kubeapps apis service. ### Possible drawbacks <!-- Describe any known limitations with your change --> It's a lot of changes, there maybe unexpected side-effects. ### Applicable issues <!-- Enter any applicable Issues here (You can reference an issue using #) --> - ref #6013 ### Additional information <!-- If there's anything else that's important and relevant to your pull request, mention that information here.--> --------- Signed-off-by: Michael Nelson <minelson@vmware.com>
- Loading branch information
1 parent
f19a2c5
commit eb82234
Showing
105 changed files
with
1,457 additions
and
1,475 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.