Skip to content

Commit

Permalink
Do not show config filter if no filter exist
Browse files Browse the repository at this point in the history
Signed-off-by: Phillip Kruger <[email protected]>
  • Loading branch information
phillip-kruger committed May 30, 2023
1 parent 69f203d commit 6b2d696
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ metadata:
categories:
- "data"
status: "stable"
unlisted: true
unlisted: true
config:
- "quarkus.datasource."
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
import io.quarkus.devui.spi.page.Page;
import io.quarkus.vertx.http.deployment.devmode.console.ConfigEditorProcessor;
import io.quarkus.vertx.http.runtime.devmode.ConfigDescription;
import io.quarkus.vertx.http.runtime.devmode.ConfigSourceName;
import io.smallrye.config.ConfigValue;
import io.smallrye.config.SmallRyeConfig;

/**
Expand Down Expand Up @@ -161,9 +159,6 @@ private List<ConfigDescription> calculate(List<ConfigDescription> cd, Set<String
}
properties.add(item.getName());
item.setConfigValue(current.getConfigValue(item.getName()));

String configSourceName = item.getConfigValue().getConfigSourceName();
item.setConfigSource(configSourceName);
ordered.add(item);
} else if (!item.getName().startsWith("quarkus.log.filter")) { //special case, we use this internally and we don't want it clogging up the editor
//we need to figure out how to expand it
Expand Down Expand Up @@ -245,10 +240,6 @@ private List<ConfigDescription> calculate(List<ConfigDescription> cd, Set<String

properties.add(newDesc.getName());
newDesc.setConfigValue(current.getConfigValue(newDesc.getName()));

String configSourceName = newDesc.getConfigValue().getConfigSourceName();
int configSourceOrdinal = newDesc.getConfigValue().getConfigSourceOrdinal();
newDesc.setConfigSource(configSourceName);
ordered.add(newDesc);
}

Expand All @@ -275,8 +266,6 @@ private List<ConfigDescription> calculate(List<ConfigDescription> cd, Set<String

properties.add(newDesc.getName());
newDesc.setConfigValue(current.getConfigValue(newDesc.getName()));
String configSourceName = newDesc.getConfigValue().getConfigSourceName();
newDesc.setConfigSource(configSourceName);
ordered.add(newDesc);
}

Expand All @@ -293,10 +282,6 @@ private List<ConfigDescription> calculate(List<ConfigDescription> cd, Set<String
}

ConfigDescription item = new ConfigDescription(propertyName, null, null, current.getConfigValue(propertyName));
ConfigValue configValue = current.getConfigValue(propertyName);
ConfigSourceName csn = new ConfigSourceName(configValue.getConfigSourceName(),
configValue.getConfigSourceOrdinal());
item.setConfigSource(csn.getName());
ordered.add(item);

configDescriptions.add(item);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class QwcConfiguration extends observeState(LitElement) {
_filterTextChanged(e) {
const searchTerm = (e.detail.value || '').trim();
if (searchTerm === '') {
this._filtered = devuiState.allConfiguration
this._filtered = devuiState.allConfiguration;
return;
}

Expand Down Expand Up @@ -208,15 +208,15 @@ export class QwcConfiguration extends observeState(LitElement) {
<vaadin-icon id="icon-dev-${prop.name}" icon="font-awesome-solid:magic"></vaadin-icon>
<vaadin-tooltip for="icon-dev-${prop.name}" text="Automatically set by Dev Services"
position="top-start"></vaadin-tooltip>
`
`;
}

if (prop.wildcardEntry) {
wildcard = html`
<vaadin-icon id="icon-wc-${prop.name}" icon="font-awesome-solid:plus"></vaadin-icon>
<vaadin-tooltip for="icon-wc-${prop.name}" text="This will add a new named config group"
position="top-start"></vaadin-tooltip>
`
`;
}

return html`
Expand Down Expand Up @@ -336,12 +336,13 @@ export class QwcConfiguration extends observeState(LitElement) {
if (prop.defaultValue) {
def = "<strong>Default value: </strong>" + prop.defaultValue;
}

let src = "<strong>Config source: </strong> " + prop.configValue.sourceName;
return html`<div class="description">
<p>${unsafeHTML(prop.description)}</p>
<div>
<span><strong>Environment variable: </strong></span><code>${res}</code><br/>
<span>${unsafeHTML(def)}</span>
<span>${unsafeHTML(def)}</span><br/>
<span>${unsafeHTML(src)}</span>
</div>
</div>`;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,23 @@ export class QwcExtension extends LitElement {
_footerTemplate() {
return html`
<div class="card-footer">
<a href="configuration-form-editor?filter=${this.configFilter}" class="config">
<vaadin-icon class="icon" icon="font-awesome-solid:pen-to-square" title="Configuration for the ${this.name} extension"></vaadin-icon>
</a>
${this._renderConfigFilterIcon()}
${this._renderStatus()}
<vaadin-icon class="icon more" icon="font-awesome-solid:ellipsis-vertical" @click="${() => (this._dialogOpened = true)}" title="More about the ${this.name} extension"></vaadin-icon>
</div>
`;
}

_renderConfigFilterIcon(){
if(this.configFilter){
return html`<a href="configuration-form-editor?filter=${this.configFilter}" class="config">
<vaadin-icon class="icon" icon="font-awesome-solid:pen-to-square" title="Configuration for the ${this.name} extension"></vaadin-icon>
</a>`;
}else{
return html`<span></span>`;
}
}

_renderStatus(){
var l = this._statusLevelOnCard();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public class ConfigDescription implements Comparable<ConfigDescription> {
private List<String> allowedValues;
private String configPhase;
private boolean wildcardEntry = false;
private String configSource;

public ConfigDescription() {
}
Expand Down Expand Up @@ -119,14 +118,6 @@ public ConfigDescription setWildcardEntry(boolean wildcardEntry) {
return this;
}

public String getConfigSource() {
return configSource;
}

public void setConfigSource(String configSource) {
this.configSource = configSource;
}

@Override
public int compareTo(ConfigDescription o) {
int ordinal = Integer.compare(o.configValue.getConfigSourceOrdinal(), this.configValue.getConfigSourceOrdinal());
Expand Down

0 comments on commit 6b2d696

Please sign in to comment.