forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Enterprise Search] Refactor SchemaExistingField component to SchemaF…
…ieldTypeSelect (elastic#98955) * Refactor SchemaExistingField to just the select component - Removes unnecessary CSS, conditionals, etc. (letting AS & WS manage their own table/row views & styling) + Move to its own component folder for organization * Update WS to use new SchemaFieldTypeSelect component * Update SchemaAddFieldModal to dogfood SchemaFieldTypeSelect component - DRY's out fieldTypeSelectOptions to only having to exist within SchemaFieldTypeSelect * i18n cleanup Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
2236633
commit 8810e84
Showing
11 changed files
with
64 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...k/plugins/enterprise_search/public/applications/shared/schema/field_type_select/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* 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 from 'react'; | ||
|
||
import { EuiSelect } from '@elastic/eui'; | ||
|
||
import { SchemaType } from '../types'; | ||
|
||
interface Props { | ||
fieldName: string; | ||
fieldType: string; | ||
updateExistingFieldType(fieldName: string, fieldType: string): void; | ||
disabled?: boolean; | ||
} | ||
|
||
export const SchemaFieldTypeSelect: React.FC<Props> = ({ | ||
fieldName, | ||
fieldType, | ||
updateExistingFieldType, | ||
disabled, | ||
}) => { | ||
const fieldTypeOptions = Object.values(SchemaType).map((type) => ({ value: type, text: type })); | ||
return ( | ||
<EuiSelect | ||
name={fieldName} | ||
required | ||
value={fieldType} | ||
options={fieldTypeOptions} | ||
disabled={disabled} | ||
onChange={(e) => updateExistingFieldType(fieldName, e.target.value)} | ||
data-test-subj="SchemaSelect" | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 0 additions & 56 deletions
56
x-pack/plugins/enterprise_search/public/applications/shared/schema/schema_existing_field.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters