Skip to content

Commit

Permalink
Merge branch 'main' into fix-default-output-health
Browse files Browse the repository at this point in the history
  • Loading branch information
juliaElastic authored Mar 18, 2024
2 parents be523ed + 98c069f commit faa276a
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import type { EuiBasicTableColumn } from '@elastic/eui';
import { EuiButtonEmpty, EuiBadge, EuiText, EuiLoadingSpinner, EuiLink } from '@elastic/eui';
import React, { useMemo } from 'react';
import { RulesTableEmptyColumnName } from '../rules_table_empty_column_name';
import { SHOW_RELATED_INTEGRATIONS_SETTING } from '../../../../../../common/constants';
import { PopoverItems } from '../../../../../common/components/popover_items';
import { useUiSetting$ } from '../../../../../common/lib/kibana';
Expand Down Expand Up @@ -63,7 +64,7 @@ export const RULE_NAME_COLUMN: TableColumn = {

const TAGS_COLUMN: TableColumn = {
field: 'tags',
name: null,
name: <RulesTableEmptyColumnName name={i18n.COLUMN_TAGS} />,
align: 'center',
render: (tags: RuleResponse['tags']) => {
if (tags == null || tags.length === 0) {
Expand Down Expand Up @@ -92,7 +93,7 @@ const TAGS_COLUMN: TableColumn = {

const INTEGRATIONS_COLUMN: TableColumn = {
field: 'related_integrations',
name: null,
name: <RulesTableEmptyColumnName name={i18n.COLUMN_INTEGRATIONS} />,
align: 'center',
render: (integrations: RuleResponse['related_integrations']) => {
if (integrations == null || integrations.length === 0) {
Expand All @@ -111,7 +112,7 @@ const createInstallButtonColumn = (
isDisabled: boolean
): TableColumn => ({
field: 'rule_id',
name: '',
name: <RulesTableEmptyColumnName name={i18n.INSTALL_RULE_BUTTON} />,
render: (ruleId: RuleSignatureId, record: Rule) => {
const isRuleInstalling = loadingRules.includes(ruleId);
const isInstallButtonDisabled = isRuleInstalling || isDisabled;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import React, { type FC } from 'react';
import { EuiScreenReaderOnly } from '@elastic/eui';

interface RulesTableEmptyColumnNameProps {
name: string;
}

export const RulesTableEmptyColumnName: FC<RulesTableEmptyColumnNameProps> = React.memo(
({ name }) => {
return (
<EuiScreenReaderOnly>
<p>{name}</p>
</EuiScreenReaderOnly>
);
}
);

RulesTableEmptyColumnName.displayName = 'RulesTableEmptyColumnName';
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import type { EuiBasicTableColumn } from '@elastic/eui';
import { EuiBadge, EuiButtonEmpty, EuiLink, EuiLoadingSpinner, EuiText } from '@elastic/eui';
import React, { useMemo } from 'react';
import { RulesTableEmptyColumnName } from '../rules_table_empty_column_name';
import { SHOW_RELATED_INTEGRATIONS_SETTING } from '../../../../../../common/constants';
import type { RuleUpgradeInfoForReview } from '../../../../../../common/api/detection_engine/prebuilt_rules';
import type { RuleSignatureId } from '../../../../../../common/api/detection_engine/model/rule_schema';
Expand Down Expand Up @@ -62,7 +63,7 @@ const RULE_NAME_COLUMN: TableColumn = {

const TAGS_COLUMN: TableColumn = {
field: 'current_rule.tags',
name: null,
name: <RulesTableEmptyColumnName name={i18n.COLUMN_TAGS} />,
align: 'center',
render: (tags: Rule['tags']) => {
if (tags == null || tags.length === 0) {
Expand Down Expand Up @@ -91,7 +92,7 @@ const TAGS_COLUMN: TableColumn = {

const INTEGRATIONS_COLUMN: TableColumn = {
field: 'current_rule.related_integrations',
name: null,
name: <RulesTableEmptyColumnName name={i18n.COLUMN_INTEGRATIONS} />,
align: 'center',
render: (integrations: Rule['related_integrations']) => {
if (integrations == null || integrations.length === 0) {
Expand All @@ -110,7 +111,7 @@ const createUpgradeButtonColumn = (
isDisabled: boolean
): TableColumn => ({
field: 'rule_id',
name: '',
name: <RulesTableEmptyColumnName name={i18n.UPDATE_RULE_BUTTON} />,
render: (ruleId: RuleUpgradeInfoForReview['rule_id']) => {
const isRuleUpgrading = loadingRules.includes(ruleId);
const isUpgradeButtonDisabled = isRuleUpgrading || isDisabled;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { EuiBadge, EuiFlexGroup, EuiFlexItem, EuiLink, EuiText, EuiToolTip } fro
import { FormattedMessage } from '@kbn/i18n-react';
import moment from 'moment';
import React, { useMemo } from 'react';
import { RulesTableEmptyColumnName } from './rules_table_empty_column_name';
import type { SecurityJob } from '../../../../common/components/ml_popover/types';
import {
DEFAULT_RELATIVE_DATE_THRESHOLD,
Expand Down Expand Up @@ -188,7 +189,7 @@ const useRuleExecutionStatusColumn = ({

const TAGS_COLUMN: TableColumn = {
field: 'tags',
name: null,
name: <RulesTableEmptyColumnName name={i18n.COLUMN_TAGS} />,
align: 'center',
render: (tags: Rule['tags']) => {
if (tags == null || tags.length === 0) {
Expand Down Expand Up @@ -217,7 +218,7 @@ const TAGS_COLUMN: TableColumn = {

const INTEGRATIONS_COLUMN: TableColumn = {
field: 'related_integrations',
name: null,
name: <RulesTableEmptyColumnName name={i18n.COLUMN_INTEGRATIONS} />,
align: 'center',
render: (integrations: Rule['related_integrations']) => {
if (integrations == null || integrations.length === 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,13 @@ export const COLUMN_TAGS = i18n.translate(
}
);

export const COLUMN_INTEGRATIONS = i18n.translate(
'xpack.securitySolution.detectionEngine.rules.allRules.columns.integrationsTitle',
{
defaultMessage: 'Integrations',
}
);

export const COLUMN_ENABLE = i18n.translate(
'xpack.securitySolution.detectionEngine.rules.allRules.columns.enabledTitle',
{
Expand Down

0 comments on commit faa276a

Please sign in to comment.