Skip to content

Commit

Permalink
fix: TestExistingConnection now incorporates the updated values as well
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-ks committed May 12, 2024
1 parent 5b13c03 commit 6a4e5d0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions backend/plugins/azuredevops_go/api/connection_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResource
if err != nil {
return nil, errors.BadInput.Wrap(err, "can't read connection from database")
}
var updatedConn models.AzuredevopsConn
if err := api.Decode(input.Body, &updatedConn, nil); err != nil {
return nil, err
}

if updatedConn.Token != "" {
connection.Token = updatedConn.Token
}

if updatedConn.Organization != "" {
connection.Organization = updatedConn.Organization
}

body, err := testConnection(context.TODO(), *connection)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion config-ui/src/plugins/components/connection-form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const ConnectionForm = ({ plugin, connectionId, onSuccess }: Props) => {
proxy: isEqual(connection?.proxy, values.proxy) ? undefined : values.proxy,
dbUrl: isEqual(connection?.dbUrl, values.dbUrl) ? undefined : values.dbUrl,
companyId: isEqual(connection?.companyId, values.companyId) ? undefined : values.companyId,
organization: isEqual(connection?.appId, values.organization) ? undefined : values.organization,
organization: isEqual(connection?.organization, values.organization) ? undefined : values.organization,
})
: API.connection.testOld(
plugin,
Expand Down

0 comments on commit 6a4e5d0

Please sign in to comment.