mirror of https://github.com/portainer/portainer
Merge pull request #4766 from portainer/fix/GH/3068-fix-auto-refresh-collapse
fix(docker/services): save the settings of the table for auto refreshpull/4758/head
commit
bc459b55ae
|
@ -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,12 +13,13 @@ angular.module('portainer.docker').controller('ServicesController', [
|
|||
function getServices() {
|
||||
var agentProxy = $scope.applicationState.endpoint.mode.agentProxy;
|
||||
|
||||
$q.all({
|
||||
services: ServiceService.services(),
|
||||
tasks: TaskService.tasks(),
|
||||
containers: agentProxy ? ContainerService.containers(1) : [],
|
||||
nodes: NodeService.nodes(),
|
||||
})
|
||||
return $q
|
||||
.all({
|
||||
services: ServiceService.services(),
|
||||
tasks: TaskService.tasks(),
|
||||
containers: agentProxy ? ContainerService.containers(1) : [],
|
||||
nodes: NodeService.nodes(),
|
||||
})
|
||||
.then(function success(data) {
|
||||
var services = data.services;
|
||||
var tasks = data.tasks;
|
||||
|
|
|
@ -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…
Reference in New Issue