@@ -30,14 +30,16 @@ export class QwcFlywayDatasources extends QwcHotReloadElement {
3030 static properties = {
3131 _ds : { state : true } ,
3232 _selectedDs : { state : true } ,
33- _createDialogOpened : { state : true }
33+ _createDialogOpened : { state : true } ,
34+ _cleanDisabled : { state : true }
3435 }
3536
3637 constructor ( ) {
3738 super ( ) ;
3839 this . _ds = null ;
3940 this . _selectedDs = null ;
4041 this . _createDialogOpened = false ;
42+ this . _cleanDisabled = true ;
4143 }
4244
4345 connectedCallback ( ) {
@@ -47,7 +49,11 @@ export class QwcFlywayDatasources extends QwcHotReloadElement {
4749
4850 hotReload ( ) {
4951 this . jsonRpc . getDatasources ( ) . then ( jsonRpcResponse => {
50- this . _ds = jsonRpcResponse . result ;
52+ this . _ds = jsonRpcResponse . result ;
53+ } ) ;
54+
55+ this . jsonRpc . isCleanDisabled ( ) . then ( jsonRpcResponse => {
56+ this . _cleanDisabled = jsonRpcResponse . result ;
5157 } ) ;
5258 }
5359
@@ -81,16 +87,21 @@ export class QwcFlywayDatasources extends QwcHotReloadElement {
8187
8288 _renderMigrationButtons ( ds ) {
8389 if ( ds . hasMigrations ) {
84- return html `
85- < vaadin-button theme ="small " @click =${ ( ) => this . _clean ( ds ) } class ="button">
86- < vaadin-icon class ="clearIcon " icon ="font-awesome-solid:broom "> </ vaadin-icon > Clean
87- </ vaadin-button >
90+ return html `${ this . _renderCleanButton ( ds ) }
8891 < vaadin-button theme ="small " @click =${ ( ) => this . _migrate ( ds ) } class ="button">
8992 < vaadin-icon icon ="font-awesome-solid:arrow-right-arrow-left "> </ vaadin-icon > Migrate
9093 </ vaadin-button > ` ;
9194 }
9295 }
9396
97+ _renderCleanButton ( ds ) {
98+ if ( ! this . _cleanDisabled ) {
99+ return html `< vaadin-button theme ="small " @click =${ ( ) => this . _clean ( ds ) } class ="button">
100+ < vaadin-icon class ="clearIcon " icon ="font-awesome-solid:broom "> </ vaadin-icon > Clean
101+ </ vaadin-button > ` ;
102+ }
103+ }
104+
94105 _renderCreateButton ( ds ) {
95106 if ( ds . createPossible ) {
96107 return html `
@@ -146,6 +157,7 @@ export class QwcFlywayDatasources extends QwcHotReloadElement {
146157 _migrate ( ds ) {
147158 this . jsonRpc . migrate ( { ds : ds . name } ) . then ( jsonRpcResponse => {
148159 this . _showResultNotification ( jsonRpcResponse . result ) ;
160+ this . hotReload ( ) ;
149161 } ) ;
150162 }
151163
0 commit comments