Skip to content

Commit 4909b42

Browse files
Fix showing undefined release version
1 parent cc25f12 commit 4909b42

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

src/components/KymaModules/components/ModulesCard.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ export default function ModulesCard({
6060
checkImage();
6161
}, [module]);
6262

63+
const getNameForVersion = version => {
64+
if (typeof version === 'string' && version.startsWith('v')) {
65+
return version;
66+
}
67+
return `v${version}`;
68+
};
69+
6370
return (
6471
<Card key={module.name} className="addModuleCard">
6572
<ListItemStandard
@@ -145,10 +152,17 @@ export default function ModulesCard({
145152
'kyma-modules.predefined-channel',
146153
)} (${kymaResource?.spec?.channel[0].toUpperCase()}${kymaResource?.spec?.channel.slice(
147154
1,
148-
)} v${
155+
)} ${
149156
module.channels?.filter(
150157
channel => channel.channel === kymaResource?.spec?.channel,
151158
)[0]?.version
159+
? getNameForVersion(
160+
module.channels?.filter(
161+
channel =>
162+
channel.channel === kymaResource?.spec?.channel,
163+
)[0]?.version,
164+
)
165+
: '- ' + t('kyma-modules.no-version')
152166
})`}
153167
</Option>
154168
{module.channels?.map(channel => (
@@ -165,9 +179,9 @@ export default function ModulesCard({
165179
>
166180
{`${(
167181
channel?.channel[0] || ''
168-
).toUpperCase()}${channel.channel.slice(1)} (v${
169-
channel.version
170-
})`}{' '}
182+
).toUpperCase()}${channel.channel.slice(
183+
1,
184+
)} (${getNameForVersion(channel.version)})`}{' '}
171185
</Option>
172186
))}
173187
</Select>

0 commit comments

Comments
 (0)