|
@@ -1,15 +1,22 @@
|
|
import React from 'react';
|
|
import React from 'react';
|
|
-import { Action, ResourceType, ConnectorAction, Connector } from 'generated-sources';
|
|
|
|
|
|
+import {
|
|
|
|
+ Action,
|
|
|
|
+ ResourceType,
|
|
|
|
+ ConnectorAction,
|
|
|
|
+ Connector,
|
|
|
|
+} from 'generated-sources';
|
|
import useAppParams from 'lib/hooks/useAppParams';
|
|
import useAppParams from 'lib/hooks/useAppParams';
|
|
import { useConfirm } from 'lib/hooks/useConfirm';
|
|
import { useConfirm } from 'lib/hooks/useConfirm';
|
|
import { RouterParamsClusterConnectConnector } from 'lib/paths';
|
|
import { RouterParamsClusterConnectConnector } from 'lib/paths';
|
|
import { useIsMutating, useQueryClient } from '@tanstack/react-query';
|
|
import { useIsMutating, useQueryClient } from '@tanstack/react-query';
|
|
import { ActionCanButton } from 'components/common/ActionComponent';
|
|
import { ActionCanButton } from 'components/common/ActionComponent';
|
|
import { usePermission } from 'lib/hooks/usePermission';
|
|
import { usePermission } from 'lib/hooks/usePermission';
|
|
-import { useDeleteConnector, useUpdateConnectorState } from 'lib/hooks/api/kafkaConnect';
|
|
|
|
|
|
+import {
|
|
|
|
+ useDeleteConnector,
|
|
|
|
+ useUpdateConnectorState,
|
|
|
|
+} from 'lib/hooks/api/kafkaConnect';
|
|
import { Row } from '@tanstack/react-table';
|
|
import { Row } from '@tanstack/react-table';
|
|
|
|
|
|
-
|
|
|
|
interface BatchActionsBarProps {
|
|
interface BatchActionsBarProps {
|
|
rows: Row<Connector>[];
|
|
rows: Row<Connector>[];
|
|
resetRowSelection(): void;
|
|
resetRowSelection(): void;
|
|
@@ -19,7 +26,6 @@ const BatchActionsBar: React.FC<BatchActionsBarProps> = ({
|
|
rows,
|
|
rows,
|
|
resetRowSelection,
|
|
resetRowSelection,
|
|
}) => {
|
|
}) => {
|
|
-
|
|
|
|
const confirm = useConfirm();
|
|
const confirm = useConfirm();
|
|
|
|
|
|
const selectedConnectors = rows.map(({ original }) => original);
|
|
const selectedConnectors = rows.map(({ original }) => original);
|
|
@@ -45,9 +51,7 @@ const BatchActionsBar: React.FC<BatchActionsBarProps> = ({
|
|
const deleteConnectorMutation = useDeleteConnector(routerProps);
|
|
const deleteConnectorMutation = useDeleteConnector(routerProps);
|
|
const deleteConnectorsHandler = () =>
|
|
const deleteConnectorsHandler = () =>
|
|
confirm(
|
|
confirm(
|
|
- <>
|
|
|
|
- Are you sure you want to remove selected connectors?
|
|
|
|
- </>,
|
|
|
|
|
|
+ <>Are you sure you want to remove selected connectors?</>,
|
|
async () => {
|
|
async () => {
|
|
try {
|
|
try {
|
|
await deleteConnectorMutation.mutateAsync();
|
|
await deleteConnectorMutation.mutateAsync();
|
|
@@ -63,14 +67,14 @@ const BatchActionsBar: React.FC<BatchActionsBarProps> = ({
|
|
confirm(message, async () => {
|
|
confirm(message, async () => {
|
|
try {
|
|
try {
|
|
await Promise.all(
|
|
await Promise.all(
|
|
- selectedConnectors.map((connector) => (
|
|
|
|
|
|
+ selectedConnectors.map((connector) =>
|
|
stateMutation.mutateAsync({
|
|
stateMutation.mutateAsync({
|
|
clusterName,
|
|
clusterName,
|
|
connectName: connector.connect,
|
|
connectName: connector.connect,
|
|
connectorName: connector.name,
|
|
connectorName: connector.name,
|
|
action,
|
|
action,
|
|
})
|
|
})
|
|
- ))
|
|
|
|
|
|
+ )
|
|
);
|
|
);
|
|
resetRowSelection();
|
|
resetRowSelection();
|
|
} catch (e) {
|
|
} catch (e) {
|
|
@@ -81,16 +85,31 @@ const BatchActionsBar: React.FC<BatchActionsBarProps> = ({
|
|
});
|
|
});
|
|
};
|
|
};
|
|
const restartConnectorHandler = () => {
|
|
const restartConnectorHandler = () => {
|
|
- updateConnector(ConnectorAction.RESTART, 'Are you sure you want to restart selected connectors?');
|
|
|
|
|
|
+ updateConnector(
|
|
|
|
+ ConnectorAction.RESTART,
|
|
|
|
+ 'Are you sure you want to restart selected connectors?'
|
|
|
|
+ );
|
|
};
|
|
};
|
|
const restartAllTasksHandler = () =>
|
|
const restartAllTasksHandler = () =>
|
|
- updateConnector(ConnectorAction.RESTART_ALL_TASKS, 'Are you sure you want to restart all tasks in selected connectors?');
|
|
|
|
|
|
+ updateConnector(
|
|
|
|
+ ConnectorAction.RESTART_ALL_TASKS,
|
|
|
|
+ 'Are you sure you want to restart all tasks in selected connectors?'
|
|
|
|
+ );
|
|
const restartFailedTasksHandler = () =>
|
|
const restartFailedTasksHandler = () =>
|
|
- updateConnector(ConnectorAction.RESTART_FAILED_TASKS, 'Are you sure you want to restart failed tasks in selected connectors?');
|
|
|
|
|
|
+ updateConnector(
|
|
|
|
+ ConnectorAction.RESTART_FAILED_TASKS,
|
|
|
|
+ 'Are you sure you want to restart failed tasks in selected connectors?'
|
|
|
|
+ );
|
|
const pauseConnectorHandler = () =>
|
|
const pauseConnectorHandler = () =>
|
|
- updateConnector(ConnectorAction.PAUSE, 'Are you sure you want to pause selected connectors?');
|
|
|
|
|
|
+ updateConnector(
|
|
|
|
+ ConnectorAction.PAUSE,
|
|
|
|
+ 'Are you sure you want to pause selected connectors?'
|
|
|
|
+ );
|
|
const resumeConnectorHandler = () =>
|
|
const resumeConnectorHandler = () =>
|
|
- updateConnector(ConnectorAction.RESUME, 'Are you sure you want to resume selected connectors?');
|
|
|
|
|
|
+ updateConnector(
|
|
|
|
+ ConnectorAction.RESUME,
|
|
|
|
+ 'Are you sure you want to resume selected connectors?'
|
|
|
|
+ );
|
|
|
|
|
|
return (
|
|
return (
|
|
<>
|
|
<>
|