-
Notifications
You must be signed in to change notification settings - Fork 2
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
Refactor ClientCreateContainer #22
Conversation
…unc, add setValue for code chell method and cookie domain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I miss broader description of the implemented parts
try { | ||
let response = await SeaCatAuthAPI.post(`/client`, body); | ||
if (response.statusText != 'OK') { | ||
throw new Error("Unable to create client"); | ||
} | ||
setDisabled(false); | ||
if (response.data?.client_id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aringoaway Is client_id
always present in response of this call? If so, then this condition is redundant (and so as setting the disable to false on line 104). I suppose client_id
will be always present in the successful response (please validate with @byewokko )
<Row> | ||
<Col md={5} title="client_secret">{t("ClientDetailContainer|Client secret")}</Col> | ||
<Col> | ||
<code>{client?.client_secret}</code> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aringoaway <code>
tag is very sensitive on undefined
values, so please test and eventually do the fix, when value will be undefined. It can cause crash of the application
</Card> | ||
</div> | ||
</Form> | ||
{(advmode && ((client != undefined) && (editClient == true))) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aringoaway Why it is possible to turn on adv mode only when you are in editing mode? Cant figure out your thinking here. Btw you are missing a lot of // Descriptions
of the code. Its more difficult to find out what your code is doing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only display this card when the user wants to edit the client. Therefore, this is the condition here. I do not show this card when the client is created.
advmode.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, then please add a description
color="danger" | ||
outline | ||
size="sm" | ||
disabled={(fields.length === 1) && ((fields[0].key === ""))} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aringoaway What are you checking with this condition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Pe5h4 This condition checks if the number of inputs is 1 and nothing has been added to the input, then the button will be disabled. If text is added to the input, the disabled button becomes a normal, or if will be added next input, the disabled button also becomes a normal.
customcomponent.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, add the description then please
@Aringoaway Can you please provide some actual printscreens / videos? |
@Pe5h4 I have added video to the MR description |
@Pe5h4 can you review pls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the UI looks good to me. i only propose a few grammar and translation changes
public/locales/cs/translation.json
Outdated
"Multidomain": "Multidoména", | ||
"Access control": "Přístupová oprávnění", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Multidomain support": "Podpora více domén",
"Access control": "Řízení přístupů",
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@byewokko I got feedback from Alesh on the review and he said to use "Multidomain"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah okay ✨
i guess i understand his view, but still the czech word sounds super weird to me. i'll ask him when i get the chance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@byewokko I'm not sure about the Czech version
public/locales/cs/translation.json
Outdated
"Create client": "Vytvořit klienta", | ||
"Unknown item": "Neznámá položka", | ||
"Code challenge methods": "Metody ověření kódu", | ||
"Code challenge method (PKCE)": "Metod ověření kódu (PKCE)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Metoda ověření kódu (PKCE)"
public/locales/cs/translation.json
Outdated
"Login URI": "URI přihlašovací stránky", | ||
"Authorize URI": "Autorizace URI", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Autorizační URI"
public/locales/cs/translation.json
Outdated
"Login URI": "URI přihlašovací stránky", | ||
"Authorize URI": "Autorizace URI", | ||
"Authorize anonymous users": "Autorizace anonymních uživatelů", | ||
"URI can't be empty": "URI nemůže být prázdný", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"URI nemůže být prázdné"
public/locales/cs/translation.json
Outdated
"URI can't be empty": "URI nemůže být prázdný", | ||
"URI have to start with https": "URI musí začínat https", | ||
"URL hash have to be empty": "URL hash musí být prázdný" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"URL hash has to be empty"
@@ -280,143 +188,224 @@ const ClientCreateContainer = (props) => { | |||
if (body?.login_uri == "") { | |||
delete body.login_uri; | |||
} | |||
if (body?.authorize_uri == "") { | |||
delete body?.authorize_uri; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aringoaway You are overusing the conditional operators. Here it should be just delete body.authorize_uri;
Please check if there is not any other in the "older" code and eventually update as well
reg={regRedirectUrisMain} | ||
labelName={`${t("ClientCreateContainer|Redirect URIs")}*`} | ||
/> | ||
{metaData["properties"] && Object.entries(metaData["properties"]).map(([key, value]) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aringoaway I think you can do that more effectively with find
method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Pe5h4 I don't quite understand how I can use the find method here. I need to return an input, but the find method won't do that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aringoaway Oh, I see, but I still dont understand, why you need to use iteration (it can be expensive), when trying to find one specific key and return its content
Can be the content of the redirect_uri_validation_method
obtained as:
{metaData["properties"] && metaData["properties"]["redirect_uri_validation_method"] &&
<RadioInput
key={key}
name={key}
register={register}
valueList={metaData["properties"]["redirect_uri_validation_method"]["enum"]}
disabled={disabled}
labelName={t('ClientCreateContainer|Redirect URI validation method')}
editing={(client != undefined)}
/>}
??
Or maybe its just my overthinking of it...
</div> | ||
</CardHeader> | ||
<CardBody> | ||
{metaData["properties"] && Object.entries(metaData["properties"]).map(([key, value]) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aringoaway find
would be more effective here
<Col md={4} title="client_id">{t("ClientDetailContainer|Client ID")}</Col> | ||
<Col><code>{client?.client_id}</code></Col> | ||
<Col md={5} title="client_id">{t("ClientDetailContainer|Client ID")}</Col> | ||
<Col><code>{(client?.client_id != undefined) && client?.client_id}</code></Col> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aringoaway Ok, this is not correct. the <code>
will still be undefined
when client_id wont be present.
This is bit better for example:
<code>{client?.client_id ? client.client_id : "N/A"}</code>
Or something similar, dont stick with N/A
but rather check how you display cases when value is undefined or empty within clients to have it unified (I have seen "N/A"
in your code, so that is why I added this value
<Row> | ||
<Col md={5} title="client_secret">{t("ClientDetailContainer|Client secret")}</Col> | ||
<Col> | ||
<code>{(client?.client_secret != undefined) && client?.client_secret}</code> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aringoaway Not correct, see my comment above
{checkboxText} | ||
</Label> | ||
</FormGroup> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aringoaway Remove redundant empty line here
</Button> | ||
</FormGroup> | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aringoaway Add empty line at the end of the file
reg={regRedirectUrisMain} | ||
labelName={`${t("ClientCreateContainer|Redirect URIs")}*`} | ||
/> | ||
{metaData["properties"] && Object.entries(metaData["properties"]).map(([key, value]) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aringoaway Oh, I see, but I still dont understand, why you need to use iteration (it can be expensive), when trying to find one specific key and return its content
Can be the content of the redirect_uri_validation_method
obtained as:
{metaData["properties"] && metaData["properties"]["redirect_uri_validation_method"] &&
<RadioInput
key={key}
name={key}
register={register}
valueList={metaData["properties"]["redirect_uri_validation_method"]["enum"]}
disabled={disabled}
labelName={t('ClientCreateContainer|Redirect URI validation method')}
editing={(client != undefined)}
/>}
??
Or maybe its just my overthinking of it...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aringoaway Ok, it looks good. Was this
{metaData["properties"] && metaData["properties"]["redirect_uri_validation_method"] && |
metadata
are {}
or when metadata["properties"]
are undefined? If so, then it can be merged
@Pe5h4 Thanks for the tip, added one condition |
Changes
authorize_uri
andredirect_uri_validation_method
clientCreate2.mp4