Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from istresearch/P4-2355
P4 2355 - Kibana 7.11 Support
- Loading branch information
Showing
79 changed files
with
1,354 additions
and
1,134 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
--- | ||
extends: "@elastic/kibana" | ||
module.exports = { | ||
root: true, | ||
extends: ['@elastic/eslint-config-kibana', 'plugin:@elastic/eui/recommended'], | ||
rules: { | ||
'@kbn/eslint/require-license-header': 'off', | ||
}, | ||
}; |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,7 +1,6 @@ | ||
npm-debug.log* | ||
node_modules | ||
/build/ | ||
yarn.lock | ||
|
||
/build | ||
/target | ||
/node_modules | ||
.DS_Store | ||
*.idea | ||
.github |
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 @@ | ||
{ | ||
"prefix": "kibanaObjectFormat", | ||
"paths": { | ||
"kibanaObjectFormat": "." | ||
}, | ||
"translations": ["translations/ja-JP.json"] | ||
} |
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,2 @@ | ||
export const PLUGIN_ID = 'kibanaObjectFormat'; | ||
export const PLUGIN_NAME = 'kibana_object_format'; |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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 @@ | ||
{ | ||
"id": "kibanaObjectFormat", | ||
"version": "1.0.0", | ||
"kibanaVersion": "kibana", | ||
"server": true, | ||
"ui": true, | ||
"requiredPlugins": ["data", "indexPatternManagement"], | ||
"optionalPlugins": [] | ||
} |
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 |
---|---|---|
@@ -1,41 +1,16 @@ | ||
{ | ||
"name": "kibana_object_format", | ||
"version": "0.1.10", | ||
"version": "1.0.0", | ||
"description": "Enables objects in arrays to be configured with a field formatter.", | ||
"license": "Apache 2.0", | ||
"homepage": "https://github.com/istresearch/kibana-object-format", | ||
"main": "index.js", | ||
"kibana": { | ||
"version": "kibana", | ||
"templateVersion": "1.0.0" | ||
}, | ||
"scripts": { | ||
"preinstall": "node ../../preinstall_check", | ||
"kbn": "node ../../scripts/kbn", | ||
"es": "node ../../scripts/es", | ||
"lint": "eslint .", | ||
"start": "plugin-helpers start", | ||
"test:server": "plugin-helpers test:server", | ||
"test:browser": "plugin-helpers test:browser", | ||
"build": "plugin-helpers build" | ||
"build": "yarn plugin-helpers build", | ||
"plugin-helpers": "node ../../scripts/plugin_helpers", | ||
"kbn": "node ../../scripts/kbn" | ||
}, | ||
"dependencies": { | ||
"tippy.js": "~6.2.2" | ||
}, | ||
"devDependencies": { | ||
"@elastic/eslint-config-kibana": "link:../../packages/eslint-config-kibana", | ||
"@elastic/eslint-import-resolver-kibana": "link:../../packages/kbn-eslint-import-resolver-kibana", | ||
"@kbn/expect": "link:../../packages/kbn-expect", | ||
"@kbn/plugin-helpers": "link:../../packages/kbn-plugin-helpers", | ||
"babel-eslint": "^10.0.1", | ||
"eslint": "^5.16.0", | ||
"eslint-plugin-babel": "^5.3.0", | ||
"eslint-plugin-import": "^2.16.0", | ||
"eslint-plugin-jest": "^22.4.1", | ||
"eslint-plugin-jsx-a11y": "^6.2.1", | ||
"eslint-plugin-mocha": "^5.3.0", | ||
"eslint-plugin-no-unsanitized": "^3.0.2", | ||
"eslint-plugin-prefer-object-spread": "^1.2.1", | ||
"eslint-plugin-react": "^7.12.4" | ||
"tippy.js": "^6.3.1", | ||
"uuid": "^8.3.2" | ||
} | ||
} |
108 changes: 108 additions & 0 deletions
108
public/bootstrap/custom_filter_manager/FilterManagerHelper.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,108 @@ | ||
import { get } from 'lodash'; | ||
import { Filter, CustomFilterManager, CustomFilterMeta } from '../../types'; | ||
|
||
class FilterManagerHelper { | ||
private addFiltersCache: (filters: Filter | Filter[], pinFilterStatus?: boolean) => void; | ||
private similarityScript: string = ''; | ||
private newFilter: Partial<Filter> = {}; | ||
private filterManager: CustomFilterManager; | ||
|
||
constructor(addFiltersCache: any, filterManager: any) { | ||
this.addFiltersCache = addFiltersCache; | ||
this.similarityScript = ''; | ||
this.filterManager = filterManager; | ||
} | ||
|
||
private getFilterIndex({ path, value, negate }: Partial<CustomFilterMeta>) { | ||
const currentFilters = this.getCurrentFilters(); | ||
|
||
return currentFilters.findIndex( | ||
(filter) => filter.path === path && filter.value === value && filter.negate === negate | ||
); | ||
} | ||
|
||
public getCurrentFilters(): Partial<CustomFilterMeta>[] { | ||
return this.filterManager.getFilters().map((filter) => ({ | ||
path: | ||
get(filter, 'query.bool.must.script.script.params.field', null) || | ||
get(filter, 'meta.key', null), | ||
value: | ||
get(filter, 'query.bool.must.script.script.params.dhash', null) || | ||
get(filter, 'meta.params.query', null), | ||
negate: get(filter, 'meta.negate', null), | ||
distance: get(filter, 'query.bool.must.script.script.params.distance', null), | ||
})); | ||
} | ||
|
||
public addFilter({ path, value, negate, alias = null }: Partial<CustomFilterMeta>) { | ||
const filterIndex = this.getFilterIndex({ path, value, negate }); | ||
|
||
if (filterIndex >= 0) { | ||
return; | ||
} | ||
|
||
if (path) { | ||
this.addFiltersCache.apply(this.filterManager, [ | ||
{ | ||
...this.newFilter, | ||
meta: { | ||
alias, | ||
negate: !!this.newFilter?.meta?.negate, | ||
index: this.newFilter?.meta?.index, | ||
disabled: false, | ||
}, | ||
query: { | ||
match_phrase: { | ||
[path]: value, | ||
}, | ||
}, | ||
}, | ||
]); | ||
} | ||
} | ||
|
||
public addImageSimilarityFilter({ path, value, distance = '8' }: CustomFilterMeta) { | ||
this.removeFilter({ path, value, negate: true }); | ||
this.removeFilter({ path, value, negate: false }); | ||
|
||
this.addFiltersCache.apply(this.filterManager, [ | ||
{ | ||
...this.newFilter, | ||
meta: { | ||
alias: `Image Similarity: ${value} (${distance})`, | ||
negate: !!this.newFilter?.meta?.negate, | ||
index: this.newFilter?.meta?.index, | ||
disabled: false, | ||
}, | ||
query: { | ||
bool: { | ||
must: { | ||
script: { | ||
script: { | ||
lang: 'painless', | ||
params: { | ||
dhash: value, | ||
distance: parseInt(distance, 10), | ||
field: path, | ||
}, | ||
source: this.similarityScript, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
]); | ||
} | ||
|
||
public removeFilter({ path, value, negate }: Partial<CustomFilterMeta>) { | ||
const currentFilters = this.filterManager.getFilters(); | ||
const filterIndex = this.getFilterIndex({ path, value, negate }); | ||
|
||
if (filterIndex >= 0) { | ||
this.filterManager.removeFilter(currentFilters[filterIndex]); | ||
} | ||
} | ||
} | ||
|
||
export default FilterManagerHelper; |
File renamed without changes.
Oops, something went wrong.