refactor: simplify Docker resource type determination logic by consolidating command structure

This commit is contained in:
Mauricio Siu
2025-09-05 02:50:37 -06:00
parent 35fc04dc8f
commit b90f0135d4
+5 -11
View File
@@ -257,20 +257,14 @@ export const getDockerResourceType = async (
console.log("resourceName", resourceName); console.log("resourceName", resourceName);
let result = ""; let result = "";
const command = ` const command = `
RESOURCE_NAME="${resourceName}" RESOURCE_NAME="${resourceName}"
if docker service inspect "$RESOURCE_NAME" &>/dev/null; then if docker service inspect "$RESOURCE_NAME" >/dev/null 2>&1; then
echo "service" echo "service"
exit 0 elif docker inspect "$RESOURCE_NAME" >/dev/null 2>&1; then
fi
if docker inspect "$RESOURCE_NAME" &>/dev/null; then
echo "standalone" echo "standalone"
exit 0 else
fi
echo "unknown" echo "unknown"
exit 0 fi`;
`;
console.log("command", command); console.log("command", command);