mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor(docker): sort container lists by name
- Add sorting to container retrieval methods in docker service - Ensure consistent container list ordering across different container fetching functions - Improve readability and predictability of container list results
This commit is contained in:
@@ -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) {}
|
||||
|
||||
Reference in New Issue
Block a user