Use type-safe alternative for links (#1280)

This commit is contained in:
Jon Koops 2021-10-01 12:52:45 +02:00 committed by GitHub
parent e832e2e454
commit eb40cabf03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 53 additions and 34 deletions

View file

@ -56,9 +56,9 @@ export const Header = () => {
return (
<DropdownItem
key="server info"
component={Link}
// @ts-ignore
to={toDashboard({ realm })}
component={(props: any) => (
<Link {...props} to={toDashboard({ realm })} />
)}
>
{t("realmInfo")}
</DropdownItem>

View file

@ -223,9 +223,9 @@ export const AuthenticationSection = () => {
toolbarItem={
<ToolbarItem>
<Button
component={Link}
// @ts-ignore
to={toCreateFlow({ realm })}
component={(props) => (
<Link {...props} to={toCreateFlow({ realm })} />
)}
>
{t("createFlow")}
</Button>

View file

@ -204,8 +204,11 @@ export const ClientScopesSection = () => {
/>
<ToolbarItem>
{/* @ts-ignore */}
<Button component={Link} to={toNewClientScope({ realm })}>
<Button
component={(props) => (
<Link {...props} to={toNewClientScope({ realm })} />
)}
>
{t("createClientScope")}
</Button>
</ToolbarItem>

View file

@ -242,9 +242,12 @@ export const MappingDetails = () => {
</Button>
<Button
variant="link"
component={Link}
// @ts-ignore
to={toClientScope({ realm, id, type, tab: "mappers" })}
component={(props) => (
<Link
{...props}
to={toClientScope({ realm, id, type, tab: "mappers" })}
/>
)}
>
{t("common:cancel")}
</Button>

View file

@ -117,16 +117,19 @@ export const ClientsSection = () => {
toolbarItem={
<>
<ToolbarItem>
{/* @ts-ignore */}
<Button component={Link} to={toAddClient({ realm })}>
<Button
component={(props) => (
<Link {...props} to={toAddClient({ realm })} />
)}
>
{t("createClient")}
</Button>
</ToolbarItem>
<ToolbarItem>
<Button
component={Link}
// @ts-ignore
to={toImportClient({ realm })}
component={(props) => (
<Link {...props} to={toImportClient({ realm })} />
)}
variant="link"
>
{t("importClient")}

View file

@ -97,8 +97,12 @@ export const ImportForm = () => {
<Button variant="primary" type="submit">
{t("common:save")}
</Button>
{/* @ts-ignore */}
<Button variant="link" component={Link} to={toClients({ realm })}>
<Button
variant="link"
component={(props) => (
<Link {...props} to={toClients({ realm })} />
)}
>
{t("common:cancel")}
</Button>
</ActionGroup>

View file

@ -130,9 +130,12 @@ export const CreateInitialAccessToken = () => {
<Button
data-testid="cancel"
variant="link"
component={Link}
// @ts-ignore
to={toClients({ realm, tab: "initialAccessToken" })}
component={(props) => (
<Link
{...props}
to={toClients({ realm, tab: "initialAccessToken" })}
/>
)}
>
{t("common:cancel")}
</Button>

View file

@ -55,12 +55,13 @@ export const InitialAccessTokenList = () => {
searchPlaceholderKey="clients:searchInitialAccessToken"
loader={loader}
toolbarItem={
<>
{/* @ts-ignore */}
<Button component={Link} to={toCreateInitialAccessToken({ realm })}>
{t("common:create")}
</Button>
</>
<Button
component={(props) => (
<Link {...props} to={toCreateInitialAccessToken({ realm })} />
)}
>
{t("common:create")}
</Button>
}
actions={[
{

View file

@ -321,7 +321,6 @@ export const DetailSettings = () => {
toolbarItem={
<ToolbarItem>
<Link
// @ts-ignore
to={toIdentityProviderAddMapper({
realm,
alias: alias!,

View file

@ -125,9 +125,12 @@ export const NewClientProfileForm = () => {
</Button>
<Button
id="cancelCreateProfile"
component={Link}
// @ts-ignore
to={`/${realm}/realm-settings/clientPolicies`}
component={(props) => (
<Link
{...props}
to={`/${realm}/realm-settings/clientPolicies`}
/>
)}
data-testid="cancelCreateProfile"
>
{t("common:cancel")}

View file

@ -157,9 +157,9 @@ export const ProfilesTab = () => {
<ToolbarItem>
<Button
id="createProfile"
component={Link}
// @ts-ignore
to={toNewClientProfile({ realm })}
component={(props) => (
<Link {...props} to={toNewClientProfile({ realm })} />
)}
data-testid="createProfile"
>
{t("createClientProfile")}