Skip to content

Commit

Permalink
this
Browse files Browse the repository at this point in the history
  • Loading branch information
oatkiller authored and parkiino committed Apr 7, 2020
1 parent e11e19f commit 43c6a10
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ export const generatePolicy = (): PolicyConfig => {
mac: {
events: {
process: true,
// TODO, is this right?
file: true,
// TODO, is this right?
network: true,
},
malware: {
mode: ProtectionModes.detect,
Expand All @@ -67,6 +71,10 @@ export const generatePolicy = (): PolicyConfig => {
linux: {
events: {
process: true,
// TODO, is this right?
file: true,
// TODO, is this right?
network: true,
},
logging: {
stdout: 'debug',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ export interface UIPolicyConfig {
mac: MacPolicyConfig;
linux: LinuxPolicyConfig;
}
export type nerds<t extends keyof UIPolicyConfig> = keyof UIPolicyConfig[t]['events'];

/** OS used in Policy */
export enum OS {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useDispatch } from 'react-redux';
import { usePolicyDetailsSelector } from '../../policy_hooks';
import { policyConfig, windowsEventing } from '../../../../store/policy_details/selectors';
import { PolicyDetailsAction } from '../../../../store/policy_details';
import { OS, UIPolicyConfig, nerds } from '../../../../types';
import { UIPolicyConfig } from '../../../../types';
import { clone } from '../../../../models/policy_details_config';

export const EventingCheckbox = React.memo(function<T extends keyof UIPolicyConfig>({
Expand All @@ -22,7 +22,7 @@ export const EventingCheckbox = React.memo(function<T extends keyof UIPolicyConf
id: string;
name: string;
os: T;
protectionField: nerds<T>;
protectionField: keyof UIPolicyConfig[T]['events'];
}) {
const policyDetailsConfig = usePolicyDetailsSelector(policyConfig);
const eventing = usePolicyDetailsSelector(windowsEventing);
Expand All @@ -31,7 +31,7 @@ export const EventingCheckbox = React.memo(function<T extends keyof UIPolicyConf
const handleCheckboxChange = useCallback(
(event: React.ChangeEvent<HTMLInputElement>) => {
if (policyDetailsConfig) {
const newPayload = clone(policyDetailsConfig);
const newPayload: UIPolicyConfig = clone(policyDetailsConfig);
newPayload[os].events[protectionField] = event.target.checked;

dispatch({
Expand Down

0 comments on commit 43c6a10

Please sign in to comment.