Skip to content

Commit

Permalink
replaced further select elements
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskari committed Sep 22, 2023
1 parent 39d9082 commit c73c419
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { MessageStrip } from '@ui5/webcomponents-react';
import { Select } from 'fundamental-react';
import { Select, Option } from '@ui5/webcomponents-react';

import { ResourceForm } from 'shared/ResourceForm';

Expand All @@ -24,6 +23,11 @@ export function ContextChooser(params) {
text: t('clusters.wizard.all-contexts'),
});

const onChange = (event, setValue) => {
const selectedContext = event.detail.selectedOption.value;
setValue(selectedContext);
};

return (
<ResourceForm.Wrapper {...params}>
<ResourceForm.FormField
Expand All @@ -34,10 +38,14 @@ export function ContextChooser(params) {
input={({ value, setValue }) => (
<Select
id="context-chooser"
selectedKey={value}
options={contexts}
onSelect={(_, { key }) => setValue(key)}
/>
onChange={event => {
onChange(event, setValue);
}}
>
{contexts.map(context => (
<Option value={context.key}>{context.text}</Option>
))}
</Select>
)}
/>
{kubeconfig['current-context'] === '-all-' && (
Expand Down
1 change: 0 additions & 1 deletion src/components/Preferences/LanguageSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { useSetRecoilState } from 'recoil';
import { Select, Option } from '@ui5/webcomponents-react';
Expand Down
20 changes: 12 additions & 8 deletions src/resources/Pods/ContainersLogs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions src/resources/RoleBindings/SubjectForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
import { FormFieldset } from 'fundamental-react';
import { ResourceForm } from 'shared/ResourceForm';
import * as Inputs from 'shared/ResourceForm/inputs';
import { Select } from 'shared/components/Select/Select';
import { Select, Option } from '@ui5/webcomponents-react';
import { ServiceAccountRef } from 'shared/components/ResourceRef/ServiceAccountRef';

import { DEFAULT_APIGROUP, SUBJECT_KINDS } from './templates';
Expand All @@ -18,8 +18,8 @@ export function SingleSubjectForm({
}) {
const { t } = useTranslation();

const setKind = (_, selected) => {
subject.kind = selected.key;
const setKind = selected => {
subject.kind = selected;
switch (subject.kind) {
case 'Group':
delete subject.namespace;
Expand Down Expand Up @@ -55,23 +55,23 @@ export function SingleSubjectForm({
setSubjects([...subjects]);
};

const onChange = event => {
const selectedKind = event.detail.selectedOption.value;
setKind(selectedKind);
};

return (
<FormFieldset>
<ResourceForm.FormField
required
tooltipContent={t('role-bindings.create-modal.tooltips.kind')}
label={t('role-bindings.create-modal.kind')}
input={() => (
<Select
compact
onSelect={setKind}
selectedKey={subject.kind || ''}
options={SUBJECT_KINDS.map(kind => ({
key: kind,
text: kind,
}))}
fullWidth
/>
<Select onChange={onChange} className="fd-col fd-col-md--11">
{SUBJECT_KINDS.map(kind => (
<Option value={kind}>{kind}</Option>
))}
</Select>
)}
/>

Expand Down
17 changes: 0 additions & 17 deletions src/shared/components/Select/Select.js

This file was deleted.

0 comments on commit c73c419

Please sign in to comment.