Skip to content

Commit

Permalink
fix(admin-ui): resolve all bugs displayed for admin-ui bug #308
Browse files Browse the repository at this point in the history
  • Loading branch information
syntrydy committed Nov 24, 2021
1 parent 224da64 commit 3241bc9
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 39 deletions.
12 changes: 2 additions & 10 deletions app/redux/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ import process from '../../../plugins/PluginReducersResolver'
const sagaMiddleware = createSagaMiddleware()
const middlewares = [sagaMiddleware]
const composeEnhancer = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose

const persistConfig = {
key: 'root',
storage,
stateReconciler: hardSet,
}

// Preserve initial state for not-yet-loaded reducers
const combine = (reducersObjects) => {
const reducerNames = Object.keys(reducersObjects)
Expand All @@ -28,7 +26,6 @@ const combine = (reducersObjects) => {
})
return combineReducers(reducersObjects)
}

const reducers = combine(reducerRegistry.getReducers())
process()
const persistedReducer = persistReducer(persistConfig, reducers)
Expand All @@ -39,23 +36,18 @@ export function configureStore(initialState) {
initialState,
composeEnhancer(applyMiddleware(...middlewares)),
)

const persistor = persistStore(store)

window.dsfaStore = store
reducerRegistry.setChangeListener((reducers) => {
store.replaceReducer(combine(reducers))
reducerRegistry.setChangeListener((reds) => {
store.replaceReducer(combine(reds))
})

sagaMiddleware.run(RootSaga)

if (module.hot) {
// Enable Webpack hot module replacement for reducers
module.hot.accept('../reducers/index', () => {
const nextRootReducer = require('../reducers/index')
store.replaceReducer(nextRootReducer)
})
}

return { store, persistor }
}
16 changes: 8 additions & 8 deletions app/routes/Apps/Gluu/GluuAppSidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ function GluuAppSidebar({ scopes }) {
<SidebarMenu.Item
icon={<i className="fa fa-fw fa-home"></i>}
title={t('menus.home')}
textStyle={{fontSize:"18px", fontWeight:"800"}}
textStyle={{ fontSize: '18px', fontWeight: '800' }}
>
<SidebarMenu.Item
title={t('menus.dashboard')}
to="/home/dashboard"
textStyle={{fontSize:"18px", fontWeight:"600"}}
textStyle={{ fontSize: '18px', fontWeight: '600' }}
exact
/>
</SidebarMenu.Item>
Expand All @@ -59,7 +59,7 @@ function GluuAppSidebar({ scopes }) {
icon={getMenuIcon(plugin.icon)}
to={getMenuPath(plugin)}
title={t(`${plugin.title}`)}
textStyle={{fontSize:"18px", fontWeight:"800"}}
textStyle={{ fontSize: '18px', fontWeight: '800' }}
>
{hasChildren(plugin) &&
plugin.children.map((item, idx) => (
Expand All @@ -72,18 +72,18 @@ function GluuAppSidebar({ scopes }) {
}
to={getMenuPath(item)}
icon={getMenuIcon(item.icon)}
textStyle={{fontSize:"18px", fontWeight:"600"}}
textStyle={{ fontSize: '18px', fontWeight: '600' }}
exact
>
{hasChildren(item) &&
item.children.map((sub, idx) => (
item.children.map((sub, id) => (
<SidebarMenu.Item
key={idx}
key={id}
title={t(`${sub.title}`)}
to={getMenuPath(sub)}
isEmptyNode={!hasPermission(scopes, sub.permission)}
icon={getMenuIcon(sub.icon)}
textStyle={{fontSize:"18px", fontWeight:"400"}}
textStyle={{ fontSize: '18px', fontWeight: '400' }}
exact
></SidebarMenu.Item>
))}
Expand All @@ -98,7 +98,7 @@ function GluuAppSidebar({ scopes }) {
icon={<i className="fa fa-fw fa-sign-out mr-2"></i>}
title={t('menus.signout')}
to="/logout"
textStyle={{fontSize:"18px", fontWeight:"800"}}
textStyle={{ fontSize: '18px', fontWeight: '800' }}
/>
</SidebarMenu>
</ErrorBoundary>
Expand Down
4 changes: 3 additions & 1 deletion app/routes/Apps/Gluu/GluuArrayCompleter.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ function GluuArrayCompleter({
allowNew
emptyLabel=""
labelKey={name}
onChange={(selected) => {}}
onChange={(selected) => {
console.log(selected)
}}
id={name}
name={name}
data-testid={name}
Expand Down
4 changes: 2 additions & 2 deletions app/routes/Apps/Gluu/GluuNotification.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ function GluuNotification({ type, message, description, show }) {
return 'fa fa-fw fa-2x ' + theType
}

function showToast(type) {
switch (type) {
function showToast(aType) {
switch (aType) {
case 'info':
toast.info(toastContent)
break
Expand Down
4 changes: 2 additions & 2 deletions app/routes/Apps/Gluu/GluuTypeAheadForDn.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ function GluuTypeAheadForDn({
doc_entry,
}) {
const { t } = useTranslation()
function getItemName(options, item) {
const data = options.filter((e) => e.dn === item)
function getItemName(theOptions, item) {
const data = theOptions.filter((e) => e.dn === item)
return data[0].name
}
return (
Expand Down
4 changes: 2 additions & 2 deletions app/routes/Apps/Gluu/GluuTypeAheadWithAdd.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ function GluuTypeAheadWithAdd({
}
}

const handleChange = (name, selected) => {
const handleChange = (aName, selected) => {
setOpts(selected)
setItems(selected)
formik.setFieldValue(name, selected)
formik.setFieldValue(aName, selected)
}

return (
Expand Down
4 changes: 3 additions & 1 deletion app/routes/Apps/Gluu/Tests/GluuToogleRow.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import { I18nextProvider } from 'react-i18next'
const LABEL = 'fields.application_type'
const NAME = 'applicationType'
const VALUE = false
function formikf() {}
function formikf() {
console.console('=========')
}

it('Test gluutooltip', () => {
render(
Expand Down
10 changes: 3 additions & 7 deletions plugins/PluginReducersResolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@ import reducerRegistry from '../app/redux/reducers/ReducerRegistry'
async function process() {
const metadataFilePath = plugins.map((item) => item.metadataFile)
let pluginReducers = []
await metadataFilePath.forEach(async (path) => {
pluginReducers = await [
...pluginReducers,
...require(`${path}`).default.reducers,
]
metadataFilePath.forEach(async (path) => {
pluginReducers = [...pluginReducers, ...require(`${path}`).default.reducers]

pluginReducers.forEach(async (element) => {
await reducerRegistry.register(element.name, element.reducer)
reducerRegistry.register(element.name, element.reducer)
})
})

}
export default process
12 changes: 6 additions & 6 deletions plugins/admin/components/CustomScripts/CustomScriptForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function CustomScriptForm({ item, scripts, handleSubmit }) {
const [init, setInit] = useState(false)
const [modal, setModal] = useState(false)
const [scriptTypeState, setScriptTypeState] = useState(item.scriptType)
const scriptTypes = [...new Set(scripts.map((item) => item.scriptType))]
const scriptTypes = [...new Set(scripts.map((anItem) => anItem.scriptType))]
function activate() {
if (!init) {
setInit(true)
Expand Down Expand Up @@ -250,9 +250,9 @@ function CustomScriptForm({ item, scripts, handleSubmit }) {
}}
>
<option value="">{t('options.choose')}...</option>
{scriptTypes.map((item, index) => (
<option key={index} value={item}>
{item}
{scriptTypes.map((itemCandidate, index) => (
<option key={index} value={itemCandidate}>
{itemCandidate}
</option>
))}
</CustomInput>
Expand Down Expand Up @@ -333,10 +333,10 @@ function CustomScriptForm({ item, scripts, handleSubmit }) {
defaultValue={
!!item.moduleProperties &&
item.moduleProperties.filter(
(item) => item.value1 === 'usage_type',
(vItem) => vItem.value1 === 'usage_type',
).length > 0
? item.moduleProperties.filter(
(item) => item.value1 === 'usage_type',
(kItem) => kItem.value1 === 'usage_type',
)[0].value2
: undefined
}
Expand Down

0 comments on commit 3241bc9

Please sign in to comment.