-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Transforms: Fixes available fields for sort options for latest c…
…onfiguration (#88617) (#88933) - Fixes the transform preview header to display the heading text in any case and the copy-to-clipboard button for latest configurations (the copy-to-clipboard option for pivot is displayed within the form). - Fix to avoid listing all fields for the sort option for latest configuration and only show date fields - Fixes ambiguous form field labels
- Loading branch information
Showing
8 changed files
with
158 additions
and
58 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
45 changes: 45 additions & 0 deletions
45
...sections/create_transform/components/step_define/hooks/use_latest_function_config.test.ts
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,45 @@ | ||
/* | ||
* 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 { LatestFunctionConfigUI } from '../../../../../../../common/types/transform'; | ||
|
||
import { latestConfigMapper, validateLatestConfig } from './use_latest_function_config'; | ||
|
||
describe('useLatestFunctionConfig', () => { | ||
it('should return a valid configuration', () => { | ||
const config: LatestFunctionConfigUI = { | ||
unique_key: [{ label: 'the-unique-key-label', value: 'the-unique-key' }], | ||
sort: { label: 'the-sort-label', value: 'the-sort' }, | ||
}; | ||
|
||
const apiConfig = latestConfigMapper.toAPIConfig(config); | ||
|
||
expect(apiConfig).toEqual({ | ||
unique_key: ['the-unique-key'], | ||
sort: 'the-sort', | ||
}); | ||
expect(validateLatestConfig(apiConfig).isValid).toBe(true); | ||
}); | ||
|
||
it('should return an invalid partial configuration', () => { | ||
const config: LatestFunctionConfigUI = { | ||
unique_key: [{ label: 'the-unique-key-label', value: 'the-unique-key' }], | ||
sort: { label: 'the-sort-label', value: undefined }, | ||
}; | ||
|
||
const apiConfig = latestConfigMapper.toAPIConfig(config); | ||
|
||
expect(apiConfig).toEqual({ | ||
unique_key: ['the-unique-key'], | ||
sort: '', | ||
}); | ||
expect(validateLatestConfig(apiConfig).isValid).toBe(false); | ||
}); | ||
|
||
it('should return false for isValid if no configuration given', () => { | ||
expect(validateLatestConfig().isValid).toBe(false); | ||
}); | ||
}); |
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
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