Skip to content

Commit 16627ba

Browse files
authored
Merge pull request #46762 from mbladel/dbview-table
Fix Agroal Dev UI table switching and move SQL input to the top
2 parents 746f5eb + be4d600 commit 16627ba

File tree

1 file changed

+43
-10
lines changed

1 file changed

+43
-10
lines changed

extensions/agroal/deployment/src/main/resources/dev-ui/qwc-agroal-datasource.js

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,26 @@ export class QwcAgroalDatasource extends QwcHotReloadElement {
8080
display: flex;
8181
justify-content: space-between;
8282
gap: 10px;
83+
align-items: center;
84+
padding-bottom: 20px;
85+
border-bottom-style: dotted;
86+
border-bottom-color: var(--lumo-contrast-10pct);
87+
}
88+
89+
.sqlInput .cm-content {
90+
padding: 5px 0;
91+
}
92+
93+
.font-large {
94+
font-size: var(--lumo-font-size-l);
95+
}
96+
97+
.cursor-text {
98+
cursor: text;
99+
}
100+
101+
.no-margin {
102+
margin: 0;
83103
}
84104
85105
#sql {
@@ -388,14 +408,14 @@ export class QwcAgroalDatasource extends QwcHotReloadElement {
388408
_renderTableData(){
389409
if(this._selectedTable && this._currentDataSet && this._currentDataSet.cols){
390410
return html`<div class="data">
411+
${this._renderSqlInput()}
391412
<vaadin-grid .items="${this._currentDataSet.data}" theme="row-stripes no-border" class="fill" column-reordering-allowed>
392413
${this._currentDataSet.cols.map((col) =>
393414
this._renderTableHeader(col)
394415
)}
395416
<span slot="empty-state">No data.</span>
396417
</vaadin-grid>
397418
${this._renderPager()}
398-
${this._renderSqlInput()}
399419
</div>
400420
`;
401421
}else if(this._displaymessage){
@@ -457,15 +477,26 @@ export class QwcAgroalDatasource extends QwcHotReloadElement {
457477
<vaadin-icon icon="font-awesome-solid:circle-chevron-right"></vaadin-icon>
458478
</vaadin-button>`;
459479
}
460-
461-
_renderSqlInput(){
462-
if(this._allowSql){
463-
return html`<div class="sqlInput">
464-
<qui-code-block @shiftEnter=${this._shiftEnterPressed} content="${this._currentSQL}" id="sql" mode="sql" theme="dark" value='${this._currentSQL}' editable></qui-code-block>
465-
<vaadin-icon class="sqlInputButton" title="Clear" icon="font-awesome-solid:broom" @click=${this._clearSqlInput}></vaadin-icon>
466-
<vaadin-icon class="sqlInputButton" title="Run" icon="font-awesome-solid:person-running" @click=${this._executeClicked}></vaadin-icon>
467-
</div>`;
468-
}else {
480+
481+
_renderSqlInput() {
482+
if (this._allowSql) {
483+
return html`
484+
<div class="sqlInput">
485+
<qui-code-block @shiftEnter=${this._shiftEnterPressed} content="${this._currentSQL}"
486+
class="font-large cursor-text" id="sql" mode="sql" theme="dark"
487+
value='${this._currentSQL}' editable></qui-code-block>
488+
<vaadin-button class="no-margin" slot="suffix" theme="icon" aria-label="Clear">
489+
<vaadin-tooltip .hoverDelay=${500} slot="tooltip" text="Clear"></vaadin-tooltip>
490+
<vaadin-icon class="small-icon" @click=${this._clearSqlInput}
491+
icon="font-awesome-solid:trash"></vaadin-icon>
492+
</vaadin-button>
493+
<vaadin-button class="no-margin" slot="suffix" theme="icon" aria-label="Run">
494+
<vaadin-tooltip .hoverDelay=${500} slot="tooltip" text="Run"></vaadin-tooltip>
495+
<vaadin-icon class="small-icon" @click=${this._executeClicked}
496+
icon="font-awesome-solid:play"></vaadin-icon>
497+
</vaadin-button>
498+
</div>`;
499+
} else {
469500
return html`<vaadin-button theme="small" @click="${this._handleAllowSqlChange}">Allow any SQL execution from here</vaadin-button>`;
470501
}
471502
}
@@ -575,6 +606,8 @@ export class QwcAgroalDatasource extends QwcHotReloadElement {
575606

576607
_executeCurrentSQL(){
577608
if(this._currentSQL){
609+
this._currentDataSet = null; // indicates loading
610+
578611
this.jsonRpc.executeSQL({
579612
datasource:this._selectedDataSource.name,
580613
sql:this._currentSQL,

0 commit comments

Comments
 (0)