⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public interface QueryService {

ConfigKey<String> UserVMReadOnlyDetails = new ConfigKey<>(String.class,
"user.vm.readonly.details", "Advanced", "dataDiskController, rootDiskController",
"List of read-only VM settings/details as comma separated string", true, ConfigKey.Scope.Global, null, null, null, null, null, ConfigKey.Kind.CSV, null);
"List of read-only VM settings/details as comma separated string", true, ConfigKey.Scope.Global, null, null, null, null, null, ConfigKey.Kind.CSV, null, "");

ConfigKey<Boolean> SortKeyAscending = new ConfigKey<>("Advanced", Boolean.class, "sortkey.algorithm", "true",
"Sort algorithm - ascending or descending - to use. For entities that use sort key(template, disk offering, service offering, " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,18 @@ public String toString() {

static ConfigDepotImpl s_depot = null;

Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding JavaDoc documentation for the new _defaultValueIfEmpty field to explain its purpose. This field represents the value to use when the configuration is explicitly set to empty string, as opposed to using the default value. This distinction is important for understanding the behavior when users clear a configuration value.

Suggested change
/**
* Alternative default value used when the configuration value is explicitly set
* to the empty string. This allows distinguishing between:
* <ul>
* <li>a missing or unset configuration value, which uses {@link #_defaultValue}, and</li>
* <li>a configuration value explicitly cleared to "", which uses this value instead.</li>
* </ul>
*/

Copilot uses AI. Check for mistakes.
static public void init(ConfigDepotImpl depot) {
private String _defaultValueIfEmpty = null;

public static void init(ConfigDepotImpl depot) {
s_depot = depot;
}

public ConfigKey(Class<T> type, String name, String category, String defaultValue, String description, boolean isDynamic, Scope scope, T multiplier,
String displayText, String parent, Ternary<String, String, Long> group, Pair<String, Long> subGroup, Kind kind, String options, String defaultValueIfEmpty) {
this(type, name, category, defaultValue, description, isDynamic, scope, multiplier, displayText, parent, group, subGroup, kind, options);
this._defaultValueIfEmpty = defaultValueIfEmpty;
}
Comment on lines +129 to +133
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding JavaDoc documentation for this new constructor to explain the purpose and usage of the defaultValueIfEmpty parameter. This would help other developers understand when and why to use this constructor variant.

Copilot uses AI. Check for mistakes.

public ConfigKey(String category, Class<T> type, String name, String defaultValue, String description, boolean isDynamic, Scope scope) {
this(type, name, category, defaultValue, description, isDynamic, scope, null);
}
Expand Down Expand Up @@ -216,7 +224,19 @@ public boolean isSameKeyAs(Object obj) {
public T value() {
if (_value == null || isDynamic()) {
String value = s_depot != null ? s_depot.getConfigStringValue(_name, Scope.Global, null) : null;
_value = valueOf((value == null) ? defaultValue() : value);

String effective;
if (value != null) {
if (value.isEmpty() && _defaultValueIfEmpty != null) {
effective = _defaultValueIfEmpty;
} else {
effective = value;
}
} else {
effective = _defaultValueIfEmpty != null ? _defaultValueIfEmpty : defaultValue();
}

_value = valueOf(effective);
}

return _value;
Expand All @@ -231,6 +251,10 @@ protected T valueInScope(Scope scope, Long id) {
if (value == null) {
return value();
}

if (value.isEmpty() && _defaultValueIfEmpty != null) {
return valueOf(_defaultValueIfEmpty);
}
return valueOf(value);
}

Expand Down
Loading