Skip to content

Commit 3241bc9

Browse files
committed
fix(admin-ui): resolve all bugs displayed for admin-ui bug #308
1 parent 224da64 commit 3241bc9

File tree

9 files changed

+31
-39
lines changed

9 files changed

+31
-39
lines changed

app/redux/store/index.js

+2-10
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@ import process from '../../../plugins/PluginReducersResolver'
1111
const sagaMiddleware = createSagaMiddleware()
1212
const middlewares = [sagaMiddleware]
1313
const composeEnhancer = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
14-
1514
const persistConfig = {
1615
key: 'root',
1716
storage,
1817
stateReconciler: hardSet,
1918
}
20-
2119
// Preserve initial state for not-yet-loaded reducers
2220
const combine = (reducersObjects) => {
2321
const reducerNames = Object.keys(reducersObjects)
@@ -28,7 +26,6 @@ const combine = (reducersObjects) => {
2826
})
2927
return combineReducers(reducersObjects)
3028
}
31-
3229
const reducers = combine(reducerRegistry.getReducers())
3330
process()
3431
const persistedReducer = persistReducer(persistConfig, reducers)
@@ -39,23 +36,18 @@ export function configureStore(initialState) {
3936
initialState,
4037
composeEnhancer(applyMiddleware(...middlewares)),
4138
)
42-
4339
const persistor = persistStore(store)
44-
4540
window.dsfaStore = store
46-
reducerRegistry.setChangeListener((reducers) => {
47-
store.replaceReducer(combine(reducers))
41+
reducerRegistry.setChangeListener((reds) => {
42+
store.replaceReducer(combine(reds))
4843
})
49-
5044
sagaMiddleware.run(RootSaga)
51-
5245
if (module.hot) {
5346
// Enable Webpack hot module replacement for reducers
5447
module.hot.accept('../reducers/index', () => {
5548
const nextRootReducer = require('../reducers/index')
5649
store.replaceReducer(nextRootReducer)
5750
})
5851
}
59-
6052
return { store, persistor }
6153
}

app/routes/Apps/Gluu/GluuAppSidebar.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ function GluuAppSidebar({ scopes }) {
4141
<SidebarMenu.Item
4242
icon={<i className="fa fa-fw fa-home"></i>}
4343
title={t('menus.home')}
44-
textStyle={{fontSize:"18px", fontWeight:"800"}}
44+
textStyle={{ fontSize: '18px', fontWeight: '800' }}
4545
>
4646
<SidebarMenu.Item
4747
title={t('menus.dashboard')}
4848
to="/home/dashboard"
49-
textStyle={{fontSize:"18px", fontWeight:"600"}}
49+
textStyle={{ fontSize: '18px', fontWeight: '600' }}
5050
exact
5151
/>
5252
</SidebarMenu.Item>
@@ -59,7 +59,7 @@ function GluuAppSidebar({ scopes }) {
5959
icon={getMenuIcon(plugin.icon)}
6060
to={getMenuPath(plugin)}
6161
title={t(`${plugin.title}`)}
62-
textStyle={{fontSize:"18px", fontWeight:"800"}}
62+
textStyle={{ fontSize: '18px', fontWeight: '800' }}
6363
>
6464
{hasChildren(plugin) &&
6565
plugin.children.map((item, idx) => (
@@ -72,18 +72,18 @@ function GluuAppSidebar({ scopes }) {
7272
}
7373
to={getMenuPath(item)}
7474
icon={getMenuIcon(item.icon)}
75-
textStyle={{fontSize:"18px", fontWeight:"600"}}
75+
textStyle={{ fontSize: '18px', fontWeight: '600' }}
7676
exact
7777
>
7878
{hasChildren(item) &&
79-
item.children.map((sub, idx) => (
79+
item.children.map((sub, id) => (
8080
<SidebarMenu.Item
81-
key={idx}
81+
key={id}
8282
title={t(`${sub.title}`)}
8383
to={getMenuPath(sub)}
8484
isEmptyNode={!hasPermission(scopes, sub.permission)}
8585
icon={getMenuIcon(sub.icon)}
86-
textStyle={{fontSize:"18px", fontWeight:"400"}}
86+
textStyle={{ fontSize: '18px', fontWeight: '400' }}
8787
exact
8888
></SidebarMenu.Item>
8989
))}
@@ -98,7 +98,7 @@ function GluuAppSidebar({ scopes }) {
9898
icon={<i className="fa fa-fw fa-sign-out mr-2"></i>}
9999
title={t('menus.signout')}
100100
to="/logout"
101-
textStyle={{fontSize:"18px", fontWeight:"800"}}
101+
textStyle={{ fontSize: '18px', fontWeight: '800' }}
102102
/>
103103
</SidebarMenu>
104104
</ErrorBoundary>

app/routes/Apps/Gluu/GluuArrayCompleter.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ function GluuArrayCompleter({
3737
allowNew
3838
emptyLabel=""
3939
labelKey={name}
40-
onChange={(selected) => {}}
40+
onChange={(selected) => {
41+
console.log(selected)
42+
}}
4143
id={name}
4244
name={name}
4345
data-testid={name}

app/routes/Apps/Gluu/GluuNotification.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ function GluuNotification({ type, message, description, show }) {
3434
return 'fa fa-fw fa-2x ' + theType
3535
}
3636

37-
function showToast(type) {
38-
switch (type) {
37+
function showToast(aType) {
38+
switch (aType) {
3939
case 'info':
4040
toast.info(toastContent)
4141
break

app/routes/Apps/Gluu/GluuTypeAheadForDn.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ function GluuTypeAheadForDn({
2626
doc_entry,
2727
}) {
2828
const { t } = useTranslation()
29-
function getItemName(options, item) {
30-
const data = options.filter((e) => e.dn === item)
29+
function getItemName(theOptions, item) {
30+
const data = theOptions.filter((e) => e.dn === item)
3131
return data[0].name
3232
}
3333
return (

app/routes/Apps/Gluu/GluuTypeAheadWithAdd.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ function GluuTypeAheadWithAdd({
3131
}
3232
}
3333

34-
const handleChange = (name, selected) => {
34+
const handleChange = (aName, selected) => {
3535
setOpts(selected)
3636
setItems(selected)
37-
formik.setFieldValue(name, selected)
37+
formik.setFieldValue(aName, selected)
3838
}
3939

4040
return (

app/routes/Apps/Gluu/Tests/GluuToogleRow.test.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ import { I18nextProvider } from 'react-i18next'
66
const LABEL = 'fields.application_type'
77
const NAME = 'applicationType'
88
const VALUE = false
9-
function formikf() {}
9+
function formikf() {
10+
console.console('=========')
11+
}
1012

1113
it('Test gluutooltip', () => {
1214
render(

plugins/PluginReducersResolver.js

+3-7
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,12 @@ import reducerRegistry from '../app/redux/reducers/ReducerRegistry'
44
async function process() {
55
const metadataFilePath = plugins.map((item) => item.metadataFile)
66
let pluginReducers = []
7-
await metadataFilePath.forEach(async (path) => {
8-
pluginReducers = await [
9-
...pluginReducers,
10-
...require(`${path}`).default.reducers,
11-
]
7+
metadataFilePath.forEach(async (path) => {
8+
pluginReducers = [...pluginReducers, ...require(`${path}`).default.reducers]
129

1310
pluginReducers.forEach(async (element) => {
14-
await reducerRegistry.register(element.name, element.reducer)
11+
reducerRegistry.register(element.name, element.reducer)
1512
})
1613
})
17-
1814
}
1915
export default process

plugins/admin/components/CustomScripts/CustomScriptForm.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function CustomScriptForm({ item, scripts, handleSubmit }) {
2424
const [init, setInit] = useState(false)
2525
const [modal, setModal] = useState(false)
2626
const [scriptTypeState, setScriptTypeState] = useState(item.scriptType)
27-
const scriptTypes = [...new Set(scripts.map((item) => item.scriptType))]
27+
const scriptTypes = [...new Set(scripts.map((anItem) => anItem.scriptType))]
2828
function activate() {
2929
if (!init) {
3030
setInit(true)
@@ -250,9 +250,9 @@ function CustomScriptForm({ item, scripts, handleSubmit }) {
250250
}}
251251
>
252252
<option value="">{t('options.choose')}...</option>
253-
{scriptTypes.map((item, index) => (
254-
<option key={index} value={item}>
255-
{item}
253+
{scriptTypes.map((itemCandidate, index) => (
254+
<option key={index} value={itemCandidate}>
255+
{itemCandidate}
256256
</option>
257257
))}
258258
</CustomInput>
@@ -333,10 +333,10 @@ function CustomScriptForm({ item, scripts, handleSubmit }) {
333333
defaultValue={
334334
!!item.moduleProperties &&
335335
item.moduleProperties.filter(
336-
(item) => item.value1 === 'usage_type',
336+
(vItem) => vItem.value1 === 'usage_type',
337337
).length > 0
338338
? item.moduleProperties.filter(
339-
(item) => item.value1 === 'usage_type',
339+
(kItem) => kItem.value1 === 'usage_type',
340340
)[0].value2
341341
: undefined
342342
}

0 commit comments

Comments
 (0)