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.
[ML] DF Analytics / Transforms: Fix job row actions menu invalid DOM …
…nesting warning (elastic#74499) Refactors the action buttons for transforms and analytics job list to no longer produce nested button elements and throw a React error.
- Loading branch information
Showing
79 changed files
with
1,002 additions
and
942 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
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
41 changes: 41 additions & 0 deletions
41
...a_frame_analytics/pages/analytics_management/components/action_clone/use_clone_action.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,41 @@ | ||
/* | ||
* 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, { useCallback, useMemo } from 'react'; | ||
|
||
import { DataFrameAnalyticsListAction, DataFrameAnalyticsListRow } from '../analytics_list/common'; | ||
|
||
import { | ||
cloneActionNameText, | ||
useNavigateToWizardWithClonedJob, | ||
CloneActionName, | ||
} from './clone_action_name'; | ||
|
||
export type CloneAction = ReturnType<typeof useCloneAction>; | ||
export const useCloneAction = (canCreateDataFrameAnalytics: boolean) => { | ||
const navigateToWizardWithClonedJob = useNavigateToWizardWithClonedJob(); | ||
|
||
const clickHandler = useCallback((item: DataFrameAnalyticsListRow) => { | ||
navigateToWizardWithClonedJob(item); | ||
}, []); | ||
|
||
const action: DataFrameAnalyticsListAction = useMemo( | ||
() => ({ | ||
name: (item: DataFrameAnalyticsListRow) => ( | ||
<CloneActionName isDisabled={!canCreateDataFrameAnalytics} /> | ||
), | ||
enabled: () => canCreateDataFrameAnalytics, | ||
description: cloneActionNameText, | ||
icon: 'copy', | ||
type: 'icon', | ||
onClick: clickHandler, | ||
'data-test-subj': 'mlAnalyticsJobCloneButton', | ||
}), | ||
[] | ||
); | ||
|
||
return { action }; | ||
}; |
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
Oops, something went wrong.