-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { resolve } from 'path'; | ||
import { Legacy } from 'kibana'; | ||
|
||
import { LegacyPluginApi, LegacyPluginInitializer } from '../../../../src/legacy/types'; | ||
|
||
const inputControlVisPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPluginApi) => | ||
new Plugin({ | ||
id: 'input_control_vis', | ||
require: ['kibana', 'elasticsearch', 'visualizations', 'interpreter', 'data'], | ||
publicDir: resolve(__dirname, 'public'), | ||
uiExports: { | ||
styleSheetPaths: resolve(__dirname, 'public/index.scss'), | ||
hacks: [resolve(__dirname, 'public/legacy')], | ||
injectDefaultVars: server => ({}), | ||
}, | ||
init: (server: Legacy.Server) => ({}), | ||
config(Joi: any) { | ||
return Joi.object({ | ||
enabled: Joi.boolean().default(true), | ||
}).default(); | ||
}, | ||
} as Legacy.PluginSpecOptions); | ||
|
||
// eslint-disable-next-line import/no-default-export | ||
export default inputControlVisPluginInitializer; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { FieldList } from 'src/plugins/data/public'; | ||
import { InputControlVisDependencies } from '../../../plugin'; | ||
|
||
const fields: FieldList = [] as any; | ||
fields.push({ name: 'myField' } as any); | ||
fields.getByName = (name: any) => { | ||
return fields.find(({ name: n }) => n === name); | ||
}; | ||
|
||
export const getDepsMock = (): InputControlVisDependencies => | ||
({ | ||
core: { | ||
getStartServices: jest.fn().mockReturnValue([ | ||
null, | ||
{ | ||
data: { | ||
ui: { | ||
IndexPatternSelect: () => (<div />) as any, | ||
}, | ||
indexPatterns: { | ||
get: () => ({ | ||
fields, | ||
}), | ||
}, | ||
}, | ||
}, | ||
]), | ||
injectedMetadata: { | ||
getInjectedVar: jest.fn().mockImplementation(key => { | ||
switch (key) { | ||
case 'autocompleteTimeout': | ||
return 1000; | ||
case 'autocompleteTerminateAfter': | ||
return 100000; | ||
default: | ||
return ''; | ||
} | ||
}), | ||
}, | ||
}, | ||
data: { | ||
query: { | ||
filterManager: { | ||
fieldName: 'myField', | ||
getIndexPattern: () => ({ | ||
fields, | ||
}), | ||
getAppFilters: jest.fn().mockImplementation(() => []), | ||
getGlobalFilters: jest.fn().mockImplementation(() => []), | ||
}, | ||
timefilter: { | ||
timefilter: {}, | ||
}, | ||
}, | ||
}, | ||
} as any); |