Skip to content

Commit 3129714

Browse files
adding missing references
We want to get them manually, because there are many references, that are not related to resources references and there are a lot of issues with that. If there will be any not working reference, we will need to fix it my providing correct path or name (example there is orgRef, and not organizationalRef - kind + Ref name.) (different path in cloudManagementRef - not in spec.ForProviders, but in spec.
1 parent 60408da commit 3129714

File tree

3 files changed

+77
-13
lines changed

3 files changed

+77
-13
lines changed

src/components/Graphs/Graph.tsx

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { NodeData, ManagedResourceGroup, ManagedResourceItem } from './types';
2525
import CustomNode from './CustomNode';
2626
import { Legend } from './Legend';
2727
import {
28+
extractRefs,
2829
generateColorMap,
2930
getStatusFromConditions,
3031
resolveProviderType,
@@ -138,17 +139,42 @@ const Graph: React.FC = () => {
138139
);
139140
const status = getStatusFromConditions(item?.status?.conditions);
140141

141-
const subaccountRef = item?.spec?.forProvider?.subaccountRef?.name;
142-
const serviceManagerRef =
143-
item?.spec?.forProvider?.serviceManagerRef?.name;
144-
const spaceRef = item?.spec?.forProvider?.spaceRef?.name;
145-
const orgRef = item?.spec?.forProvider?.orgRef?.name;
146-
const cloudManagementRef = item?.spec?.cloudManagementRef?.name;
142+
const {
143+
subaccountRef,
144+
serviceManagerRef,
145+
spaceRef,
146+
orgRef,
147+
cloudManagementRef,
148+
directoryRef,
149+
entitlementRef,
150+
globalAccountRef,
151+
orgRoleRef,
152+
spaceMembersRef,
153+
cloudFoundryEnvironmentRef,
154+
kymaEnvironmentRef,
155+
roleCollectionRef,
156+
roleCollectionAssignmentRef,
157+
subaccountTrustConfigurationRef,
158+
globalaccountTrustConfigurationRef,
159+
} = extractRefs(item);
147160

148161
const parentId = serviceManagerRef || subaccountRef;
149-
const extraRefs = [spaceRef, orgRef, cloudManagementRef].filter(
150-
Boolean,
151-
) as string[];
162+
const extraRefs = [
163+
spaceRef,
164+
orgRef,
165+
cloudManagementRef,
166+
directoryRef,
167+
entitlementRef,
168+
globalAccountRef,
169+
orgRoleRef,
170+
spaceMembersRef,
171+
cloudFoundryEnvironmentRef,
172+
kymaEnvironmentRef,
173+
roleCollectionRef,
174+
roleCollectionAssignmentRef,
175+
subaccountTrustConfigurationRef,
176+
globalaccountTrustConfigurationRef,
177+
].filter(Boolean) as string[];
152178

153179
if (id) {
154180
allNodesMap.set(id, {

src/components/Graphs/graphUtils.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
Condition,
3+
ManagedResourceItem,
34
NodeData,
45
ProviderConfig,
56
ProviderConfigItem,
@@ -70,3 +71,28 @@ export const generateColorMap = (
7071
});
7172
return map;
7273
};
74+
75+
export function extractRefs(item: ManagedResourceItem) {
76+
return {
77+
subaccountRef: item?.spec?.forProvider?.subaccountRef?.name,
78+
serviceManagerRef: item?.spec?.forProvider?.serviceManagerRef?.name,
79+
spaceRef: item?.spec?.forProvider?.spaceRef?.name,
80+
orgRef: item?.spec?.forProvider?.orgRef?.name,
81+
cloudManagementRef: item?.spec?.cloudManagementRef?.name,
82+
directoryRef: item?.spec?.forProvider?.directoryRef?.name,
83+
entitlementRef: item?.spec?.forProvider?.entitlementRef?.name,
84+
globalAccountRef: item?.spec?.forProvider?.globalAccountRef?.name,
85+
orgRoleRef: item?.spec?.forProvider?.orgRoleRef?.name,
86+
spaceMembersRef: item?.spec?.forProvider?.spaceMembersRef?.name,
87+
cloudFoundryEnvironmentRef:
88+
item?.spec?.forProvider?.cloudFoundryEnvironmentRef?.name,
89+
kymaEnvironmentRef: item?.spec?.forProvider?.kymaEnvironmentRef?.name,
90+
roleCollectionRef: item?.spec?.forProvider?.roleCollectionRef?.name,
91+
roleCollectionAssignmentRef:
92+
item?.spec?.forProvider?.roleCollectionAssignmentRef?.name,
93+
subaccountTrustConfigurationRef:
94+
item?.spec?.forProvider?.subaccountTrustConfigurationRef?.name,
95+
globalaccountTrustConfigurationRef:
96+
item?.spec?.forProvider?.globalaccountTrustConfigurationRef?.name,
97+
};
98+
}

src/components/Graphs/types.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,22 @@ export interface ManagedResourceItem {
1414
spec?: {
1515
providerConfigRef?: { name: string };
1616
forProvider?: {
17-
subaccountRef?: { name: string };
18-
serviceManagerRef?: { name: string };
19-
spaceRef?: { name: string };
20-
orgRef?: { name: string };
17+
subaccountRef?: { name?: string };
18+
serviceManagerRef?: { name?: string };
19+
spaceRef?: { name?: string };
20+
orgRef?: { name?: string };
21+
directoryRef?: { name?: string };
22+
entitlementRef?: { name?: string };
23+
globalAccountRef?: { name?: string };
24+
orgRoleRef?: { name?: string };
25+
spaceMembersRef?: { name?: string };
26+
cloudFoundryEnvironmentRef?: { name?: string };
27+
kymaEnvironmentRef?: { name?: string };
28+
roleCollectionRef?: { name?: string };
29+
roleCollectionAssignmentRef?: { name?: string };
30+
subaccountTrustConfigurationRef?: { name?: string };
31+
globalaccountTrustConfigurationRef?: { name?: string };
32+
// Dodaj inne referencje jeśli będą potrzebne
2133
};
2234
cloudManagementRef?: { name: string };
2335
};

0 commit comments

Comments
 (0)