-
Notifications
You must be signed in to change notification settings - Fork 22
feat(admin-ui): revamp Health, License, and Audit Message and Loader components (#2584) #2620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
a55f546
Health page migrated
faisalsiddique4400 51ee802
License page implemented
faisalsiddique4400 45f8311
Gluu Commit Page implemented
faisalsiddique4400 89743e9
code rabbit ai reviews
faisalsiddique4400 ae1297b
code rabbit ai reviews
faisalsiddique4400 fcffeaf
code rabbit ai reviews
faisalsiddique4400 d130b93
code rabbit ai reviews
faisalsiddique4400 ed811c9
code rabbit ai reviews
faisalsiddique4400 14d81e1
Merge branch 'main' into admin-ui-issue-2584
faisalsiddique4400 31f4c36
code rabbit ai reviews
faisalsiddique4400 3ec0043
code rabbit ai reviews
faisalsiddique4400 b9ef372
code rabbit ai reviews
faisalsiddique4400 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
admin-ui/app/components/GluuPageContent/GluuPageContent.style.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import { makeStyles } from 'tss-react/mui' | ||
| import { SPACING } from '@/constants' | ||
|
|
||
| interface GluuPageContentStyleParams { | ||
| withVerticalPadding: boolean | ||
| maxWidth?: number | ||
| background: string | ||
| } | ||
|
|
||
| export const useStyles = makeStyles<GluuPageContentStyleParams>()( | ||
| (_, { withVerticalPadding, maxWidth, background }) => ({ | ||
| root: { | ||
| maxWidth: '100vw', | ||
| width: '100%', | ||
| padding: withVerticalPadding ? `${SPACING.PAGE}px` : `0 ${SPACING.PAGE}px`, | ||
| boxSizing: 'border-box', | ||
| backgroundColor: background, | ||
| }, | ||
| wrapper: { | ||
| width: '100%', | ||
| maxWidth: maxWidth ?? '100%', | ||
| display: 'flex', | ||
| justifyContent: 'center', | ||
| flexDirection: 'column', | ||
| }, | ||
| }), | ||
| ) |
35 changes: 35 additions & 0 deletions
35
admin-ui/app/components/GluuPageContent/GluuPageContent.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import React, { memo, useContext, useMemo } from 'react' | ||
| import { ThemeContext } from '@/context/theme/themeContext' | ||
| import getThemeColor from '@/context/theme/config' | ||
| import { DEFAULT_THEME } from '@/context/theme/constants' | ||
| import customColors from '@/customColors' | ||
| import { useStyles } from './GluuPageContent.style' | ||
| import type { GluuPageContentProps } from './types' | ||
|
|
||
| const GluuPageContent: React.FC<GluuPageContentProps> = memo( | ||
| ({ children, className, withVerticalPadding = true, maxWidth, backgroundColor }) => { | ||
| const themeContext = useContext(ThemeContext) | ||
| const currentTheme = useMemo( | ||
| () => themeContext?.state.theme || DEFAULT_THEME, | ||
| [themeContext?.state.theme], | ||
| ) | ||
| const themeColors = useMemo(() => getThemeColor(currentTheme), [currentTheme]) | ||
| const background = backgroundColor ?? themeColors?.background ?? customColors.lightBackground | ||
|
|
||
| const { classes } = useStyles({ | ||
| withVerticalPadding, | ||
| maxWidth, | ||
| background, | ||
| }) | ||
|
|
||
| return ( | ||
| <div className={`${classes.root} ${className ?? ''}`.trim()}> | ||
| {maxWidth ? <div className={classes.wrapper}>{children}</div> : children} | ||
| </div> | ||
| ) | ||
| }, | ||
| ) | ||
|
|
||
| GluuPageContent.displayName = 'GluuPageContent' | ||
|
|
||
| export default GluuPageContent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export { default as GluuPageContent } from './GluuPageContent' | ||
| export type { GluuPageContentProps } from './types' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import type { ReactNode } from 'react' | ||
|
|
||
| export type GluuPageContentProps = { | ||
| children: ReactNode | ||
| className?: string | ||
| withVerticalPadding?: boolean | ||
| maxWidth?: number | ||
| backgroundColor?: string | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { makeStyles } from 'tss-react/mui' | ||
| import customColors, { hexToRgb } from '@/customColors' | ||
|
|
||
| const TRACK_COLOR_DARK = `rgba(${hexToRgb(customColors.white)}, 0.12)` | ||
| const TRACK_COLOR_LIGHT = `rgba(${hexToRgb(customColors.black)}, 0.08)` | ||
|
|
||
| interface GluuSpinnerStyleParams { | ||
| size: number | ||
| isDark: boolean | ||
| } | ||
|
|
||
| const useStyles = makeStyles<GluuSpinnerStyleParams>()((_, { size, isDark }) => ({ | ||
| '@keyframes spin': { | ||
| '0%': { transform: 'rotate(0deg)' }, | ||
| '100%': { transform: 'rotate(360deg)' }, | ||
| }, | ||
| 'spinner': { | ||
| display: 'block', | ||
| width: size, | ||
| height: size, | ||
| borderRadius: '50%', | ||
| border: `${Math.max(3, Math.floor(size / 12))}px solid ${ | ||
| isDark ? TRACK_COLOR_DARK : TRACK_COLOR_LIGHT | ||
| }`, | ||
| borderTopColor: customColors.logo, | ||
| animation: 'spin 0.8s linear infinite', | ||
| flexShrink: 0, | ||
| }, | ||
| })) | ||
|
|
||
| export { useStyles } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import React, { useContext } from 'react' | ||
| import { ThemeContext } from '@/context/theme/themeContext' | ||
| import { THEME_DARK, DEFAULT_THEME } from '@/context/theme/constants' | ||
| import { useStyles } from './GluuSpinner.style' | ||
|
|
||
| interface GluuSpinnerProps { | ||
| 'size'?: number | ||
| 'isDark'?: boolean | ||
| 'aria-label'?: string | ||
| } | ||
|
|
||
| const GluuSpinner = React.memo<GluuSpinnerProps>( | ||
| ({ size = 48, 'isDark': isDarkProp, 'aria-label': ariaLabel = 'Loading' }) => { | ||
| const themeContext = useContext(ThemeContext) | ||
| const currentTheme = themeContext?.state.theme || DEFAULT_THEME | ||
| const isDark = isDarkProp ?? currentTheme === THEME_DARK | ||
|
|
||
| const { classes } = useStyles({ size, isDark }) | ||
|
|
||
| return ( | ||
| <output className={classes.spinner} role="status" aria-label={ariaLabel} aria-live="polite" /> | ||
| ) | ||
| }, | ||
| ) | ||
|
|
||
| GluuSpinner.displayName = 'GluuSpinner' | ||
|
|
||
| export default GluuSpinner | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { default as GluuSpinner } from './GluuSpinner' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export type { StatusBadgeProps, StatusBadgeTheme, ServiceStatusValue } from './types' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| export type StatusBadgeTheme = 'active' | 'inactive' | 'success' | 'danger' | 'warning' | 'info' | ||
|
|
||
| export type ServiceStatusValue = 'up' | 'down' | 'unknown' | 'degraded' | ||
|
|
||
| export interface StatusBadgeProps { | ||
| text?: string | ||
| theme?: StatusBadgeTheme | ||
| isDark?: boolean | ||
| isActive?: boolean | ||
| status?: ServiceStatusValue | ||
| variant?: 'default' | 'health' | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export * from './ui' | ||
| export * from './status' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import customColors from '@/customColors' | ||
|
|
||
| export type ServiceStatusValue = 'up' | 'down' | 'unknown' | 'degraded' | ||
|
|
||
| export const STATUS_MAP = { | ||
| 'Running': 'up', | ||
| 'UP': 'up', | ||
| 'up': 'up', | ||
| 'DOWN': 'down', | ||
| 'down': 'down', | ||
| 'DEGRADED': 'degraded', | ||
| 'degraded': 'degraded', | ||
| 'Not present': 'unknown', | ||
| 'not present': 'unknown', | ||
| 'unknown': 'unknown', | ||
| } as const satisfies Record<string, ServiceStatusValue> | ||
faisalsiddique4400 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| export const DEFAULT_STATUS: ServiceStatusValue = 'unknown' | ||
|
|
||
| export const STATUS_LABEL_KEYS: Record<ServiceStatusValue, string> = { | ||
| up: 'messages.status_active', | ||
| down: 'messages.status_inactive', | ||
| degraded: 'messages.status_degraded', | ||
| unknown: 'messages.status_unknown', | ||
| } as const | ||
faisalsiddique4400 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| export const STATUS_COLORS: Record<ServiceStatusValue, string> = { | ||
| up: customColors.statusActive, | ||
| down: customColors.statusInactive, | ||
| degraded: customColors.orange, | ||
| unknown: customColors.orange, | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| export const STATUS_BADGE_COLOR: Record<ServiceStatusValue, string> = { | ||
| up: 'success', | ||
| down: 'danger', | ||
| degraded: 'warning', | ||
| unknown: 'warning', | ||
| } as const | ||
|
|
||
| export const STATUS_DETAILS = [ | ||
| { label: 'menus.oauthserver', key: 'jans-auth' }, | ||
| { label: 'dashboard.config_api', key: 'jans-config-api' }, | ||
| { label: 'menus.fido', key: 'jans-fido2' }, | ||
| { label: 'dashboard.casa', key: 'jans-casa' }, | ||
| { label: 'dashboard.key_cloak', key: 'keycloak' }, | ||
| { label: 'menus.scim', key: 'jans-scim' }, | ||
| { label: 'dashboard.jans_lock', key: 'jans-lock' }, | ||
| ] as const | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| export const SPACING = { | ||
| PAGE: 24, | ||
| CONTENT_PADDING: 40, | ||
| SECTION_GAP: 24, | ||
| CARD_GAP: 24, | ||
| CARD_PADDING: 24, | ||
| CARD_CONTENT_GAP: 8, | ||
| } as const | ||
|
|
||
| export const BORDER_RADIUS = { | ||
| DEFAULT: 16, | ||
| LARGE: 24, | ||
| MEDIUM: 14, | ||
| SMALL: 5, | ||
| CIRCLE: '50%', | ||
| THIN: '1.5px', | ||
| } as const | ||
|
|
||
| export const GRADIENT_POSITION = { | ||
| TOP_RIGHT: 'top right', | ||
| TOP_LEFT: 'top left', | ||
| BOTTOM_RIGHT: 'bottom right', | ||
| BOTTOM_LEFT: 'bottom left', | ||
| CENTER: 'center', | ||
| } as const | ||
|
|
||
| export const ELLIPSE_SIZE = '200% 160%' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.