Skip to content

Commit

Permalink
refactor(core): rename property initially to defaults (#1092)
Browse files Browse the repository at this point in the history
  • Loading branch information
timonback authored Nov 29, 2024
1 parent 5053e2a commit 9667d6e
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,15 +232,25 @@ public static class Group {
@Getter
@Setter
public static class UI {
/**
* Allows to show or hide the bindings in the UI when opening the UI.
*/
private boolean initiallyShowBindings = true;

/**
* Allows to show or hide the headers in the UI when opening the UI.
* Initial configuration when opening the UI.
*/
private boolean initiallyShowHeaders = true;
private Defaults defaults = new Defaults();

@Getter
@Setter
public static class Defaults {
/**
* Allows to show or hide the bindings in the UI when opening the UI.
*/
private boolean showBindings = true;

/**
* Allows to show or hide the headers in the UI when opening the UI.
*/
private boolean showHeaders = true;
}
}

@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ private List<UiConfig.UiConfigGroup> createGroups() {
}

private UiConfig.InitialConfig createInitialConfig() {
return new UiConfig.InitialConfig(
configProperties.getUi().isInitiallyShowBindings(),
configProperties.getUi().isInitiallyShowHeaders());
SpringwolfConfigProperties.UI.Defaults defaults =
configProperties.getUi().getDefaults();
return new UiConfig.InitialConfig(defaults.isShowBindings(), defaults.isShowHeaders());
}

private record UiConfig(InitialConfig initialConfig, List<UiConfigGroup> groups) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ void groupConfigIsMappedCorrectly() {
@ExtendWith(SpringExtension.class)
@EnableConfigurationProperties(SpringwolfConfigProperties.class)
@TestPropertySource(
properties = {"springwolf.ui.initially-show-bindings=false", "springwolf.ui.initially-show-headers=true"})
properties = {"springwolf.ui.defaults.show-bindings=false", "springwolf.ui.defaults.show-headers=true"})
class UiConfigTest {

@Autowired
Expand All @@ -224,8 +224,8 @@ void uiConfigIsMappedCorrectly() {
final SpringwolfConfigProperties.UI actual = properties.getUi();

// then
assertThat(actual.isInitiallyShowBindings()).isFalse();
assertThat(actual.isInitiallyShowHeaders()).isTrue();
assertThat(actual.getDefaults().isShowBindings()).isFalse();
assertThat(actual.getDefaults().isShowHeaders()).isTrue();
}
}

Expand All @@ -243,8 +243,8 @@ void uiConfigIsMappedCorrectly() {
final SpringwolfConfigProperties.UI actual = properties.getUi();

// then
assertThat(actual.isInitiallyShowBindings()).isTrue();
assertThat(actual.isInitiallyShowHeaders()).isTrue();
assertThat(actual.getDefaults().isShowBindings()).isTrue();
assertThat(actual.getDefaults().isShowHeaders()).isTrue();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ springwolf.docket.servers.amqp-server.host=${spring.rabbitmq.host}:${spring.rabb
springwolf.plugin.amqp.publishing.enabled=true

# Springwolf ui configuration
springwolf.ui.initially-show-bindings=true
springwolf.ui.initially-show-headers=true
springwolf.ui.defaults.show-bindings=true
springwolf.ui.defaults.show-headers=true

# For debugging purposes
logging.level.io.github.springwolf=DEBUG
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ springwolf.docket.servers.kafka-server.host=${spring.cloud.stream.binders.kafka.
springwolf.use-fqn=false

# Springwolf ui configuration
springwolf.ui.initially-show-bindings=true
springwolf.ui.initially-show-headers=true
springwolf.ui.defaults.show-bindings=true
springwolf.ui.defaults.show-headers=true

# For debugging purposes
logging.level.io.github.springwolf=DEBUG
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ springwolf.docket.servers.jms-server.host=${spring.activemq.broker-url}
springwolf.plugin.jms.publishing.enabled=true

# Springwolf ui configuration
springwolf.ui.initially-show-bindings=true
springwolf.ui.initially-show-headers=true
springwolf.ui.defaults.show-bindings=true
springwolf.ui.defaults.show-headers=true

# For debugging purposes
logging.level.io.github.springwolf=DEBUG
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ springwolf.docket.group-configs[0].group=Only Vehicles
springwolf.docket.group-configs[0].message-name-to-match=.*Vehicle.*

# Springwolf ui configuration
springwolf.ui.initially-show-bindings=true
springwolf.ui.initially-show-headers=true
springwolf.ui.defaults.show-bindings=true
springwolf.ui.defaults.show-headers=true

# Springwolf kafka configuration
springwolf.docket.servers.kafka-server.protocol=kafka
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ springwolf.docket.servers.sns-server.host=http://localhost:4566
springwolf.plugin.sns.publishing.enabled=true

# Springwolf ui configuration
springwolf.ui.initially-show-bindings=true
springwolf.ui.initially-show-headers=true
springwolf.ui.defaults.show-bindings=true
springwolf.ui.defaults.show-headers=true

# For debugging purposes
logging.level.io.github.springwolf=DEBUG
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ springwolf.docket.servers.sqs-server.host=http://localhost:4566
springwolf.plugin.sqs.publishing.enabled=true

# Springwolf ui configuration
springwolf.ui.initially-show-bindings=true
springwolf.ui.initially-show-headers=true
springwolf.ui.defaults.show-bindings=true
springwolf.ui.defaults.show-headers=true

# For debugging purposes
logging.level.io.github.springwolf=DEBUG
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ springwolf.plugin.stomp.endpoint.app=/app
springwolf.plugin.stomp.endpoint.user=/user

# Springwolf ui configuration
springwolf.ui.initially-show-bindings=true
springwolf.ui.initially-show-headers=true
springwolf.ui.defaults.show-bindings=true
springwolf.ui.defaults.show-headers=true

# For debugging purposes
logging.level.io.github.springwolf=DEBUG

0 comments on commit 9667d6e

Please sign in to comment.