Skip to content

Commit

Permalink
get rid of console err in management. disable links in menu if needed (
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarezmelissa87 authored Jul 9, 2020
1 parent 8a1d7d7 commit 4b2e5bd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function getTabs(disableLinks: boolean): Tab[] {
name: i18n.translate('xpack.ml.navMenu.settingsTabLinkText', {
defaultMessage: 'Settings',
}),
disabled: false,
disabled: disableLinks,
},
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,21 @@ export const useActions = (
actions: EuiTableActionsColumnType<DataFrameAnalyticsListRow>['actions'];
modals: JSX.Element | null;
} => {
const deleteAction = useDeleteAction();
const editAction = useEditAction();
const startAction = useStartAction();

let modals: JSX.Element | null = null;

const actions: EuiTableActionsColumnType<DataFrameAnalyticsListRow>['actions'] = [
getViewAction(isManagementTable),
];

// isManagementTable will be the same for the lifecycle of the component
// Disabling lint error to fix console error in management list due to action hooks using deps not initialized in management
if (isManagementTable === false) {
/* eslint-disable react-hooks/rules-of-hooks */
const deleteAction = useDeleteAction();
const editAction = useEditAction();
const startAction = useStartAction();
/* eslint-disable react-hooks/rules-of-hooks */

modals = (
<>
{startAction.isModalVisible && <StartButtonModal {...startAction} />}
Expand Down

0 comments on commit 4b2e5bd

Please sign in to comment.