Merge pull request #4766 from portainer/fix/GH/3068-fix-auto-refresh-collapse

fix(docker/services): save the settings of the table for auto refresh
pull/4758/head
jfadelhaye 4 years ago committed by GitHub
commit bc459b55ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -66,6 +66,13 @@ angular.module('portainer.docker').controller('ServicesDatatableController', [
}
};
this.onDataRefresh = function () {
var storedExpandedItems = DatatableService.getDataTableExpandedItems(this.tableKey);
if (storedExpandedItems !== null) {
this.expandItems(storedExpandedItems);
}
};
this.$onInit = function () {
this.setDefaults();
this.prepareTableFromDataset();

@ -13,7 +13,8 @@ angular.module('portainer.docker').controller('ServicesController', [
function getServices() {
var agentProxy = $scope.applicationState.endpoint.mode.agentProxy;
$q.all({
return $q
.all({
services: ServiceService.services(),
tasks: TaskService.tasks(),
containers: agentProxy ? ContainerService.containers(1) : [],

@ -183,8 +183,9 @@ angular.module('portainer.app').controller('GenericDatatableController', [
};
this.startRepeater = function () {
this.repeater = $interval(() => {
this.refreshCallback();
this.repeater = $interval(async () => {
await this.refreshCallback();
this.onDataRefresh();
}, this.settings.repeater.refreshRate * 1000);
};
@ -197,6 +198,14 @@ angular.module('portainer.app').controller('GenericDatatableController', [
}
DatatableService.setDataTableSettings(this.tableKey, this.settings);
};
/**
* Override this method to execute code after calling the refresh callback
*/
this.onDataRefresh = function () {
return;
};
/**
* !REPEATER SECTION
*/

Loading…
Cancel
Save