Skip to content

Commit

Permalink
feat: add onChange
Browse files Browse the repository at this point in the history
  • Loading branch information
mrCherry97 committed Oct 22, 2024
1 parent 39045f6 commit b77a051
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/components/KymaModules/KymaModulesCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,20 @@ export default function KymaModulesCreate({ resource, ...props }) {
});
setIsEdited(true);
};

const setManaged = (managed, index) => {
selectedModules[index].managed = managed;

setKymaResource({
...kymaResource,
spec: {
...kymaResource.spec,
modules: selectedModules,
},
});
setIsEdited(true);
};

const installedModules = modules?.items.filter(module => {
const name =
module.metadata?.labels['operator.kyma-project.io/module-name'];
Expand Down Expand Up @@ -170,7 +184,7 @@ export default function KymaModulesCreate({ resource, ...props }) {
const index = selectedModules?.findIndex(selectedModule => {
return selectedModule.name === module?.name;
});
console.log(module);

const mod = (
<FlexBox
direction="Column"
Expand Down Expand Up @@ -223,6 +237,10 @@ export default function KymaModulesCreate({ resource, ...props }) {
<CheckBox
text={t('kyma-modules.managed')}
checked={findSpec(module.name)?.managed}
onChange={event => {
console.log(event.target.checked);
setManaged(event.target.checked, index);
}}
/>
</FlexBox>
);
Expand Down

0 comments on commit b77a051

Please sign in to comment.