Skip to content

Commit

Permalink
fix checking beta for add and edit view
Browse files Browse the repository at this point in the history
  • Loading branch information
mrCherry97 committed Jan 3, 2025
1 parent e5052fa commit 8d66d42
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
11 changes: 7 additions & 4 deletions src/components/KymaModules/KymaModulesAddModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export default function KymaModulesAddModule({
{
channel: channel.channel,
version: channel.version,
isBeta: module.spec.beta ?? false,
isBeta: moduleMetaRelase.spec.beta ?? false,
isMetaRelease: true,
},
],
Expand All @@ -143,7 +143,7 @@ export default function KymaModulesAddModule({
.channels.push({
channel: channel.channel,
version: channel.version,
isBeta: module.spec.beta ?? false,
isBeta: moduleMetaRelase.spec.beta ?? false,
isMetaRelease: true,
});
}
Expand Down Expand Up @@ -222,9 +222,11 @@ export default function KymaModulesAddModule({
return false;
}
const moduleData = modulesAddData?.find(module => module.name === name);

return moduleData
? moduleData.channels.some(
({ channel: ch, isBeta }) => ch === channel && isBeta,
({ channel: ch, isBeta }) =>
ch === channel || (kymaResource.spec.channel && isBeta),
)
: false;
});
Expand All @@ -235,7 +237,8 @@ export default function KymaModulesAddModule({
?.find(mod => mod.name === moduleName)
?.channels.some(
({ channel: ch, isBeta }) =>
ch === findStatus(moduleName)?.channel && isBeta,
ch === findStatus(moduleName)?.channel ||
(kymaResource.spec.channel && isBeta),
);
};

Expand Down
8 changes: 5 additions & 3 deletions src/components/KymaModules/KymaModulesCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export default function KymaModulesCreate({ resource, ...props }) {
{
channel: channel.channel,
version: channel.version,
isBeta: module.spec.beta ?? false,
isBeta: moduleMetaRelase.spec.beta ?? false,
isMetaRelease: true,
},
],
Expand All @@ -194,7 +194,7 @@ export default function KymaModulesCreate({ resource, ...props }) {
.channels.push({
channel: channel.channel,
version: channel.version,
isBeta: module.spec.beta ?? false,
isBeta: moduleMetaRelase.spec.beta ?? false,
isMetaRelease: true,
});
}
Expand Down Expand Up @@ -222,9 +222,11 @@ export default function KymaModulesCreate({ resource, ...props }) {
return false;
}
const moduleData = modulesEditData?.find(module => module.name === name);

return moduleData
? moduleData.channels.some(
({ channel: ch, isBeta }) => ch === channel && isBeta,
({ channel: ch, isBeta }) =>
ch === channel || (kymaResource.spec.channel && isBeta),
)
: false;
});
Expand Down

0 comments on commit 8d66d42

Please sign in to comment.