Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/7.x' into backport/7.x/pr-80992
Browse files Browse the repository at this point in the history
  • Loading branch information
smith committed Oct 21, 2020
2 parents 5913c85 + 052c64c commit 86001cc
Show file tree
Hide file tree
Showing 40 changed files with 894 additions and 161 deletions.
19 changes: 19 additions & 0 deletions src/plugins/kibana_usage_collection/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
"emitDeclarationOnly": true,
"declaration": true,
"declarationMap": true
},
"include": [
"common/*",
"server/**/**/*",
"../../../typings/*"
],
"references": [
{ "path": "../../core/tsconfig.json" },
{ "path": "../../plugins/usage_collection/tsconfig.json" },
]
}
1 change: 1 addition & 0 deletions test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
{ "path": "../src/plugins/usage_collection/tsconfig.json" },
{ "path": "../src/plugins/telemetry_collection_manager/tsconfig.json" },
{ "path": "../src/plugins/telemetry/tsconfig.json" },
{ "path": "../src/plugins/kibana_usage_collection/tsconfig.json" },
{ "path": "../src/plugins/newsfeed/tsconfig.json" }
]
}
2 changes: 2 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"src/core/**/*",
"src/plugins/kibana_legacy/**/*",
"src/plugins/kibana_react/**/*",
"src/plugins/kibana_usage_collection/**/*",
"src/plugins/kibana_utils/**/*",
"src/plugins/newsfeed/**/*",
"src/plugins/telemetry/**/*",
Expand All @@ -29,6 +30,7 @@
{ "path": "./src/plugins/usage_collection/tsconfig.json" },
{ "path": "./src/plugins/telemetry_collection_manager/tsconfig.json" },
{ "path": "./src/plugins/telemetry/tsconfig.json" },
{ "path": "./src/plugins/kibana_usage_collection/tsconfig.json" },
{ "path": "./src/plugins/newsfeed/tsconfig.json" }
]
}
1 change: 1 addition & 0 deletions tsconfig.refs.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{ "path": "./src/plugins/usage_collection/tsconfig.json" },
{ "path": "./src/plugins/telemetry_collection_manager/tsconfig.json" },
{ "path": "./src/plugins/telemetry/tsconfig.json" },
{ "path": "./src/plugins/kibana_usage_collection/tsconfig.json" },
{ "path": "./src/plugins/newsfeed/tsconfig.json" },
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,13 @@ When('the user changes the selected percentile', () => {
// wait for all loading to finish
cy.get('kbnLoadingIndicator').should('not.be.visible');

getDataTestSubj('uxPercentileSelect').click();

getDataTestSubj('p95Percentile').click();
getDataTestSubj('uxPercentileSelect').select('95');
});

