Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to show all consumer groups by default #971

Merged
merged 1 commit into from
Jan 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions application.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ akhq:
default-view: ALL # default list view (ALL, HIDE_INTERNAL, HIDE_INTERNAL_STREAM, HIDE_STREAM). Overrides default
skip-consumer-groups: false # Skip loading consumer group information when showing topics. Overrides default
skip-last-record: true # Skip loading last record date information when showing topics. Overrides default
show-all-consumer-groups: true # Expand list of consumer groups instead of showing one. Overrides default.
topic-data:
sort: NEWEST # default sort order (OLDEST, NEWEST) (default: OLDEST). Overrides default

Expand Down Expand Up @@ -154,6 +155,7 @@ akhq:
- "^.*-rekey$"
skip-consumer-groups: false # Skip loading consumer group information when showing topics
skip-last-record: false # Skip loading last record date information when showing topics
show-all-consumer-groups: false # Expand list of consumer groups instead of showing one.
# Retry options for topic operations
retry:
topic-exists: # Delay between retries when checking for existence of newly created topics. This is needed as it might take the kafka broker a few seconds to create new topics.
Expand All @@ -170,6 +172,7 @@ akhq:
default-view: ALL # default list view (ALL, HIDE_INTERNAL, HIDE_INTERNAL_STREAM, HIDE_STREAM). Overrides default
skip-consumer-groups: false # Skip loading consumer group information when showing topics. Overrides default
skip-last-record: true # Skip loading last record date information when showing topics. Overrides default
show-all-consumer-groups: true # Expand list of consumer groups instead of showing one. Overrides default.
topic-data:
sort: NEWEST # default sort order (OLDEST, NEWEST) (default: OLDEST). Overrides default

Expand Down
38 changes: 31 additions & 7 deletions client/src/containers/Settings/Settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class Settings extends Form {
topicDefaultView: '',
topicDataSort: '',
skipConsumerGroups: false,
skipLastRecord: false
skipLastRecord: false,
showAllConsumerGroups: true
},
errors: {}
};
Expand All @@ -26,7 +27,8 @@ class Settings extends Form {
topicDefaultView: Joi.string().required(),
topicDataSort: Joi.string().required(),
skipConsumerGroups: Joi.boolean().optional(),
skipLastRecord: Joi.boolean().optional()
skipLastRecord: Joi.boolean().optional(),
showAllConsumerGroups: Joi.boolean().optional()
};

componentDidMount() {
Expand All @@ -38,7 +40,8 @@ class Settings extends Form {
topicDefaultView: (uiOptions && uiOptions.topic)? uiOptions.topic.defaultView : '',
topicDataSort: (uiOptions && uiOptions.topicData)? uiOptions.topicData.sort : '',
skipConsumerGroups: (uiOptions && uiOptions.topic)? uiOptions.topic.skipConsumerGroups : false,
skipLastRecord: (uiOptions && uiOptions.topic)? uiOptions.topic.skipLastRecord : false
skipLastRecord: (uiOptions && uiOptions.topic)? uiOptions.topic.skipLastRecord : false,
showAllConsumerGroups: (uiOptions && uiOptions.topic)? uiOptions.topic.showAllConsumerGroups : false
}})
}

Expand All @@ -53,10 +56,17 @@ class Settings extends Form {
doSubmit() {
const { clusterId, formData } = this.state;
setUIOptions(clusterId,
{ topic: { defaultView: formData.topicDefaultView,
skipConsumerGroups: formData.skipConsumerGroups,
skipLastRecord: formData.skipLastRecord },
topicData: {sort: formData.topicDataSort} });
{
topic: {
defaultView: formData.topicDefaultView,
skipConsumerGroups: formData.skipConsumerGroups,
skipLastRecord: formData.skipLastRecord,
showAllConsumerGroups: formData.showAllConsumerGroups
},
topicData: {
sort: formData.topicDataSort
}
});
toast.success(`Settings for cluster '${clusterId}' updated successfully.`);
}

Expand Down Expand Up @@ -109,6 +119,20 @@ class Settings extends Form {
}}
/></span>
</div>
<div className="select-wrapper settings-wrapper row">
<span className="col-sm-2 col-form-label">Show All Consumer Groups</span>
<span className="col-sm-10 row-checkbox-settings">
<input
type="checkbox"
value="showAllConsumerGroups"
checked={this.state.formData.showAllConsumerGroups || false}
onChange={ event => {
const { formData } = this.state;
formData.showAllConsumerGroups = event.target.checked;
this.setState({formData});
}}
/></span>
</div>
</fieldset>

<fieldset id="topicData" key="topicData">
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/Topic/TopicList/TopicList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class TopicList extends Root {
groupComponent: undefined,
internal: topic.internal
}
collapseConsumerGroups[topic.name] = false;
collapseConsumerGroups[topic.name] = (uiOptions.showAllConsumerGroups) ? true : false;
});
this.setState({collapseConsumerGroups});
setState()
Expand Down
1 change: 1 addition & 0 deletions docs/docs/configuration/akhq.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ These parameters are the default values used in the topic creation page.
* `akhq.ui-options.topic.default-view` is default list view (ALL, HIDE_INTERNAL, HIDE_INTERNAL_STREAM, HIDE_STREAM) (default: HIDE_INTERNAL)
* `akhq.ui-options.topic.skip-consumer-groups` hide consumer groups columns on topic list
* `akhq.ui-options.topic.skip-last-record` hide the last records on topic list
* `akhq.ui-options.topic.show-all-consumer-groups` expand lists of consumer groups on topic list

### Topic Data
* `akhq.ui-options.topic-data.sort`: default sort order (OLDEST, NEWEST) (default: OLDEST)
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/akhq/configs/Connection.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ public UiOptions mergeOptions(UIOptions defaultOptions) {
options.topic = new UiOptionsTopic(
StringUtils.isNotEmpty(this.uiOptions.topic.getDefaultView()) ? this.uiOptions.topic.getDefaultView() : defaultOptions.getTopic().getDefaultView(),
(this.uiOptions.topic.getSkipConsumerGroups() != null) ? this.uiOptions.topic.getSkipConsumerGroups() : defaultOptions.getTopic().getSkipConsumerGroups(),
(this.uiOptions.topic.getSkipLastRecord() != null) ? this.uiOptions.topic.getSkipLastRecord() : defaultOptions.getTopic().getSkipLastRecord()
(this.uiOptions.topic.getSkipLastRecord() != null) ? this.uiOptions.topic.getSkipLastRecord() : defaultOptions.getTopic().getSkipLastRecord(),
(this.uiOptions.topic.getShowAllConsumerGroups() != null) ? this.uiOptions.topic.getShowAllConsumerGroups() : defaultOptions.getTopic().getShowAllConsumerGroups()
);

options.topicData = new UiOptionsTopicData(
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/akhq/configs/UiOptionsTopic.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ public class UiOptionsTopic {
private String defaultView;
private Boolean skipConsumerGroups;
private Boolean skipLastRecord;
private Boolean showAllConsumerGroups;
}