Skip to content

Commit

Permalink
Merge branch 'master' into fix/otherBucketFilters
Browse files Browse the repository at this point in the history
  • Loading branch information
ppisljar committed Oct 22, 2018
2 parents f9ea47c + ee334c4 commit bcb718f
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ export const createGoClientInstructions = () => [
textPre: i18n.translate('kbn.server.tutorials.apm.goClient.install.textPre', {
defaultMessage: 'Install the APM agent packages for Go.',
}),
commands: ['go get github.com/elastic/apm-agent-go'],
commands: ['go get go.elastic.co/apm'],
},
{
title: i18n.translate('kbn.server.tutorials.apm.goClient.configure.title', {
Expand All @@ -384,13 +384,14 @@ file name, or the `ELASTIC_APM_SERVICE_NAME` environment variable.',
})}
export ELASTIC_APM_SERVICE_NAME=
# ${i18n.translate('kbn.server.tutorials.apm.goClient.configure.commands.setAmpServerUrlComment', {
defaultMessage: 'Set the APM Server URL. If unspecified, the agent will effectively be disabled.',
# ${i18n.translate('kbn.server.tutorials.apm.goClient.configure.commands.setCustomApmServerUrlComment', {
defaultMessage: 'Set custom APM Server URL (default: {defaultApmServerUrl})',
values: { defaultApmServerUrl: 'http://localhost:8200' },
})}
export ELASTIC_APM_SERVER_URL=
# ${i18n.translate('kbn.server.tutorials.apm.goClient.configure.commands.setIfAmpServerRequiresTokenComment', {
defaultMessage: 'Set if APM Server requires a token.',
# ${i18n.translate('kbn.server.tutorials.apm.goClient.configure.commands.useIfApmRequiresTokenComment', {
defaultMessage: 'Use if APM Server requires a token',
})}
export ELASTIC_APM_SECRET_TOKEN=
`.split('\n'),
Expand All @@ -407,11 +408,11 @@ export ELASTIC_APM_SECRET_TOKEN=
defaultMessage: 'Instrument your Go application by using one of the provided instrumentation modules or \
by using the tracer API directly.',
}),
commands: `
commands: `\
import (
"net/http"
"github.com/elastic/apm-agent-go/module/apmhttp"
"go.elastic.co/apm/module/apmhttp"
)
func main() {curlyOpen}
Expand All @@ -422,8 +423,7 @@ func main() {curlyOpen}
`.split('\n'),
textPost: i18n.translate('kbn.server.tutorials.apm.goClient.instrument.textPost', {
defaultMessage: 'See the [documentation]({documentationLink}) for a detailed \
guide to instrumenting Go source code.\n\n\
**Warning: The Go agent is currently in Beta and not meant for production use.**',
guide to instrumenting Go source code.',
values: { documentationLink: '{config.docs.base_url}guide/en/apm/agent/go/current/instrumenting-source.html' },
}),
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { EuiBadge } from '@elastic/eui';
import React from 'react';
import { TABLE_CONFIG } from '../../../common/constants';

interface TagBadgeProps {
maxIdRenderSize?: number;
id: string;
}

