Skip to content
This repository was archived by the owner on Jul 15, 2022. It is now read-only.

Commit fe58996

Browse files
author
Leonardo Chaia
committed
fix: improved list refreshing logics
1 parent 75ea8ce commit fe58996

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

src/app/daemon-tools/container-list/container-list.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class ContainerListComponent implements OnInit, OnDestroy {
2727

2828
public ngOnInit() {
2929

30-
this.daemonEvents.bindAll(['destroy', 'start', 'stop', 'pause', 'unpause', 'restart', 'update'])
30+
this.daemonEvents.bindAll(['destroy', 'start', 'stop', 'pause', 'unpause', 'restart', 'update'], 'container')
3131
.pipe(takeUntil(this.componetDestroyed))
3232
.subscribe(() => {
3333
this.reload();

src/app/daemon-tools/docker-events.service.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ export class DockerEventsService implements OnDestroy {
2525
if (this.events.has(decoded.Action)) {
2626
this.events.get(decoded.Action).next(decoded);
2727
}
28+
29+
const combined = `${decoded.Type}.${decoded.Action}`;
30+
if (this.events.has(combined)) {
31+
this.events.get(combined).next(decoded);
32+
}
2833
});
2934
}
3035

@@ -43,7 +48,7 @@ export class DockerEventsService implements OnDestroy {
4348
}
4449
}
4550

46-
public bindAll(events: string[]) {
47-
return combineLatest(events.map(e => this.bind(e).pipe(startWith(null))));
51+
public bindAll(events: string[], type?: string) {
52+
return combineLatest(events.map(e => this.bind(type ? `${type}.${e}` : e).pipe(startWith(null))));
4853
}
4954
}

src/app/daemon-tools/image-list/image-list.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class ImageListComponent implements OnInit, OnDestroy {
4747
this.processFilter();
4848
});
4949

50-
this.daemonEvents.bindAll(['delete', 'import', 'load', 'pull', 'tag', 'untag'])
50+
this.daemonEvents.bindAll(['delete', 'import', 'load', 'pull', 'tag', 'untag'], 'image')
5151
.pipe(takeUntil(this.componetDestroyed))
5252
.subscribe(() => {
5353
this.reload();

0 commit comments

Comments
 (0)