fixed create client scope header (#155)
This commit is contained in:
parent
0aa63ddfbb
commit
b49d07e18c
3 changed files with 170 additions and 152 deletions
|
@ -56,7 +56,11 @@ export const ClientScopesSection = () => {
|
||||||
inputGroupPlaceholder={t("searchFor")}
|
inputGroupPlaceholder={t("searchFor")}
|
||||||
inputGroupOnChange={filterData}
|
inputGroupOnChange={filterData}
|
||||||
toolbarItem={
|
toolbarItem={
|
||||||
<Button onClick={() => history.push("/add-client-scopes")}>
|
<Button
|
||||||
|
onClick={() =>
|
||||||
|
history.push("/client-scopes/add-client-scopes/")
|
||||||
|
}
|
||||||
|
>
|
||||||
{t("createClientScope")}
|
{t("createClientScope")}
|
||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import React, { useContext, useState } from "react";
|
import React, { useContext, useState } from "react";
|
||||||
|
import { useHistory } from "react-router-dom";
|
||||||
import {
|
import {
|
||||||
ActionGroup,
|
ActionGroup,
|
||||||
AlertVariant,
|
AlertVariant,
|
||||||
|
@ -21,13 +22,15 @@ import { HttpClientContext } from "../../context/http-service/HttpClientContext"
|
||||||
import { RealmContext } from "../../context/realm-context/RealmContext";
|
import { RealmContext } from "../../context/realm-context/RealmContext";
|
||||||
import { useAlerts } from "../../components/alert/Alerts";
|
import { useAlerts } from "../../components/alert/Alerts";
|
||||||
import { useLoginProviders } from "../../context/server-info/ServerInfoProvider";
|
import { useLoginProviders } from "../../context/server-info/ServerInfoProvider";
|
||||||
|
import { ViewHeader } from "../../components/view-header/ViewHeader";
|
||||||
|
|
||||||
export const NewClientScopeForm = () => {
|
export const NewClientScopeForm = () => {
|
||||||
const { t } = useTranslation("client-scopes");
|
const { t } = useTranslation("client-scopes");
|
||||||
const helpText = useTranslation("client-scopes-help").t;
|
const helpText = useTranslation("client-scopes-help").t;
|
||||||
const { register, control, handleSubmit } = useForm<
|
const { register, control, handleSubmit, errors } = useForm<
|
||||||
ClientScopeRepresentation
|
ClientScopeRepresentation
|
||||||
>();
|
>();
|
||||||
|
const history = useHistory();
|
||||||
|
|
||||||
const httpClient = useContext(HttpClientContext)!;
|
const httpClient = useContext(HttpClientContext)!;
|
||||||
const { realm } = useContext(RealmContext);
|
const { realm } = useContext(RealmContext);
|
||||||
|
@ -58,6 +61,12 @@ export const NewClientScopeForm = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
|
<ViewHeader
|
||||||
|
titleKey="client-scopes:createClientScope"
|
||||||
|
subKey="client-scopes:clientScopeExplain"
|
||||||
|
/>
|
||||||
|
|
||||||
<PageSection variant="light">
|
<PageSection variant="light">
|
||||||
<Form isHorizontal onSubmit={handleSubmit(save)}>
|
<Form isHorizontal onSubmit={handleSubmit(save)}>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
|
@ -71,6 +80,8 @@ export const NewClientScopeForm = () => {
|
||||||
}
|
}
|
||||||
fieldId="kc-name"
|
fieldId="kc-name"
|
||||||
isRequired
|
isRequired
|
||||||
|
validated={errors.name ? "error" : "default"}
|
||||||
|
helperTextInvalid={t("common:required")}
|
||||||
>
|
>
|
||||||
<TextInput
|
<TextInput
|
||||||
ref={register({ required: true })}
|
ref={register({ required: true })}
|
||||||
|
@ -205,9 +216,12 @@ export const NewClientScopeForm = () => {
|
||||||
<Button variant="primary" type="submit">
|
<Button variant="primary" type="submit">
|
||||||
{t("common:save")}
|
{t("common:save")}
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="link">{t("common:cancel")}</Button>
|
<Button variant="link" onClick={() => history.push("..")}>
|
||||||
|
{t("common:cancel")}
|
||||||
|
</Button>
|
||||||
</ActionGroup>
|
</ActionGroup>
|
||||||
</Form>
|
</Form>
|
||||||
</PageSection>
|
</PageSection>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -47,10 +47,10 @@ export const routes = (t: TFunction) => [
|
||||||
{
|
{
|
||||||
path: "/client-scopes",
|
path: "/client-scopes",
|
||||||
component: ClientScopesSection,
|
component: ClientScopesSection,
|
||||||
breadcrumb: t("clientScopeList"),
|
breadcrumb: t("client-scopes:clientScopeList"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/add-client-scopes",
|
path: "/client-scopes/add-client-scopes",
|
||||||
component: NewClientScopeForm,
|
component: NewClientScopeForm,
|
||||||
breadcrumb: t("client-scopes:createClientScope"),
|
breadcrumb: t("client-scopes:createClientScope"),
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue