Skip to content

Commit

Permalink
use data-test-subj in form cards
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-tavares committed Jul 8, 2023
1 parent 6994b9d commit 199790b
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { OperatingSystem } from '@kbn/securitysolution-utils';
import { i18n } from '@kbn/i18n';
import { EuiSpacer, EuiSwitch, EuiText } from '@elastic/eui';
import { cloneDeep } from 'lodash';
import { useTestIdGenerator } from '../../../../../../hooks/use_test_id_generator';
import { SettingCard } from '../setting_card';
import type { PolicyFormComponentCommonProps } from '../../types';

Expand Down Expand Up @@ -47,6 +48,7 @@ type AntivirusRegistrationCardProps = PolicyFormComponentCommonProps;

export const AntivirusRegistrationCard = memo<AntivirusRegistrationCardProps>(
({ policy, onChange, mode, 'data-test-subj': dataTestSubj }) => {
const getTestId = useTestIdGenerator(dataTestSubj);
const isChecked = policy.windows.antivirus_registration.enabled;
const isEditMode = mode === 'edit';
const label = isChecked ? REGISTERED_LABEL : NOT_REGISTERED_LABEL;
Expand All @@ -65,7 +67,7 @@ export const AntivirusRegistrationCard = memo<AntivirusRegistrationCardProps>(
<SettingCard
type={CARD_TITLE}
supportedOss={[OperatingSystem.WINDOWS]}
dataTestSubj="antivirusRegistrationForm"
dataTestSubj={getTestId()}
osRestriction={i18n.translate(
'xpack.securitySolution.endpoint.policy.details.av.windowsServerNotSupported',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { OperatingSystem } from '@kbn/securitysolution-utils';
import { EuiSwitch } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { cloneDeep } from 'lodash';
import { useTestIdGenerator } from '../../../../../../hooks/use_test_id_generator';
import { useLicense } from '../../../../../../../common/hooks/use_license';
import { SettingLockedCard } from '../setting_locked_card';
import type { PolicyFormComponentCommonProps } from '../../types';
Expand Down Expand Up @@ -48,8 +49,9 @@ const SWITCH_DISABLED_LABEL = i18n.translate(
type AttackSurfaceReductionCardProps = PolicyFormComponentCommonProps;

export const AttackSurfaceReductionCard = memo<AttackSurfaceReductionCardProps>(
({ policy, onChange, mode }) => {
({ policy, onChange, mode, 'data-test-subj': dataTestSubj }) => {
const isPlatinumPlus = useLicense().isPlatinumPlus();
const getTestId = useTestIdGenerator(dataTestSubj);
const isChecked = policy.windows.attack_surface_reduction.credential_hardening.enabled;
const isEditMode = mode === 'edit';
const label = isChecked ? SWITCH_ENABLED_LABEL : SWITCH_DISABLED_LABEL;
Expand All @@ -71,7 +73,11 @@ export const AttackSurfaceReductionCard = memo<AttackSurfaceReductionCardProps>(
}

return (
<SettingCard type={CARD_TITLE} supportedOss={ATTACK_SURFACE_OS_LIST}>
<SettingCard
type={CARD_TITLE}
supportedOss={ATTACK_SURFACE_OS_LIST}
dataTestSubj={getTestId()}
>
{isEditMode ? (
<EuiSwitch label={label} checked={isChecked} onChange={handleSwitchChange} />
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { i18n } from '@kbn/i18n';
import { OperatingSystem } from '@kbn/securitysolution-utils';
import { EuiCallOut, EuiSpacer } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { useTestIdGenerator } from '../../../../../../hooks/use_test_id_generator';
import { SettingCard } from '../setting_card';
import { NotifyUserOption } from '../notify_user_option';
import { DetectPreventProtectionLevel } from '../detect_prevent_protection_lavel';
Expand Down Expand Up @@ -39,8 +40,9 @@ const BEHAVIOUR_OS_VALUES: Immutable<BehaviorProtectionOSes[]> = [
type BehaviourProtectionCardProps = PolicyFormComponentCommonProps;

export const BehaviourProtectionCard = memo<BehaviourProtectionCardProps>(
({ policy, onChange, mode }) => {
({ policy, onChange, mode, 'data-test-subj': dataTestSubj }) => {
const isPlatinumPlus = useLicense().isPlatinumPlus();
const getTestId = useTestIdGenerator(dataTestSubj);
const protection = 'behavior_protection';
const protectionLabel = i18n.translate(
'xpack.securitySolution.endpoint.policy.protections.behavior',
Expand All @@ -59,7 +61,7 @@ export const BehaviourProtectionCard = memo<BehaviourProtectionCardProps>(
defaultMessage: 'Malicious behavior',
})}
supportedOss={[OperatingSystem.WINDOWS, OperatingSystem.MAC, OperatingSystem.LINUX]}
dataTestSubj="behaviorProtectionsForm"
dataTestSubj={getTestId()}
rightCorner={
<ProtectionSettingCardSwitch
policy={policy}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const MalwareProtectionsCard = React.memo<MalwareProtectionsProps>(
defaultMessage: 'Malware',
})}
supportedOss={[OperatingSystem.WINDOWS, OperatingSystem.MAC, OperatingSystem.LINUX]}
dataTestSubj={getTestId('card')}
dataTestSubj={getTestId()}
rightCorner={
<ProtectionSettingCardSwitch
protection={protection}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { i18n } from '@kbn/i18n';
import { OperatingSystem } from '@kbn/securitysolution-utils';
import { EuiCallOut, EuiSpacer } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { useTestIdGenerator } from '../../../../../../hooks/use_test_id_generator';
import { NotifyUserOption } from '../notify_user_option';
import { DetectPreventProtectionLevel } from '../detect_prevent_protection_lavel';
import { ProtectionSettingCardSwitch } from '../protection_setting_card_switch';
Expand Down Expand Up @@ -39,8 +40,9 @@ const MEMORY_PROTECTION_OS_VALUES: Immutable<MemoryProtectionOSes[]> = [
type MemoryProtectionCardProps = PolicyFormComponentCommonProps;

export const MemoryProtectionCard = memo<MemoryProtectionCardProps>(
({ policy, onChange, mode }) => {
({ policy, onChange, mode, 'data-test-subj': dataTestSubj }) => {
const isPlatinumPlus = useLicense().isPlatinumPlus();
const getTestId = useTestIdGenerator(dataTestSubj);
const protection = 'memory_protection';
const protectionLabel = i18n.translate(
'xpack.securitySolution.endpoint.policy.protections.memory',
Expand All @@ -59,7 +61,7 @@ export const MemoryProtectionCard = memo<MemoryProtectionCardProps>(
defaultMessage: 'Memory threat',
})}
supportedOss={[OperatingSystem.WINDOWS, OperatingSystem.MAC, OperatingSystem.LINUX]}
dataTestSubj="memoryProtectionsForm"
dataTestSubj={getTestId()}
rightCorner={
<ProtectionSettingCardSwitch
policy={policy}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { i18n } from '@kbn/i18n';
import { OperatingSystem } from '@kbn/securitysolution-utils';
import { EuiCallOut, EuiSpacer } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { useTestIdGenerator } from '../../../../../../hooks/use_test_id_generator';
import { ProtectionSettingCardSwitch } from '../protection_setting_card_switch';
import { NotifyUserOption } from '../notify_user_option';
import { DetectPreventProtectionLevel } from '../detect_prevent_protection_lavel';
Expand Down Expand Up @@ -37,8 +38,9 @@ const LOCKED_CARD_RAMSOMWARE_TITLE = i18n.translate(
type RansomwareProtectionCardProps = PolicyFormComponentCommonProps;

export const RansomwareProtectionCard = React.memo<RansomwareProtectionCardProps>(
({ policy, onChange, mode }) => {
({ policy, onChange, mode, 'data-test-subj': dataTestSubj }) => {
const isPlatinumPlus = useLicense().isPlatinumPlus();
const getTestId = useTestIdGenerator(dataTestSubj);
const protection = 'ransomware';
const protectionLabel = i18n.translate(
'xpack.securitySolution.endpoint.policy.protections.ransomware',
Expand All @@ -57,7 +59,7 @@ export const RansomwareProtectionCard = React.memo<RansomwareProtectionCardProps
defaultMessage: 'Ransomware',
})}
supportedOss={[OperatingSystem.WINDOWS]}
dataTestSubj="ransomwareProtectionsForm"
dataTestSubj={getTestId()}
rightCorner={
<ProtectionSettingCardSwitch
policy={policy}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const DO_NOT_NOTIFY_USER_CHECKBOX_LABEL = i18n.translate(
);

const NOTIFICATION_MESSAGE_LABEL = i18n.translate(
'xpack.securitySolution.endpoint.policyDetailsConfig.customizeUserNotification',
'xpack.securitySolution.endpoint.policyDetailsConfig.notificationMessage',
{
defaultMessage: 'Notification message',
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const PolicySettingsForm = memo<PolicySettingsFormProps>((props) => {
<MalwareProtectionsCard {...props} data-test-subj={getTestId('malware')} />
<EuiSpacer size="l" />

<RansomwareProtectionCard {...props} data-test-subj={getTestId('malware')} />
<RansomwareProtectionCard {...props} data-test-subj={getTestId('ransomware')} />
<EuiSpacer size="l" />

<MemoryProtectionCard {...props} data-test-subj={getTestId('memory')} />
Expand Down
7 changes: 0 additions & 7 deletions x-pack/plugins/translations/translations/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -28971,7 +28971,6 @@
"xpack.securitySolution.endpoint.list.totalCount": "Affichage de {totalItemCount, plural, one {# point de terminaison} many {# points de terminaison} other {# points de terminaison}}",
"xpack.securitySolution.endpoint.list.totalCount.limited": "Affichage de {limit} sur {totalItemCount, plural, one {# point de terminaison} many {# points de terminaison} other {# points de terminaison}}",
"xpack.securitySolution.endpoint.list.transformFailed.message": "Une transformation requise, {transformId}, est actuellement en échec. La plupart du temps, ce problème peut être corrigé par {transformsPage}. Pour une assistance supplémentaire, veuillez visitez la {docsPage}",
"xpack.securitySolution.endpoint.policy.advanced.show": "Paramètres avancés pour {action}",
"xpack.securitySolution.endpoint.policy.artifacts.empty.unassigned.backButtonLabel": "Retour à la politique {policyName}",
"xpack.securitySolution.endpoint.policy.artifacts.empty.unassigned.content": "Aucun artefact n'est actuellement affecté à {policyName}. Affectez des artefacts maintenant, ou ajoutez-les et gérez-les sur la page des artefacts.",
"xpack.securitySolution.endpoint.policy.artifacts.empty.unassigned.noPrivileges.content": "Aucun artefact n'est actuellement affecté à {policyName}.",
Expand Down Expand Up @@ -31606,7 +31605,6 @@
"xpack.securitySolution.endpoint.policy.blocklist.list.search.placeholder": "Rechercher sur les champs ci-dessous : nom, description, valeur",
"xpack.securitySolution.endpoint.policy.details.antivirusRegistration.explanation": "Activez la bascule pour enregistrer Elastic comme solution d'antivirus officielle pour le système d'exploitation Windows. Cela désactivera également Windows Defender.",
"xpack.securitySolution.endpoint.policy.details.antivirusRegistration.osRestriction": "Restrictions",
"xpack.securitySolution.endpoint.policy.details.antivirusRegistration.toggle": "Enregistrer comme antivirus",
"xpack.securitySolution.endpoint.policy.details.antivirusRegistration.type": "Enregistrer comme antivirus",
"xpack.securitySolution.endpoint.policy.details.attack_surface_reduction": "Réduction de la surface d’attaque",
"xpack.securitySolution.endpoint.policy.details.attackSurfaceReduction.type": "Réduction de la surface d’attaque",
Expand All @@ -31616,7 +31614,6 @@
"xpack.securitySolution.endpoint.policy.details.behavior_protection": "Comportement malveillant",
"xpack.securitySolution.endpoint.policy.details.cancel": "Annuler",
"xpack.securitySolution.endpoint.policy.details.cloudDeploymentLInk": "déploiement sur le cloud",
"xpack.securitySolution.endpoint.policy.details.credentialHardening.toggle": "Renforcement de l’identification",
"xpack.securitySolution.endpoint.policy.details.detect": "Détecter",
"xpack.securitySolution.endpoint.policy.details.detectionRulesLink": "règles de détection associées",
"xpack.securitySolution.endpoint.policy.details.eventCollection": "Collection d'événements",
Expand Down Expand Up @@ -31684,7 +31681,6 @@
"xpack.securitySolution.endpoint.policy.multiStepOnboarding.learnMore": "En savoir plus",
"xpack.securitySolution.endpoint.policy.multiStepOnboarding.title": "Nous enregistrerons votre intégration avec nos valeurs par défaut recommandées.",
"xpack.securitySolution.endpoint.policy.protections.behavior": "Protections contre les comportements malveillants",
"xpack.securitySolution.endpoint.policy.protections.blocklist": "Liste noire activée",
"xpack.securitySolution.endpoint.policy.protections.malware": "Protections contre les malware",
"xpack.securitySolution.endpoint.policy.protections.memory": "Protections de la mémoire contre les menaces",
"xpack.securitySolution.endpoint.policy.protections.ransomware": "Protections contre les ransomware",
Expand Down Expand Up @@ -31717,7 +31713,6 @@
"xpack.securitySolution.endpoint.policyDetails.agentsSummary.onlineTitle": "Intègre",
"xpack.securitySolution.endpoint.policyDetails.agentsSummary.totalTitle": "Total des agents",
"xpack.securitySolution.endpoint.policyDetails.artifacts.title": "Artefacts",
"xpack.securitySolution.endpoint.policyDetails.loadError": "Impossible de charger les paramètres de la politique des points de terminaison",
"xpack.securitySolution.endpoint.policyDetails.settings.title": "Paramètres de politique",
"xpack.securitySolution.endpoint.policyDetails.userNotification.placeholder": "Saisir votre message de notification personnalisé",
"xpack.securitySolution.endpoint.policyDetailsConfig.blocklistTooltip": "Active ou désactive la liste noire associée à cette politique. La liste noire est une collection de hachages, de chemins ou de signataires qui étend la liste de processus considérés comme malveillants par le point de terminaison. Consultez l'onglet de la liste noire pour plus de détails sur l'entrée.",
Expand All @@ -31726,10 +31721,8 @@
"xpack.securitySolution.endpoint.policyDetailsConfig.linux.events.file": "Fichier",
"xpack.securitySolution.endpoint.policyDetailsConfig.linux.events.network": "Réseau",
"xpack.securitySolution.endpoint.policyDetailsConfig.linux.events.process": "Processus",
"xpack.securitySolution.endpoint.policyDetailsConfig.linux.events.session_data": "Collecter les données de session",
"xpack.securitySolution.endpoint.policyDetailsConfig.linux.events.session_data.description": "Activez cette option pour capturer les données de processus étendues requises pour la vue de session. La vue de session vous fournit une représentation visuelle des données de session et d'exécution du processus. Les données de la vue de session sont organisées en fonction du modèle de processus Linux pour vous aider à examiner l'activité des processus, des utilisateurs et des services dans votre infrastructure Linux.",
"xpack.securitySolution.endpoint.policyDetailsConfig.linux.events.session_data.title": "Données de session",
"xpack.securitySolution.endpoint.policyDetailsConfig.linux.events.tty_io": "Capturer la sortie du terminal",
"xpack.securitySolution.endpoint.policyDetailsConfig.linux.events.tty_io.tooltip": "Activez cette option pour collecter la sortie du terminal (tty). La sortie du terminal apparaît dans la vue de session, et vous pouvez l'afficher séparément pour voir quelles commandes ont été exécutées et comment elles ont été tapées, à condition que le terminal soit en mode écho. Fonctionne uniquement sur les hôtes qui prennent en charge ebpf.",
"xpack.securitySolution.endpoint.policyDetailsConfig.mac.events.file": "Fichier",
"xpack.securitySolution.endpoint.policyDetailsConfig.mac.events.network": "Réseau",
Expand Down
Loading

0 comments on commit 199790b

Please sign in to comment.