Skip to content

Commit

Permalink
[Workplace Search] Send kibana_host when calling /reauth_prepare (ela…
Browse files Browse the repository at this point in the history
…stic#95529)

* WIP almost there?

* Fix server route validation

* fix account route

* Fix test expectations

Co-authored-by: scottybollinger <[email protected]>
Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
3 people committed Mar 30, 2021
1 parent c209143 commit 42079ec
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,12 @@ describe('AddSourceLogic', () => {
AddSourceLogic.actions.getSourceReConnectData('github');

expect(http.get).toHaveBeenCalledWith(
'/api/workplace_search/org/sources/github/reauth_prepare'
'/api/workplace_search/org/sources/github/reauth_prepare',
{
query: {
kibana_host: '',
},
}
);
await nextTick();
expect(setSourceConnectDataSpy).toHaveBeenCalledWith(sourceConnectData);
Expand Down Expand Up @@ -648,7 +653,12 @@ describe('AddSourceLogic', () => {
AddSourceLogic.actions.getSourceReConnectData('123');

expect(http.get).toHaveBeenCalledWith(
'/api/workplace_search/account/sources/123/reauth_prepare'
'/api/workplace_search/account/sources/123/reauth_prepare',
{
query: {
kibana_host: '',
},
}
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,12 @@ export const AddSourceLogic = kea<MakeLogicType<AddSourceValues, AddSourceAction
? `/api/workplace_search/org/sources/${sourceId}/reauth_prepare`
: `/api/workplace_search/account/sources/${sourceId}/reauth_prepare`;

const query = {
kibana_host: kibanaHost,
} as HttpFetchQuery;

try {
const response = await HttpLogic.values.http.get(route);
const response = await HttpLogic.values.http.get(route, { query });
actions.setSourceConnectData(response);
} catch (e) {
flashAPIErrors(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ export function registerAccountSourceReauthPrepareRoute({
params: schema.object({
id: schema.string(),
}),
query: schema.object({
kibana_host: schema.string(),
}),
},
},
enterpriseSearchRequestHandler.createRequest({
Expand Down Expand Up @@ -539,6 +542,9 @@ export function registerOrgSourceReauthPrepareRoute({
params: schema.object({
id: schema.string(),
}),
query: schema.object({
kibana_host: schema.string(),
}),
},
},
enterpriseSearchRequestHandler.createRequest({
Expand Down

0 comments on commit 42079ec

Please sign in to comment.