diff --git a/striker-ui-api/src/lib/request_handlers/command/getHostSSH.ts b/striker-ui-api/src/lib/request_handlers/command/getHostSSH.ts index 5b359625..258d9f49 100644 --- a/striker-ui-api/src/lib/request_handlers/command/getHostSSH.ts +++ b/striker-ui-api/src/lib/request_handlers/command/getHostSSH.ts @@ -9,7 +9,7 @@ import { stderr } from '../../shell'; export const getHostSSH: RequestHandler< unknown, { - badSSHKeys?: DeleteSSHKeyConflictRequestBody; + badSSHKeys?: DeleteSshKeyConflictRequestBody; hostName: string; hostOS: string; hostUUID: string; @@ -53,7 +53,7 @@ export const getHostSSH: RequestHandler< return; } - let badSSHKeys: DeleteSSHKeyConflictRequestBody | undefined; + let badSSHKeys: DeleteSshKeyConflictRequestBody | undefined; if (!isConnected) { const rows = dbQuery(` @@ -65,7 +65,7 @@ export const getHostSSH: RequestHandler< )}';`).stdout as [stateNote: string, stateUUID: string][]; if (rows.length > 0) { - badSSHKeys = rows.reduce( + badSSHKeys = rows.reduce( (previous, [, stateUUID]) => { previous[localHostUUID].push(stateUUID); diff --git a/striker-ui-api/src/lib/request_handlers/host/getHostConnection.ts b/striker-ui-api/src/lib/request_handlers/host/getHostConnection.ts index cf5e5453..0bf8da69 100644 --- a/striker-ui-api/src/lib/request_handlers/host/getHostConnection.ts +++ b/striker-ui-api/src/lib/request_handlers/host/getHostConnection.ts @@ -59,9 +59,9 @@ export const getHostConnection = buildGetRequestHandler( stdout(`condHostUUIDs=[${condHostUUIDs}]`); try { - ({ database: rawDatabaseData } = getAnvilData<{ database: AnvilDataDatabaseHash }>( - { database: true }, - )); + ({ database: rawDatabaseData } = getAnvilData<{ + database: AnvilDataDatabaseHash; + }>({ database: true })); } catch (subError) { throw new Error(`Failed to get anvil data; CAUSE: ${subError}`); } diff --git a/striker-ui-api/src/lib/request_handlers/ssh-key/deleteSSHKeyConflict.ts b/striker-ui-api/src/lib/request_handlers/ssh-key/deleteSSHKeyConflict.ts index c4144efb..f2e634c8 100644 --- a/striker-ui-api/src/lib/request_handlers/ssh-key/deleteSSHKeyConflict.ts +++ b/striker-ui-api/src/lib/request_handlers/ssh-key/deleteSSHKeyConflict.ts @@ -9,7 +9,7 @@ import { stderr } from '../../shell'; export const deleteSSHKeyConflict: RequestHandler< unknown, undefined, - DeleteSSHKeyConflictRequestBody + DeleteSshKeyConflictRequestBody > = (request, response) => { const { body } = request; const hostUUIDs = Object.keys(body); diff --git a/striker-ui-api/src/lib/request_handlers/ssh-key/getSSHKeyConflict.ts b/striker-ui-api/src/lib/request_handlers/ssh-key/getSSHKeyConflict.ts index fcb29b94..d808e64c 100644 --- a/striker-ui-api/src/lib/request_handlers/ssh-key/getSSHKeyConflict.ts +++ b/striker-ui-api/src/lib/request_handlers/ssh-key/getSSHKeyConflict.ts @@ -22,16 +22,7 @@ export const getSSHKeyConflict = buildGetRequestHandler( ON sta.state_host_uuid = hos.host_uuid WHERE sta.state_name LIKE '${HOST_KEY_CHANGED_PREFIX}%';`; const afterQueryReturn = buildQueryResultReducer<{ - [hostUUID: string]: { - [stateUUID: string]: { - badFile: string; - badLine: number; - hostName: string; - hostUUID: string; - ipAddress: string; - stateUUID: string; - }; - }; + [hostUUID: string]: SshKeyConflict; }>((previous, [hostName, hostUUID, stateName, stateNote, stateUUID]) => { const hostUUIDKey = toLocal(hostUUID, localHostUUID); diff --git a/striker-ui-api/src/lib/request_handlers/ups/getUPS.ts b/striker-ui-api/src/lib/request_handlers/ups/getUPS.ts index e884e54f..099cdbc8 100644 --- a/striker-ui-api/src/lib/request_handlers/ups/getUPS.ts +++ b/striker-ui-api/src/lib/request_handlers/ups/getUPS.ts @@ -14,7 +14,7 @@ export const getUPS: RequestHandler = buildGetRequestHandler( FROM upses ORDER BY ups_name ASC;`; const afterQueryReturn: QueryResultModifierFunction | undefined = - buildQueryResultReducer<{ [upsUUID: string]: UPSOverview }>( + buildQueryResultReducer<{ [upsUUID: string]: UpsOverview }>( (previous, [upsUUID, upsName, upsAgent, upsIPAddress]) => { previous[upsUUID] = { upsAgent, diff --git a/striker-ui-api/src/lib/request_handlers/ups/getUPSTemplate.ts b/striker-ui-api/src/lib/request_handlers/ups/getUPSTemplate.ts index 3c4a8b9c..395e46b7 100644 --- a/striker-ui-api/src/lib/request_handlers/ups/getUPSTemplate.ts +++ b/striker-ui-api/src/lib/request_handlers/ups/getUPSTemplate.ts @@ -21,13 +21,13 @@ export const getUPSTemplate: RequestHandler = (request, response) => { const upsData: AnvilDataUPSHash = Object.entries( rawUPSData, - ).reduce((previous, [upsTypeId, value]) => { + ).reduce((previous, [upsTypeId, value]) => { const { brand, description: rawDescription, ...rest } = value; const matched = rawDescription.match( /^(.+)\s+[-]\s+[<][^>]+href=[\\"]+([^\s]+)[\\"]+.+[>]([^<]+)[<]/, ); - const result: UPSTemplate[string] = { + const result: UpsTemplate[string] = { ...rest, brand, description: rawDescription, diff --git a/striker-ui-api/src/types/AnvilOverview.d.ts b/striker-ui-api/src/types/AnvilOverview.d.ts deleted file mode 100644 index 2b37b418..00000000 --- a/striker-ui-api/src/types/AnvilOverview.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -type AnvilOverview = { - anvilName: string; - anvilUUID: string; - hosts: Array<{ - hostName: string; - hostUUID: string; - }>; -}; diff --git a/striker-ui-api/src/types/AnvilDetail.d.ts b/striker-ui-api/src/types/ApiAn.d.ts similarity index 85% rename from striker-ui-api/src/types/AnvilDetail.d.ts rename to striker-ui-api/src/types/ApiAn.d.ts index 55261544..d49b8d61 100644 --- a/striker-ui-api/src/types/AnvilDetail.d.ts +++ b/striker-ui-api/src/types/ApiAn.d.ts @@ -31,3 +31,12 @@ type AnvilDetailForProvisionServer = { fileName: string; }>; }; + +type AnvilOverview = { + anvilName: string; + anvilUUID: string; + hosts: Array<{ + hostName: string; + hostUUID: string; + }>; +}; diff --git a/striker-ui-api/src/types/APIAuth.d.ts b/striker-ui-api/src/types/ApiAuth.d.ts similarity index 100% rename from striker-ui-api/src/types/APIAuth.d.ts rename to striker-ui-api/src/types/ApiAuth.d.ts diff --git a/striker-ui-api/src/types/APIFence.d.ts b/striker-ui-api/src/types/ApiFence.d.ts similarity index 100% rename from striker-ui-api/src/types/APIFence.d.ts rename to striker-ui-api/src/types/ApiFence.d.ts diff --git a/striker-ui-api/src/types/ApiHost.d.ts b/striker-ui-api/src/types/ApiHost.d.ts new file mode 100644 index 00000000..e9127590 --- /dev/null +++ b/striker-ui-api/src/types/ApiHost.d.ts @@ -0,0 +1,89 @@ +type CreateHostConnectionRequestBody = { + dbName?: string; + ipAddress: string; + isPing?: boolean; + /** Host password; same as database password */ + password: string; + port?: number; + sshPort?: number; + /** Database user */ + user?: string; +}; + +type DeleteHostConnectionRequestBody = { + [hostUUID: string]: string[]; +}; + +type HostConnectionOverview = { + inbound: { + ipAddress: { + [ipAddress: string]: { + hostUUID: string; + ipAddress: string; + ipAddressUUID: string; + networkLinkNumber: number; + networkNumber: number; + networkType: string; + }; + }; + port: number; + user: string; + }; + peer: { + [ipAddress: string]: { + hostUUID: string; + ipAddress: string; + isPing: boolean; + port: number; + user: string; + }; + }; +}; + +type HostOverview = { + hostName: string; + hostType: string; + hostUUID: string; + shortHostName: string; +}; + +type InitializeStrikerNetworkForm = { + interfaces: Array; + ipAddress: string; + name: string; + subnetMask: string; + type: string; +}; + +type InitializeStrikerForm = { + adminPassword: string; + domainName: string; + hostName: string; + hostNumber: number; + networkDNS: string; + networkGateway: string; + networks: InitializeStrikerNetworkForm[]; + organizationName: string; + organizationPrefix: string; +}; + +type PrepareHostRequestBody = { + enterpriseUUID?: string; + hostIPAddress: string; + hostName: string; + hostPassword: string; + hostSSHPort?: number; + hostType: string; + hostUser?: string; + hostUUID?: string; + redhatPassword: string; + redhatUser: string; +}; + +type SetHostInstallTargetRequestBody = { + isEnableInstallTarget: boolean; +}; + +type UpdateHostParams = { + hostUUID: string; +}; diff --git a/striker-ui-api/src/types/APIManifest.d.ts b/striker-ui-api/src/types/ApiManifest.d.ts similarity index 100% rename from striker-ui-api/src/types/APIManifest.d.ts rename to striker-ui-api/src/types/ApiManifest.d.ts diff --git a/striker-ui-api/src/types/NetworkInterfaceOverview.d.ts b/striker-ui-api/src/types/ApiNetworkInterface.d.ts similarity index 100% rename from striker-ui-api/src/types/NetworkInterfaceOverview.d.ts rename to striker-ui-api/src/types/ApiNetworkInterface.d.ts diff --git a/striker-ui-api/src/types/ServerOverview.d.ts b/striker-ui-api/src/types/ApiServer.d.ts similarity index 100% rename from striker-ui-api/src/types/ServerOverview.d.ts rename to striker-ui-api/src/types/ApiServer.d.ts diff --git a/striker-ui-api/src/types/ApiSshKey.d.ts b/striker-ui-api/src/types/ApiSshKey.d.ts new file mode 100644 index 00000000..956cf6e1 --- /dev/null +++ b/striker-ui-api/src/types/ApiSshKey.d.ts @@ -0,0 +1,12 @@ +type SshKeyConflict = { + [stateUUID: string]: { + badFile: string; + badLine: number; + hostName: string; + hostUUID: string; + ipAddress: string; + stateUUID: string; + }; +}; + +type DeleteSshKeyConflictRequestBody = { [hostUUID: string]: string[] }; diff --git a/striker-ui-api/src/types/APIUPS.d.ts b/striker-ui-api/src/types/ApiUps.d.ts similarity index 85% rename from striker-ui-api/src/types/APIUPS.d.ts rename to striker-ui-api/src/types/ApiUps.d.ts index 5199e348..c8ded148 100644 --- a/striker-ui-api/src/types/APIUPS.d.ts +++ b/striker-ui-api/src/types/ApiUps.d.ts @@ -1,11 +1,11 @@ -type UPSOverview = { +type UpsOverview = { upsAgent: string; upsIPAddress: string; upsName: string; upsUUID: string; }; -type UPSTemplate = { +type UpsTemplate = { [upsName: string]: AnvilDataUPSHash[string] & { links: { [linkId: string]: { diff --git a/striker-ui-api/src/types/ApiUser.d.ts b/striker-ui-api/src/types/ApiUser.d.ts new file mode 100644 index 00000000..213a6871 --- /dev/null +++ b/striker-ui-api/src/types/ApiUser.d.ts @@ -0,0 +1,7 @@ +type DeleteUserParamsDictionary = { + userUuid: string; +}; + +type DeleteUserRequestBody = { + uuids?: string[]; +}; diff --git a/striker-ui-api/src/types/CreateHostConnectionRequestBody.d.ts b/striker-ui-api/src/types/CreateHostConnectionRequestBody.d.ts deleted file mode 100644 index ce50d3a2..00000000 --- a/striker-ui-api/src/types/CreateHostConnectionRequestBody.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -type CreateHostConnectionRequestBody = { - dbName?: string; - ipAddress: string; - isPing?: boolean; - // Host password; same as database password. - password: string; - port?: number; - sshPort?: number; - // database user. - user?: string; -}; diff --git a/striker-ui-api/src/types/DeleteHostConnectionRequestBody.d.ts b/striker-ui-api/src/types/DeleteHostConnectionRequestBody.d.ts deleted file mode 100644 index cea743b6..00000000 --- a/striker-ui-api/src/types/DeleteHostConnectionRequestBody.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -type DeleteHostConnectionRequestBody = { - [hostUUID: string]: string[]; -}; diff --git a/striker-ui-api/src/types/DeleteSSHKeyConflictRequestBody.d.ts b/striker-ui-api/src/types/DeleteSSHKeyConflictRequestBody.d.ts deleted file mode 100644 index f2451843..00000000 --- a/striker-ui-api/src/types/DeleteSSHKeyConflictRequestBody.d.ts +++ /dev/null @@ -1 +0,0 @@ -type DeleteSSHKeyConflictRequestBody = { [hostUUID: string]: string[] }; diff --git a/striker-ui-api/src/types/HostConnectionOverview.d.ts b/striker-ui-api/src/types/HostConnectionOverview.d.ts deleted file mode 100644 index 71c405bd..00000000 --- a/striker-ui-api/src/types/HostConnectionOverview.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -type HostConnectionOverview = { - inbound: { - ipAddress: { - [ipAddress: string]: { - hostUUID: string; - ipAddress: string; - ipAddressUUID: string; - networkLinkNumber: number; - networkNumber: number; - networkType: string; - }; - }; - port: number; - user: string; - }; - peer: { - [ipAddress: string]: { - hostUUID: string; - ipAddress: string; - isPing: boolean; - port: number; - user: string; - }; - }; -}; diff --git a/striker-ui-api/src/types/HostOverview.d.ts b/striker-ui-api/src/types/HostOverview.d.ts deleted file mode 100644 index 8e991dd3..00000000 --- a/striker-ui-api/src/types/HostOverview.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -type HostOverview = { - hostName: string; - hostType: string; - hostUUID: string; - shortHostName: string; -}; diff --git a/striker-ui-api/src/types/InitializeStrikerForm.d.ts b/striker-ui-api/src/types/InitializeStrikerForm.d.ts deleted file mode 100644 index 64a46c7b..00000000 --- a/striker-ui-api/src/types/InitializeStrikerForm.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -type InitializeStrikerNetworkForm = { - interfaces: Array; - ipAddress: string; - name: string; - subnetMask: string; - type: string; -}; - -type InitializeStrikerForm = { - adminPassword: string; - domainName: string; - hostName: string; - hostNumber: number; - networkDNS: string; - networkGateway: string; - networks: InitializeStrikerNetworkForm[]; - organizationName: string; - organizationPrefix: string; -}; diff --git a/striker-ui-api/src/types/UpdateHostRequestBody.d.ts b/striker-ui-api/src/types/UpdateHostRequestBody.d.ts deleted file mode 100644 index a518e2d8..00000000 --- a/striker-ui-api/src/types/UpdateHostRequestBody.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -type SetHostInstallTargetRequestBody = { - isEnableInstallTarget: boolean; -}; - -type PrepareHostRequestBody = { - enterpriseUUID?: string; - hostIPAddress: string; - hostName: string; - hostPassword: string; - hostSSHPort?: number; - hostType: string; - hostUser?: string; - hostUUID?: string; - redhatPassword: string; - redhatUser: string; -}; - -type UpdateHostParams = { - hostUUID: string; -};