fix(striker-ui-api): add short name and rename to installTarget in GET /host/:hostUUID

main
Tsu-ba-me 2 years ago
parent a1602d5ea8
commit 9d52213ef9
  1. 11
      striker-ui-api/src/lib/request_handlers/host/buildQueryHostDetail.ts

@ -1,6 +1,7 @@
import { buildKnownIDCondition } from '../../buildCondition';
import { buildQueryResultModifier } from '../../buildQueryResultModifier';
import { cap } from '../../cap';
import { getShortHostName } from '../../getShortHostName';
import { stdout } from '../../shell';
type ExtractVariableKeyFunction = (parts: string[]) => string;
@ -14,7 +15,7 @@ const MAP_TO_EXTRACTOR: { [prefix: string]: ExtractVariableKeyFunction } = {
head,
);
},
'install-target': () => 'installTargetEnable',
'install-target': () => 'installTarget',
};
export const buildQueryHostDetail: BuildQueryDetailFunction = ({
@ -42,9 +43,13 @@ export const buildQueryHostDetail: BuildQueryDetailFunction = ({
const afterQueryReturn: QueryResultModifierFunction =
buildQueryResultModifier((output) => {
const [hostName, hostUUID] = output[0];
const shortHostName = getShortHostName(hostName);
return output.reduce<
{ hostName: string; hostUUID: string } & Record<string, string>
{ hostName: string; hostUUID: string; shortHostName: string } & Record<
string,
string
>
>(
(previous, [, , variableName, variableValue]) => {
const [variablePrefix, ...restVariableParts] =
@ -55,7 +60,7 @@ export const buildQueryHostDetail: BuildQueryDetailFunction = ({
return previous;
},
{ hostName, hostUUID },
{ hostName, hostUUID, shortHostName },
);
});

Loading…
Cancel
Save