Skip to content

Commit 3ad982b

Browse files
authored
Merge pull request #1579 from GluuFederation/admin-ui-test-1575
feat(admin-ui): fetch sessionTimeout from config response #1575
2 parents ff51ff2 + 1aa52b5 commit 3ad982b

File tree

8 files changed

+8
-16
lines changed

8 files changed

+8
-16
lines changed

admin-ui/.env

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
BASE_PATH=/
22
CONFIG_API_BASE_URL=http://localhost:8080/jans-config-api
33
API_BASE_URL=http://localhost:8080/jans-config-api/admin-ui
4-
NPM_TOKEN=
5-
SESSION_TIMEOUT_IN_MINUTES=30
4+
NPM_TOKEN=

admin-ui/.env.adminuitest

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
BASE_PATH=/admin/
22
CONFIG_API_BASE_URL=https://admin-ui-test.gluu.org/jans-config-api
33
API_BASE_URL=https://admin-ui-test.gluu.org/jans-config-api/admin-ui
4-
NPM_TOKEN=
5-
SESSION_TIMEOUT_IN_MINUTES=30
4+
NPM_TOKEN=

admin-ui/.env.goldencrane

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
BASE_PATH=/admin/
22
CONFIG_API_BASE_URL=https://jv18creator-golden-crane/jans-config-api
33
API_BASE_URL=https://jv18creator-golden-crane/jans-config-api/admin-ui
4-
NPM_TOKEN=
5-
SESSION_TIMEOUT_IN_MINUTES=30
4+
NPM_TOKEN=

admin-ui/.env.test

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
BASE_PATH=/
22
CONFIG_API_BASE_URL=http://localhost:8080/jans-config-api
3-
API_BASE_URL=http://localhost:8080/jans-config-api/admin-ui
4-
SESSION_TIMEOUT_IN_MINUTES=30
3+
API_BASE_URL=http://localhost:8080/jans-config-api/admin-ui

admin-ui/.env.tmp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
BASE_PATH=/admin/
22
CONFIG_API_BASE_URL=https://%(hostname)s/jans-config-api
33
API_BASE_URL=https://%(hostname)s/jans-config-api/admin-ui
4-
NPM_TOKEN=
5-
SESSION_TIMEOUT_IN_MINUTES=30
4+
NPM_TOKEN=

admin-ui/app/routes/Apps/Gluu/GluuSessionTimeout.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { useRef, useState } from 'react'
22
import SessionTimeoutDialog from './GluuSessionTimeoutDialog'
33
import { useNavigate } from 'react-router-dom'
44
import { withIdleTimer } from 'react-idle-timer'
5+
import { useSelector } from 'react-redux'
56

67
let countdownInterval
78
let timeout
@@ -13,7 +14,7 @@ const SessionTimeout = ({ isAuthenticated }) => {
1314
const [timeoutModalOpen, setTimeoutModalOpen] = useState(false)
1415
const [timeoutCountdown, setTimeoutCountdown] = useState(0)
1516
const idleTimer = useRef(null)
16-
const SESSION_TIMEOUT_IN_MINUTES = process.env.SESSION_TIMEOUT_IN_MINUTES
17+
const sessionTimeout = useSelector((state) => state.authReducer?.config?.sessionTimeoutInMins) || 5
1718
const navigate =useNavigate()
1819

1920
const clearSessionTimeout = () => {
@@ -73,7 +74,7 @@ const SessionTimeout = ({ isAuthenticated }) => {
7374
onActive={onActive}
7475
onIdle={onIdle}
7576
debounce={250}
76-
timeout={SESSION_TIMEOUT_IN_MINUTES * 60 * 1000}
77+
timeout={sessionTimeout * 60 * 1000}
7778
/>
7879
<SessionTimeoutDialog
7980
countdown={timeoutCountdown}

admin-ui/build/webpack.config.client.dev.js

-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ require('dotenv').config({
1010
})
1111

1212
const BASE_PATH = process.env.BASE_PATH || '/'
13-
const SESSION_TIMEOUT_IN_MINUTES = process.env.SESSION_TIMEOUT_IN_MINUTES || 2
1413
const CONFIG_API_BASE_URL =
1514
process.env.CONFIG_API_BASE_URL || 'https://sample.com'
1615

@@ -74,7 +73,6 @@ module.exports = {
7473
BASE_PATH: JSON.stringify(BASE_PATH),
7574
API_BASE_URL: JSON.stringify(process.env.API_BASE_URL),
7675
CONFIG_API_BASE_URL: JSON.stringify(CONFIG_API_BASE_URL),
77-
SESSION_TIMEOUT_IN_MINUTES: SESSION_TIMEOUT_IN_MINUTES,
7876
},
7977
}),
8078
new MiniCssExtractPlugin(),

admin-ui/build/webpack.config.client.prod.js

-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ const CONFIG_API_BASE_URL =
1515
process.env.CONFIG_API_BASE_URL || 'https://sample.com'
1616
const API_BASE_URL =
1717
process.env.API_BASE_URL || 'https://bank.gluu.org/admin-ui-api'
18-
const SESSION_TIMEOUT_IN_MINUTES = process.env.SESSION_TIMEOUT_IN_MINUTES || 2
1918

2019
module.exports = {
2120
devtool: false,
@@ -89,7 +88,6 @@ module.exports = {
8988
BASE_PATH: JSON.stringify(BASE_PATH),
9089
API_BASE_URL: JSON.stringify(API_BASE_URL),
9190
CONFIG_API_BASE_URL: JSON.stringify(CONFIG_API_BASE_URL),
92-
SESSION_TIMEOUT_IN_MINUTES: JSON.stringify(SESSION_TIMEOUT_IN_MINUTES),
9391
},
9492
}),
9593
new BundleAnalyzerPlugin({ analyzerMode: 'disabled' }) //* switch mode to "server" to activate BundleAnalyzerPlugin

0 commit comments

Comments
 (0)