|
|
@ -1,4 +1,7 @@ |
|
|
|
|
|
|
|
import { DELETED } from '../../consts'; |
|
|
|
|
|
|
|
|
|
|
|
import buildGetRequestHandler from '../buildGetRequestHandler'; |
|
|
|
import buildGetRequestHandler from '../buildGetRequestHandler'; |
|
|
|
|
|
|
|
import { buildQueryResultReducer } from '../../buildQueryResultModifier'; |
|
|
|
import join from '../../join'; |
|
|
|
import join from '../../join'; |
|
|
|
import { sanitize } from '../../sanitize'; |
|
|
|
import { sanitize } from '../../sanitize'; |
|
|
|
import { stdoutVar } from '../../shell'; |
|
|
|
import { stdoutVar } from '../../shell'; |
|
|
@ -17,31 +20,33 @@ export const getServer = buildGetRequestHandler( |
|
|
|
stdoutVar({ condAnvilUUIDs }); |
|
|
|
stdoutVar({ condAnvilUUIDs }); |
|
|
|
|
|
|
|
|
|
|
|
if (buildQueryOptions) { |
|
|
|
if (buildQueryOptions) { |
|
|
|
buildQueryOptions.afterQueryReturn = (queryStdout) => { |
|
|
|
buildQueryOptions.afterQueryReturn = buildQueryResultReducer< |
|
|
|
let result = queryStdout; |
|
|
|
ServerOverview[] |
|
|
|
|
|
|
|
>( |
|
|
|
if (queryStdout instanceof Array) { |
|
|
|
( |
|
|
|
result = queryStdout.map<ServerOverview>( |
|
|
|
previous, |
|
|
|
([ |
|
|
|
[ |
|
|
|
serverUUID, |
|
|
|
serverUUID, |
|
|
|
serverName, |
|
|
|
serverName, |
|
|
|
serverState, |
|
|
|
serverState, |
|
|
|
serverHostUUID, |
|
|
|
serverHostUUID, |
|
|
|
anvilUUID, |
|
|
|
anvilUUID, |
|
|
|
anvilName, |
|
|
|
anvilName, |
|
|
|
]) => ({ |
|
|
|
], |
|
|
|
serverHostUUID, |
|
|
|
) => { |
|
|
|
serverName, |
|
|
|
previous.push({ |
|
|
|
serverState, |
|
|
|
anvilName, |
|
|
|
serverUUID, |
|
|
|
anvilUUID, |
|
|
|
anvilUUID, |
|
|
|
serverHostUUID, |
|
|
|
anvilName, |
|
|
|
serverName, |
|
|
|
}), |
|
|
|
serverState, |
|
|
|
); |
|
|
|
serverUUID, |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
return previous; |
|
|
|
}; |
|
|
|
}, |
|
|
|
|
|
|
|
[], |
|
|
|
|
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return ` |
|
|
|
return ` |
|
|
@ -55,7 +60,7 @@ export const getServer = buildGetRequestHandler( |
|
|
|
FROM servers AS ser |
|
|
|
FROM servers AS ser |
|
|
|
JOIN anvils AS anv |
|
|
|
JOIN anvils AS anv |
|
|
|
ON ser.server_anvil_uuid = anv.anvil_uuid |
|
|
|
ON ser.server_anvil_uuid = anv.anvil_uuid |
|
|
|
WHERE ser.server_state != 'DELETED' |
|
|
|
WHERE ser.server_state != '${DELETED}' |
|
|
|
${condAnvilUUIDs};`;
|
|
|
|
${condAnvilUUIDs};`;
|
|
|
|
}, |
|
|
|
}, |
|
|
|
); |
|
|
|
); |
|
|
|