mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
parent
835812fb26
commit
dbd3532149
4 changed files with 6 additions and 9 deletions
|
@ -19,7 +19,6 @@ export const entry = t.union([
|
|||
entriesMatchAny,
|
||||
entriesList,
|
||||
entriesExists,
|
||||
entriesNested,
|
||||
entriesMatchWildcard,
|
||||
]);
|
||||
export type Entry = t.TypeOf<typeof entry>;
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import { TypeOf } from '@kbn/config-schema';
|
||||
import { ApplicationStart } from 'kibana/public';
|
||||
|
||||
import { Entry } from '../../../../lists/common/schemas/types/entries';
|
||||
import {
|
||||
DeleteTrustedAppsRequestSchema,
|
||||
GetOneTrustedAppRequestSchema,
|
||||
|
@ -76,9 +75,10 @@ export enum OperatorFieldIds {
|
|||
matches = 'matches',
|
||||
}
|
||||
|
||||
export type TrustedAppEntryTypes = 'match' | 'wildcard';
|
||||
export interface ConditionEntry<T extends ConditionEntryField = ConditionEntryField> {
|
||||
field: T;
|
||||
type: Entry['type'];
|
||||
type: TrustedAppEntryTypes;
|
||||
operator: 'included';
|
||||
value: string;
|
||||
}
|
||||
|
|
|
@ -423,9 +423,7 @@ describe('mapping', () => {
|
|||
updated_at: '11/11/2011T11:11:11.111',
|
||||
updated_by: 'admin',
|
||||
os: OperatingSystem.WINDOWS,
|
||||
entries: [
|
||||
createConditionEntry(ConditionEntryField.SIGNER, 'nested', 'Microsoft Windows'),
|
||||
],
|
||||
entries: [createConditionEntry(ConditionEntryField.SIGNER, 'match', 'Microsoft Windows')],
|
||||
}
|
||||
);
|
||||
});
|
||||
|
|
|
@ -9,7 +9,6 @@ import uuid from 'uuid';
|
|||
|
||||
import { OsType } from '../../../../../lists/common/schemas';
|
||||
import {
|
||||
Entry,
|
||||
EntriesArray,
|
||||
EntryMatch,
|
||||
EntryMatchWildcard,
|
||||
|
@ -30,6 +29,7 @@ import {
|
|||
OperatingSystem,
|
||||
TrustedApp,
|
||||
UpdateTrustedApp,
|
||||
TrustedAppEntryTypes,
|
||||
} from '../../../../common/endpoint/types';
|
||||
|
||||
type ConditionEntriesMap = { [K in ConditionEntryField]?: ConditionEntry<K> };
|
||||
|
@ -56,7 +56,7 @@ const filterUndefined = <T>(list: Array<T | undefined>): T[] => {
|
|||
|
||||
export const createConditionEntry = <T extends ConditionEntryField>(
|
||||
field: T,
|
||||
type: Entry['type'],
|
||||
type: TrustedAppEntryTypes,
|
||||
value: string
|
||||
): ConditionEntry<T> => {
|
||||
return { field, value, type, operator: OPERATOR_VALUE };
|
||||
|
@ -110,7 +110,7 @@ export const entriesToConditionEntriesMap = (entries: EntriesArray): ConditionEn
|
|||
...result,
|
||||
[ConditionEntryField.SIGNER]: createConditionEntry(
|
||||
ConditionEntryField.SIGNER,
|
||||
entry.type,
|
||||
subjectNameCondition.type,
|
||||
subjectNameCondition.value
|
||||
),
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue