Skip to content

Commit

Permalink
Merge branch 'main' into 162768-update-rule-creation-form-design-thre…
Browse files Browse the repository at this point in the history
…shold-rule
  • Loading branch information
fkanout authored Aug 10, 2023
2 parents 446f35d + 7353dc6 commit d128231
Show file tree
Hide file tree
Showing 12 changed files with 111 additions and 104 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export default function ({ getService }: PluginFunctionalProviderContext) {
'xpack.graph.savePolicy (alternatives)',
'xpack.ilm.ui.enabled (boolean)',
'xpack.index_management.ui.enabled (boolean)',
'xpack.index_management.enableIndexActions (boolean)',
'xpack.index_management.enableIndexActions (any)',
'xpack.infra.sources.default.fields.message (array)',
/**
* xpack.infra.logs is conditional and will resolve to an object of properties
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/fleet/cypress/screens/fleet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ export const SETTINGS_OUTPUTS = {
NAME_INPUT: 'settingsOutputsFlyout.nameInput',
TYPE_INPUT: 'settingsOutputsFlyout.typeInput',
ADD_HOST_ROW_BTN: 'fleetServerHosts.multiRowInput.addRowButton',
WARNING_KAFKA_CALLOUT: 'settingsOutputsFlyout.kafkaOutputTypeCallout',
WARNING_ELASTICSEARCH_CALLOUT: 'settingsOutputsFlyout.elasticsearchOutputTypeCallout',
};

export const getSpecificSelectorId = (selector: string, id: number) => {
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/fleet/cypress/screens/fleet_outputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const selectKafkaOutput = () => {
visit('/app/fleet/settings');
cy.getBySel(SETTINGS_OUTPUTS.ADD_BTN).click();
cy.getBySel(SETTINGS_OUTPUTS.TYPE_INPUT).select('kafka');
cy.getBySel(SETTINGS_OUTPUTS.WARNING_KAFKA_CALLOUT);
cy.getBySel(SETTINGS_OUTPUTS_KAFKA.AUTHENTICATION_USERNAME_PASSWORD_OPTION).click();
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ export const EditOutputFlyout: React.FunctionComponent<EditOutputFlyoutProps> =
[proxies]
);

const isESOutput = inputs.typeInput.value === outputType.Elasticsearch;
const { kafkaOutput: isKafkaOutputEnabled } = ExperimentalFeaturesService.get();

const OUTPUT_TYPE_OPTIONS = [
Expand Down Expand Up @@ -249,6 +248,43 @@ export const EditOutputFlyout: React.FunctionComponent<EditOutputFlyoutProps> =
}
};

const renderTypeSpecificWarning = () => {
const isESOutput = inputs.typeInput.value === outputType.Elasticsearch;
const isKafkaOutput = inputs.typeInput.value === outputType.Kafka;
if (!isKafkaOutput && !isESOutput) {
return null;
}

const generateWarningMessage = () => {
switch (inputs.typeInput.value) {
case outputType.Kafka:
return i18n.translate('xpack.fleet.settings.editOutputFlyout.kafkaOutputTypeCallout', {
defaultMessage:
'Kafka output is currently not supported on Agents using the Elastic Defend integration.',
});
default:
case outputType.Elasticsearch:
return i18n.translate('xpack.fleet.settings.editOutputFlyout.esOutputTypeCallout', {
defaultMessage:
'This output type currently does not support connectivity to a remote Elasticsearch cluster.',
});
}
};
return (
<>
<EuiSpacer size="xs" />
<EuiCallOut
data-test-subj={`settingsOutputsFlyout.${inputs.typeInput.value}OutputTypeCallout`}
title={generateWarningMessage()}
iconType="alert"
color="warning"
size="s"
heading="p"
/>
</>
);
};

return (
<EuiFlyout maxWidth={FLYOUT_MAX_WIDTH} onClose={onClose}>
<EuiFlyoutHeader hasBorder={true}>
Expand Down Expand Up @@ -350,24 +386,7 @@ export const EditOutputFlyout: React.FunctionComponent<EditOutputFlyoutProps> =
}
)}
/>
{isESOutput && (
<>
<EuiSpacer size="xs" />
<EuiCallOut
title={i18n.translate(
'xpack.fleet.settings.editOutputFlyout.esOutputTypeCallout',
{
defaultMessage:
'This output type currently does not support connectivity to a remote Elasticsearch cluster.',
}
)}
iconType="alert"
color="warning"
size="s"
heading="p"
/>
</>
)}
{renderTypeSpecificWarning()}
</>
</EuiFormRow>

Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/fleet/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ export const config: PluginConfigDescriptor = {
disableRegistryVersionCheck: schema.boolean({ defaultValue: false }),
allowAgentUpgradeSourceUri: schema.boolean({ defaultValue: false }),
bundledPackageLocation: schema.string({ defaultValue: DEFAULT_BUNDLED_PACKAGE_LOCATION }),
testSecretsIndex: schema.maybe(schema.string()),
}),
packageVerification: schema.object({
gpgKeyPath: schema.string({ defaultValue: DEFAULT_GPG_KEY_PATH }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ export async function installKibanaSavedObjects({
readStream: createListStream(toBeSavedObjects),
createNewCopies: false,
refresh: false,
managed: true,
})
);

Expand Down Expand Up @@ -371,6 +372,7 @@ export async function installKibanaSavedObjects({
await savedObjectsImporter.resolveImportErrors({
readStream: createListStream(toBeSavedObjects),
createNewCopies: false,
managed: true,
retries,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export async function mountManagementSection(
extensionsService: ExtensionsService,
isFleetEnabled: boolean,
kibanaVersion: SemVer,
enableIndexActions: boolean
enableIndexActions: boolean = true
) {
const { element, setBreadcrumbs, history, theme$ } = params;
const [core, startDependencies] = await coreSetup.getStartServices();
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/index_management/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ export interface ClientConfigType {
ui: {
enabled: boolean;
};
enableIndexActions: boolean;
enableIndexActions?: boolean;
}
9 changes: 8 additions & 1 deletion x-pack/plugins/index_management/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@ const schemaLatest = schema.object(
ui: schema.object({
enabled: schema.boolean({ defaultValue: true }),
}),
enableIndexActions: schema.boolean({ defaultValue: true }),
enableIndexActions: schema.conditional(
schema.contextRef('serverless'),
true,
// Index actions are disabled in serverless; refer to the serverless.yml file as the source of truth
// We take this approach in order to have a central place (serverless.yml) for serverless config across Kibana
schema.boolean({ defaultValue: true }),
schema.never()
),
},
{ defaultValue: undefined }
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,61 +437,75 @@ const expectAssetsInstalled = ({
id: 'sample_dashboard',
});
expect(resDashboard.id).equal('sample_dashboard');
expect(resDashboard.managed).be(true);
expect(resDashboard.references.map((ref: any) => ref.id).includes('sample_tag')).equal(true);
const resDashboard2 = await kibanaServer.savedObjects.get({
type: 'dashboard',
id: 'sample_dashboard2',
});
expect(resDashboard2.id).equal('sample_dashboard2');
expect(resDashboard2.managed).be(true);
const resVis = await kibanaServer.savedObjects.get({
type: 'visualization',
id: 'sample_visualization',
});

expect(resVis.id).equal('sample_visualization');
expect(resVis.managed).be(true);
const resSearch = await kibanaServer.savedObjects.get({
type: 'search',
id: 'sample_search',
});
expect(resSearch.id).equal('sample_search');
expect(resSearch.managed).be(true);
const resLens = await kibanaServer.savedObjects.get({
type: 'lens',
id: 'sample_lens',
});

expect(resLens.id).equal('sample_lens');
expect(resLens.managed).be(true);
const resMlModule = await kibanaServer.savedObjects.get({
type: 'ml-module',
id: 'sample_ml_module',
});
expect(resMlModule.id).equal('sample_ml_module');
expect(resMlModule.managed).be(true);
const resSecurityRule = await kibanaServer.savedObjects.get({
type: 'security-rule',
id: 'sample_security_rule',
});
expect(resSecurityRule.id).equal('sample_security_rule');
expect(resSecurityRule.managed).be(true);
const resOsqueryPackAsset = await kibanaServer.savedObjects.get({
type: 'osquery-pack-asset',
id: 'sample_osquery_pack_asset',
});
expect(resOsqueryPackAsset.id).equal('sample_osquery_pack_asset');
expect(resOsqueryPackAsset.managed).be(true);
const resOsquerySavedObject = await kibanaServer.savedObjects.get({
type: 'osquery-saved-query',
id: 'sample_osquery_saved_query',
});
expect(resOsquerySavedObject.id).equal('sample_osquery_saved_query');
expect(resOsquerySavedObject.managed).be(true);
const resCloudSecurityPostureRuleTemplate = await kibanaServer.savedObjects.get({
type: 'csp-rule-template',
id: 'sample_csp_rule_template',
});
expect(resCloudSecurityPostureRuleTemplate.id).equal('sample_csp_rule_template');
expect(resCloudSecurityPostureRuleTemplate.managed).be(true);
const resTag = await kibanaServer.savedObjects.get({
type: 'tag',
id: 'sample_tag',
});
expect(resTag.managed).be(true);
expect(resTag.id).equal('sample_tag');
const resIndexPattern = await kibanaServer.savedObjects.get({
type: 'index-pattern',
id: 'test-*',
});
expect(resIndexPattern.managed).be(true);
expect(resIndexPattern.id).equal('test-*');

let resInvalidTypeIndexPattern;
Expand Down
Loading

0 comments on commit d128231

Please sign in to comment.