Skip to content

Conversation

@yaelleC
Copy link
Contributor

@yaelleC yaelleC commented Mar 4, 2022

Backend work (second iteration) for #61
First iteration merged: #121

Description

To be more user friendly and avoid typos, we want to change Redshift's UI to use a dropdown (if permissions allow) to select a clusterID.
This PR updates the cluster endpoint to clusters that return the list of all clusters

A next PR #127 will use it to display the dropdown and update the description on the datasource card

Test coverage

/pkg/redshift/api/api.go:345:           Cluster                         100.0%
/pkg/redshift/datasource.go:144:          (all)                         0.0%
/pkg/redshift/routes/routes.go:36:        cluster                         100.0%
/pkg/redshift/routes/routes.go:47:         Routes                         100.0%

total:                                    (statements)                50.9%

@yaelleC yaelleC requested a review from a team as a code owner March 4, 2022 09:16
@yaelleC yaelleC requested review from andresmgot, iwysiu and vickyyyyyyy and removed request for a team March 4, 2022 09:16
Copy link
Contributor

@andresmgot andresmgot left a comment

Choose a reason for hiding this comment

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

Nice! Some minor comments here.

res := []models.RedshiftCluster{}
for _, r := range out.Clusters {
res = append(res, models.RedshiftCluster{
ClusterIdentifier: *r.ClusterIdentifier,
Copy link
Contributor

@andresmgot andresmgot Mar 4, 2022

Choose a reason for hiding this comment

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

I'm afraid we still need the nil point checks 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Of course! 🤭

expectedCluster *models.RedshiftCluster
c *API
desc string
clusterId string
Copy link
Contributor

Choose a reason for hiding this comment

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

you can remove now the clusterId input

Comment on lines 37 to 42
reqBody, err := routes.ParseBody(req.Body)
if err != nil {
rw.WriteHeader(http.StatusBadRequest)
routes.Write(rw, []byte(err.Error()))
return
}
Copy link
Contributor

Choose a reason for hiding this comment

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

you don't need now to parse the body, it should be a GET request (similar to the Secrets function)

Copy link
Contributor

@andresmgot andresmgot left a comment

Choose a reason for hiding this comment

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

👍 LGTM

@yaelleC yaelleC merged commit 1173b38 into main Mar 4, 2022
@yaelleC yaelleC deleted the yaelle_61_be_2 branch March 4, 2022 14:22
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