Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/14 add custom params for topics creation #20

Merged
merged 4 commits into from
Apr 13, 2020

Conversation

Gataniel
Copy link
Contributor

@Gataniel Gataniel commented Apr 9, 2020

#14

@workshur workshur self-requested a review April 9, 2020 10:45
@workshur workshur self-assigned this Apr 9, 2020
@Gataniel Gataniel linked an issue Apr 9, 2020 that may be closed by this pull request

interface Props {
onClick: (event: React.MouseEvent<HTMLButtonElement>) => void,
btnColor: string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use className instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- <CustomParamButton btnColor="is-danger" btnIcon='fa-minus' onClick={() => onRemove(index)} />
+ <CustomParamButton 
+  className="is-danger" 
+  type='minus' 
+  onClick={() => onRemove(index)} 
+/>
enum CustomParamButtonType {
  plus=
  minus=
}
interface Props {
  onClick: (event: React.MouseEvent<HTMLButtonElement>) => void,
  className: string;
  type: CustomParamButtonType;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good suggestion! thanks!

</>
);

export default React.memo(CustomParamOptions);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥇

const optInputName = `${index}[name]`;

React.useEffect(
() => { if (isFirstParam(index)) { unregister(optInputName) } },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to add eslint ASAP

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let me add it in a separate task =)

);

const selectedMustBeUniq = (selected: string) => {
const values: any = getValues({ nest: true });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any?

const { register, unregister, errors, watch, setValue } = useFormContext();
const selectInputName: string = `${index}[name]`;
const valInputName: string = `${index}[value]`;
const selectedParamName: any = watch(selectInputName, name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a typescript newbie =) Not sure how to handle this if things like watch(), getValues() return undefined

which is ok?
const selectedParamName = watch(selectInputName, name);
const selectedParamName: string = watch(selectInputName, name);
but if I do this way, I start getting typescript warnings like: Type 'uknown' is not assignable to type 'string' or Type 'unknown' cannot be used as an index type.

Please do suggest a correct option

import CustomParamValue from './CustomParamValue';
import CustomParamAction from './CustomParamAction';

const DEF_INDEX = 'default';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DEFAULT_INDEX

@Gataniel Gataniel merged commit ea9426e into master Apr 13, 2020
@Gataniel Gataniel deleted the feature/14-add-custom-params-for-topics-creation branch April 13, 2020 09:20
javalover123 pushed a commit to javalover123/kafka-ui that referenced this pull request Dec 7, 2022
…params-for-topics-creation

Feature/14 add custom params for topics creation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add custom parameters to topic creation form
3 participants