-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Enterprise Search] Update apps to use a service for docs links #89425
Merged
scottybollinger
merged 11 commits into
elastic:master
from
scottybollinger:scottybollinger/doc-links-service
Jan 29, 2021
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
478d6d4
Create DocLinksService
scottybollinger c0732bc
Set docLinks on app start
scottybollinger 1403029
Update routes modules to use service
scottybollinger 7fd37a5
Update component and test to use service
scottybollinger 7c05410
Remove legacy files
scottybollinger be4d776
Merge branch 'master' into scottybollinger/doc-links-service
kibanamachine 221969f
Add comment
scottybollinger fbefb94
Add new line
scottybollinger e6c0b68
Refactor test
scottybollinger 7e092a1
Rename class and remove extra route segments
scottybollinger 1cb8342
Update test names
scottybollinger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[not a blocker, just leaving this comment here before I forget it] It would be awesome to directly add
cloudBase
into the Kibana core helper someday! I'm sure other plugins might need it at some point