From 17a011e76837c9662f817941b90377d9ec3d1315 Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Fri, 24 Mar 2023 14:17:41 -0400 Subject: [PATCH] fix(striker-ui): correct types for manifest management --- striker-ui/types/APIManifest.d.ts | 26 ++++++++++++++++++++ striker-ui/types/ManageManifest.d.ts | 36 ++++++++++++++++++---------- 2 files changed, 49 insertions(+), 13 deletions(-) diff --git a/striker-ui/types/APIManifest.d.ts b/striker-ui/types/APIManifest.d.ts index 85a07e86..0022f5aa 100644 --- a/striker-ui/types/APIManifest.d.ts +++ b/striker-ui/types/APIManifest.d.ts @@ -6,3 +6,29 @@ type APIManifestOverview = { type APIManifestOverviewList = { [manifestUUID: string]: APIManifestOverview; }; + +type APIManifestTemplateFence = { + fenceName: string; + fenceUUID: string; +}; + +type APIManifestTemplateUps = { + upsName: string; + upsUUID: string; +}; + +type APIManifestTemplateFenceList = { + [fenceUuid: string]: APIManifestTemplateFence; +}; + +type APIManifestTemplateUpsList = { + [upsUuid: string]: APIManifestTemplateUps; +}; + +type APIManifestTemplate = { + domain: string; + fences: APIManifestTemplateFenceList; + prefix: string; + sequence: number; + upses: APIManifestTemplateUpsList; +}; diff --git a/striker-ui/types/ManageManifest.d.ts b/striker-ui/types/ManageManifest.d.ts index 8aa911ec..80dd3535 100644 --- a/striker-ui/types/ManageManifest.d.ts +++ b/striker-ui/types/ManageManifest.d.ts @@ -23,6 +23,13 @@ type ManifestNetworkList = { [networkId: string]: ManifestNetwork; }; +type ManifestHostFenceList = { + [fenceId: string]: { + fenceName: string; + fencePort: string; + }; +}; + type ManifestHostNetworkList = { [networkId: string]: { networkIp: string; @@ -31,22 +38,19 @@ type ManifestHostNetworkList = { }; }; -type ManifestHost = { - fences?: { - [fenceId: string]: { - fenceName: string; - fencePort: number; - }; +type ManifestHostUpsList = { + [upsId: string]: { + isUsed: boolean; + upsName: string; }; +}; + +type ManifestHost = { + fences?: ManifestHostFenceList; hostNumber: number; hostType: string; networks?: ManifestHostNetworkList; - upses?: { - [upsId: string]: { - isPowerHost: boolean; - upsName: string; - }; - }; + upses?: ManifestHostUpsList; }; type ManifestHostList = { @@ -127,6 +131,8 @@ type AnvilNetworkConfigInputGroupProps = }; type AnvilHostConfigInputGroupOptionalProps = { + knownFences?: APIManifestTemplateFenceList; + knownUpses?: APIManifestTemplateUpsList; previous?: { hosts?: ManifestHostList; }; @@ -138,8 +144,12 @@ type AnvilHostConfigInputGroupProps = networkListEntries: Array<[string, ManifestNetwork]>; }; -type AddManifestInputGroupOptionalProps = { +type AddManifestInputGroupOptionalProps = Pick< + AnvilHostConfigInputGroupOptionalProps, + 'knownFences' | 'knownUpses' +> & { previous?: { + anId?: AnvilIdInputGroupOptionalProps['previous']; networkConfig?: AnvilNetworkConfigInputGroupOptionalProps['previous']; hostConfig?: AnvilHostConfigInputGroupOptionalProps['previous']; };