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

DevUI: Add search for Arc tables #45489

Merged
merged 1 commit into from
Jan 28, 2025
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 @@ -18,6 +18,12 @@ export class QwcArcBeans extends LitElement {
jsonRpc = new JsonRpc(this);

static styles = css`
:host {
display: flex;
flex-direction: column;
height: 100%;
}

.arctable {
height: 100%;
padding-bottom: 10px;
Expand Down Expand Up @@ -46,17 +52,23 @@ export class QwcArcBeans extends LitElement {
overflow: hidden;
height: 100%;
}
.filterBar {
width: 99%;
margin-left: 5px;
}
`;

static properties = {
_beans: {state: true},
_filteredBeans: {state: true},
_beanIdsWithDependencyGraphs: {state: true},
_selectedBean: {state: true}
};

constructor() {
super();
this._beans = beans;
this._filteredBeans = this._beans;
this._beanIdsWithDependencyGraphs = beanIdsWithDependencyGraphs;
this._selectedBean = null;
}
Expand All @@ -74,11 +86,12 @@ export class QwcArcBeans extends LitElement {
newBeans.push(bean);
}
this._beans = newBeans;
this._filteredBeans = this._beans;
});
}

render() {
if (this._beans) {
if (this._filteredBeans) {
if (this._selectedBean) {
return this._renderBeanGraph();
} else {
Expand All @@ -89,8 +102,35 @@ export class QwcArcBeans extends LitElement {
}
}

_renderFilterBar(){
return html`<vaadin-text-field
placeholder="Search"
class="filterBar"
@value-changed="${(e) => {
const searchTerm = (e.detail.value || '').trim();
const matchesTerm = (value) => {
if(value){
return value.toLowerCase().includes(searchTerm.toLowerCase());
}
}
if(searchTerm?.trim()){
this._filteredBeans = this._beans.filter(
({ providerType, kind }) => {
return !searchTerm ||
matchesTerm(providerType?.name) ||
matchesTerm(kind)
});
}else{
this._filteredBeans = this._beans;
}
}}">
<vaadin-icon slot="prefix" icon="font-awesome-solid:magnifying-glass"></vaadin-icon>
</vaadin-text-field>`;
}

_renderBeanList(){
return html`<vaadin-grid .items="${this._beans}" class="arctable" theme="no-border">
return html`${this._renderFilterBar()}
<vaadin-grid .items="${this._filteredBeans}" class="arctable" theme="no-border">
<vaadin-grid-sort-column path="providerType.name" auto-width
header="Bean"
${columnBodyRenderer(this._beanRenderer, [])}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ import 'qui-badge';
export class QwcArcInterceptors extends LitElement {

static styles = css`
:host {
display: flex;
flex-direction: column;
height: 100%;
}

.arctable {
height: 100%;
padding-bottom: 10px;
Expand All @@ -24,21 +30,28 @@ export class QwcArcInterceptors extends LitElement {
.annotation {
color: var(--lumo-contrast-50pct);
}

.filterBar {
width: 99%;
margin-left: 5px;
}
`;

static properties = {
_interceptors: {attribute: false}
_interceptors: {attribute: false},
_filteredInterceptors: {attribute: false}
};

constructor() {
super();
this._interceptors = interceptors;
this._filteredInterceptors = this._interceptors;
}

render() {
if(this._interceptors){
return html`
<vaadin-grid .items="${this._interceptors}" class="arctable" theme="no-border">
if(this._filteredInterceptors){
return html`${this._renderFilterBar()}
<vaadin-grid .items="${this._filteredInterceptors}" class="arctable" theme="no-border">
<vaadin-grid-sort-column path="interceptorClass.name" auto-width
header="Interceptor Class"
${columnBodyRenderer(this._classRenderer, [])}
Expand Down Expand Up @@ -67,6 +80,32 @@ export class QwcArcInterceptors extends LitElement {
}
}

_renderFilterBar(){
return html`<vaadin-text-field
placeholder="Search"
class="filterBar"
@value-changed="${(e) => {
const searchTerm = (e.detail.value || '').trim();
const matchesTerm = (value) => {
if(value){
return value.toLowerCase().includes(searchTerm.toLowerCase());
}
}
if(searchTerm?.trim()){
this._filteredInterceptors = this._interceptors.filter(
({ interceptorClass, priority }) => {
return !searchTerm ||
matchesTerm(interceptorClass?.name) ||
matchesTerm(priority.toString())
});
}else{
this._filteredInterceptors = this._interceptors;
}
}}">
<vaadin-icon slot="prefix" icon="font-awesome-solid:magnifying-glass"></vaadin-icon>
</vaadin-text-field>`;
}

_classRenderer(bean){
return html`
<code>${bean.interceptorClass.name}</code>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ import 'qui-ide-link';
export class QwcArcObservers extends LitElement {

static styles = css`
:host {
display: flex;
flex-direction: column;
height: 100%;
}
.arctable {
height: 100%;
padding-bottom: 10px;
Expand All @@ -33,22 +38,28 @@ export class QwcArcObservers extends LitElement {
.annotation {
color: var(--lumo-contrast-50pct);
}
.filterBar {
width: 99%;
margin-left: 5px;
}
`;

static properties = {
_observers: {attribute: false}
_observers: {attribute: false},
_filteredObservers: {state: true}
};

constructor() {
super();
this._observers = observers;
this._filteredObservers = this._observers;
}

render() {
if(this._observers){
if(this._filteredObservers){

return html`
<vaadin-grid .items="${this._observers}" class="arctable" theme="no-border">
return html`${this._renderFilterBar()}
<vaadin-grid .items="${this._filteredObservers}" class="arctable" theme="no-border">

<vaadin-grid-sort-column path="declaringClass.name" auto-width
header="Source"
Expand Down Expand Up @@ -90,6 +101,33 @@ export class QwcArcObservers extends LitElement {
}
}

_renderFilterBar(){
return html`<vaadin-text-field
placeholder="Search"
class="filterBar"
@value-changed="${(e) => {
const searchTerm = (e.detail.value || '').trim();
const matchesTerm = (value) => {
if(value){
return value.toLowerCase().includes(searchTerm.toLowerCase());
}
}
if(searchTerm?.trim()){
this._filteredObservers = this._observers.filter(
({ declaringClass, observedType , priority}) => {
return !searchTerm ||
matchesTerm(declaringClass?.name) ||
matchesTerm(observedType?.name) ||
matchesTerm(priority.toString())
});
}else{
this._filteredObservers = this._observers;
}
}}">
<vaadin-icon slot="prefix" icon="font-awesome-solid:magnifying-glass"></vaadin-icon>
</vaadin-text-field>`;
}

_sourceRenderer(bean){
return html`<qui-ide-link fileName='${bean.declaringClass.name}'><code>${bean.declaringClass.name}</code><code class="method">#${bean.methodName}()</code></qui-ide-link>`;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,48 @@ import 'qui-ide-link';
export class QwcArcRemovedComponents extends LitElement {
static styles = css`
.fullHeight {
height: 100%;
height: 100%;
}

.searchableGrid {
display: flex;
flex-direction: column;
height: 100%;
}

code {
font-size: 85%;
font-size: 85%;
}

.annotation {
color: var(--lumo-contrast-50pct);
color: var(--lumo-contrast-50pct);
}

.producer {
color: var(--lumo-primary-text-color);
color: var(--lumo-primary-text-color);
}

.filterBar {
width: 99%;
margin-left: 5px;
}
`;

static properties = {
_removedBeans: {state: true},
_filteredRemovedBeans: {state: true},
_removedDecorators: {state: true},
_removedInterceptors: {state: true},
_filteredRemovedInterceptors: {state: true},
};

constructor() {
super();
this._removedBeans = removedBeans;
this._filteredRemovedBeans = this._removedBeans;
this._removedDecorators = removedDecorators;
this._removedInterceptors = removedInterceptors;
this._filteredRemovedInterceptors = this._removedInterceptors;
}

render() {
Expand Down Expand Up @@ -75,8 +91,8 @@ export class QwcArcRemovedComponents extends LitElement {

if (this._removedBeans.length > 0) {

return html`
<vaadin-grid .items="${this._removedBeans}" theme="no-border" class="fullHeight">
return html`${this._renderFilterBar(0)}
<vaadin-grid .items="${this._filteredRemovedBeans}" theme="no-border" class="searchableGrid">
<vaadin-grid-sort-column path="providerType.name" auto-width
header="Bean"
${columnBodyRenderer(this._beanRenderer, [])}
Expand All @@ -95,6 +111,43 @@ export class QwcArcRemovedComponents extends LitElement {
}
}

_renderFilterBar(tab){
return html`<vaadin-text-field
placeholder="Search"
class="filterBar"
@value-changed="${(e) => {
const searchTerm = (e.detail.value || '').trim();
const matchesTerm = (value) => {
if(value){
return value.toLowerCase().includes(searchTerm.toLowerCase());
}
}
if(tab === 0){
if(searchTerm?.trim()){
this._filteredRemovedBeans = this._removedBeans.filter(
({ providerType}) => {
return !searchTerm ||
matchesTerm(providerType?.name)
});
}else{
this._filteredRemovedBeans = this._removedBeans;
}
}else if (tab === 2){
if(searchTerm?.trim()){
this._filteredRemovedInterceptors = this._removedInterceptors.filter(
({ interceptorClass}) => {
return !searchTerm ||
matchesTerm(interceptorClass?.name)
});
}else{
this._filteredRemovedInterceptors = this._removedInterceptors;
}
}
}}">
<vaadin-icon slot="prefix" icon="font-awesome-solid:magnifying-glass"></vaadin-icon>
</vaadin-text-field>`;
}

_renderRemovedDecorators(){
if (this._removedDecorators.length > 0) {
return html`TODO: Not yet implemented`;
Expand All @@ -106,8 +159,8 @@ export class QwcArcRemovedComponents extends LitElement {

_renderRemovedInterceptors(){
if (this._removedInterceptors.length > 0) {
return html`
<vaadin-grid .items="${this._removedInterceptors}" theme="no-border" class="fullHeight">
return html`${this._renderFilterBar(2)}
<vaadin-grid .items="${this._filteredRemovedInterceptors}" theme="no-border" class="fullHeight">
<vaadin-grid-sort-column path="interceptorClass.name" auto-width
header="Interceptor"
${columnBodyRenderer(this._interceptorRenderer, [])}
Expand Down
Loading