From a1b4393e0db68d11d0f9ce3a4b614168874c9cc2 Mon Sep 17 00:00:00 2001 From: Phillip Kruger Date: Tue, 30 May 2023 11:54:27 +1000 Subject: [PATCH] Add ability to only show own properties Signed-off-by: Phillip Kruger (cherry picked from commit 69e437c1d057a8f180f4abe1e97663169277714e) --- .../menu/ConfigurationProcessor.java | 17 +++-- .../resources/dev-ui/qwc/qwc-configuration.js | 69 ++++++++++++++----- 2 files changed, 66 insertions(+), 20 deletions(-) diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/menu/ConfigurationProcessor.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/menu/ConfigurationProcessor.java index 9519fe3aaef3d..3d278a51aa0da 100644 --- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/menu/ConfigurationProcessor.java +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/menu/ConfigurationProcessor.java @@ -29,6 +29,7 @@ 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.smallrye.config.ConfigValue; import io.smallrye.config.SmallRyeConfig; /** @@ -158,7 +159,7 @@ private List calculate(List cd, Set calculate(List cd, Set calculate(List cd, Set calculate(List cd, Set calculate(List cd, Set { this._values = e.result; }); this._detailsOpenedItem = []; this._busy = null; + + this._showOnlyOwnProperties = false; + this._searchTerm = ''; } render() { @@ -132,31 +144,56 @@ export class QwcConfiguration extends observeState(LitElement) { } _filterTextChanged(e) { - const searchTerm = (e.detail.value || '').trim(); - if (searchTerm === '') { - this._filtered = devuiState.allConfiguration; + this._searchTerm = (e.detail.value || '').trim(); + return this._filterGrid(); + } + + _filterGrid(){ + if (this._searchTerm === '') { + this._filtered = this._visibleConfiguration; return; } - this._filtered = devuiState.allConfiguration.filter((prop) => { - return this._match(prop.name, searchTerm) || this._match(prop.description, searchTerm) + this._filtered = this._visibleConfiguration.filter((prop) => { + return this._match(prop.name, this._searchTerm) || this._match(prop.description, this._searchTerm) }); } _render() { return html`
- - - ${this._filtered.length} - +
+ + + ${this._filtered.length} + + + +
${this._renderGrid()}
`; } + _toggleShowOnlyOwnProperties(onlyMine){ + this._showOnlyOwnProperties = onlyMine; + if(this._showOnlyOwnProperties){ + this._visibleConfiguration = devuiState.allConfiguration.filter((prop) => { + return (prop.configValue.sourceName && prop.configValue.sourceName.startsWith("PropertiesConfigSource[source") + && prop.configValue.sourceName.endsWith("/application.properties]")); + }); + }else { + this._visibleConfiguration = devuiState.allConfiguration; + } + return this._filterGrid(); + } + _renderGrid(){ if(this._busy){ return html`${this._renderStyledGrid("disabledDatatable")}`;