export const DisabledTagBadge = (props: TagBadgeProps) => {
const { id, maxIdRenderSize } = props;
const idRenderSize = maxIdRenderSize || TABLE_CONFIG.TRUNCATE_TAG_LENGTH;
const idToRender = id.length > idRenderSize ? `${id.substring(0, idRenderSize)}...` : id;
return (
<EuiBadge color="default" iconType="cross">
{idToRender}
</EuiBadge>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,29 @@
import { EuiBadge } from '@elastic/eui';
import React from 'react';
import { TABLE_CONFIG } from '../../../common/constants';
import { DisabledTagBadge } from './disabled_tag_badge';

interface TagBadgeProps {
iconType?: any;
onClick?: () => void;
onClickAriaLabel?: string;
maxIdRenderSize?: number;
tag: { color?: string; id: string };
tag: { color?: string; disabled?: boolean; id: string };
}

export const TagBadge = (props: TagBadgeProps) => {
const {
iconType,
onClick,
onClickAriaLabel,
tag: { color, id },
tag: { color, disabled, id },
} = props;

const maxIdRenderSize = props.maxIdRenderSize || TABLE_CONFIG.TRUNCATE_TAG_LENGTH;
const idToRender = id.length > maxIdRenderSize ? `${id.substring(0, maxIdRenderSize)}...` : id;
return (
return disabled ? (
<DisabledTagBadge maxIdRenderSize={props.maxIdRenderSize} id={id} />
) : (
<EuiBadge
color={color || 'primary'}
iconType={iconType}
Expand Down
35 changes: 32 additions & 3 deletions x-pack/plugins/beats_management/public/pages/main/beats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ import {
EuiModalHeaderTitle,
EuiOverlayMask,
} from '@elastic/eui';
import { sortBy } from 'lodash';
import { flatten, intersection, sortBy } from 'lodash';
import moment from 'moment';
import React from 'react';
import { RouteComponentProps } from 'react-router';
import { CMPopulatedBeat } from '../../../common/domain_types';
import { UNIQUENESS_ENFORCING_TYPES } from 'x-pack/plugins/beats_management/common/constants';
import { BeatTag, CMPopulatedBeat, ConfigurationBlock } from '../../../common/domain_types';
import { BeatsTagAssignment } from '../../../server/lib/adapters/beats/adapter_types';
import { AppURLState } from '../../app';
import { BeatsTableType, Table } from '../../components/table';
Expand Down Expand Up @@ -122,7 +123,7 @@ export class BeatsPage extends React.PureComponent<BeatsPageProps, BeatsPageStat
value: this.props.urlState.beatsKBar || '',
}}
assignmentOptions={{
items: this.state.tags || [],
items: this.filterSelectedBeatTags(),
schema: beatsListAssignmentOptions,
type: 'assignment',
actionHandler: this.handleBeatsActions,
Expand Down Expand Up @@ -289,4 +290,32 @@ export class BeatsPage extends React.PureComponent<BeatsPageProps, BeatsPageStat
});
return beats;
};

private filterSelectedBeatTags = () => {
if (!this.state.tags) {
return [];
}
return this.selectedBeatConfigsRequireUniqueness()
? this.state.tags.map(this.disableTagForUniquenessEnforcement)
: this.state.tags;
};

private configBlocksRequireUniqueness = (configurationBlocks: ConfigurationBlock[]) =>
intersection(UNIQUENESS_ENFORCING_TYPES, configurationBlocks.map(block => block.type))
.length !== 0;

private disableTagForUniquenessEnforcement = (tag: BeatTag) =>
this.configBlocksRequireUniqueness(tag.configuration_blocks) &&
// if > 0 beats are associated with the tag, it will result in disassociation, so do not disable it
!this.getSelectedBeats().some(beat => beat.full_tags.some(({ id }) => id === tag.id))
? { ...tag, disabled: true }
: tag;

private selectedBeatConfigsRequireUniqueness = () =>
// union beat tags
flatten(this.getSelectedBeats().map(({ full_tags }) => full_tags))
// map tag list to bool
.map(({ configuration_blocks }) => this.configBlocksRequireUniqueness(configuration_blocks))
// reduce to result
.reduce((acc, cur) => acc || cur, false);
}
1 change: 0 additions & 1 deletion x-pack/plugins/graph/public/templates/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@
class="form-control input-sm"
min="1"
max="500000"
step="1000"
id="qIndexSampleSize"
ng-model="exploreControls.sampleSize"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,22 @@
</form>

<div class="kuiFormSection">
<label
class="kuiFormLabel"
i18n-id="xpack.watcher.sections.watchEdit.detail.watchJSONLabel"
i18n-default-message="Watch JSON({syntax})"
i18n-values="{ syntax: '<a href=\'{{ watchEditDetail.documentationLinks.watcher.putWatchApi }}\' target=\'_blank\' rel=\'noopener noreferrer\' data-test-subj=\'lnkPutWatchApiDoc\'>' + watchEditDetail.syntaxLinkLabel + '</a>'}"
></label>
<label class="kuiFormLabel">
<span
i18n-id="xpack.watcher.sections.watchEdit.detail.watchJSONLabel"
i18n-default-message="Watch JSON"
></span>
(
<a
href="{{ watchEditDetail.documentationLinks.watcher.putWatchApi }}"
target="_blank"
rel="noopener noreferrer"
data-test-subj="lnkPutWatchApiDoc"
i18n-id="xpack.watcher.sections.watchEdit.detail.syntaxLinkLabel"
i18n-default-message="Syntax"
></a>
)
</label>
<json-editor
json="watchEditDetail.watch.watch"
on-change="watchEditDetail.onJsonChange"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { documentationLinks } from 'plugins/watcher/lib/documentation_links';

const app = uiModules.get('xpack/watcher');

app.directive('watchEditDetail', function (i18n) {
app.directive('watchEditDetail', function () {
return {
restrict: 'E',
template: template,
Expand All @@ -36,7 +36,7 @@ app.directive('watchEditDetail', function (i18n) {
$scope.$watch('watchEditDetail.form.$valid', () => {
this.updateIsValid();
});
this.syntaxLinkLabel = i18n('xpack.watcher.sections.watchEdit.detail.syntaxLinkLabel', { defaultMessage: 'Syntax' });

this.documentationLinks = documentationLinks;
}

Expand Down

0 comments on commit bcb718f

Please sign in to comment.