fix(striker-ui-api): replace all instances of parseInt

main
Tsu-ba-me 1 year ago
parent 8f5620f84e
commit 47960b8565
  1. 2
      striker-ui-api/src/lib/accessModule.ts
  2. 4
      striker-ui-api/src/lib/disassembleEntityId.ts
  3. 10
      striker-ui-api/src/lib/request_handlers/anvil/buildQueryAnvilDetail.ts
  4. 6
      striker-ui-api/src/lib/request_handlers/host/getHostConnection.ts
  5. 4
      striker-ui-api/src/lib/request_handlers/manifest/getManifestDetail.ts
  6. 2
      striker-ui-api/src/lib/request_handlers/manifest/getManifestTemplate.ts
  7. 2
      striker-ui-api/src/lib/request_handlers/ssh-key/getSSHKeyConflict.ts
  8. 2
      striker-ui-api/src/lib/shell.ts

@ -463,7 +463,7 @@ const getVncinfo = async (serverUuid: string): Promise<ServerDetailVncInfo> => {
const [[vncinfo]] = rows;
const [domain, rPort] = vncinfo.split(':');
const port = Number.parseInt(rPort);
const port = Number(rPort);
const protocol = 'ws';
return { domain, port, protocol };

@ -1,7 +1,7 @@
export const getEntityName = (id: string) => id.replace(/\d*$/, '');
export const getEntityNumber = (id: string) =>
Number.parseInt(id.replace(/^[^\d]*/, ''));
Number(id.replace(/^[^\d]*/, ''));
export const getEntityParts = (id: string) => {
let name = '';
@ -13,7 +13,7 @@ export const getEntityParts = (id: string) => {
const parts = matchResult;
name = parts[1];
number = Number.parseInt(parts[2]);
number = Number(parts[2]);
}
return { name, number };

@ -263,12 +263,12 @@ const buildQueryAnvilDetail = ({
anvilUUID,
anvilName,
anvilDescription,
anvilTotalCPUCores: parseInt(anvilTotalCPUCores),
anvilTotalCPUCores: Number(anvilTotalCPUCores),
anvilTotalMemory: String(anvilTotalMemory),
anvilTotalAllocatedCPUCores: parseInt(
anvilTotalAllocatedCPUCores: Number(
anvilTotalAllocatedCPUCores,
),
anvilTotalAvailableCPUCores: parseInt(
anvilTotalAvailableCPUCores: Number(
anvilTotalAvailableCPUCores,
),
} as AnvilDetailForProvisionServer;
@ -280,7 +280,7 @@ const buildQueryAnvilDetail = ({
hosts[hostUUID] = {
hostUUID,
hostName,
hostCPUCores: parseInt(hostCPUCores),
hostCPUCores: Number(hostCPUCores),
hostMemory: String(hostMemory),
};
}
@ -297,7 +297,7 @@ const buildQueryAnvilDetail = ({
servers[serverUUID] = {
serverUUID,
serverName,
serverCPUCores: parseInt(serverCPUCores),
serverCPUCores: Number(serverCPUCores),
serverMemory,
};
}

@ -15,7 +15,7 @@ const buildHostConnections = (
) =>
Object.entries(databaseHash).reduce<HostConnectionOverview>(
(previous, [hostUUID, { host: ipAddress, ping, port: rawPort, user }]) => {
const port = parseInt(rawPort);
const port = Number(rawPort);
if (hostUUID === fromHostUUID) {
previous.inbound.port = port;
@ -91,8 +91,8 @@ export const getHostConnection = buildGetRequestHandler(
hostUUID,
ipAddress,
ipAddressUUID,
networkLinkNumber: parseInt(rawNetworkLinkNumber),
networkNumber: parseInt(rawNetworkNumber),
networkLinkNumber: Number(rawNetworkLinkNumber),
networkNumber: Number(rawNetworkNumber),
networkType,
};
},

@ -217,7 +217,7 @@ export const getManifestDetail: RequestHandler = async (request, response) => {
name,
networkConfig: {
dnsCsv,
mtu: Number.parseInt(mtu),
mtu: Number(mtu),
networks: Object.entries(networkList)
.sort(handleSortNetworks)
.reduce<ManifestDetailNetworkList>(
@ -252,7 +252,7 @@ export const getManifestDetail: RequestHandler = async (request, response) => {
ntpCsv,
},
prefix,
sequence: Number.parseInt(sequence),
sequence: Number(sequence),
};
response.status(200).send(manifestData);

@ -105,7 +105,7 @@ export const getManifestTemplate: RequestHandler = async (
}
if (lastSequence) {
previous.sequence = Number.parseInt(lastSequence) + 1;
previous.sequence = Number(lastSequence) + 1;
}
return previous;

@ -38,7 +38,7 @@ export const getSSHKeyConflict = buildGetRequestHandler(
previous[hostUUIDKey][stateUUID] = {
badFile,
badLine: parseInt(badLine),
badLine: Number(badLine),
hostName,
hostUUID,
ipAddress,

@ -48,7 +48,7 @@ export const uuidgen = (...args: string[]) =>
systemCall(SERVER_PATHS.usr.bin.uuidgen.self, args);
export const resolveId = (id: number | string, database: string) =>
Number.parseInt(getent(database, String(id)).split(':', 3)[2]);
Number(getent(database, String(id)).split(':', 3)[2]);
export const resolveGid = (id: number | string) => resolveId(id, 'group');

Loading…
Cancel
Save