feat: Enhance container stats monitoring and UI integration with new ContainerStatsComponent
This commit is contained in:
@@ -574,14 +574,23 @@ export class OneboxDockerManager {
|
||||
|
||||
/**
|
||||
* Get container stats (CPU, memory, network)
|
||||
* Handles both regular containers and Swarm services
|
||||
*/
|
||||
async getContainerStats(containerID: string): Promise<IContainerStats | null> {
|
||||
try {
|
||||
const container = await this.dockerClient!.getContainerById(containerID);
|
||||
// Try to get container directly first
|
||||
let container = await this.dockerClient!.getContainerById(containerID);
|
||||
|
||||
// If not found, it might be a service ID - try to get the actual container ID
|
||||
if (!container) {
|
||||
const serviceContainerId = await this.getContainerIdForService(containerID);
|
||||
if (serviceContainerId) {
|
||||
container = await this.dockerClient!.getContainerById(serviceContainerId);
|
||||
}
|
||||
}
|
||||
|
||||
if (!container) {
|
||||
// Container not found - this is expected for Swarm services where we have service ID instead of container ID
|
||||
// Return null silently
|
||||
// Container/service not found
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user