fix(striker-ui-api): get NICs on specified host

main
Tsu-ba-me 2 years ago
parent f4c171b44f
commit 32c32350bd
  1. 10
      striker-ui-api/src/lib/request_handlers/network-interface/getNetworkInterface.ts
  2. 2
      striker-ui-api/src/routes/network-interface.ts

@ -1,10 +1,10 @@
import { getLocalHostUUID } from '../../accessModule';
import { toHostUUID } from '../../convertHostUUID';
import buildGetRequestHandler from '../buildGetRequestHandler';
export const getNetworkInterface = buildGetRequestHandler(
(request, buildQueryOptions) => {
const localHostUUID: string = getLocalHostUUID();
({ params: { hostUUID: rawHostUUID } }, buildQueryOptions) => {
const hostUUID = toHostUUID(rawHostUUID ?? 'local');
if (buildQueryOptions) {
buildQueryOptions.afterQueryReturn = (queryStdout) => {
@ -48,7 +48,7 @@ export const getNetworkInterface = buildGetRequestHandler(
network_interface_speed,
ROW_NUMBER() OVER(ORDER BY modified_date ASC) AS network_interface_order
FROM network_interfaces
WHERE network_interface_operational != 'DELETE'
AND network_interface_host_uuid = '${localHostUUID}';`;
WHERE network_interface_operational != 'DELETED'
AND network_interface_host_uuid = '${hostUUID}';`;
},
);

@ -4,6 +4,6 @@ import { getNetworkInterface } from '../lib/request_handlers/network-interface';
const router = express.Router();
router.get('/', getNetworkInterface);
router.get('/', getNetworkInterface).get('/:hostUUID', getNetworkInterface);
export default router;

Loading…
Cancel
Save