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.
Standardizing IconField implementation across the app (elastic#47196)
* Moving FieldNameIcon implementation to FieldIcon implementation in kibana_react directory * Adding LensFieldIcon implementation around the new FieldIcon to be used in Lens components * Applying new LensFieldIcon in the Lens components * Applying new FieldIcon component in Graph components * Applying new FieldIcon component in the rest of the components * Adding missing type to lens field icon * adding missing type * Addressing PR comments
- Loading branch information
Maja Grubic
committed
Oct 7, 2019
1 parent
cb27486
commit e485a6a
Showing
15 changed files
with
158 additions
and
53 deletions.
There are no files selected for viewing
27 changes: 0 additions & 27 deletions
27
src/legacy/ui/public/directives/field_name/__snapshots__/field_name_icon.test.tsx.snap
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
37 changes: 37 additions & 0 deletions
37
src/plugins/kibana_react/public/field_icon/__snapshots__/field_icon.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
export * from './field_icon'; |
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
10 changes: 10 additions & 0 deletions
10
...egacy/plugins/lens/public/indexpattern_plugin/__snapshots__/lens_field_icon.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
29 changes: 29 additions & 0 deletions
29
x-pack/legacy/plugins/lens/public/indexpattern_plugin/lens_field_icon.test.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,29 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import { LensFieldIcon, getColorForDataType } from './lens_field_icon'; | ||
|
||
test('LensFieldIcon renders properly', () => { | ||
const component = shallow(<LensFieldIcon type={'date'} />); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
|
||
test('LensFieldIcon getColorForDataType for a valid type', () => { | ||
const color = getColorForDataType('date'); | ||
expect(color).toEqual('#B0916F'); | ||
}); | ||
|
||
test('LensFieldIcon getColorForDataType for an invalid type', () => { | ||
const color = getColorForDataType('invalid'); | ||
expect(color).toEqual('#1EA593'); | ||
}); |
22 changes: 22 additions & 0 deletions
22
x-pack/legacy/plugins/lens/public/indexpattern_plugin/lens_field_icon.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,22 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { palettes } from '@elastic/eui'; | ||
import { FieldIcon, typeToEuiIconMap } from '../../../../../../src/plugins/kibana_react/public'; | ||
import { DataType } from '../types'; | ||
|
||
export function getColorForDataType(type: string) { | ||
const iconMap = typeToEuiIconMap[type]; | ||
if (iconMap) { | ||
return iconMap.color; | ||
} | ||
return palettes.euiPaletteColorBlind.colors[0]; | ||
} | ||
|
||
export function LensFieldIcon({ type }: { type: DataType }) { | ||
return <FieldIcon type={type} className="lnsFieldListPanel__fieldIcon" size="m" useColor />; | ||
} |