Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into split-types-from-co…
Browse files Browse the repository at this point in the history
…de-on-kbn-ui-shared-deps-src-2
  • Loading branch information
mistic committed Jan 19, 2022
2 parents 74c57de + 2050262 commit ea720f2
Show file tree
Hide file tree
Showing 27 changed files with 378 additions and 243 deletions.
7 changes: 0 additions & 7 deletions docs/developer/advanced/running-elasticsearch.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,6 @@ elasticsearch.password: {{ password }}
elasticsearch.ssl.verificationMode: none
----

If many other users will be interacting with your remote cluster, you'll want to add the following to avoid causing conflicts:

[source,bash]
----
kibana.index: '.{YourGitHubHandle}-kibana'
----

==== Running remote clusters

Setup remote clusters for cross cluster search (CCS) and cross cluster replication (CCR).
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,6 @@
"venn.js": "0.2.20",
"vinyl": "^2.2.0",
"vt-pbf": "^3.1.1",
"wellknown": "^0.5.0",
"whatwg-fetch": "^3.0.0",
"xml2js": "^0.4.22",
"yauzl": "^2.10.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,10 @@ export const stackManagementSchema: MakeSchemaFrom<UsageStats> = {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
},
'observability:enableInfrastructureView': {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
},
'banners:placement': {
type: 'keyword',
_meta: { description: 'Non-default value of setting.' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export interface UsageStats {
'observability:enableInspectEsQueries': boolean;
'observability:maxSuggestions': number;
'observability:enableComparisonByDefault': boolean;
'observability:enableInfrastructureView': boolean;
'visualize:enableLabs': boolean;
'visualization:heatmap:maxBuckets': number;
'visualization:colorMapping': string;
Expand Down
6 changes: 6 additions & 0 deletions src/plugins/telemetry/schema/oss_plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -7790,6 +7790,12 @@
"description": "Non-default value of setting."
}
},
"observability:enableInfrastructureView": {
"type": "boolean",
"_meta": {
"description": "Non-default value of setting."
}
},
"banners:placement": {
"type": "keyword",
"_meta": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
import { i18n } from '@kbn/i18n';
import { omit } from 'lodash';
import React from 'react';
import { enableInfrastructureView } from '../../../../../../observability/public';
import {
isIosAgentName,
isJavaAgentName,
Expand Down Expand Up @@ -159,7 +160,8 @@ export function isJVMsTabHidden({

function useTabs({ selectedTab }: { selectedTab: Tab['key'] }) {
const { agentName, runtimeName } = useApmServiceContext();
const { config } = useApmPluginContext();
const { config, core } = useApmPluginContext();
const showInfraTab = core.uiSettings.get<boolean>(enableInfrastructureView);

const router = useApmRouter();

Expand Down Expand Up @@ -250,6 +252,7 @@ function useTabs({ selectedTab }: { selectedTab: Tab['key'] }) {
label: i18n.translate('xpack.apm.home.infraTabLabel', {
defaultMessage: 'Infrastructure',
}),
hidden: !showInfraTab,
},
{
key: 'service-map',
Expand Down
53 changes: 30 additions & 23 deletions x-pack/plugins/fleet/server/services/package_policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,10 @@ class PackagePolicyService {
);
}
}
validatePackagePolicyOrThrow(packagePolicy, pkgInfo);

const registryPkgInfo = await Registry.fetchInfo(pkgInfo.name, pkgInfo.version);

inputs = await this._compilePackagePolicyInputs(
registryPkgInfo,
pkgInfo,
Expand Down Expand Up @@ -392,6 +394,8 @@ class PackagePolicyService {
pkgVersion: packagePolicy.package.version,
});

validatePackagePolicyOrThrow(packagePolicy, pkgInfo);

const registryPkgInfo = await Registry.fetchInfo(pkgInfo.name, pkgInfo.version);
inputs = await this._compilePackagePolicyInputs(
registryPkgInfo,
Expand Down Expand Up @@ -865,6 +869,31 @@ class PackagePolicyService {
}
}

function validatePackagePolicyOrThrow(packagePolicy: NewPackagePolicy, pkgInfo: PackageInfo) {
const validationResults = validatePackagePolicy(packagePolicy, pkgInfo, safeLoad);
if (validationHasErrors(validationResults)) {
const responseFormattedValidationErrors = Object.entries(getFlattenedObject(validationResults))
.map(([key, value]) => ({
key,
message: value,
}))
.filter(({ message }) => !!message);

if (responseFormattedValidationErrors.length) {
throw new PackagePolicyValidationError(
i18n.translate('xpack.fleet.packagePolicyInvalidError', {
defaultMessage: 'Package policy is invalid: {errors}',
values: {
errors: responseFormattedValidationErrors
.map(({ key, message }) => `${key}: ${message}`)
.join('\n'),
},
})
);
}
}
}

function assignStreamIdToInput(packagePolicyId: string, input: NewPackagePolicyInput) {
return {
...input,
Expand Down Expand Up @@ -1314,29 +1343,7 @@ export function preconfigurePackageInputs(
inputs,
};

const validationResults = validatePackagePolicy(resultingPackagePolicy, packageInfo, safeLoad);

if (validationHasErrors(validationResults)) {
const responseFormattedValidationErrors = Object.entries(getFlattenedObject(validationResults))
.map(([key, value]) => ({
key,
message: value,
}))
.filter(({ message }) => !!message);

if (responseFormattedValidationErrors.length) {
throw new PackagePolicyValidationError(
i18n.translate('xpack.fleet.packagePolicyInvalidError', {
defaultMessage: 'Package policy is invalid: {errors}',
values: {
errors: responseFormattedValidationErrors
.map(({ key, message }) => `${key}: ${message}`)
.join('\n'),
},
})
);
}
}
validatePackagePolicyOrThrow(resultingPackagePolicy, packageInfo);

return resultingPackagePolicy;
}
Expand Down
Loading

0 comments on commit ea720f2

Please sign in to comment.