Skip to content

Commit b298b3d

Browse files
author
Liza Katz
authored
Moved query bar into data plugin (#35390)
* moved query bar to data plugin
1 parent af3594f commit b298b3d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+172
-71
lines changed

.i18nrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"paths": {
33
"common.ui": "src/legacy/ui",
4+
"data": "src/legacy/core_plugins/data",
45
"server": "src/legacy/server",
56
"console": "src/legacy/core_plugins/console",
67
"core": "src/core",

src/legacy/core_plugins/data/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ export default function DataPlugin(kibana: any) {
3232
}).default();
3333
},
3434
init: (server: Legacy.Server) => ({}),
35+
uiExports: {
36+
injectDefaultVars: () => ({}),
37+
styleSheetPaths: resolve(__dirname, 'public/index.scss'),
38+
},
3539
};
3640

3741
return new kibana.Plugin(config);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@import 'src/legacy/ui/public/styles/styling_constants';
2+
3+
@import './query_bar/index';
4+

src/legacy/core_plugins/data/public/index.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,42 @@
1717
* under the License.
1818
*/
1919

20-
import { IndexPatternsService } from './index_patterns';
20+
import { QueryBarService } from './query_bar';
21+
import { IndexPatternsService, IndexPatternsSetup } from './index_patterns';
2122

22-
class DataService {
23+
class DataPlugin {
2324
private readonly indexPatterns: IndexPatternsService;
25+
private readonly queryBar: QueryBarService;
2426

2527
constructor() {
2628
this.indexPatterns = new IndexPatternsService();
29+
this.queryBar = new QueryBarService();
2730
}
2831

2932
public setup() {
3033
return {
3134
indexPatterns: this.indexPatterns.setup(),
35+
query: this.queryBar.setup(),
3236
};
3337
}
3438

3539
public stop() {
3640
this.indexPatterns.stop();
41+
this.queryBar.stop();
3742
}
3843
}
3944

4045
/**
41-
* We temporarily export default here so that users importing from 'plugins/data'
46+
* We export data here so that users importing from 'plugins/data'
4247
* will automatically receive the response value of the `setup` contract, mimicking
4348
* the data that will eventually be injected by the new platform.
4449
*/
45-
// eslint-disable-next-line import/no-default-export
46-
export default new DataService().setup();
50+
export const data = new DataPlugin().setup();
4751

4852
/** @public */
49-
export type DataSetup = ReturnType<DataService['setup']>;
53+
export interface DataSetup {
54+
indexPatterns: IndexPatternsSetup;
55+
}
56+
57+
/** @public types */
58+
export { IndexPattern, StaticIndexPattern, StaticIndexPatternField, Field } from './index_patterns';

src/legacy/core_plugins/data/public/index_patterns/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,12 @@
1717
* under the License.
1818
*/
1919

20-
export { IndexPatternsService, IndexPatternsSetup } from './index_patterns_service';
20+
export {
21+
IndexPatternsService,
22+
// types
23+
IndexPatternsSetup,
24+
IndexPattern,
25+
StaticIndexPattern,
26+
StaticIndexPatternField,
27+
Field,
28+
} from './index_patterns_service';

src/legacy/core_plugins/data/public/index_patterns/index_patterns_service.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ import setupRouteWithDefaultPattern from 'ui/index_patterns/route_setup/load_def
5151
import { getFromSavedObject, isFilterable } from 'ui/index_patterns/static_utils';
5252

5353
// IndexPattern, StaticIndexPattern, StaticIndexPatternField, Field
54-
import * as types from 'ui/index_patterns/index.d.ts';
54+
55+
import * as types from 'ui/index_patterns';
5556

5657
/**
5758
* Index Patterns Service
@@ -91,9 +92,6 @@ export class IndexPatternsService {
9192
mockFields,
9293
mockIndexPattern,
9394
},
94-
types: {
95-
...types,
96-
},
9795
ui: {
9896
IndexPatternSelect,
9997
},
@@ -107,3 +105,15 @@ export class IndexPatternsService {
107105

108106
/** @public */
109107
export type IndexPatternsSetup = ReturnType<IndexPatternsService['setup']>;
108+
109+
/** @public */
110+
export type IndexPattern = types.IndexPattern;
111+
112+
/** @public */
113+
export type StaticIndexPattern = types.StaticIndexPattern;
114+
115+
/** @public */
116+
export type StaticIndexPatternField = types.StaticIndexPatternField;
117+
118+
/** @public */
119+
export type Field = types.Field;

src/legacy/ui/public/query_bar/components/__snapshots__/language_switcher.test.tsx.snap renamed to src/legacy/core_plugins/data/public/query_bar/components/__snapshots__/language_switcher.test.tsx.snap

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)