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

View file

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