fix(striker-ui-api): consolidate disassemble host name functions

main
Tsu-ba-me 2 years ago
parent 7b0a7e711d
commit db248efd96
  1. 8
      striker-ui-api/src/lib/disassembleHostName.ts
  2. 2
      striker-ui-api/src/lib/getShortHostName.ts
  3. 2
      striker-ui-api/src/lib/request_handlers/host/buildQueryHostDetail.ts
  4. 2
      striker-ui-api/src/lib/request_handlers/host/getHost.ts

@ -0,0 +1,8 @@
export const getHostNameDomain = (hostName: string) =>
hostName.replace(/^.*?[.]/, '');
export const getHostNamePrefix = (hostName: string) =>
hostName.replace(/-.*$/, '');
export const getShortHostName = (hostName: string) =>
hostName.replace(/[.].*$/, '');

@ -1,2 +0,0 @@
export const getShortHostName = (hostName: string) =>
hostName.replace(/[.].*$/, '');

@ -1,7 +1,7 @@
import { buildKnownIDCondition } from '../../buildCondition';
import { buildQueryResultModifier } from '../../buildQueryResultModifier';
import { cap } from '../../cap';
import { getShortHostName } from '../../getShortHostName';
import { getShortHostName } from '../../disassembleHostName';
import { stdout } from '../../shell';
type ExtractVariableKeyFunction = (parts: string[]) => string;

@ -4,7 +4,7 @@ import buildGetRequestHandler from '../buildGetRequestHandler';
import { buildQueryHostDetail } from './buildQueryHostDetail';
import { buildQueryResultReducer } from '../../buildQueryResultModifier';
import { toLocal } from '../../convertHostUUID';
import { getShortHostName } from '../../getShortHostName';
import { getShortHostName } from '../../disassembleHostName';
import { sanitize } from '../../sanitize';
export const getHost = buildGetRequestHandler((request, buildQueryOptions) => {

Loading…
Cancel
Save