Skip to content

Commit 05027a1

Browse files
authored
Merge pull request #1 from gansheer/fix_error_incomplete_metadatas
Avoid error when missing some annotations
2 parents 73dabbe + 5cc29f6 commit 05027a1

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

plugin/src/components/ApplicationDetailsCard.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ const ApplicationDetailsCard: React.FC<{ application: Application }> = ({ applic
4141

4242
function getBuildTimestamp(application: Application): string | null {
4343
if (application && application.metadata) {
44-
return application.metadata.annotations["app.quarkus.io/build-timestamp"];
44+
return application.metadata.annotations?.["app.quarkus.io/build-timestamp"];
4545
}
4646
return null;
4747
}
4848

4949
function getApplicationVersion(application: Application): string | null {
5050
if (application && application.metadata) {
51-
return application.metadata.annotations["app.kubernetes.io/version"];
51+
return application.metadata.annotations?.["app.kubernetes.io/version"];
5252
}
5353
return null;
5454
}
@@ -140,12 +140,12 @@ const ApplicationDetailsCard: React.FC<{ application: Application }> = ({ applic
140140
<Card>
141141
<CardTitle>Frameworks</CardTitle>
142142
<CardBody>
143-
{application.metadata.annotations['camel/camel-core-version'] && <TextContent><strong>Camel: </strong> {application.metadata.annotations['camel/camel-core-version']}</TextContent>}
144-
{application.metadata.annotations['camel/quarkus-platform'] && <TextContent><strong>Quarkus Platform: </strong> {application.metadata.annotations['camel/quarkus-platform']}</TextContent>}
145-
{application.metadata.annotations['camel/camel-quarkus'] && <TextContent><strong>Camel Quarkus: </strong> {application.metadata.annotations['camel/camel-quarkus']}</TextContent>}
143+
{application.metadata.annotations?.['camel/camel-core-version'] && <TextContent><strong>Camel: </strong> {application.metadata.annotations['camel/camel-core-version']}</TextContent>}
144+
{application.metadata.annotations?.['camel/quarkus-platform'] && <TextContent><strong>Quarkus Platform: </strong> {application.metadata.annotations['camel/quarkus-platform']}</TextContent>}
145+
{application.metadata.annotations?.['camel/camel-quarkus'] && <TextContent><strong>Camel Quarkus: </strong> {application.metadata.annotations['camel/camel-quarkus']}</TextContent>}
146146

147-
{application.metadata.annotations['camel/camel-spring-boot-version'] && <TextContent><strong>Camel Spring Boot: </strong> {application.metadata.annotations['camel/camel-spring-boot-version']}</TextContent>}
148-
{application.metadata.annotations['camel/spring-boot-version'] && <TextContent><strong>Spring Boot: </strong> {application.metadata.annotations['camel/spring-boot-version']}</TextContent>}
147+
{application.metadata.annotations?.['camel/camel-spring-boot-version'] && <TextContent><strong>Camel Spring Boot: </strong> {application.metadata.annotations['camel/camel-spring-boot-version']}</TextContent>}
148+
{application.metadata.annotations?.['camel/spring-boot-version'] && <TextContent><strong>Spring Boot: </strong> {application.metadata.annotations['camel/spring-boot-version']}</TextContent>}
149149
</CardBody>
150150
</Card>
151151
</div>

plugin/src/components/ApplicationList.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ export const ApplicationList: React.FC<ApplicationListProps> = ({ apps }) => {
257257
<Td dataLabel={columnNames.exchangesTotal}>{app.exchangesTotal}</Td>
258258
<Td dataLabel={columnNames.cpu}>{app.cpu}</Td>
259259
<Td dataLabel={columnNames.memory}>{app.memory}</Td>
260-
<Td dataLabel={columnNames.runtime}>Camel: {app.metadata.annotations['camel/camel-core-version']}</Td>
260+
<Td dataLabel={columnNames.runtime}>Camel: {app.metadata.annotations?.['camel/camel-core-version']}</Td>
261261
</Tr>
262262
))}
263263
</Tbody>

0 commit comments

Comments
 (0)