Skip to content

Commit f85a340

Browse files
Ilya Kuramshiniliax
andauthored
ISSUE-1444: Additional params added to connector restart endpoint to be able to… (#1445)
* Additional params added to connector restart endpoint to be able to restart not only connector instance, but all its tasks * RESTARTING state added to ConnectorTaskStatus * Restart connector button rename Co-authored-by: iliax <[email protected]>
1 parent 79442a7 commit f85a340

File tree

6 files changed

+28
-10
lines changed

6 files changed

+28
-10
lines changed

kafka-ui-api/src/main/java/com/provectus/kafka/ui/service/KafkaConnectService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,8 @@ public Mono<Void> updateConnectorState(KafkaCluster cluster, String connectName,
266266
switch (action) {
267267
case RESTART:
268268
kafkaClientCall =
269-
connect -> KafkaConnectClients.withBaseUrl(connect).restartConnector(connectorName);
269+
connect -> KafkaConnectClients.withBaseUrl(connect)
270+
.restartConnector(connectorName, true, false);
270271
break;
271272
case PAUSE:
272273
kafkaClientCall =

kafka-ui-contract/src/main/resources/swagger/kafka-connect-api.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,29 @@ paths:
169169
post:
170170
tags:
171171
- KafkaConnectClient
172-
summary: restart the connector
172+
summary: restart the connector and its tasks
173173
operationId: restartConnector
174174
parameters:
175175
- name: connectorName
176176
in: path
177177
required: true
178178
schema:
179179
type: string
180+
- name: includeTasks
181+
in: query
182+
required: false
183+
schema:
184+
type: boolean
185+
default: false
186+
description: Specifies whether to restart the connector instance and task instances or just the connector instance
187+
- name: onlyFailed
188+
in: query
189+
required: false
190+
schema:
191+
type: boolean
192+
default: false
193+
description: Specifies whether to restart just the instances with a FAILED status or all instances
194+
180195
responses:
181196
200:
182197
description: OK
@@ -406,6 +421,7 @@ components:
406421
- RUNNING
407422
- FAILED
408423
- PAUSED
424+
- RESTARTING
409425
- UNASSIGNED
410426
worker_id:
411427
type: string

kafka-ui-contract/src/main/resources/swagger/kafka-ui-api.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2396,6 +2396,7 @@ components:
23962396
- RUNNING
23972397
- FAILED
23982398
- PAUSED
2399+
- RESTARTING
23992400
- UNASSIGNED
24002401

24012402
ConnectorState:

kafka-ui-react-app/src/components/Connect/Details/Actions/Actions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ const Actions: React.FC<ActionsProps> = ({
126126
<span>
127127
<i className="fas fa-sync-alt" />
128128
</span>
129-
<span>Restart All Tasks</span>
129+
<span>Restart Connector</span>
130130
</Button>
131131
<Button
132132
buttonSize="M"

kafka-ui-react-app/src/components/Connect/Details/Actions/__tests__/Actions.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ describe('Actions', () => {
148148
it('calls restartConnector when restart button clicked', () => {
149149
const restartConnector = jest.fn();
150150
const wrapper = mount(setupWrapper({ restartConnector }));
151-
wrapper.find({ children: 'Restart All Tasks' }).simulate('click');
151+
wrapper.find({ children: 'Restart Connector' }).simulate('click');
152152
expect(restartConnector).toHaveBeenCalledTimes(1);
153153
expect(restartConnector).toHaveBeenCalledWith(
154154
clusterName,

kafka-ui-react-app/src/components/Connect/Details/Actions/__tests__/__snapshots__/Actions.spec.tsx.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ exports[`Actions view matches snapshot 1`] = `
141141
/>
142142
</span>
143143
<span>
144-
Restart All Tasks
144+
Restart Connector
145145
</span>
146146
</button>
147147
<a
@@ -334,7 +334,7 @@ exports[`Actions view matches snapshot when deleting connector 1`] = `
334334
/>
335335
</span>
336336
<span>
337-
Restart All Tasks
337+
Restart Connector
338338
</span>
339339
</button>
340340
<a
@@ -512,7 +512,7 @@ exports[`Actions view matches snapshot when failed 1`] = `
512512
/>
513513
</span>
514514
<span>
515-
Restart All Tasks
515+
Restart Connector
516516
</span>
517517
</button>
518518
<a
@@ -705,7 +705,7 @@ exports[`Actions view matches snapshot when paused 1`] = `
705705
/>
706706
</span>
707707
<span>
708-
Restart All Tasks
708+
Restart Connector
709709
</span>
710710
</button>
711711
<a
@@ -898,7 +898,7 @@ exports[`Actions view matches snapshot when running connector action 1`] = `
898898
/>
899899
</span>
900900
<span>
901-
Restart All Tasks
901+
Restart Connector
902902
</span>
903903
</button>
904904
<a
@@ -1076,7 +1076,7 @@ exports[`Actions view matches snapshot when unassigned 1`] = `
10761076
/>
10771077
</span>
10781078
<span>
1079-
Restart All Tasks
1079+
Restart Connector
10801080
</span>
10811081
</button>
10821082
<a

0 commit comments

Comments
 (0)