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

View File

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