forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Kawika Avilla <[email protected]>
- Loading branch information
Showing
9 changed files
with
137 additions
and
36 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Any modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
import { IndexPatternSelectProps } from './index_pattern_select'; | ||
import { StatefulSearchBarProps } from './search_bar'; | ||
|
||
export interface UiEnhancements { | ||
externalLanguage: string; | ||
} | ||
|
||
/** | ||
* Data plugin prewired UI components | ||
*/ | ||
export interface DataPublicPluginStartUi { | ||
externalLanguages: string[]; | ||
IndexPatternSelect: React.ComponentType<IndexPatternSelectProps>; | ||
SearchBar: React.ComponentType<StatefulSearchBarProps>; | ||
} |
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,74 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Any modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
import { Plugin, CoreSetup, CoreStart, PluginInitializerContext } from 'src/core/public'; | ||
import { DataPublicPluginStartUi, UiEnhancements } from './types'; | ||
|
||
import { ConfigSchema } from '../../config'; | ||
import { createIndexPatternSelect } from './index_pattern_select'; | ||
import { createSearchBar } from './search_bar/create_search_bar'; | ||
import { DataPublicPluginStart } from '../types'; | ||
import { IStorageWrapper } from '../../../opensearch_dashboards_utils/public'; | ||
|
||
/** @internal */ | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
export interface UiServiceSetupDependencies {} | ||
|
||
/** @internal */ | ||
export interface UiServiceStartDependencies { | ||
dataServices: Omit<DataPublicPluginStart, 'ui'>; | ||
storage: IStorageWrapper; | ||
} | ||
|
||
export class UiService implements Plugin<any, DataPublicPluginStartUi> { | ||
constructor(private _: PluginInitializerContext<ConfigSchema>) {} | ||
private externalLanguages: string[] = []; | ||
|
||
public setup( | ||
{ http, getStartServices, notifications, uiSettings }: CoreSetup, | ||
{}: UiServiceSetupDependencies | ||
) { | ||
/** | ||
* A global object that intercepts all searches and provides convenience methods for cancelling | ||
* all pending search requests, as well as getting the number of pending search requests. | ||
*/ | ||
// this.searchInterceptor = new SearchInterceptor({ | ||
// toasts: notifications.toasts, | ||
// http, | ||
// uiSettings, | ||
// startServices: getStartServices(), | ||
// usageCollector: this.usageCollector!, | ||
// }); | ||
|
||
return { | ||
__enhance: (enhancements?: UiEnhancements) => { | ||
if (!enhancements) return; | ||
this.externalLanguages.push(enhancements.externalLanguage); | ||
}, | ||
}; | ||
} | ||
|
||
public start(core: CoreStart, { dataServices, storage }: UiServiceStartDependencies) { | ||
const SearchBar = createSearchBar({ | ||
core, | ||
data: dataServices, | ||
storage, | ||
}); | ||
|
||
return { | ||
externalLanguages: this.externalLanguages, | ||
IndexPatternSelect: createIndexPatternSelect(core.savedObjects.client), | ||
SearchBar, | ||
}; | ||
} | ||
|
||
public stop() {} | ||
} |
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