@@ -30,14 +30,16 @@ export class QwcFlywayDatasources extends QwcHotReloadElement {
30
30
static properties = {
31
31
_ds : { state : true } ,
32
32
_selectedDs : { state : true } ,
33
- _createDialogOpened : { state : true }
33
+ _createDialogOpened : { state : true } ,
34
+ _cleanDisabled : { state : true }
34
35
}
35
36
36
37
constructor ( ) {
37
38
super ( ) ;
38
39
this . _ds = null ;
39
40
this . _selectedDs = null ;
40
41
this . _createDialogOpened = false ;
42
+ this . _cleanDisabled = true ;
41
43
}
42
44
43
45
connectedCallback ( ) {
@@ -47,7 +49,11 @@ export class QwcFlywayDatasources extends QwcHotReloadElement {
47
49
48
50
hotReload ( ) {
49
51
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 ;
51
57
} ) ;
52
58
}
53
59
@@ -81,16 +87,21 @@ export class QwcFlywayDatasources extends QwcHotReloadElement {
81
87
82
88
_renderMigrationButtons ( ds ) {
83
89
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 ) }
88
91
< vaadin-button theme ="small " @click =${ ( ) => this . _migrate ( ds ) } class ="button">
89
92
< vaadin-icon icon ="font-awesome-solid:arrow-right-arrow-left "> </ vaadin-icon > Migrate
90
93
</ vaadin-button > ` ;
91
94
}
92
95
}
93
96
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
+
94
105
_renderCreateButton ( ds ) {
95
106
if ( ds . createPossible ) {
96
107
return html `
@@ -146,6 +157,7 @@ export class QwcFlywayDatasources extends QwcHotReloadElement {
146
157
_migrate ( ds ) {
147
158
this . jsonRpc . migrate ( { ds : ds . name } ) . then ( jsonRpcResponse => {
148
159
this . _showResultNotification ( jsonRpcResponse . result ) ;
160
+ this . hotReload ( ) ;
149
161
} ) ;
150
162
}
151
163
0 commit comments