[Workplace Search] Send kibana_host when calling /reauth_prepare (#95529)

* WIP almost there?

* Fix server route validation

* fix account route

* Fix test expectations

Co-authored-by: scottybollinger <scotty.bollinger@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
James Rucker 2021-03-29 18:49:16 -07:00 committed by GitHub
parent 28410539b5
commit 4c89da2b45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 3 deletions

View file

@ -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);
@ -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: '',
},
}
);
});

View file

@ -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);

View file

@ -194,6 +194,9 @@ export function registerAccountSourceReauthPrepareRoute({
params: schema.object({
id: schema.string(),
}),
query: schema.object({
kibana_host: schema.string(),
}),
},
},
enterpriseSearchRequestHandler.createRequest({
@ -539,6 +542,9 @@ export function registerOrgSourceReauthPrepareRoute({
params: schema.object({
id: schema.string(),
}),
query: schema.object({
kibana_host: schema.string(),
}),
},
},
enterpriseSearchRequestHandler.createRequest({