-
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.
Merge branch 'master' into resolver/add-events-to-dal
- Loading branch information
Showing
36 changed files
with
167 additions
and
173 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
x-pack/plugins/enterprise_search/public/applications/__mocks__/enterprise_search_url.mock.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,9 @@ | ||
/* | ||
* 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 { externalUrl } from '../shared/enterprise_search_url'; | ||
|
||
externalUrl.enterpriseSearchUrl = 'http://localhost:3002'; |
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
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
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
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
42 changes: 42 additions & 0 deletions
42
...s/enterprise_search/public/applications/shared/enterprise_search_url/external_url.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,42 @@ | ||
/* | ||
* 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 { externalUrl, getEnterpriseSearchUrl, getAppSearchUrl, getWorkplaceSearchUrl } from './'; | ||
|
||
describe('Enterprise Search external URL helpers', () => { | ||
describe('getter/setter tests', () => { | ||
it('defaults to an empty string', () => { | ||
expect(externalUrl.enterpriseSearchUrl).toEqual(''); | ||
}); | ||
|
||
it('sets the internal enterpriseSearchUrl value', () => { | ||
externalUrl.enterpriseSearchUrl = 'http://localhost:3002'; | ||
expect(externalUrl.enterpriseSearchUrl).toEqual('http://localhost:3002'); | ||
}); | ||
|
||
it('does not allow mutating enterpriseSearchUrl once set', () => { | ||
externalUrl.enterpriseSearchUrl = 'hello world'; | ||
expect(externalUrl.enterpriseSearchUrl).toEqual('http://localhost:3002'); | ||
}); | ||
}); | ||
|
||
describe('function helpers', () => { | ||
it('generates a public Enterprise Search URL', () => { | ||
expect(getEnterpriseSearchUrl()).toEqual('http://localhost:3002'); | ||
expect(getEnterpriseSearchUrl('/login')).toEqual('http://localhost:3002/login'); | ||
}); | ||
|
||
it('generates a public App Search URL', () => { | ||
expect(getAppSearchUrl()).toEqual('http://localhost:3002/as'); | ||
expect(getAppSearchUrl('/path')).toEqual('http://localhost:3002/as/path'); | ||
}); | ||
|
||
it('generates a public Workplace Search URL', () => { | ||
expect(getWorkplaceSearchUrl()).toEqual('http://localhost:3002/ws'); | ||
expect(getWorkplaceSearchUrl('/path')).toEqual('http://localhost:3002/ws/path'); | ||
}); | ||
}); | ||
}); |
37 changes: 37 additions & 0 deletions
37
...lugins/enterprise_search/public/applications/shared/enterprise_search_url/external_url.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,37 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
/** | ||
* NOTE: The externalUrl obj holds the reference to externalUrl, which should | ||
* only ever be updated once on plugin init. We're using a getter and setter | ||
* here to ensure it isn't accidentally mutated. | ||
* | ||
* Someday (8.x+), when our UI is entirely on Kibana and no longer on | ||
* Enterprise Search's standalone UI, we can potentially deprecate this helper. | ||
*/ | ||
export const externalUrl = { | ||
_enterpriseSearchUrl: '', | ||
get enterpriseSearchUrl() { | ||
return this._enterpriseSearchUrl; | ||
}, | ||
set enterpriseSearchUrl(value) { | ||
if (this._enterpriseSearchUrl) { | ||
// enterpriseSearchUrl is set once on plugin init - we should not mutate it | ||
return; | ||
} | ||
this._enterpriseSearchUrl = value; | ||
}, | ||
}; | ||
|
||
export const getEnterpriseSearchUrl = (path: string = ''): string => { | ||
return externalUrl.enterpriseSearchUrl + path; | ||
}; | ||
export const getAppSearchUrl = (path: string = ''): string => { | ||
return getEnterpriseSearchUrl('/as' + path); | ||
}; | ||
export const getWorkplaceSearchUrl = (path: string = ''): string => { | ||
return getEnterpriseSearchUrl('/ws' + path); | ||
}; |
25 changes: 0 additions & 25 deletions
25
...ise_search/public/applications/shared/enterprise_search_url/generate_external_url.test.ts
This file was deleted.
Oops, something went wrong.
38 changes: 0 additions & 38 deletions
38
...terprise_search/public/applications/shared/enterprise_search_url/generate_external_url.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
Oops, something went wrong.