Then(`it displays client metric related to that percentile`, () => {
const metrics = ['14 ms', '131 ms', '55'];

verifyClientMetrics(metrics, false);

// reset to median
getDataTestSubj('uxPercentileSelect').click();

getDataTestSubj('p50Percentile').click();
getDataTestSubj('uxPercentileSelect').select('50');
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,14 @@

import React, { useCallback, useEffect } from 'react';

import { EuiSuperSelect } from '@elastic/eui';
import { EuiSelect } from '@elastic/eui';
import { useHistory } from 'react-router-dom';
import styled from 'styled-components';
import { useUrlParams } from '../../../../hooks/useUrlParams';
import { fromQuery, toQuery } from '../../../shared/Links/url_helpers';
import { I18LABELS } from '../translations';

const DEFAULT_P = 50;

const StyledSpan = styled.span`
font-weight: 600;
`;

export function UserPercentile() {
const history = useHistory();

Expand Down Expand Up @@ -49,32 +44,29 @@ export function UserPercentile() {
const options = [
{
value: '50',
inputDisplay: I18LABELS.percentile50thMedian,
text: I18LABELS.percentile50thMedian,
dropdownDisplay: I18LABELS.percentile50thMedian,
'data-test-subj': 'p50Percentile',
},
{
value: '75',
inputDisplay: <StyledSpan>{I18LABELS.percentile75th}</StyledSpan>,
text: I18LABELS.percentile75th,
dropdownDisplay: I18LABELS.percentile75th,
'data-test-subj': 'p75Percentile',
},
{
value: '90',
inputDisplay: <StyledSpan>{I18LABELS.percentile90th}</StyledSpan>,
dropdownDisplay: I18LABELS.percentile90th,
text: I18LABELS.percentile90th,
'data-test-subj': 'p90Percentile',
},
{
value: '95',
inputDisplay: <StyledSpan>{I18LABELS.percentile95th}</StyledSpan>,
dropdownDisplay: I18LABELS.percentile95th,
text: I18LABELS.percentile95th,
'data-test-subj': 'p95Percentile',
},
{
value: '99',
inputDisplay: <StyledSpan>{I18LABELS.percentile99th}</StyledSpan>,
dropdownDisplay: I18LABELS.percentile99th,
text: I18LABELS.percentile99th,
'data-test-subj': 'p99Percentile',
},
];
Expand All @@ -84,13 +76,12 @@ export function UserPercentile() {
};

return (
<EuiSuperSelect
<EuiSelect
prepend={I18LABELS.percentile}
data-test-subj="uxPercentileSelect"
style={{ width: 150 }}
options={options}
valueOfSelected={String(percentile ?? DEFAULT_P)}
onChange={(value) => onChange(value)}
onChange={(evt) => onChange(evt.target.value)}
/>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export interface DeleteAgentPolicyRequest {

export interface DeleteAgentPolicyResponse {
id: string;
name: string;
}

export interface GetFullAgentPolicyRequest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@ export interface DeletePackagePoliciesRequest {

export type DeletePackagePoliciesResponse = Array<{
id: string;
name?: string;
success: boolean;
}>;
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const AgentPolicyDeleteProvider: React.FunctionComponent<Props> = ({ chil
notifications.toasts.addSuccess(
i18n.translate('xpack.ingestManager.deleteAgentPolicy.successSingleNotificationTitle', {
defaultMessage: "Deleted agent policy '{id}'",
values: { id: agentPolicy },
values: { id: data.name || data.id },
})
);
if (onSuccessCallback.current) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const PackagePolicyDeleteProvider: React.FunctionComponent<Props> = ({
'xpack.ingestManager.deletePackagePolicy.successSingleNotificationTitle',
{
defaultMessage: "Deleted integration '{id}'",
values: { id: successfulResults[0].id },
values: { id: successfulResults[0].name || successfulResults[0].id },
}
);
notifications.toasts.addSuccess(successMessage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ export const AgentListPage: React.FunctionComponent<{}> = () => {
// Agent data states
const [showInactive, setShowInactive] = useState<boolean>(false);
const [showUpgradeable, setShowUpgradeable] = useState<boolean>(false);

// Table and search states
const [search, setSearch] = useState<string>(defaultKuery);
const [selectionMode, setSelectionMode] = useState<SelectionMode>('manual');
Expand All @@ -188,11 +189,20 @@ export const AgentListPage: React.FunctionComponent<{}> = () => {
const [isStatusFilterOpen, setIsStatutsFilterOpen] = useState<boolean>(false);
const [selectedStatus, setSelectedStatus] = useState<string[]>([]);

const isUsingFilter =
search.trim() ||
selectedAgentPolicies.length ||
selectedStatus.length ||
showInactive ||
showUpgradeable;

const clearFilters = useCallback(() => {
setSearch('');
setSelectedAgentPolicies([]);
setSelectedStatus([]);
}, [setSearch, setSelectedAgentPolicies, setSelectedStatus]);
setShowInactive(false);
setShowUpgradeable(false);
}, [setSearch, setSelectedAgentPolicies, setSelectedStatus, setShowInactive, setShowUpgradeable]);

// Add a agent policy id to current search
const addAgentPolicyFilter = (policyId: string) => {
Expand Down Expand Up @@ -638,7 +648,7 @@ export const AgentListPage: React.FunctionComponent<{}> = () => {
id="xpack.ingestManager.agentList.loadingAgentsMessage"
defaultMessage="Loading agents…"
/>
) : search.trim() || selectedAgentPolicies.length || selectedStatus.length ? (
) : isUsingFilter ? (
<FormattedMessage
id="xpack.ingestManager.agentList.noFilteredAgentsPrompt"
defaultMessage="No agents found. {clearFiltersLink}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ class AgentPolicyService {
await this.triggerAgentPolicyUpdatedEvent(soClient, 'deleted', id);
return {
id,
name: agentPolicy.name,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,15 +286,15 @@ class PackagePolicyService {

for (const id of ids) {
try {
const oldPackagePolicy = await this.get(soClient, id);
if (!oldPackagePolicy) {
const packagePolicy = await this.get(soClient, id);
if (!packagePolicy) {
throw new Error('Package policy not found');
}
if (!options?.skipUnassignFromAgentPolicies) {
await agentPolicyService.unassignPackagePolicies(
soClient,
oldPackagePolicy.policy_id,
[oldPackagePolicy.id],
packagePolicy.policy_id,
[packagePolicy.id],
{
user: options?.user,
}
Expand All @@ -303,6 +303,7 @@ class PackagePolicyService {
await soClient.delete(SAVED_OBJECT_TYPE, id);
result.push({
id,
name: packagePolicy.name,
success: true,
});
} catch (e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
EuiLink,
EuiSelect,
EuiSpacer,
EuiSwitch,
EuiTitle,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
Expand Down Expand Up @@ -138,7 +139,7 @@ export const AdvancedStepForm: FC<CreateAnalyticsStepProps> = ({
const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = docLinks;

const { setEstimatedModelMemoryLimit, setFormState } = actions;
const { form, isJobCreated } = state;
const { form, isJobCreated, estimatedModelMemoryLimit } = state;
const {
computeFeatureInfluence,
eta,
Expand All @@ -159,6 +160,7 @@ export const AdvancedStepForm: FC<CreateAnalyticsStepProps> = ({
outlierFraction,
predictionFieldName,
randomizeSeed,
useEstimatedMml,
} = form;

const [numTopClassesOptions, setNumTopClassesOptions] = useState<EuiComboBoxOptionOption[]>([
Expand Down Expand Up @@ -204,7 +206,9 @@ export const AdvancedStepForm: FC<CreateAnalyticsStepProps> = ({
if (success) {
if (modelMemoryLimit !== expectedMemory) {
setEstimatedModelMemoryLimit(expectedMemory);
setFormState({ modelMemoryLimit: expectedMemory });
if (useEstimatedMml === true) {
setFormState({ modelMemoryLimit: expectedMemory });
}
}
} else {
// Check which field is invalid
Expand Down Expand Up @@ -481,18 +485,35 @@ export const AdvancedStepForm: FC<CreateAnalyticsStepProps> = ({
}
)}
>
<EuiFieldText
placeholder={
jobType !== undefined
? DEFAULT_MODEL_MEMORY_LIMIT[jobType]
: DEFAULT_MODEL_MEMORY_LIMIT.outlier_detection
}
disabled={isJobCreated}
value={modelMemoryLimit || ''}
onChange={(e) => setFormState({ modelMemoryLimit: e.target.value })}
isInvalid={modelMemoryLimitValidationResult !== null}
data-test-subj="mlAnalyticsCreateJobWizardModelMemoryInput"
/>
<>
<EuiFieldText
placeholder={
jobType !== undefined
? DEFAULT_MODEL_MEMORY_LIMIT[jobType]
: DEFAULT_MODEL_MEMORY_LIMIT.outlier_detection
}
disabled={isJobCreated || useEstimatedMml}
value={useEstimatedMml ? estimatedModelMemoryLimit : modelMemoryLimit || ''}
onChange={(e) => setFormState({ modelMemoryLimit: e.target.value })}
isInvalid={modelMemoryLimitValidationResult !== null}
data-test-subj="mlAnalyticsCreateJobWizardModelMemoryInput"
/>
<EuiSpacer size="s" />
<EuiSwitch
disabled={isJobCreated}
name="mlDataFrameAnalyticsUseEstimatedMml"
label={i18n.translate('xpack.ml.dataframe.analytics.create.useEstimatedMmlLabel', {
defaultMessage: 'Use estimated model memory limit',
})}
checked={useEstimatedMml === true}
onChange={() =>
setFormState({
useEstimatedMml: !useEstimatedMml,
})
}
data-test-subj="mlAnalyticsCreateJobWizardUseEstimatedMml"
/>
</>
</EuiFormRow>
</EuiFlexItem>
<EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export const ConfigurationStepForm: FC<CreateAnalyticsStepProps> = ({
requiredFieldsError,
sourceIndex,
trainingPercent,
useEstimatedMml,
} = form;

const toastNotifications = getToastNotifications();
Expand Down Expand Up @@ -164,7 +165,8 @@ export const ConfigurationStepForm: FC<CreateAnalyticsStepProps> = ({

const debouncedGetExplainData = debounce(async () => {
const jobTypeChanged = previousJobType !== jobType;
const shouldUpdateModelMemoryLimit = !firstUpdate.current || !modelMemoryLimit;
const shouldUpdateModelMemoryLimit =
(!firstUpdate.current || !modelMemoryLimit) && useEstimatedMml === true;
const shouldUpdateEstimatedMml =
!firstUpdate.current || !modelMemoryLimit || estimatedModelMemoryLimit === '';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export interface State {
sourceIndexFieldsCheckFailed: boolean;
standardizationEnabled: undefined | string;
trainingPercent: number;
useEstimatedMml: boolean;
};
disabled: boolean;
indexPatternsMap: SourceIndexMap;
Expand Down Expand Up @@ -161,6 +162,7 @@ export const getInitialState = (): State => ({
sourceIndexFieldsCheckFailed: false,
standardizationEnabled: 'true',
trainingPercent: 80,
useEstimatedMml: true,
},
jobConfig: {},
disabled:
Expand Down
Loading

0 comments on commit 86001cc

Please sign in to comment.