Skip to content

Commit

Permalink
Move types out of AttributeSelector component to shared types
Browse files Browse the repository at this point in the history
  • Loading branch information
scottybollinger committed Mar 10, 2021
1 parent b4672cf commit 4033d16
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import { shallow, ShallowWrapper } from 'enzyme';

import { EuiComboBox, EuiFieldText } from '@elastic/eui';

import { AttributeSelector, AttributeName } from './attribute_selector';
import { AttributeName } from '../types';

import { AttributeSelector } from './attribute_selector';
import { ANY_AUTH_PROVIDER, ANY_AUTH_PROVIDER_OPTION_LABEL } from './constants';

const handleAttributeSelectorChange = jest.fn();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import {
EuiTitle,
} from '@elastic/eui';

import { AttributeName, AttributeExamples } from '../types';

import {
ANY_AUTH_PROVIDER,
ANY_AUTH_PROVIDER_OPTION_LABEL,
Expand All @@ -31,8 +33,6 @@ import {
ATTRIBUTE_VALUE_LABEL,
} from './constants';

export type AttributeName = keyof AttributeExamples | 'role';

interface Props {
attributeName: AttributeName;
attributeValue?: string;
Expand All @@ -47,12 +47,6 @@ interface Props {
handleAuthProviderChange?(value: string[]): void;
}

interface AttributeExamples {
username: string;
email: string;
metadata: string;
}

interface ParentOption extends EuiComboBoxOptionOption<string> {
label: string;
options: ChildOption[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,17 @@ export interface RoleRules {
metadata?: string;
}

export interface AttributeExamples {
username: string;
email: string;
metadata: string;
}

export type AttributeName = keyof AttributeExamples | 'role';

export interface RoleMapping {
id: string;
attributeName: string;
attributeName: AttributeName;
attributeValue: string;
authProvider: string[];
roleType: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { kea, MakeLogicType } from 'kea';
import { clearFlashMessages, flashAPIErrors } from '../../../shared/flash_messages';
import { HttpLogic } from '../../../shared/http';
import { KibanaLogic } from '../../../shared/kibana';
import { AttributeName } from '../../../shared/role_mapping/attribute_selector';
import { ANY_AUTH_PROVIDER } from '../../../shared/role_mapping/constants';
import { AttributeName } from '../../../shared/types';
import { ROLE_MAPPINGS_PATH } from '../../routes';
import { RoleGroup, WSRoleMapping, Role } from '../../types';

Expand Down

0 comments on commit 4033d16

Please sign in to comment.