mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Workplace Search] Remove unused kibana_host parameter (#128077)
* [Workplace Search] Remove unused kibana_host parameter
This commit is contained in:
parent
1a215ba08a
commit
2adb417a9b
4 changed files with 14 additions and 59 deletions
|
@ -363,8 +363,6 @@ export const GITHUB_ENTERPRISE_SERVER_VIA_APP_SERVICE_TYPE = 'github_enterprise_
|
|||
export const CUSTOM_SERVICE_TYPE = 'custom';
|
||||
export const EXTERNAL_SERVICE_TYPE = 'external';
|
||||
|
||||
export const WORKPLACE_SEARCH_URL_PREFIX = '/app/enterprise_search/workplace_search';
|
||||
|
||||
export const DOCUMENTATION_LINK_TITLE = i18n.translate(
|
||||
'xpack.enterpriseSearch.workplaceSearch.sources.documentation',
|
||||
{
|
||||
|
|
|
@ -362,7 +362,6 @@ describe('AddSourceLogic', () => {
|
|||
expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/sources/create', {
|
||||
query: {
|
||||
...params,
|
||||
kibana_host: '',
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -401,7 +400,6 @@ describe('AddSourceLogic', () => {
|
|||
expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/sources/create', {
|
||||
query: {
|
||||
...params,
|
||||
kibana_host: '',
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -484,7 +482,6 @@ describe('AddSourceLogic', () => {
|
|||
|
||||
const query = {
|
||||
index_permissions: false,
|
||||
kibana_host: '',
|
||||
};
|
||||
|
||||
expect(clearFlashMessages).toHaveBeenCalled();
|
||||
|
@ -508,7 +505,6 @@ describe('AddSourceLogic', () => {
|
|||
|
||||
const query = {
|
||||
index_permissions: true,
|
||||
kibana_host: '',
|
||||
subdomain: 'subdomain',
|
||||
};
|
||||
|
||||
|
@ -536,12 +532,7 @@ describe('AddSourceLogic', () => {
|
|||
AddSourceLogic.actions.getSourceReConnectData('github');
|
||||
|
||||
expect(http.get).toHaveBeenCalledWith(
|
||||
'/internal/workplace_search/org/sources/github/reauth_prepare',
|
||||
{
|
||||
query: {
|
||||
kibana_host: '',
|
||||
},
|
||||
}
|
||||
'/internal/workplace_search/org/sources/github/reauth_prepare'
|
||||
);
|
||||
await nextTick();
|
||||
expect(setSourceConnectDataSpy).toHaveBeenCalledWith(sourceConnectData);
|
||||
|
@ -725,17 +716,11 @@ describe('AddSourceLogic', () => {
|
|||
});
|
||||
|
||||
it('getSourceConnectData', () => {
|
||||
const query = {
|
||||
kibana_host: '',
|
||||
};
|
||||
|
||||
AddSourceLogic.actions.getSourceConnectData('github', jest.fn());
|
||||
|
||||
expect(http.get).toHaveBeenCalledWith(
|
||||
'/internal/workplace_search/account/sources/github/prepare',
|
||||
{
|
||||
query,
|
||||
}
|
||||
{ query: { index_permissions: false } }
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -743,12 +728,7 @@ describe('AddSourceLogic', () => {
|
|||
AddSourceLogic.actions.getSourceReConnectData('123');
|
||||
|
||||
expect(http.get).toHaveBeenCalledWith(
|
||||
'/internal/workplace_search/account/sources/123/reauth_prepare',
|
||||
{
|
||||
query: {
|
||||
kibana_host: '',
|
||||
},
|
||||
}
|
||||
'/internal/workplace_search/account/sources/123/reauth_prepare'
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ import { kea, MakeLogicType } from 'kea';
|
|||
import { keys, pickBy } from 'lodash';
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { HttpFetchQuery } from 'src/core/public';
|
||||
|
||||
import {
|
||||
flashAPIErrors,
|
||||
|
@ -21,7 +20,6 @@ import {
|
|||
import { HttpLogic } from '../../../../../shared/http';
|
||||
import { KibanaLogic } from '../../../../../shared/kibana';
|
||||
import { AppLogic } from '../../../../app_logic';
|
||||
import { WORKPLACE_SEARCH_URL_PREFIX } from '../../../../constants';
|
||||
import { SOURCES_PATH, PRIVATE_SOURCES_PATH, getSourcesPath, getAddPath } from '../../../../routes';
|
||||
import { SourceDataItem } from '../../../../types';
|
||||
import { PERSONAL_DASHBOARD_SOURCE_ERROR } from '../../constants';
|
||||
|
@ -156,15 +154,6 @@ interface PreContentSourceResponse {
|
|||
githubOrganizations: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Workplace Search needs to know the host for the redirect. As of yet, we do not
|
||||
* have access to this in Kibana. We parse it from the browser and pass it as a param.
|
||||
*/
|
||||
const {
|
||||
location: { href },
|
||||
} = window;
|
||||
const kibanaHost = href.substr(0, href.indexOf(WORKPLACE_SEARCH_URL_PREFIX));
|
||||
|
||||
export const AddSourceLogic = kea<MakeLogicType<AddSourceValues, AddSourceActions>>({
|
||||
path: ['enterprise_search', 'workplace_search', 'add_source_logic'],
|
||||
actions: {
|
||||
|
@ -383,16 +372,17 @@ export const AddSourceLogic = kea<MakeLogicType<AddSourceValues, AddSourceAction
|
|||
const route = isOrganization
|
||||
? `/internal/workplace_search/org/sources/${serviceType}/prepare`
|
||||
: `/internal/workplace_search/account/sources/${serviceType}/prepare`;
|
||||
|
||||
const query = {
|
||||
kibana_host: kibanaHost,
|
||||
} as HttpFetchQuery;
|
||||
|
||||
if (isOrganization) query.index_permissions = indexPermissions;
|
||||
if (subdomain) query.subdomain = subdomain;
|
||||
const query = subdomain
|
||||
? {
|
||||
index_permissions: indexPermissions,
|
||||
subdomain,
|
||||
}
|
||||
: { index_permissions: indexPermissions };
|
||||
|
||||
try {
|
||||
const response = await HttpLogic.values.http.get<SourceConnectData>(route, { query });
|
||||
const response = await HttpLogic.values.http.get<SourceConnectData>(route, {
|
||||
query,
|
||||
});
|
||||
actions.setSourceConnectData(response);
|
||||
successCallback(response.oauthUrl);
|
||||
} catch (e) {
|
||||
|
@ -407,12 +397,8 @@ export const AddSourceLogic = kea<MakeLogicType<AddSourceValues, AddSourceAction
|
|||
? `/internal/workplace_search/org/sources/${sourceId}/reauth_prepare`
|
||||
: `/internal/workplace_search/account/sources/${sourceId}/reauth_prepare`;
|
||||
|
||||
const query = {
|
||||
kibana_host: kibanaHost,
|
||||
} as HttpFetchQuery;
|
||||
|
||||
try {
|
||||
const response = await HttpLogic.values.http.get<SourceConnectData>(route, { query });
|
||||
const response = await HttpLogic.values.http.get<SourceConnectData>(route);
|
||||
actions.setSourceConnectData(response);
|
||||
} catch (e) {
|
||||
flashAPIErrors(e);
|
||||
|
@ -497,7 +483,7 @@ export const AddSourceLogic = kea<MakeLogicType<AddSourceValues, AddSourceAction
|
|||
const { http } = HttpLogic.values;
|
||||
const { navigateToUrl } = KibanaLogic.values;
|
||||
const { setAddedSource } = SourcesLogic.actions;
|
||||
const query = { ...params, kibana_host: kibanaHost };
|
||||
const query = { ...params };
|
||||
const route = '/internal/workplace_search/sources/create';
|
||||
|
||||
/**
|
||||
|
|
|
@ -273,9 +273,6 @@ export function registerAccountSourceReauthPrepareRoute({
|
|||
params: schema.object({
|
||||
id: schema.string(),
|
||||
}),
|
||||
query: schema.object({
|
||||
kibana_host: schema.string(),
|
||||
}),
|
||||
},
|
||||
},
|
||||
enterpriseSearchRequestHandler.createRequest({
|
||||
|
@ -355,7 +352,6 @@ export function registerAccountPrepareSourcesRoute({
|
|||
serviceType: schema.string(),
|
||||
}),
|
||||
query: schema.object({
|
||||
kibana_host: schema.string(),
|
||||
subdomain: schema.maybe(schema.string()),
|
||||
}),
|
||||
},
|
||||
|
@ -640,9 +636,6 @@ export function registerOrgSourceReauthPrepareRoute({
|
|||
params: schema.object({
|
||||
id: schema.string(),
|
||||
}),
|
||||
query: schema.object({
|
||||
kibana_host: schema.string(),
|
||||
}),
|
||||
},
|
||||
},
|
||||
enterpriseSearchRequestHandler.createRequest({
|
||||
|
@ -722,7 +715,6 @@ export function registerOrgPrepareSourcesRoute({
|
|||
serviceType: schema.string(),
|
||||
}),
|
||||
query: schema.object({
|
||||
kibana_host: schema.string(),
|
||||
index_permissions: schema.boolean(),
|
||||
subdomain: schema.maybe(schema.string()),
|
||||
}),
|
||||
|
@ -995,7 +987,6 @@ export function registerOauthConnectorParamsRoute({
|
|||
path: '/internal/workplace_search/sources/create',
|
||||
validate: {
|
||||
query: schema.object({
|
||||
kibana_host: schema.string(),
|
||||
code: schema.maybe(schema.string()),
|
||||
session_state: schema.maybe(schema.string()),
|
||||
authuser: schema.maybe(schema.string()),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue