Skip to content

Commit f0e6529

Browse files
feat(admin-ui): revamp Home -> WebHooks page as per Figma (#2629) (#2663)
* feat(admin-ui): revamp Audit Logs and reusable Table component as per Figma (#2646) * feat(admin-ui): revamp Audit Logs and reusable Table component as per Figma (#2646) * feat(admin-ui): revamp Audit Logs and reusable Table component as per Figma (#2646) * feat(admin-ui): revamp Audit Logs and reusable Table component as per Figma (#2646) * new design changes * border bottom implemented * Code rabbit implementations * Code rabbit implementations * Code rabbit implementations * initial webhook * feat(admin-ui): revamp Home -> WebHooks page as per Figma (#2629) * minor changes * theme tooltip centralized * coderabbit suggestions * coderabbit suggestions * coderabbit suggestions * coderabbit suggestions * coderabbit suggestions * coderabbit suggestions * coderabbit suggestions * form titles issues fix * form titles issues fix
1 parent 7177ed2 commit f0e6529

File tree

204 files changed

+7379
-6762
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+7379
-6762
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const mockCedarling = {
2+
authorize: jest.fn().mockResolvedValue({ decision: 'Allow' }),
3+
}
4+
5+
const init = jest.fn().mockResolvedValue(mockCedarling)
6+
const initWasm = jest.fn().mockResolvedValue(undefined)
7+
8+
class Cedarling {}
9+
class AuthorizeResult {}
10+
11+
export { init, Cedarling, AuthorizeResult }
12+
export default initWasm
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
global.XMLHttpRequest = require('xhr2')
21
import * as dotenv from 'dotenv'
2+
import XHR2 from 'xhr2'
33

4+
global.XMLHttpRequest = XHR2
45
dotenv.config({ path: '.env.test' })

admin-ui/__tests__/setup.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

admin-ui/__tests__/setup.ts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import ResizeObserverPolyfill from 'resize-observer-polyfill'
2+
import 'whatwg-fetch'
3+
import '@testing-library/jest-dom'
4+
import i18n from '../app/i18n'
5+
6+
const originalError = console.error.bind(console)
7+
8+
beforeAll(async () => {
9+
if (!i18n.isInitialized) {
10+
try {
11+
await i18n.init()
12+
} catch (error) {
13+
console.error('i18n.init() failed:', (error as Error).message, (error as Error).stack)
14+
throw error
15+
}
16+
}
17+
})
18+
19+
afterAll(() => {
20+
jest.restoreAllMocks()
21+
})
22+
23+
jest.spyOn(global.console, 'log').mockImplementation(jest.fn())
24+
jest.spyOn(global.console, 'warn').mockImplementation(jest.fn())
25+
26+
jest.spyOn(global.console, 'error').mockImplementation((...args: unknown[]) => {
27+
const msg = args.map((a) => String(a ?? '')).join(' ')
28+
const shouldSuppress =
29+
msg.includes('Problems getting API access token') ||
30+
msg.includes('Problems posting user action audit log') ||
31+
msg.includes('suspended resource finished loading') ||
32+
(msg.includes('Failed prop type') && msg.includes('timeout') && msg.includes('Fade'))
33+
34+
if (shouldSuppress) return
35+
originalError(...args)
36+
})
37+
38+
jest.setTimeout(30000)
39+
40+
jest.spyOn(HTMLAnchorElement.prototype, 'click').mockImplementation(jest.fn())
41+
if (typeof globalThis.URL !== 'undefined') {
42+
if ('createObjectURL' in globalThis.URL) {
43+
jest.spyOn(globalThis.URL, 'createObjectURL').mockImplementation(jest.fn())
44+
} else {
45+
Object.defineProperty(globalThis.URL, 'createObjectURL', {
46+
value: jest.fn(),
47+
configurable: true,
48+
writable: true,
49+
})
50+
}
51+
}
52+
53+
global.ResizeObserver = ResizeObserverPolyfill
54+
55+
it('Jans-admin UI test setup', () => {
56+
expect(true).toBeTruthy()
57+
})

admin-ui/__tests__/types/xhr2.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module 'xhr2' {
2+
const XHR2: typeof globalThis.XMLHttpRequest
3+
export default XHR2
4+
}

admin-ui/app/cedarling/client/CedarlingClient.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type {
55
AuthorizationResponse,
66
TokenAuthorizationRequest,
77
} from '@/cedarling'
8+
import { devLogger } from '@/utils/devLogger'
89

910
let cedarling: Cedarling | null = null
1011
let cedarlingInitialized: boolean = false
@@ -25,7 +26,7 @@ const initialize = async (bootStrapConfig: BootStrapConfig): Promise<void> => {
2526
cedarling = await init(bootStrapConfig)
2627
cedarlingInitialized = true
2728
} catch (err) {
28-
console.error('Error during Cedarling init:', err)
29+
devLogger.error('Error during Cedarling init:', err)
2930
initializationPromise = null // Reset on error to allow retry
3031
throw err
3132
}
@@ -48,7 +49,7 @@ const token_authorize = async (
4849
decision: result.decision,
4950
} as AuthorizationResponse
5051
} catch (error) {
51-
console.error('Error during authorization:', error)
52+
devLogger.error('Error during authorization:', error)
5253
throw error
5354
}
5455
}

admin-ui/app/cedarling/types/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,6 @@ export interface AuthReducerState {
128128
export interface RootState {
129129
authReducer: AuthReducerState
130130
cedarPermissions: CedarPermissionsState
131-
apiPermissionReducer: {
132-
items: ApiPermission[]
133-
loading: boolean
134-
}
135131
}
136132

137133
// Policy Generation Types

admin-ui/app/components/App/AppMain.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ import { Provider } from 'react-redux'
33
import { configStore } from 'Redux/store'
44
import { PersistGate } from 'redux-persist/integration/react'
55
import AuthenticatedRouteSelector from './AuthenticatedRouteSelector'
6+
import GluuLoader from '@/routes/Apps/Gluu/GluuLoader'
67
const basePath = process.env.BASE_PATH || '/admin'
78

89
const { store, persistor } = configStore()
910

1011
const AppMain = () => {
1112
return (
1213
<Provider store={store}>
13-
<PersistGate loading={null} persistor={persistor}>
14+
<PersistGate loading={<GluuLoader blocking />} persistor={persistor}>
1415
<Router basename={basePath}>
1516
<AuthenticatedRouteSelector />
1617
</Router>

admin-ui/app/components/App/PermissionsPolicyInitializer.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
} from '../../redux/features/cedarPermissionsSlice'
88
import { cedarlingClient, CedarlingLogType } from '@/cedarling'
99
import bootstrap from '@/cedarling/config/cedarling-bootstrap-TBAC.json'
10+
import { devLogger } from '@/utils/devLogger'
1011
// Extended state interface for this component
1112
interface ExtendedRootState {
1213
authReducer: {
@@ -15,9 +16,6 @@ interface ExtendedRootState {
1516
cedarlingLogType?: CedarlingLogType
1617
}
1718
}
18-
mappingReducer: {
19-
items: unknown[]
20-
}
2119
cedarPermissions: {
2220
initialized: boolean
2321
isInitializing: boolean
@@ -113,18 +111,19 @@ const PermissionsPolicyInitializer = () => {
113111
.then(() => {
114112
retryCount.current = { tryCount: 0, callMethod: false }
115113
dispatch(setCedarlingInitialized(true))
116-
console.log('✅ Cedarling initialized!')
114+
devLogger.log('✅ Cedarling initialized!')
117115
})
118116
.catch(() => {
119117
retryCount.current.tryCount += 1
120-
console.warn(`❌ Cedarling got failed. Retrying in 1000ms`)
118+
devLogger.warn(`❌ Cedarling initialization failed. Retrying in 1000ms`)
121119

122120
if (retryCount.current.tryCount < maxRetries) {
123121
setTimeout(() => {
124122
dispatch(setCedarlingInitialized(false)) // Triggers re-run of useEffect
125123
}, 1000)
126124
} else {
127125
console.error('❌ Max retry attempts reached. Cedarling init failed permanently.')
126+
devLogger.error('❌ Max retry attempts reached. Cedarling init failed permanently.')
128127
dispatch(setCedarFailedStatusAfterMaxTries())
129128
}
130129
})

admin-ui/app/components/Card/Card.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
}
4747

4848
&--shadow {
49-
box-shadow: 0 1px 2px 0 rgba(31, 45, 61, 0.07);
49+
box-shadow: 0 1px 2px 0 rgba(var(--custom-black-rgb), 0.07);
5050
}
5151

5252
&--none {

0 commit comments

Comments
 (0)