mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor: streamline container parsing logic in Docker service functions
This commit is contained in:
@@ -136,8 +136,7 @@ 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()
|
||||
@@ -154,8 +153,7 @@ export const getContainersByAppNameMatch = async (
|
||||
name,
|
||||
state,
|
||||
};
|
||||
})
|
||||
.sort((a, b) => a.name.localeCompare(b.name));
|
||||
});
|
||||
|
||||
return containers || [];
|
||||
} catch (_error) {}
|
||||
@@ -192,8 +190,7 @@ 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()
|
||||
@@ -214,8 +211,7 @@ export const getStackContainersByAppName = async (
|
||||
state,
|
||||
node,
|
||||
};
|
||||
})
|
||||
.sort((a, b) => a.name.localeCompare(b.name));
|
||||
});
|
||||
|
||||
return containers || [];
|
||||
} catch (_error) {}
|
||||
@@ -253,8 +249,7 @@ 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()
|
||||
@@ -276,8 +271,7 @@ export const getServiceContainersByAppName = async (
|
||||
state,
|
||||
node,
|
||||
};
|
||||
})
|
||||
.sort((a, b) => a.name.localeCompare(b.name));
|
||||
});
|
||||
|
||||
return containers || [];
|
||||
} catch (_error) {}
|
||||
@@ -318,8 +312,7 @@ 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()
|
||||
@@ -335,8 +328,7 @@ 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