use === instead of == and unused imports (#431)

This commit is contained in:
Erik Jan de Wit 2021-03-12 07:42:54 +01:00 committed by GitHub
parent 28f1fdfda4
commit ab857938cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 13 additions and 18 deletions

View file

@ -1,5 +1,5 @@
import React, { useEffect } from "react"; import React, { useEffect } from "react";
import { useFieldArray, useFormContext, UseFormMethods } from "react-hook-form"; import { useFieldArray, useFormContext } from "react-hook-form";
import { import {
TextInput, TextInput,
Split, Split,

View file

@ -59,9 +59,6 @@ export const PaginatingTableToolbar = ({
/> />
); );
if (count === 0) {
<>{children}</>;
}
return ( return (
<TableToolbar <TableToolbar
searchTypeComponent={searchTypeComponent} searchTypeComponent={searchTypeComponent}

View file

@ -25,7 +25,7 @@ export type AssociatedRolesModalProps = {
}; };
const attributesToArray = (attributes: { [key: string]: string }): any => { const attributesToArray = (attributes: { [key: string]: string }): any => {
if (!attributes || Object.keys(attributes).length == 0) { if (!attributes || Object.keys(attributes).length === 0) {
return [ return [
{ {
key: "", key: "",
@ -138,7 +138,7 @@ export const AssociatedRolesModal = (props: AssociatedRolesModalProps) => {
})(); })();
}, []); }, []);
const setupForm = (role: RoleRepresentation) => { const setupForm = (role: RoleRepresentation) =>
Object.entries(role).map((entry) => { Object.entries(role).map((entry) => {
if (entry[0] === "attributes") { if (entry[0] === "attributes") {
form.setValue(entry[0], attributesToArray(entry[1])); form.setValue(entry[0], attributesToArray(entry[1]));
@ -146,17 +146,16 @@ export const AssociatedRolesModal = (props: AssociatedRolesModalProps) => {
form.setValue(entry[0], entry[1]); form.setValue(entry[0], entry[1]);
} }
}); });
};
const onFilterDropdownToggle = () => { const onFilterDropdownToggle = () => {
setIsFilterDropdownOpen(!isFilterDropdownOpen); setIsFilterDropdownOpen(!isFilterDropdownOpen);
}; };
const onFilterDropdownSelect = (filterType: string) => { const onFilterDropdownSelect = (filterType: string) => {
if (filterType == "roles") { if (filterType === "roles") {
setFilterType("clients"); setFilterType("clients");
} }
if (filterType == "clients") { if (filterType === "clients") {
setFilterType("roles"); setFilterType("roles");
} }
setIsFilterDropdownOpen(!isFilterDropdownOpen); setIsFilterDropdownOpen(!isFilterDropdownOpen);
@ -194,7 +193,7 @@ export const AssociatedRolesModal = (props: AssociatedRolesModalProps) => {
> >
<KeycloakDataTable <KeycloakDataTable
key={key} key={key}
loader={filterType == "roles" ? loader : clientRolesLoader} loader={filterType === "roles" ? loader : clientRolesLoader}
ariaLabelKey="roles:roleList" ariaLabelKey="roles:roleList"
searchPlaceholderKey="roles:searchFor" searchPlaceholderKey="roles:searchFor"
searchTypeComponent={ searchTypeComponent={
@ -217,7 +216,7 @@ export const AssociatedRolesModal = (props: AssociatedRolesModalProps) => {
data-testid="filter-type-dropdown-item" data-testid="filter-type-dropdown-item"
key="filter-type" key="filter-type"
> >
{filterType == "roles" {filterType === "roles"
? t("filterByClients") ? t("filterByClients")
: t("filterByRoles")}{" "} : t("filterByRoles")}{" "}
</DropdownItem>, </DropdownItem>,

View file

@ -210,7 +210,7 @@ export const AssociatedRolesTab = ({
</Button> </Button>
<Button <Button
variant="link" variant="link"
isDisabled={selectedRows.length == 0} isDisabled={selectedRows.length === 0}
key="remove-role-button" key="remove-role-button"
onClick={() => { onClick={() => {
toggleDeleteAssociatedRolesDialog(); toggleDeleteAssociatedRolesDialog();

View file

@ -36,7 +36,7 @@ const arrayToAttributes = (attributeArray: KeyValueType[]) => {
const attributesToArray = (attributes?: { const attributesToArray = (attributes?: {
[key: string]: string[]; [key: string]: string[];
}): KeyValueType[] => { }): KeyValueType[] => {
if (!attributes || Object.keys(attributes).length == 0) { if (!attributes || Object.keys(attributes).length === 0) {
return []; return [];
} }
return Object.keys(attributes).map((key) => ({ return Object.keys(attributes).map((key) => ({

View file

@ -4,7 +4,6 @@ import { useTranslation } from "react-i18next";
import { import {
PageSection, PageSection,
FormGroup, FormGroup,
Form,
TextInput, TextInput,
Switch, Switch,
ActionGroup, ActionGroup,

View file

@ -102,7 +102,7 @@ export const UserFederationLdapWizard = () => {
<WizardContextConsumer> <WizardContextConsumer>
{({ activeStep, onNext, onBack, onClose }) => { {({ activeStep, onNext, onBack, onClose }) => {
// First step buttons // First step buttons
if (activeStep.id == "ldapRequiredSettingsStep") { if (activeStep.id === "ldapRequiredSettingsStep") {
return ( return (
<> <>
<Button variant="primary" type="submit" onClick={onNext}> <Button variant="primary" type="submit" onClick={onNext}>
@ -123,8 +123,8 @@ export const UserFederationLdapWizard = () => {
} }
// Other required step buttons // Other required step buttons
else if ( else if (
activeStep.id == "ldapConnectionSettingsStep" || activeStep.id === "ldapConnectionSettingsStep" ||
activeStep.id == "ldapSearchingSettingsStep" activeStep.id === "ldapSearchingSettingsStep"
) { ) {
return ( return (
<> <>
@ -141,7 +141,7 @@ export const UserFederationLdapWizard = () => {
); );
} }
// Last step buttons // Last step buttons
else if (activeStep.id == "ldapAdvancedSettingsStep") { else if (activeStep.id === "ldapAdvancedSettingsStep") {
return ( return (
<> <>
<Button <Button