-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Enterprise Search] Update apps to use a service for docs links (#89425)
* Create DocLinksService * Set docLinks on app start * Update routes modules to use service * Update component and test to use service * Remove legacy files * Add comment Co-authored-by: Constance <[email protected]> * Add new line Co-authored-by: Constance <[email protected]> * Refactor test * Rename class and remove extra route segments * Update test names Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Constance <[email protected]>
- Loading branch information
1 parent
da65019
commit 67014a7
Showing
11 changed files
with
86 additions
and
38 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
x-pack/plugins/enterprise_search/public/applications/shared/constants/documentation_links.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,3 @@ | |
*/ | ||
|
||
export { DEFAULT_META } from './default_meta'; | ||
export * from './documentation_links'; |
30 changes: 30 additions & 0 deletions
30
x-pack/plugins/enterprise_search/public/applications/shared/doc_links/doc_links.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { docLinks } from './'; | ||
|
||
describe('DocLinks', () => { | ||
it('setDocLinks', () => { | ||
const links = { | ||
DOC_LINK_VERSION: '', | ||
ELASTIC_WEBSITE_URL: 'https://elastic.co/', | ||
links: { | ||
enterpriseSearch: { | ||
base: 'http://elastic.enterprise.search', | ||
appSearchBase: 'http://elastic.app.search', | ||
workplaceSearchBase: 'http://elastic.workplace.search', | ||
}, | ||
}, | ||
}; | ||
|
||
docLinks.setDocLinks(links as any); | ||
|
||
expect(docLinks.enterpriseSearchBase).toEqual('http://elastic.enterprise.search'); | ||
expect(docLinks.appSearchBase).toEqual('http://elastic.app.search'); | ||
expect(docLinks.workplaceSearchBase).toEqual('http://elastic.workplace.search'); | ||
expect(docLinks.cloudBase).toEqual('https://elastic.co/guide/en/cloud/current'); | ||
}); | ||
}); |
30 changes: 30 additions & 0 deletions
30
x-pack/plugins/enterprise_search/public/applications/shared/doc_links/doc_links.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { DocLinksStart } from 'kibana/public'; | ||
|
||
class DocLinks { | ||
public enterpriseSearchBase: string; | ||
public appSearchBase: string; | ||
public workplaceSearchBase: string; | ||
public cloudBase: string; | ||
|
||
constructor() { | ||
this.enterpriseSearchBase = ''; | ||
this.appSearchBase = ''; | ||
this.workplaceSearchBase = ''; | ||
this.cloudBase = ''; | ||
} | ||
|
||
public setDocLinks(docLinks: DocLinksStart): void { | ||
this.enterpriseSearchBase = docLinks.links.enterpriseSearch.base; | ||
this.appSearchBase = docLinks.links.enterpriseSearch.appSearchBase; | ||
this.workplaceSearchBase = docLinks.links.enterpriseSearch.workplaceSearchBase; | ||
this.cloudBase = `${docLinks.ELASTIC_WEBSITE_URL}guide/en/cloud/current`; | ||
} | ||
} | ||
|
||
export const docLinks = new DocLinks(); |
7 changes: 7 additions & 0 deletions
7
x-pack/plugins/enterprise_search/public/applications/shared/doc_links/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
export { docLinks } from './doc_links'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,7 @@ | |
|
||
import { generatePath } from 'react-router-dom'; | ||
|
||
import { CURRENT_MAJOR_VERSION } from '../../../common/version'; | ||
import { ENT_SEARCH_DOCS_PREFIX } from '../shared/constants'; | ||
import { docLinks } from '../shared/doc_links'; | ||
|
||
export const SETUP_GUIDE_PATH = '/setup_guide'; | ||
|
||
|
@@ -16,7 +15,7 @@ export const NOT_FOUND_PATH = '/404'; | |
export const LEAVE_FEEDBACK_EMAIL = '[email protected]'; | ||
export const LEAVE_FEEDBACK_URL = `mailto:${LEAVE_FEEDBACK_EMAIL}?Subject=Elastic%20Workplace%20Search%20Feedback`; | ||
|
||
export const DOCS_PREFIX = `https://www.elastic.co/guide/en/workplace-search/${CURRENT_MAJOR_VERSION}`; | ||
export const DOCS_PREFIX = docLinks.workplaceSearchBase; | ||
export const DOCUMENT_PERMISSIONS_DOCS_URL = `${DOCS_PREFIX}/workplace-search-sources-document-permissions.html`; | ||
export const DOCUMENT_PERMISSIONS_SYNC_DOCS_URL = `${DOCUMENT_PERMISSIONS_DOCS_URL}#sources-permissions-synchronizing`; | ||
export const PRIVATE_SOURCES_DOCS_URL = `${DOCUMENT_PERMISSIONS_DOCS_URL}#sources-permissions-org-private`; | ||
|
@@ -42,7 +41,7 @@ export const ZENDESK_DOCS_URL = `${DOCS_PREFIX}/workplace-search-zendesk-connect | |
export const CUSTOM_SOURCE_DOCS_URL = `${DOCS_PREFIX}/workplace-search-custom-api-sources.html`; | ||
export const CUSTOM_API_DOCS_URL = `${DOCS_PREFIX}/workplace-search-custom-sources-api.html`; | ||
export const CUSTOM_API_DOCUMENT_PERMISSIONS_DOCS_URL = `${CUSTOM_SOURCE_DOCS_URL}#custom-api-source-document-level-access-control`; | ||
export const ENT_SEARCH_LICENSE_MANAGEMENT = `${ENT_SEARCH_DOCS_PREFIX}/license-management.html`; | ||
export const ENT_SEARCH_LICENSE_MANAGEMENT = `${docLinks.enterpriseSearchBase}/license-management.html`; | ||
|
||
export const PERSONAL_PATH = '/p'; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters