diff --git a/ui/public/assets/data/registrations.json b/ui/public/assets/data/registrations.json new file mode 100644 index 000000000..c3c60440c --- /dev/null +++ b/ui/public/assets/data/registrations.json @@ -0,0 +1,18 @@ +[ + { + "name": "Foobar", + "redirect_uris": [], + "response_types": [], + "grant_types": "", + "application_type": "", + "contacts": "", + "subject_type": "", + "jwks": "", + "jwks_uri": "", + "token_endpoint_auth_method": "", + "logo_uri": "", + "policy_uri": "", + "tos_uri": "", + "scope": "" + } +] diff --git a/ui/src/app/App.js b/ui/src/app/App.js index ca70ee51a..0f6057141 100644 --- a/ui/src/app/App.js +++ b/ui/src/app/App.js @@ -35,7 +35,8 @@ import { Groups } from './admin/Groups'; import { BASE_PATH } from './App.constant'; import { ProtectRoute } from './core/components/ProtectRoute'; import { IdpConfiguration } from './admin/IdpConfiguration'; - +import { DynamicRegistration } from './dynamic-registration/DynamicRegistration'; +import { DynamicRegistrationsApi } from './dynamic-registration/hoc/DynamicRegistrationContext'; function App() { @@ -83,6 +84,11 @@ function App() { + + + + + } /> diff --git a/ui/src/app/dashboard/view/Dashboard.js b/ui/src/app/dashboard/view/Dashboard.js index 7644b6def..4db3f8327 100644 --- a/ui/src/app/dashboard/view/Dashboard.js +++ b/ui/src/app/dashboard/view/Dashboard.js @@ -15,6 +15,8 @@ import { useCurrentUserLoading, useIsAdmin } from '../../core/user/UserContext'; import useFetch from 'use-http'; import API_BASE_PATH from '../../App.constant'; import { useNonAdminSources } from '../../metadata/hooks/api'; +import { DynamicRegistrationsApi } from '../../dynamic-registration/hoc/DynamicRegistrationContext'; +import { DynamicRegistrationsTab } from './DynamicRegistrationsTab'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faSpinner } from '@fortawesome/free-solid-svg-icons'; import Badge from 'react-bootstrap/Badge'; @@ -76,12 +78,19 @@ export function Dashboard () { {isAdmin && - <> Metadata Providers + } + + + Dynamic Registration + + + {isAdmin && + <> Admin @@ -102,6 +111,11 @@ export function Dashboard () { + + + + + } /> diff --git a/ui/src/app/dashboard/view/DynamicRegistrationsTab.js b/ui/src/app/dashboard/view/DynamicRegistrationsTab.js new file mode 100644 index 000000000..97b88e3be --- /dev/null +++ b/ui/src/app/dashboard/view/DynamicRegistrationsTab.js @@ -0,0 +1,43 @@ +import React from 'react'; +// import { useDynamicRegistrationDispatcher } from '../../dynamic-registration/hoc/DynamicRegistrationContext'; +import Translate from '../../i18n/components/translate'; +import { Ordered } from '../component/Ordered'; +import { Search } from '../component/Search'; + +import {DynamicRegistrationList} from '../../dynamic-registration/component/DynamicRegistrationList'; + +const searchProps = ['name']; + +export function DynamicRegistrationsTab () { + + // const dispatcher = useDynamicRegistrationDispatcher(); + + /*eslint-disable react-hooks/exhaustive-deps*/ + // React.useEffect(() => { loadRegistrations() }, []); + const registrations = []; + + return ( +
+
+ <> +
+ + Dynamic Registrations + +
+
+ + {(ordered, first, last, onOrderUp, onOrderDown) => + + {(searched) => + + } + + } + +
+ +
+
+ ) +} \ No newline at end of file diff --git a/ui/src/app/dynamic-registration/DynamicRegistration.js b/ui/src/app/dynamic-registration/DynamicRegistration.js new file mode 100644 index 000000000..95d753d99 --- /dev/null +++ b/ui/src/app/dynamic-registration/DynamicRegistration.js @@ -0,0 +1,38 @@ +import React from 'react'; +import { useDynamicRegistrationDispatcher } from './hoc/DynamicRegistrationContext'; +import Translate from '../i18n/components/translate'; +import { Search } from '../dashboard/component/Search'; + +import {DynamicRegistrationList} from './component/DynamicRegistrationList'; + +const searchProps = ['name']; + +export function DynamicRegistration () { + + // const dispatcher = useDynamicRegistrationDispatcher(); + + /*eslint-disable react-hooks/exhaustive-deps*/ + // React.useEffect(() => { loadRegistrations() }, []); + const registrations = []; + + return ( +
+
+ <> +
+ + Dynamic Registrations + +
+
+ + {(searched) => + + } + +
+ +
+
+ ) +} \ No newline at end of file diff --git a/ui/src/app/dynamic-registration/component/DynamicRegistrationList.js b/ui/src/app/dynamic-registration/component/DynamicRegistrationList.js new file mode 100644 index 000000000..f06d7f240 --- /dev/null +++ b/ui/src/app/dynamic-registration/component/DynamicRegistrationList.js @@ -0,0 +1,5 @@ +import React from 'react'; + +export function DynamicRegistrationList ({entities}) { + return <>
{JSON.stringify(entities, null, 4)}
+} \ No newline at end of file diff --git a/ui/src/app/dynamic-registration/hoc/DynamicRegistrationContext.js b/ui/src/app/dynamic-registration/hoc/DynamicRegistrationContext.js new file mode 100644 index 000000000..ff19ae8ef --- /dev/null +++ b/ui/src/app/dynamic-registration/hoc/DynamicRegistrationContext.js @@ -0,0 +1,91 @@ +import React from 'react'; + + +const initialState = { + registrations: [], + selected: null, +}; + +const DynamicRegistrationContext = React.createContext(); + +const { Provider, Consumer } = DynamicRegistrationContext; + +export const DynamicRegistrationActions = { + LOAD_REGISTRATIONS: 'load dynamic registrations (list GET)', + SELECT_REGISTRATION: 'load dynamic registration (single GET)', + CREATE_REGISTRATION: 'create dynamic registration (POST)', + UPDATE_REGISTRATION: 'update dynamic registration (PUT)', + DELETE_REGISTRATION: 'delete dynamic registration (DELETE)' +}; + +export const loadRegistrations = (payload) => { + return { + type: DynamicRegistrationActions.LOAD_REGISTRATIONS, + payload + } +} + +export const selectRegistration = (payload) => { + return { + type: DynamicRegistrationActions.SELECT_REGISTRATION, + payload + } +} + +export const createRegistration = (payload) => { + return { + type: DynamicRegistrationActions.CREATE_REGISTRATION, + payload + } +} + +export const updateRegistration = (payload) => { + return { + type: DynamicRegistrationActions.UPDATE_REGISTRATION, + payload + } +} + +export const deleteRegistration = (payload) => { + return { + type: DynamicRegistrationActions.DELETE_REGISTRATION, + payload + } +} + +function reducer(state, action) { + switch (action.type) { + default: + return state; + } +} + +/*eslint-disable react-hooks/exhaustive-deps*/ +function DynamicRegistrationsApi({ children, initial = {} }) { + + const [contextValue, setContextValue] = React.useState({...initialState}); + + return ( + + {children} + + ); +} + + +function useDynamicRegistrationContext () { + return React.useContext(DynamicRegistrationContext); +} + +function useDynamicRegistrationDispatcher () { + const { dispatch } = useDynamicRegistrationContext(); + return dispatch; +} + +export { + DynamicRegistrationsApi, + useDynamicRegistrationContext, + useDynamicRegistrationDispatcher, + Provider as MetadataFormProvider, + Consumer as MetadataFormConsumer +}; \ No newline at end of file