Charts plugin (combining ui/color_maps and EuiUtils)#55469
Charts plugin (combining ui/color_maps and EuiUtils)#55469nickofthyme merged 67 commits intoelastic:masterfrom
Conversation
Add `kbn_vislib_vis_types` to sass lint Co-Authored-By: Caroline Horn <549577+cchaos@users.noreply.github.com>
nreese
left a comment
There was a problem hiding this comment.
maps changes LGTM
code review, tested in chrome
src/plugins/charts/public/plugin.ts
Outdated
| this.colorsService.init(uiSettings); | ||
|
|
||
| return { | ||
| colorMaps: colorMapsService, |
There was a problem hiding this comment.
You are exposing the color maps service via the contract, but it looks like it is just offering static helper functions and is not tied to any internal state of the plugin - is this correct? If yes you can just re-export it from the top level index.ts of the charts plugin and import where needed. Then this problem is also solved directly.
|
|
||
| return (value: string) => { | ||
| // @ts-ignore | ||
| return colorMapping[value] || this.mappedColors.get(value); |
There was a problem hiding this comment.
If you specify colorMapping as Partial<Record<string, string>> in https://github.com/elastic/kibana/pull/55469/files#diff-4026f17dfd1c005f7bc2f012cb664948R50 , then you don't need to overwrite type checking here.
| this._mappedColors = new MappedColors(uiSettings); | ||
| } | ||
|
|
||
| vislibColor(arrayOfStringsOrNumbers?: any, colorMapping = {}) { |
There was a problem hiding this comment.
I know it's just used by vislib right now, but can we rename that function? Maybe createColorLookupFunction - naming is hard :D But I think it's better than having that legacy name in here
jloleysens
left a comment
There was a problem hiding this comment.
Tested locally in watcher and EUI utils looks to be working as expected.
Left some non-blocker comments.
| // For our test harness, we don't use this mocked out http service | ||
| http: httpServiceMock.createSetupContract(), | ||
| }; | ||
| } as any; |
There was a problem hiding this comment.
Could we rather scope the as any here to theme: {...} as any?
There was a problem hiding this comment.
Yup great point
| } | ||
|
|
||
| /** @public */ | ||
| export type ChartsPluginStart = ChartsPluginSetup; |
There was a problem hiding this comment.
Is it necessary to expose the same interface for start and setup from this plugin? This seems like something that would most naturally fit into just setup.
Also, if we just expose at setup time we can remove the need to check for inited services and remove init step entirely. Not a blocker though.
There was a problem hiding this comment.
I don't think it's necessary long term but it was currently being used in both so I resorted to the init approach over using getStartServices.
|
@nreese Could you check this once more please? I moved some services to static exports. |
flash1293
left a comment
There was a problem hiding this comment.
LGTM, tested and still seems to work fine for me
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
* Combine ui/color_maps and EuiUtils into new Charts plugin * EuiUtils is now the theme service * ui/color_maps is now the colorMaps service * Fix all imports of each to pull from new Charts plugin * Add theme methods to both setup and start contracts * Move and jestify heatMapColors tests * Convert remaining js files to ts * Move vis/color to Charts plugin * Update missed visTypeVislib naming
* master: (21 commits) [SIEM][Detection Engine] critical blocker updates to latest ECS version [Monitoring] Fix inaccuracies in logstash pipeline listing metrics (elastic#55868) Resetting errors and removing duplicates (elastic#56054) Add flag to opt out from sub url tracking (elastic#55672) [SIEM][Detection Engine] critical bug, fixes duplicate tags [ML] Anomaly Detection: Fix persist/restore of refreshInterval in globalState. (elastic#56113) [ML] Single Metric Viewer: Fix annnotations refresh. (elastic#56107) adapt ObjectToConfigAdapter.getFlattenedPaths to consider arrays as final values (elastic#56105) Add Appender.receiveAllLevels option to fix LegacyAppender (elastic#55752) [ML] Process delimited files like semi-structured text (elastic#56038) Charts plugin (combining ui/color_maps and EuiUtils) (elastic#55469) fix tutorial documentation (elastic#55996) [ML] Fix persist/restore of time/refreshInterval in data visualizer. (elastic#56122) [Index Management] Fix errors with validation (elastic#56072) [Index Management] Add try/catch when parsing index filter from URI (elastic#56051) [NP] add HTTP resources testing strategies (elastic#54908) [ML] Single Metric Viewer: Fix brush update on short recent timespans. (elastic#56125) [Uptime] Add timeout for slow process to skipped functional tests (elastic#56065) refactor (elastic#56121) Move tests in dashboard into appropriate folders (elastic#55304) ...
Summary
EuiUtilsplugin is now thethemeservice of the newChartspluginui/color_mapsis now thecolorMapsservice of the newChartspluginChartspluginthememethods to bothsetupandstartcontract ofChartspluginui/vis/components/colorsinto newChartspluginChecklist
For maintainers