fix(smartTable): refresh button await query
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2022-09-07 10:30:50 +02:00
parent ee23e26104
commit bbc5790945
2 changed files with 15 additions and 8 deletions

View File

@ -10,9 +10,9 @@
<div ng-transclude="actions"></div>
</div>
<div class="actions-right">
<div class="totalRows" ng-if="$ctrl.model.data">
{{model.data.length}}
<span translate>results</span>
<div class="totalRows" ng-if="$ctrl.model.data">
{{model.data.length}}
<span translate>results</span>
</div>
<vn-button icon="search"
ng-if="$ctrl.options.activeButtons.search"
@ -40,7 +40,8 @@
</vn-button>
</div>
<vn-button icon="refresh"
ng-click="$ctrl.model.refresh()"
ng-click="$ctrl.refresh()"
disabled="$ctrl.isRefreshing"
vn-tooltip="Refresh">
</vn-button>
</div>
@ -64,7 +65,7 @@
<vn-crud-model
ng-if="$ctrl.viewConfigId"
vn-id="userViewModel"
vn-id="userViewModel"
url="UserConfigViews"
link="{tableCode: $ctrl.viewConfigId, userFk: $ctrl.currentUserId}"
data="$ctrl.viewConfig"
@ -75,9 +76,9 @@
<div class="smart-table-columns vn-pa-md vn-w-sm">
<vn-horizontal>
<h6 translate style="margin:0">Shown columns</h6>
<vn-icon
<vn-icon
vn-none
icon="info"
icon="info"
color-marginal
vn-tooltip="Check the columns you want to see"/>
</vn-horizontal>
@ -101,4 +102,4 @@
</vn-horizontal>
</div>
</tpl-body>
</vn-popover>
</vn-popover>

View File

@ -511,6 +511,12 @@ export default class SmartTable extends Component {
return this.model.save()
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')));
}
refresh() {
this.isRefreshing = true;
this.model.refresh()
.then(() => this.isRefreshing = false);
}
}
SmartTable.$inject = ['$element', '$scope', '$transclude'];