diff --git a/src/App.tsx b/src/App.tsx index 3e20243304..fdc2c55f22 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -6,8 +6,8 @@ import { Header } from "./PageHeader"; import { PageNav } from "./PageNav"; import { Help } from "./components/help-enabler/HelpHeader"; -import { RealmContextProvider } from "./components/realm-context/RealmContext"; -import { WhoAmIContextProvider } from "./whoami/WhoAmI"; +import { RealmContextProvider } from "./context/realm-context/RealmContext"; +import { WhoAmIContextProvider } from "./context/whoami/WhoAmI"; import { routes } from "./route-config"; import { PageBreadCrumbs } from "./components/bread-crumb/PageBreadCrumbs"; diff --git a/src/PageHeader.tsx b/src/PageHeader.tsx index eba6226067..c7a22e771f 100644 --- a/src/PageHeader.tsx +++ b/src/PageHeader.tsx @@ -14,8 +14,8 @@ import { PageHeaderToolsGroup, } from "@patternfly/react-core"; import { HelpIcon } from "@patternfly/react-icons"; -import { KeycloakContext } from "./auth/KeycloakContext"; -import { WhoAmIContext } from "./whoami/WhoAmI"; +import { KeycloakContext } from "./context/auth/KeycloakContext"; +import { WhoAmIContext } from "./context/whoami/WhoAmI"; import { HelpHeader } from "./components/help-enabler/HelpHeader"; import { Link } from "react-router-dom"; diff --git a/src/PageNav.tsx b/src/PageNav.tsx index d1c5634dae..61fc476acf 100644 --- a/src/PageNav.tsx +++ b/src/PageNav.tsx @@ -10,7 +10,7 @@ import { } from "@patternfly/react-core"; import { RealmSelector } from "./components/realm-selector/RealmSelector"; import { DataLoader } from "./components/data-loader/DataLoader"; -import { HttpClientContext } from "./http-service/HttpClientContext"; +import { HttpClientContext } from "./context/http-service/HttpClientContext"; import { RealmRepresentation } from "./realm/models/Realm"; export const PageNav: React.FunctionComponent = () => { diff --git a/src/client-scopes/ClientScopesSection.tsx b/src/client-scopes/ClientScopesSection.tsx index a7e29afd60..53148b122c 100644 --- a/src/client-scopes/ClientScopesSection.tsx +++ b/src/client-scopes/ClientScopesSection.tsx @@ -3,8 +3,8 @@ import { Button, PageSection } from "@patternfly/react-core"; import { useTranslation } from "react-i18next"; import { useHistory } from "react-router-dom"; -import { RealmContext } from "../components/realm-context/RealmContext"; -import { HttpClientContext } from "../http-service/HttpClientContext"; +import { RealmContext } from "../context/realm-context/RealmContext"; +import { HttpClientContext } from "../context/http-service/HttpClientContext"; import { ClientRepresentation } from "../realm/models/Realm"; import { DataLoader } from "../components/data-loader/DataLoader"; import { TableToolbar } from "../components/table-toolbar/TableToolbar"; diff --git a/src/client-scopes/add/NewClientScopeForm.tsx b/src/client-scopes/add/NewClientScopeForm.tsx index 929551f887..54e1545f52 100644 --- a/src/client-scopes/add/NewClientScopeForm.tsx +++ b/src/client-scopes/add/NewClientScopeForm.tsx @@ -16,8 +16,8 @@ import { Controller, useForm } from "react-hook-form"; import { ClientScopeRepresentation } from "../models/client-scope"; import { HelpItem } from "../../components/help-enabler/HelpItem"; -import { HttpClientContext } from "../../http-service/HttpClientContext"; -import { RealmContext } from "../../components/realm-context/RealmContext"; +import { HttpClientContext } from "../../context/http-service/HttpClientContext"; +import { RealmContext } from "../../context/realm-context/RealmContext"; import { useAlerts } from "../../components/alert/Alerts"; export const NewClientScopeForm = () => { diff --git a/src/clients/ClientList.tsx b/src/clients/ClientList.tsx index e245a079c3..1c91b18538 100644 --- a/src/clients/ClientList.tsx +++ b/src/clients/ClientList.tsx @@ -12,10 +12,10 @@ import { import { Badge, AlertVariant } from "@patternfly/react-core"; import { ExternalLink } from "../components/external-link/ExternalLink"; -import { HttpClientContext } from "../http-service/HttpClientContext"; +import { HttpClientContext } from "../context/http-service/HttpClientContext"; import { useAlerts } from "../components/alert/Alerts"; import { ClientRepresentation } from "./models/client-model"; -import { RealmContext } from "../components/realm-context/RealmContext"; +import { RealmContext } from "../context/realm-context/RealmContext"; import { exportClient } from "../util"; type ClientListProps = { diff --git a/src/clients/ClientSettings.tsx b/src/clients/ClientSettings.tsx index caaa82bb08..0bfb2fd15d 100644 --- a/src/clients/ClientSettings.tsx +++ b/src/clients/ClientSettings.tsx @@ -19,8 +19,8 @@ import { Controller, useForm } from "react-hook-form"; import { ScrollForm } from "../components/scroll-form/ScrollForm"; import { ClientDescription } from "./ClientDescription"; import { CapabilityConfig } from "./add/CapabilityConfig"; -import { RealmContext } from "../components/realm-context/RealmContext"; -import { HttpClientContext } from "../http-service/HttpClientContext"; +import { RealmContext } from "../context/realm-context/RealmContext"; +import { HttpClientContext } from "../context/http-service/HttpClientContext"; import { ClientRepresentation } from "../realm/models/Realm"; import { convertToMultiline, diff --git a/src/clients/ClientsSection.tsx b/src/clients/ClientsSection.tsx index e8048deedc..d68310b5c0 100644 --- a/src/clients/ClientsSection.tsx +++ b/src/clients/ClientsSection.tsx @@ -5,10 +5,10 @@ import { Button, PageSection, Spinner } from "@patternfly/react-core"; import { TableToolbar } from "../components/table-toolbar/TableToolbar"; import { ClientList } from "./ClientList"; -import { HttpClientContext } from "../http-service/HttpClientContext"; -import { KeycloakContext } from "../auth/KeycloakContext"; +import { HttpClientContext } from "../context/http-service/HttpClientContext"; +import { KeycloakContext } from "../context/auth/KeycloakContext"; import { ClientRepresentation } from "./models/client-model"; -import { RealmContext } from "../components/realm-context/RealmContext"; +import { RealmContext } from "../context/realm-context/RealmContext"; import { ViewHeader } from "../components/view-header/ViewHeader"; export const ClientsSection = () => { diff --git a/src/clients/add/GeneralSettings.tsx b/src/clients/add/GeneralSettings.tsx index 70cc0a82d0..5a7607e8a8 100644 --- a/src/clients/add/GeneralSettings.tsx +++ b/src/clients/add/GeneralSettings.tsx @@ -9,7 +9,7 @@ import { import { useTranslation } from "react-i18next"; import { Controller, UseFormMethods } from "react-hook-form"; -import { HttpClientContext } from "../../http-service/HttpClientContext"; +import { HttpClientContext } from "../../context/http-service/HttpClientContext"; import { sortProvider } from "../../util"; import { ServerInfoRepresentation } from "../models/server-info"; import { ClientDescription } from "../ClientDescription"; diff --git a/src/clients/add/NewClientForm.tsx b/src/clients/add/NewClientForm.tsx index fccbebe094..f29a94d771 100644 --- a/src/clients/add/NewClientForm.tsx +++ b/src/clients/add/NewClientForm.tsx @@ -11,12 +11,12 @@ import { import { useTranslation } from "react-i18next"; import { useForm } from "react-hook-form"; -import { HttpClientContext } from "../../http-service/HttpClientContext"; +import { HttpClientContext } from "../../context/http-service/HttpClientContext"; import { GeneralSettings } from "./GeneralSettings"; import { CapabilityConfig } from "./CapabilityConfig"; import { ClientRepresentation } from "../models/client-model"; import { useAlerts } from "../../components/alert/Alerts"; -import { RealmContext } from "../../components/realm-context/RealmContext"; +import { RealmContext } from "../../context/realm-context/RealmContext"; import { ViewHeader } from "../../components/view-header/ViewHeader"; export const NewClientForm = () => { diff --git a/src/clients/import/ImportForm.tsx b/src/clients/import/ImportForm.tsx index 943e37c82c..2b03da77f2 100644 --- a/src/clients/import/ImportForm.tsx +++ b/src/clients/import/ImportForm.tsx @@ -13,10 +13,10 @@ import { useTranslation } from "react-i18next"; import { ClientRepresentation } from "../models/client-model"; import { ClientDescription } from "../ClientDescription"; -import { HttpClientContext } from "../../http-service/HttpClientContext"; +import { HttpClientContext } from "../../context/http-service/HttpClientContext"; import { JsonFileUpload } from "../../components/json-file-upload/JsonFileUpload"; import { useAlerts } from "../../components/alert/Alerts"; -import { RealmContext } from "../../components/realm-context/RealmContext"; +import { RealmContext } from "../../context/realm-context/RealmContext"; import { ViewHeader } from "../../components/view-header/ViewHeader"; export const ImportForm = () => { diff --git a/src/components/realm-selector/RealmSelector.tsx b/src/components/realm-selector/RealmSelector.tsx index 77861eccee..4f57b411ef 100644 --- a/src/components/realm-selector/RealmSelector.tsx +++ b/src/components/realm-selector/RealmSelector.tsx @@ -15,8 +15,8 @@ import { import { CheckIcon } from "@patternfly/react-icons"; import { RealmRepresentation } from "../../realm/models/Realm"; -import { RealmContext } from "../realm-context/RealmContext"; -import { WhoAmIContext } from "../../whoami/WhoAmI"; +import { RealmContext } from "../../context/realm-context/RealmContext"; +import { WhoAmIContext } from "../../context/whoami/WhoAmI"; import "./realm-selector.css"; diff --git a/src/components/realm-selector/__tests__/RealmSelector.test.tsx b/src/components/realm-selector/__tests__/RealmSelector.test.tsx index acb6e96ec9..7a284f51f1 100644 --- a/src/components/realm-selector/__tests__/RealmSelector.test.tsx +++ b/src/components/realm-selector/__tests__/RealmSelector.test.tsx @@ -3,7 +3,7 @@ import { mount } from "enzyme"; import { act } from "@testing-library/react"; import { RealmSelector } from "../RealmSelector"; -import { RealmContextProvider } from "../../realm-context/RealmContext"; +import { RealmContextProvider } from "../../../context/realm-context/RealmContext"; it("renders realm selector", async () => { const wrapper = mount( diff --git a/src/auth/KeycloakContext.tsx b/src/context/auth/KeycloakContext.tsx similarity index 100% rename from src/auth/KeycloakContext.tsx rename to src/context/auth/KeycloakContext.tsx diff --git a/src/auth/keycloak.service.ts b/src/context/auth/keycloak.service.ts similarity index 100% rename from src/auth/keycloak.service.ts rename to src/context/auth/keycloak.service.ts diff --git a/src/auth/keycloak.ts b/src/context/auth/keycloak.ts similarity index 100% rename from src/auth/keycloak.ts rename to src/context/auth/keycloak.ts diff --git a/src/http-service/HttpClientContext.tsx b/src/context/http-service/HttpClientContext.tsx similarity index 100% rename from src/http-service/HttpClientContext.tsx rename to src/context/http-service/HttpClientContext.tsx diff --git a/src/http-service/http-client.ts b/src/context/http-service/http-client.ts similarity index 100% rename from src/http-service/http-client.ts rename to src/context/http-service/http-client.ts diff --git a/src/components/realm-context/RealmContext.tsx b/src/context/realm-context/RealmContext.tsx similarity index 89% rename from src/components/realm-context/RealmContext.tsx rename to src/context/realm-context/RealmContext.tsx index d6db32e5e3..1d2e29df66 100644 --- a/src/components/realm-context/RealmContext.tsx +++ b/src/context/realm-context/RealmContext.tsx @@ -1,5 +1,5 @@ import React, { useState, useContext } from "react"; -import { WhoAmIContext } from "../../whoami/WhoAmI"; +import { WhoAmIContext } from "../../context/whoami/WhoAmI"; export const RealmContext = React.createContext({ realm: "", diff --git a/src/whoami/WhoAmI.tsx b/src/context/whoami/WhoAmI.tsx similarity index 95% rename from src/whoami/WhoAmI.tsx rename to src/context/whoami/WhoAmI.tsx index 8a61313e19..52eb7fe00f 100644 --- a/src/whoami/WhoAmI.tsx +++ b/src/context/whoami/WhoAmI.tsx @@ -1,11 +1,11 @@ import React, { useContext } from "react"; -import i18n from "../i18n"; +import i18n from "../../i18n"; import WhoAmIRepresentation from "./who-am-i-model"; import { HttpClientContext } from "../http-service/HttpClientContext"; import { KeycloakContext } from "../auth/KeycloakContext"; -import { DataLoader } from "../components/data-loader/DataLoader"; +import { DataLoader } from "../../components/data-loader/DataLoader"; export class WhoAmI { constructor( diff --git a/src/whoami/__tests__/WhoAmI.test.tsx b/src/context/whoami/__tests__/WhoAmI.test.tsx similarity index 100% rename from src/whoami/__tests__/WhoAmI.test.tsx rename to src/context/whoami/__tests__/WhoAmI.test.tsx diff --git a/src/whoami/__tests__/mock-whoami.json b/src/context/whoami/__tests__/mock-whoami.json similarity index 100% rename from src/whoami/__tests__/mock-whoami.json rename to src/context/whoami/__tests__/mock-whoami.json diff --git a/src/whoami/who-am-i-model.ts b/src/context/whoami/who-am-i-model.ts similarity index 100% rename from src/whoami/who-am-i-model.ts rename to src/context/whoami/who-am-i-model.ts diff --git a/src/groups/GroupsList.tsx b/src/groups/GroupsList.tsx index 3b3b28464d..b3ff387c4e 100644 --- a/src/groups/GroupsList.tsx +++ b/src/groups/GroupsList.tsx @@ -9,7 +9,7 @@ import { Button } from "@patternfly/react-core"; import { useTranslation } from "react-i18next"; import { GroupRepresentation } from "./models/groups"; import { UsersIcon } from "@patternfly/react-icons"; -import { HttpClientContext } from "../http-service/HttpClientContext"; +import { HttpClientContext } from "../context/http-service/HttpClientContext"; type GroupsListProps = { list?: GroupRepresentation[]; diff --git a/src/groups/GroupsSection.tsx b/src/groups/GroupsSection.tsx index 4a5108e297..772ba41a86 100644 --- a/src/groups/GroupsSection.tsx +++ b/src/groups/GroupsSection.tsx @@ -1,6 +1,6 @@ import React, { useContext, useState, useEffect } from "react"; import { useTranslation } from "react-i18next"; -import { HttpClientContext } from "../http-service/HttpClientContext"; +import { HttpClientContext } from "../context/http-service/HttpClientContext"; import { GroupsList } from "./GroupsList"; import { GroupRepresentation } from "./models/groups"; import { diff --git a/src/index.tsx b/src/index.tsx index a268f47a5d..7c82d9db61 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -3,11 +3,11 @@ import ReactDom from "react-dom"; import i18n from "./i18n"; import { App } from "./App"; -import init from "./auth/keycloak"; -import { KeycloakContext } from "./auth/KeycloakContext"; -import { KeycloakService } from "./auth/keycloak.service"; -import { HttpClientContext } from "./http-service/HttpClientContext"; -import { HttpClient } from "./http-service/http-client"; +import init from "./context/auth/keycloak"; +import { KeycloakContext } from "./context/auth/KeycloakContext"; +import { KeycloakService } from "./context/auth/keycloak.service"; +import { HttpClientContext } from "./context/http-service/HttpClientContext"; +import { HttpClient } from "./context/http-service/http-client"; console.info("supported languages", ...i18n.languages); init().then((keycloak) => { diff --git a/src/realm-roles/RealmRolesSection.tsx b/src/realm-roles/RealmRolesSection.tsx index e7e2460d92..2d38780cb8 100644 --- a/src/realm-roles/RealmRolesSection.tsx +++ b/src/realm-roles/RealmRolesSection.tsx @@ -14,10 +14,10 @@ import { import { DataLoader } from "../components/data-loader/DataLoader"; import { TableToolbar } from "../components/table-toolbar/TableToolbar"; -import { HttpClientContext } from "../http-service/HttpClientContext"; +import { HttpClientContext } from "../context/http-service/HttpClientContext"; import { RoleRepresentation } from "../model/role-model"; import { RolesList } from "./RoleList"; -import { RealmContext } from "../components/realm-context/RealmContext"; +import { RealmContext } from "../context/realm-context/RealmContext"; export const RealmRolesSection = () => { const { t } = useTranslation("roles"); diff --git a/src/realm-roles/add/NewRoleForm.tsx b/src/realm-roles/add/NewRoleForm.tsx index 858b01cca7..495bd745bf 100644 --- a/src/realm-roles/add/NewRoleForm.tsx +++ b/src/realm-roles/add/NewRoleForm.tsx @@ -16,10 +16,10 @@ import { } from "@patternfly/react-core"; import { RoleRepresentation } from "../../model/role-model"; -import { HttpClientContext } from "../../http-service/HttpClientContext"; +import { HttpClientContext } from "../../context/http-service/HttpClientContext"; import { useAlerts } from "../../components/alert/Alerts"; import { Controller, useForm } from "react-hook-form"; -import { RealmContext } from "../../components/realm-context/RealmContext"; +import { RealmContext } from "../../context/realm-context/RealmContext"; export const NewRoleForm = () => { const { t } = useTranslation("roles"); diff --git a/src/realm/add/NewRealmForm.tsx b/src/realm/add/NewRealmForm.tsx index 4f06362882..aab0203ce7 100644 --- a/src/realm/add/NewRealmForm.tsx +++ b/src/realm/add/NewRealmForm.tsx @@ -13,7 +13,7 @@ import { import { JsonFileUpload } from "../../components/json-file-upload/JsonFileUpload"; import { RealmRepresentation } from "../models/Realm"; -import { HttpClientContext } from "../../http-service/HttpClientContext"; +import { HttpClientContext } from "../../context/http-service/HttpClientContext"; import { useAlerts } from "../../components/alert/Alerts"; import { useForm, Controller } from "react-hook-form"; import { ViewHeader } from "../../components/view-header/ViewHeader"; diff --git a/src/stories/Toobar.stories.tsx b/src/stories/Toolbar.stories.tsx similarity index 94% rename from src/stories/Toobar.stories.tsx rename to src/stories/Toolbar.stories.tsx index 228894b1a3..b99c1eb4cd 100644 --- a/src/stories/Toobar.stories.tsx +++ b/src/stories/Toolbar.stories.tsx @@ -9,7 +9,7 @@ import { import { Meta } from "@storybook/react"; import { RealmSelector } from "../components/realm-selector/RealmSelector"; -import { RealmContextProvider } from "../components/realm-context/RealmContext"; +import { RealmContextProvider } from "../context/realm-context/RealmContext"; export default { title: "Header",