Skip to content

Commit

Permalink
Merge branch 'master' into chore/reporting-np-move
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan committed Jun 3, 2020
2 parents 419cc2b + d7b830a commit 4fe3ee1
Show file tree
Hide file tree
Showing 208 changed files with 3,297 additions and 2,008 deletions.
2 changes: 1 addition & 1 deletion docs/setup/docker.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Some example translations are shown here:
[horizontal]
**Environment Variable**:: **Kibana Setting**
`SERVER_NAME`:: `server.name`
`KIBANA_DEFAULTAPPID`:: `kibana.defaultAppId`
`SERVER_BASEPATH`:: `server.basePath`
`MONITORING_ENABLED`:: `monitoring.enabled`

In general, any setting listed in <<settings>> can be
Expand Down
4 changes: 3 additions & 1 deletion docs/setup/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@ on the {kib} index at startup. {kib} users still need to authenticate with
| Enables use of interpreter in Visualize. *Default: `true`*

| `kibana.defaultAppId:`
| The default application to load. *Default: `"home"`*
| *deprecated* This setting is deprecated and will get removed in Kibana 8.0.
Please use the `defaultRoute` advanced setting instead.
The default application to load. *Default: `"home"`*

| `kibana.index:`
| {kib} uses an index in {es} to store saved searches, visualizations, and
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/data/common/es_query/filters/get_display_value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { Filter } from '../filters';

function getValueFormatter(indexPattern?: IIndexPattern, key?: string) {
if (!indexPattern || !key) return;

let format = get(indexPattern, ['fields', 'byName', key, 'format']);
if (!format && (indexPattern.fields as any).getByName) {
// TODO: Why is indexPatterns sometimes a map and sometimes an array?
Expand All @@ -43,9 +44,8 @@ function getValueFormatter(indexPattern?: IIndexPattern, key?: string) {
}

export function getDisplayValueFromFilter(filter: Filter, indexPatterns: IIndexPattern[]): string {
const indexPattern = getIndexPatternFromFilter(filter, indexPatterns);

if (typeof filter.meta.value === 'function') {
const indexPattern = getIndexPatternFromFilter(filter, indexPatterns);
const valueFormatter: any = getValueFormatter(indexPattern, filter.meta.key);
return filter.meta.value(valueFormatter);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,5 +228,21 @@ describe('filter manager utilities', () => {

expect(compareFilters([f1], [f2], COMPARE_ALL_OPTIONS)).toBeFalsy();
});

test('should compare index with index true', () => {
const f1 = {
$state: { store: FilterStateStore.GLOBAL_STATE },
...buildQueryFilter({ _type: { match: { query: 'apache', type: 'phrase' } } }, 'index', ''),
};
const f2 = {
$state: { store: FilterStateStore.GLOBAL_STATE },
...buildQueryFilter({ _type: { match: { query: 'apache', type: 'phrase' } } }, 'index', ''),
};

f2.meta.index = 'wassup';
f2.meta.index = 'dog';

expect(compareFilters([f1], [f2], { index: true })).toBeFalsy();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { defaults, isEqual, omit, map } from 'lodash';
import { FilterMeta, Filter } from '../../es_query';

export interface FilterCompareOptions {
index?: boolean;
disabled?: boolean;
negate?: boolean;
state?: boolean;
Expand All @@ -31,6 +32,7 @@ export interface FilterCompareOptions {
* Include disabled, negate and store when comparing filters
*/
export const COMPARE_ALL_OPTIONS: FilterCompareOptions = {
index: true,
disabled: true,
negate: true,
state: true,
Expand All @@ -44,6 +46,7 @@ const mapFilter = (
) => {
const cleaned: FilterMeta = omit(filter, excludedAttributes);

if (comparators.index) cleaned.index = filter.meta?.index;
if (comparators.negate) cleaned.negate = filter.meta && Boolean(filter.meta.negate);
if (comparators.disabled) cleaned.disabled = filter.meta && Boolean(filter.meta.disabled);
if (comparators.alias) cleaned.alias = filter.meta?.alias;
Expand Down Expand Up @@ -81,6 +84,7 @@ export const compareFilters = (
const excludedAttributes: string[] = ['$$hashKey', 'meta'];

comparators = defaults(comparatorOptions || {}, {
index: false,
state: false,
negate: false,
disabled: false,
Expand Down
15 changes: 13 additions & 2 deletions src/plugins/data/public/ui/filter_bar/_global_filter_item.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,26 @@
font-style: italic;
}

.globalFilterItem-isInvalid {
.globalFilterItem-isError, .globalFilterItem-isWarning {
text-decoration: none;

.globalFilterLabel__value {
color: $euiColorDanger;
font-weight: $euiFontWeightBold;
}
}

.globalFilterItem-isError {
.globalFilterLabel__value {
color: makeHighContrastColor($euiColorDangerText, $euiColorLightShade);
}
}

.globalFilterItem-isWarning {
.globalFilterLabel__value {
color: makeHighContrastColor($euiColorWarningText, $euiColorLightShade);
}
}

.globalFilterItem-isPinned {
position: relative;

Expand Down
1 change: 1 addition & 0 deletions src/plugins/data/public/ui/filter_bar/filter_bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ function FilterBarUI(props: Props) {
<EuiFlexItem key={i} grow={false} className="globalFilterBar__flexItem">
<FilterItem
id={`${i}`}
intl={props.intl}
filter={filter}
onUpdate={(newFilter) => onUpdate(i, newFilter)}
onRemove={() => onRemove(i)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,14 @@ class FilterEditorUI extends Component<Props, State> {
if (
this.props.indexPatterns.length <= 1 &&
this.props.indexPatterns.find(
(indexPattern) => indexPattern === this.state.selectedIndexPattern
(indexPattern) => indexPattern === this.getIndexPatternFromFilter()
)
) {
/**
* Don't render the index pattern selector if there's just one \ zero index patterns
* and if the index pattern the filter was LOADED with is in the indexPatterns list.
**/

return '';
}
const { selectedIndexPattern } = this.state;
Expand Down
Loading

0 comments on commit 4fe3ee1

Please sign in to comment.