Merge pull request #1432 from Dokploy/1315-show-containers-sorted-by-name

refactor(docker): sort container lists by name
This commit is contained in:
Mauricio Siu
2025-03-08 17:56:49 -06:00
committed by GitHub

View File

@@ -136,7 +136,8 @@ export const getContainersByAppNameMatch = async (
result = stdout.trim().split("\n");
}
const containers = result.map((line) => {
const containers = result
.map((line) => {
const parts = line.split(" | ");
const containerId = parts[0]
? parts[0].replace("CONTAINER ID : ", "").trim()
@@ -153,7 +154,8 @@ export const getContainersByAppNameMatch = async (
name,
state,
};
});
})
.sort((a, b) => a.name.localeCompare(b.name));
return containers || [];
} catch (_error) {}
@@ -190,7 +192,8 @@ export const getStackContainersByAppName = async (
result = stdout.trim().split("\n");
}
const containers = result.map((line) => {
const containers = result
.map((line) => {
const parts = line.split(" | ");
const containerId = parts[0]
? parts[0].replace("CONTAINER ID : ", "").trim()
@@ -211,7 +214,8 @@ export const getStackContainersByAppName = async (
state,
node,
};
});
})
.sort((a, b) => a.name.localeCompare(b.name));
return containers || [];
} catch (_error) {}
@@ -249,7 +253,8 @@ export const getServiceContainersByAppName = async (
result = stdout.trim().split("\n");
}
const containers = result.map((line) => {
const containers = result
.map((line) => {
const parts = line.split(" | ");
const containerId = parts[0]
? parts[0].replace("CONTAINER ID : ", "").trim()
@@ -271,7 +276,8 @@ export const getServiceContainersByAppName = async (
state,
node,
};
});
})
.sort((a, b) => a.name.localeCompare(b.name));
return containers || [];
} catch (_error) {}
@@ -306,7 +312,8 @@ export const getContainersByAppLabel = async (
const lines = stdout.trim().split("\n");
const containers = lines.map((line) => {
const containers = lines
.map((line) => {
const parts = line.split(" | ");
const containerId = parts[0]
? parts[0].replace("CONTAINER ID : ", "").trim()
@@ -322,7 +329,8 @@ export const getContainersByAppLabel = async (
name,
state,
};
});
})
.sort((a, b) => a.name.localeCompare(b.name));
return containers || [];
} catch (_error) {}