Fixed issue comment on PR (#694)

* Fixed issue comment on PR

see: https://github.com/keycloak/keycloak-admin-ui/pull/657#issuecomment-857488393

* remove delete action on create
This commit is contained in:
Erik Jan de Wit 2021-06-15 13:08:58 +02:00 committed by GitHub
parent 861d382621
commit a03c8fc79b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 21 deletions

View file

@ -13,6 +13,8 @@ import {
Switch,
ActionGroup,
Button,
TextArea,
NumberInput,
} from "@patternfly/react-core";
import type ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation";
@ -228,7 +230,7 @@ export const ScopeForm = ({ clientScope, save }: ScopeFormProps) => {
}
fieldId="kc-consent-screen-text"
>
<TextInput
<TextArea
ref={register}
type="text"
id="kc-consent-screen-text"
@ -273,23 +275,23 @@ export const ScopeForm = ({ clientScope, save }: ScopeFormProps) => {
/>
}
fieldId="kc-gui-order"
helperTextInvalid={t("shouldBeANumber")}
validated={
errors.attributes && errors.attributes["gui_order"]
? ValidatedOptions.error
: ValidatedOptions.default
}
>
<TextInput
ref={register({ pattern: /^([0-9]*)$/ })}
type="text"
id="kc-gui-order"
<Controller
name="attributes.gui-order"
validated={
errors.attributes && errors.attributes["gui_order"]
? ValidatedOptions.error
: ValidatedOptions.default
}
defaultValue={1}
control={control}
render={({ onChange, value }) => (
<NumberInput
type="text"
id="kc-gui-order"
value={value}
onPlus={() => onChange(value + 1)}
onMinus={() => onChange(value - 1)}
onChange={(event) =>
onChange(Number((event.target as HTMLInputElement).value))
}
/>
)}
/>
</FormGroup>
<ActionGroup>

View file

@ -205,11 +205,15 @@ export const ClientScopeForm = () => {
titleKey={
clientScope ? clientScope.name! : "client-scopes:createClientScope"
}
dropdownItems={[
<DropdownItem key="delete" onClick={() => toggleDeleteDialog()}>
{t("common:delete")}
</DropdownItem>,
]}
dropdownItems={
clientScope
? [
<DropdownItem key="delete" onClick={() => toggleDeleteDialog()}>
{t("common:delete")}
</DropdownItem>,
]
: undefined
}
badge={clientScope ? clientScope.protocol : undefined}
divider={!id}
/>