mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 09:05:45 -06:00
* Add items for navmodel and basic page * add reducer and actions * adding user mapping table component * adding components for ldap tables * add alert box on error * close error alert box * LDAP status page: connect APIs WIP * LDAP debug: fetch connection status from API * LDAP debug: fetch user info from API * LDAP debug: improve connection error view * LDAP debug: connection error tweaks * LDAP debug: fix role mapping view * LDAP debug: role mapping view tweaks * LDAP debug: add bulk-sync button stub * LDAP debug: minor refactor * LDAP debug: show user teams * LDAP debug: user info refactor * LDAP debug: initial user page * LDAP debug: minor refactor, remove unused angular wrapper * LDAP debug: add sessions to user page * LDAP debug: tweak user page * LDAP debug: tweak view for disabled user * LDAP debug: get sync info from API * LDAP debug: user sync info * LDAP debug: sync user button * LDAP debug: clear error on page load * LDAP debug: add user last sync info * LDAP debug: actions refactor * LDAP debug: roles and teams style tweaks * Pass showAttributeMapping to LdapUserTeams * LDAP debug: hide bulk sync button * LDAP debug: refactor sessions component * LDAP debug: fix loading user sessions * LDAP debug: hide sync user button * LDAP debug: fix fetching unavailable /ldap-sync-status endpoint * LDAP debug: revert accidentally added fix * LDAP debug: show error when LDAP is not enabled * LDAP debug: refactor, move ldap components into ldap/ folder * LDAP debug: styles refactoring * LDAP debug: ldap reducer tests * LDAP debug: ldap user reducer tests * LDAP debug: fix connection error placement * Text update * LdapUser: Minor UI changes moving things around * AlertBox: Removed icon-on-top as everywhere else it is centered, want to have it be consistent
136 lines
2.8 KiB
TypeScript
136 lines
2.8 KiB
TypeScript
import { reducerFactory } from 'app/core/redux';
|
|
import { LdapState, LdapUserState } from 'app/types';
|
|
import {
|
|
ldapConnectionInfoLoadedAction,
|
|
ldapFailedAction,
|
|
userMappingInfoLoadedAction,
|
|
userMappingInfoFailedAction,
|
|
clearUserErrorAction,
|
|
userLoadedAction,
|
|
userSessionsLoadedAction,
|
|
ldapSyncStatusLoadedAction,
|
|
clearUserMappingInfoAction,
|
|
} from './actions';
|
|
|
|
const initialLdapState: LdapState = {
|
|
connectionInfo: [],
|
|
syncInfo: null,
|
|
user: null,
|
|
connectionError: null,
|
|
userError: null,
|
|
};
|
|
|
|
const initialLdapUserState: LdapUserState = {
|
|
user: null,
|
|
ldapUser: null,
|
|
ldapSyncInfo: null,
|
|
sessions: [],
|
|
};
|
|
|
|
export const ldapReducer = reducerFactory(initialLdapState)
|
|
.addMapper({
|
|
filter: ldapConnectionInfoLoadedAction,
|
|
mapper: (state, action) => ({
|
|
...state,
|
|
ldapError: null,
|
|
connectionInfo: action.payload,
|
|
}),
|
|
})
|
|
.addMapper({
|
|
filter: ldapFailedAction,
|
|
mapper: (state, action) => ({
|
|
...state,
|
|
ldapError: action.payload,
|
|
}),
|
|
})
|
|
.addMapper({
|
|
filter: ldapSyncStatusLoadedAction,
|
|
mapper: (state, action) => ({
|
|
...state,
|
|
syncInfo: action.payload,
|
|
}),
|
|
})
|
|
.addMapper({
|
|
filter: userMappingInfoLoadedAction,
|
|
mapper: (state, action) => ({
|
|
...state,
|
|
user: action.payload,
|
|
userError: null,
|
|
}),
|
|
})
|
|
.addMapper({
|
|
filter: userMappingInfoFailedAction,
|
|
mapper: (state, action) => ({
|
|
...state,
|
|
user: null,
|
|
userError: action.payload,
|
|
}),
|
|
})
|
|
.addMapper({
|
|
filter: clearUserMappingInfoAction,
|
|
mapper: (state, action) => ({
|
|
...state,
|
|
user: null,
|
|
}),
|
|
})
|
|
.addMapper({
|
|
filter: clearUserErrorAction,
|
|
mapper: state => ({
|
|
...state,
|
|
userError: null,
|
|
}),
|
|
})
|
|
.create();
|
|
|
|
export const ldapUserReducer = reducerFactory(initialLdapUserState)
|
|
.addMapper({
|
|
filter: userMappingInfoLoadedAction,
|
|
mapper: (state, action) => ({
|
|
...state,
|
|
ldapUser: action.payload,
|
|
}),
|
|
})
|
|
.addMapper({
|
|
filter: userMappingInfoFailedAction,
|
|
mapper: (state, action) => ({
|
|
...state,
|
|
ldapUser: null,
|
|
userError: action.payload,
|
|
}),
|
|
})
|
|
.addMapper({
|
|
filter: clearUserErrorAction,
|
|
mapper: state => ({
|
|
...state,
|
|
userError: null,
|
|
}),
|
|
})
|
|
.addMapper({
|
|
filter: ldapSyncStatusLoadedAction,
|
|
mapper: (state, action) => ({
|
|
...state,
|
|
ldapSyncInfo: action.payload,
|
|
}),
|
|
})
|
|
.addMapper({
|
|
filter: userLoadedAction,
|
|
mapper: (state, action) => ({
|
|
...state,
|
|
user: action.payload,
|
|
userError: null,
|
|
}),
|
|
})
|
|
.addMapper({
|
|
filter: userSessionsLoadedAction,
|
|
mapper: (state, action) => ({
|
|
...state,
|
|
sessions: action.payload,
|
|
}),
|
|
})
|
|
.create();
|
|
|
|
export default {
|
|
ldap: ldapReducer,
|
|
ldapUser: ldapUserReducer,
|
|
};
|