Skip to content

Commit

Permalink
feat(admin-ui): table header background color based on selected theme
Browse files Browse the repository at this point in the history
  • Loading branch information
harryandriyan committed Jul 11, 2022
1 parent ad29bcd commit a3ffc7f
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 19 deletions.
2 changes: 1 addition & 1 deletion admin-ui/app/routes/Apps/Gluu/styles/applicationstyle.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default {
tableHeaderStyle: {
backgroundColor: '#03a96d',
backgroundColor: 'rgb(48, 54, 65)',
color: '#FFF',
padding: '12px',
textTransform: 'uppercase',
Expand Down
4 changes: 4 additions & 0 deletions admin-ui/app/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ body {
border-top-right-radius: 16px;
}

.MuiTableCell-head .MuiTableSortLabel-root:hover {
color: #ddd;
}

.nav-item > a.nav-link {
background: transparent!important;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react'
import React, { useState, useEffect, useContext } from 'react'
import MaterialTable from '@material-table/core'
import { DeleteOutlined } from '@material-ui/icons'
import { useHistory } from 'react-router-dom'
Expand Down Expand Up @@ -36,6 +36,8 @@ import {
} from '../../common/Constants'
import { useTranslation } from 'react-i18next'
import SetTitle from 'Utils/SetTitle'
import { ThemeContext } from 'Context/theme/themeContext'
import getThemeColor from 'Context/theme/config'

function ScriptListTable({ scripts, loading, dispatch, permissions }) {
const { t } = useTranslation()
Expand All @@ -51,6 +53,10 @@ function ScriptListTable({ scripts, loading, dispatch, permissions }) {
const [selectedScripts, setSelectedScripts] = useState(scripts)
const [type, setType] = useState('PERSON_AUTHENTICATION')
const toggle = () => setModal(!modal)
const theme = useContext(ThemeContext)
const selectedTheme = theme.state.theme
const themeColors = getThemeColor(selectedTheme)
const bgThemeColor = { background: themeColors.background }
SetTitle(t('titles.scripts'))

function makeOptions() {
Expand Down Expand Up @@ -196,7 +202,7 @@ function ScriptListTable({ scripts, loading, dispatch, permissions }) {
rowStyle: (rowData) => ({
backgroundColor: rowData.enabled ? '#33AE9A' : '#FFF',
}),
headerStyle: applicationStyle.tableHeaderStyle,
headerStyle: { ...applicationStyle.tableHeaderStyle, ...bgThemeColor },
actionsColumnIndex: -1,
}}
detailPanel={(rowData) => {
Expand Down
12 changes: 10 additions & 2 deletions admin-ui/plugins/admin/components/Permissions/UiPermListPage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'
import React, { useEffect, useState, useContext } from 'react'
import MaterialTable from '@material-table/core'
import { Paper } from '@material-ui/core'
import UiPermDetailPage from './UiPermDetailPage'
Expand All @@ -22,6 +22,8 @@ import {
PERMISSION_WRITE,
} from 'Utils/PermChecker'
import SetTitle from 'Utils/SetTitle'
import { ThemeContext } from 'Context/theme/themeContext'
import getThemeColor from 'Context/theme/config'

function UiPermListPage({ apiPerms, permissions, loading, dispatch }) {
const { t } = useTranslation()
Expand All @@ -31,9 +33,15 @@ function UiPermListPage({ apiPerms, permissions, loading, dispatch }) {
const options = []
const userAction = {}
const pageSize = localStorage.getItem('paggingSize') || 10
const theme = useContext(ThemeContext)
const selectedTheme = theme.state.theme
const themeColors = getThemeColor(selectedTheme)
const bgThemeColor = { background: themeColors.background }

useEffect(() => {
doFetchList()
}, [])

SetTitle(t('titles.permissions'))

if (hasPermission(permissions, PERMISSION_WRITE)) {
Expand Down Expand Up @@ -91,7 +99,7 @@ function UiPermListPage({ apiPerms, permissions, loading, dispatch }) {
rowStyle: (rowData) => ({
backgroundColor: rowData.enabled ? '#33AE9A' : '#FFF',
}),
headerStyle: applicationStyle.tableHeaderStyle,
headerStyle: { ...applicationStyle.tableHeaderStyle, ...bgThemeColor },
actionsColumnIndex: -1,
}}
detailPanel={(rowD) => {
Expand Down
12 changes: 10 additions & 2 deletions admin-ui/plugins/admin/components/Roles/UiRoleListPage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'
import React, { useEffect, useState, useContext } from 'react'
import MaterialTable from '@material-table/core'
import { Paper } from '@material-ui/core'
import UiRoleDetailPage from './UiRoleDetailPage'
Expand All @@ -23,6 +23,8 @@ import {
ROLE_WRITE,
} from 'Utils/PermChecker'
import SetTitle from 'Utils/SetTitle'
import { ThemeContext } from 'Context/theme/themeContext'
import getThemeColor from 'Context/theme/config'

function UiRoleListPage({ apiRoles, permissions, loading, dispatch }) {
const { t } = useTranslation()
Expand All @@ -32,9 +34,15 @@ function UiRoleListPage({ apiRoles, permissions, loading, dispatch }) {
const options = []
const userAction = {}
const pageSize = localStorage.getItem('paggingSize') || 10
const theme = useContext(ThemeContext)
const selectedTheme = theme.state.theme
const themeColors = getThemeColor(selectedTheme)
const bgThemeColor = { background: themeColors.background }

useEffect(() => {
doFetchList()
}, [])

SetTitle(t('titles.roles'))

if (hasPermission(permissions, ROLE_WRITE)) {
Expand Down Expand Up @@ -127,7 +135,7 @@ function UiRoleListPage({ apiRoles, permissions, loading, dispatch }) {
rowStyle: (rowData) => ({
backgroundColor: rowData.enabled ? '#33AE9A' : '#FFF',
}),
headerStyle: applicationStyle.tableHeaderStyle,
headerStyle: { ...applicationStyle.tableHeaderStyle, ...bgThemeColor },
actionsColumnIndex: -1,
}}
detailPanel={(rowData) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react'
import React, { useState, useEffect, useContext } from 'react'
import MaterialTable from '@material-table/core'
import { DeleteOutlined } from '@material-ui/icons'
import { useHistory } from 'react-router-dom'
Expand Down Expand Up @@ -36,6 +36,8 @@ import {
} from 'Utils/PermChecker'
import ClientShowScopes from './ClientShowScopes'
import SetTitle from 'Utils/SetTitle'
import { ThemeContext } from 'Context/theme/themeContext'
import getThemeColor from 'Context/theme/config'

function ClientListPage({ clients, permissions, scopes, loading, dispatch }) {
const { t } = useTranslation()
Expand All @@ -44,6 +46,11 @@ function ClientListPage({ clients, permissions, scopes, loading, dispatch }) {
const myActions = []
const history = useHistory()
const pageSize = localStorage.getItem('paggingSize') || 10
const theme = useContext(ThemeContext)
const selectedTheme = theme.state.theme
const themeColors = getThemeColor(selectedTheme)
const bgThemeColor = { background: themeColors.background }

SetTitle(t('titles.oidc_clients'))

const [scopesModal, setScopesModal] = useState({
Expand Down Expand Up @@ -288,7 +295,7 @@ function ClientListPage({ clients, permissions, scopes, loading, dispatch }) {
searchFieldAlignment: 'left',
selection: false,
pageSize: pageSize,
headerStyle: applicationStyle.tableHeaderStyle,
headerStyle: { ...applicationStyle.tableHeaderStyle, ...bgThemeColor },
actionsColumnIndex: -1,
}}
detailPanel={(rowData) => {
Expand Down
11 changes: 9 additions & 2 deletions admin-ui/plugins/auth-server/components/Scopes/ScopeListPage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react'
import React, { useState, useEffect, useContext } from 'react'
import MaterialTable from '@material-table/core'
import { DeleteOutlined } from '@material-ui/icons'
import { Paper } from '@material-ui/core'
Expand Down Expand Up @@ -34,6 +34,8 @@ import {
FETCHING_SCOPES,
} from 'Plugins/auth-server/common/Constants'
import SetTitle from 'Utils/SetTitle'
import { ThemeContext } from 'Context/theme/themeContext'
import getThemeColor from 'Context/theme/config'

function ScopeListPage({ scopes, permissions, loading, dispatch }) {
const { t } = useTranslation()
Expand All @@ -47,6 +49,11 @@ function ScopeListPage({ scopes, permissions, loading, dispatch }) {
const [limit, setLimit] = useState(500)
const [pattern, setPattern] = useState(null)
const toggle = () => setModal(!modal)
const theme = useContext(ThemeContext)
const selectedTheme = theme.state.theme
const themeColors = getThemeColor(selectedTheme)
const bgThemeColor = { background: themeColors.background }

SetTitle(t('titles.scopes'))

let memoLimit = limit
Expand Down Expand Up @@ -195,7 +202,7 @@ function ScopeListPage({ scopes, permissions, loading, dispatch }) {
searchFieldAlignment: 'left',
selection: false,
pageSize: pageSize,
headerStyle: applicationStyle.tableHeaderStyle,
headerStyle: { ...applicationStyle.tableHeaderStyle, ...bgThemeColor },
actionsColumnIndex: -1,
}}
detailPanel={(rowData) => {
Expand Down
11 changes: 9 additions & 2 deletions admin-ui/plugins/schema/components/Person/AttributeListPage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react'
import React, { useState, useEffect, useContext } from 'react'
import MaterialTable from '@material-table/core'
import { DeleteOutlined } from '@material-ui/icons'
import { useHistory } from 'react-router-dom'
Expand All @@ -25,13 +25,20 @@ import {
} from 'Plugins/schema/redux/actions/AttributeActions'
import { useTranslation } from 'react-i18next'
import SetTitle from 'Utils/SetTitle'
import { ThemeContext } from 'Context/theme/themeContext'
import getThemeColor from 'Context/theme/config'

function AttributeListPage({ attributes, permissions, loading, dispatch }) {
const { t } = useTranslation()
const options = {}
const pageSize = localStorage.getItem('paggingSize') || 10
const [limit, setLimit] = useState(pageSize)
const [pattern, setPattern] = useState(null)
const theme = useContext(ThemeContext)
const selectedTheme = theme.state.theme
const themeColors = getThemeColor(selectedTheme)
const bgThemeColor = { background: themeColors.background }

useEffect(() => {
makeOptions()
dispatch(getAttributes(options))
Expand Down Expand Up @@ -197,7 +204,7 @@ function AttributeListPage({ attributes, permissions, loading, dispatch }) {
selection: false,
searchFieldAlignment: 'left',
pageSize: pageSize,
headerStyle: applicationStyle.tableHeaderStyle,
headerStyle: { ...applicationStyle.tableHeaderStyle, ...bgThemeColor },
actionsColumnIndex: -1,
}}
detailPanel={(rowData) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react'
import React, { useState, useEffect, useContext } from 'react'
import MaterialTable from '@material-table/core'
import { DeleteOutlined } from '@material-ui/icons'
import { useHistory } from 'react-router-dom'
Expand Down Expand Up @@ -28,6 +28,8 @@ import {
import { getPersistenceType } from 'Plugins/services/redux/actions/PersistenceActions'
import { useTranslation } from 'react-i18next'
import SetTitle from 'Utils/SetTitle'
import { ThemeContext } from 'Context/theme/themeContext'
import getThemeColor from 'Context/theme/config'

function LdapListPage({
ldapConfigurations,
Expand All @@ -54,6 +56,10 @@ function LdapListPage({
message: '',
show: false,
})
const theme = useContext(ThemeContext)
const selectedTheme = theme.state.theme
const themeColors = getThemeColor(selectedTheme)
const bgThemeColor = { background: themeColors.background }
SetTitle(t('titles.ldap_authentication'))
const toggle = () => setModal(!modal)

Expand Down Expand Up @@ -189,7 +195,7 @@ function LdapListPage({
search: true,
selection: false,
pageSize: pageSize,
headerStyle: applicationStyle.tableHeaderStyle,
headerStyle: { ...applicationStyle.tableHeaderStyle, ...bgThemeColor },
actionsColumnIndex: -1,
}}
detailPanel={(rowData) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react'
import React, { useState, useEffect, useContext } from 'react'
import MaterialTable from '@material-table/core'
import { DeleteOutlined } from '@material-ui/icons'
import { useHistory } from 'react-router-dom'
Expand Down Expand Up @@ -27,6 +27,8 @@ import {
} from 'Plugins/services/redux/actions/SqlActions'
import { useTranslation } from 'react-i18next'
import SetTitle from 'Utils/SetTitle'
import { ThemeContext } from 'Context/theme/themeContext'
import getThemeColor from 'Context/theme/config'

function SqlListPage({
sqlConfigurations,
Expand All @@ -53,6 +55,10 @@ function SqlListPage({
message: '',
show: false,
})
const theme = useContext(ThemeContext)
const selectedTheme = theme.state.theme
const themeColors = getThemeColor(selectedTheme)
const bgThemeColor = { background: themeColors.background }
const toggle = () => setModal(!modal)
SetTitle(t('titles.sql_authentication'))

Expand Down Expand Up @@ -173,7 +179,7 @@ function SqlListPage({
search: true,
selection: false,
pageSize: pageSize,
headerStyle: applicationStyle.tableHeaderStyle,
headerStyle: { ...applicationStyle.tableHeaderStyle, ...bgThemeColor },
actionsColumnIndex: -1,
}}
detailPanel={(rowData) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'
import React, { useEffect, useState, useContext } from 'react'
import MaterialTable from '@material-table/core'
import { DeleteOutlined } from '@material-ui/icons'
import { Paper } from '@material-ui/core'
Expand All @@ -24,6 +24,8 @@ import {
import GluuCommitDialog from '../../../../app/routes/Apps/Gluu/GluuCommitDialog'
import SetTitle from 'Utils/SetTitle'
import { getRoles } from '../../../admin/redux/actions/ApiRoleActions'
import { ThemeContext } from 'Context/theme/themeContext'
import getThemeColor from 'Context/theme/config'

function UserList(props) {
const dispatch = useDispatch()
Expand All @@ -49,6 +51,10 @@ function UserList(props) {
toggle()
handleUserDelete(deleteData)
}
const theme = useContext(ThemeContext)
const selectedTheme = theme.state.theme
const themeColors = getThemeColor(selectedTheme)
const bgThemeColor = { background: themeColors.background }
SetTitle(t('titles.user_management'))

const myActions = []
Expand Down Expand Up @@ -132,7 +138,7 @@ function UserList(props) {
rowStyle: (rowData) => ({
backgroundColor: rowData.enabled ? '#33AE9A' : '#FFF',
}),
headerStyle: applicationStyle.tableHeaderStyle,
headerStyle: { ...applicationStyle.tableHeaderStyle, ...bgThemeColor },
actionsColumnIndex: -1,
}}
detailPanel={(rowData) => {
Expand Down

0 comments on commit a3ffc7f

Please sign in to comment.