diff --git a/admin-ui/app/redux/actions/InitActions.js b/admin-ui/app/redux/actions/InitActions.js
deleted file mode 100644
index d2f1d0a7d..000000000
--- a/admin-ui/app/redux/actions/InitActions.js
+++ /dev/null
@@ -1,48 +0,0 @@
-import {
- GET_ATTRIBUTES_FOR_STAT,
- GET_ATTRIBUTES_FOR_STAT_RESPONSE,
- GET_SCRIPTS_FOR_STAT,
- GET_SCRIPTS_FOR_STAT_RESPONSE,
- GET_CLIENTS_FOR_STAT,
- GET_CLIENTS_FOR_STAT_RESPONSE,
- GET_SCOPES_FOR_STAT,
- GET_SCOPES_FOR_STAT_RESPONSE,
-} from './types'
-
-export const getScripts = (action) => ({
- type: GET_SCRIPTS_FOR_STAT,
- payload: { action },
-})
-export const getScriptsResponse = (data) => ({
- type: GET_SCRIPTS_FOR_STAT_RESPONSE,
- payload: { data },
-})
-export const getClients = (action) => ({
- type: GET_CLIENTS_FOR_STAT,
- payload: { action },
-})
-
-export const getClientsResponse = (data) => ({
- type: GET_CLIENTS_FOR_STAT_RESPONSE,
- payload: { data },
-})
-
-export const getScopes = (action) => ({
- type: GET_SCOPES_FOR_STAT,
- payload: { action },
-})
-
-export const getScopesResponse = (data) => ({
- type: GET_SCOPES_FOR_STAT_RESPONSE,
- payload: { data },
-})
-
-export const getAttributes = (action) => ({
- type: GET_ATTRIBUTES_FOR_STAT,
- payload: { action },
-})
-
-export const getAttributesResponse = (data) => ({
- type: GET_ATTRIBUTES_FOR_STAT_RESPONSE,
- payload: { data },
-})
diff --git a/admin-ui/app/redux/actions/LicenseDetailsActions.js b/admin-ui/app/redux/actions/LicenseDetailsActions.js
deleted file mode 100644
index 487377212..000000000
--- a/admin-ui/app/redux/actions/LicenseDetailsActions.js
+++ /dev/null
@@ -1,26 +0,0 @@
-import {
- GET_LICENSE_DETAILS,
- GET_LICENSE_DETAILS_RESPONSE,
- UPDATE_LICENSE_DETAILS,
- UPDATE_LICENSE_DETAILS_RESPONSE,
-} from './types'
-
-export const getLicenseDetails = (action) => ({
- type: GET_LICENSE_DETAILS,
- payload: { action },
-})
-
-export const getLicenseDetailsResponse = (data) => ({
- type: GET_LICENSE_DETAILS_RESPONSE,
- payload: { data },
-})
-
-export const updateLicenseDetails = (action) => ({
- type: UPDATE_LICENSE_DETAILS,
- payload: { action },
-})
-
-export const updateLicenseDetailsResponse = (data) => ({
- type: UPDATE_LICENSE_DETAILS_RESPONSE,
- payload: { data },
-})
\ No newline at end of file
diff --git a/admin-ui/app/redux/actions/MauActions.js b/admin-ui/app/redux/actions/MauActions.js
deleted file mode 100644
index dc13b0985..000000000
--- a/admin-ui/app/redux/actions/MauActions.js
+++ /dev/null
@@ -1,11 +0,0 @@
-import { GET_MAU, GET_MAU_RESPONSE } from './types'
-
-export const getMau = (action) => ({
- type: GET_MAU,
- payload: { action },
-})
-
-export const getMauResponse = (data) => ({
- type: GET_MAU_RESPONSE,
- payload: { data },
-})
diff --git a/admin-ui/app/redux/actions/index.js b/admin-ui/app/redux/actions/index.js
index d04157e8b..875e55e86 100644
--- a/admin-ui/app/redux/actions/index.js
+++ b/admin-ui/app/redux/actions/index.js
@@ -2,7 +2,6 @@
* Redux Actions
*/
export * from './AuthActions'
-export * from './InitActions'
export * from './LicenseActions'
export * from './OidcDiscoveryActions'
export * from './AttributesActions'
\ No newline at end of file
diff --git a/admin-ui/app/redux/actions/types.js b/admin-ui/app/redux/actions/types.js
index 319dc0233..e2947094e 100644
--- a/admin-ui/app/redux/actions/types.js
+++ b/admin-ui/app/redux/actions/types.js
@@ -1,17 +1,6 @@
-export const GET_MAU = 'GET_MAU'
-export const GET_MAU_RESPONSE = 'GET_MAU_RESPONSE'
//Stat Actions
-export const GET_SCRIPTS_FOR_STAT = 'GET_SCRIPTS_FOR_STAT'
-export const GET_SCRIPTS_FOR_STAT_RESPONSE = 'GET_SCRIPTS_FOR_STAT_RESPONSE'
-export const GET_SCOPES_FOR_STAT = 'GET_SCOPES_FOR_STAT'
-export const GET_SCOPES_FOR_STAT_RESPONSE = 'GET_SCOPES_FOR_STAT_RESPONSE'
-export const GET_ATTRIBUTES_FOR_STAT = 'GET_ATTRIBUTES_FOR_STAT'
-export const GET_ATTRIBUTES_FOR_STAT_RESPONSE =
- 'GET_ATTRIBUTES_FOR_STAT_RESPONSE'
export const GET_ATTRIBUTES_FOR_USER_MANAGEMENT = "GET_ATTRIBUTES_FOR_USER_MANAGEMENT"
export const GET_ATTRIBUTES_FOR_USER_MANAGEMENT_RESPONSE = "GET_ATTRIBUTES_FOR_USER_MANAGEMENT_RESPONSE"
-export const GET_CLIENTS_FOR_STAT = 'GET_CLIENTS_FOR_STAT'
-export const GET_CLIENTS_FOR_STAT_RESPONSE = 'GET_CLIENTS_FOR_STAT_RESPONSE'
// Auth Actions
export const GET_OAUTH2_CONFIG = 'GET_OAUTH2_CONFIG'
@@ -87,12 +76,6 @@ export const GET_OIDC_DISCOVERY_RESPONSE = 'GET_OIDC_DISCOVERY_RESPONSE'
export const GET_HEALTH = 'GET_HEALTH'
export const GET_HEALTH_RESPONSE = 'GET_HEALTH_RESPONSE'
-//License Details
-export const GET_LICENSE_DETAILS = 'GET_LICENSE_DETAILS'
-export const GET_LICENSE_DETAILS_RESPONSE = 'GET_LICENSE_DETAILS_RESPONSE'
-export const UPDATE_LICENSE_DETAILS = 'UPDATE_LICENSE_DETAILS'
-export const UPDATE_LICENSE_DETAILS_RESPONSE = 'UPDATE_LICENSE_DETAILS_RESPONSE'
-
//User Management
export const GET_USERS = 'GET_USERS'
export const GET_USERS_RESPONSE = 'GET_USERS_RESPONSE'
diff --git a/admin-ui/app/redux/features/initSlice.js b/admin-ui/app/redux/features/initSlice.js
new file mode 100644
index 000000000..136390b47
--- /dev/null
+++ b/admin-ui/app/redux/features/initSlice.js
@@ -0,0 +1,55 @@
+import reducerRegistry from 'Redux/reducers/ReducerRegistry'
+import { createSlice } from '@reduxjs/toolkit'
+
+const initialState = {
+ scripts: [],
+ clients: [],
+ scopes: [],
+ attributes: [],
+ totalClientsEntries: 0
+}
+
+const initSlice = createSlice({
+ name: 'init',
+ initialState,
+ reducers: {
+ getScripts: () => {},
+ getScriptsResponse: (state, action) => {
+ if (action.payload?.data) {
+ state.scripts = action.payload.data?.entries
+ }
+ },
+ getClients: () => {},
+ getClientsResponse: (state, action) => {
+ if (action.payload?.data) {
+ state.clients = action.payload.data?.entries
+ state.totalClientsEntries = action.payload.data.totalEntriesCount
+ }
+ },
+ getScopes: () => {},
+ getScopesResponse: (state, action) => {
+ if (action.payload?.data) {
+ state.scopes = action.payload.data
+ }
+ },
+ getAttributes: () => {},
+ getAttributesResponse: (state, action) => {
+ if (action.payload?.data) {
+ state.attributes = action.payload.data?.entries
+ }
+ }
+ }
+})
+
+export const {
+ getScripts,
+ getScriptsResponse,
+ getClients,
+ getClientsResponse,
+ getScopes,
+ getScopesResponse,
+ getAttributes,
+ getAttributesResponse
+} = initSlice.actions
+export const { actions, reducer, state } = initSlice
+reducerRegistry.register('initReducer', reducer)
diff --git a/admin-ui/app/redux/features/licenseDetailsSlice.js b/admin-ui/app/redux/features/licenseDetailsSlice.js
new file mode 100644
index 000000000..ae8ad561a
--- /dev/null
+++ b/admin-ui/app/redux/features/licenseDetailsSlice.js
@@ -0,0 +1,59 @@
+import reducerRegistry from 'Redux/reducers/ReducerRegistry'
+import { createSlice } from '@reduxjs/toolkit'
+
+const initialState = {
+ item: {},
+ loading: true
+}
+
+const licenseDetailsSlice = createSlice({
+ name: 'licenseDetails',
+ initialState,
+ reducers: {
+ getLicenseDetails: (state) => ({
+ ...state,
+ loading: true
+ }),
+ getLicenseDetailsResponse: (state, action) => {
+ if (action.payload?.data) {
+ return {
+ ...state,
+ item: action.payload.data,
+ loading: false
+ }
+ } else {
+ return {
+ ...state,
+ loading: false
+ }
+ }
+ },
+ updateLicenseDetails: (state) => ({
+ ...state,
+ loading: true
+ }),
+ updateLicenseDetailsResponse: (state, action) => {
+ if (action.payload?.data) {
+ return {
+ ...state,
+ items: action.payload.data,
+ loading: false
+ }
+ } else {
+ return {
+ ...state,
+ loading: false
+ }
+ }
+ }
+ }
+})
+
+export const {
+ getLicenseDetails,
+ getLicenseDetailsResponse,
+ updateLicenseDetails,
+ updateLicenseDetailsResponse
+} = licenseDetailsSlice.actions
+export const { actions, reducer, state } = licenseDetailsSlice
+reducerRegistry.register('licenseDetailsReducer', reducer)
diff --git a/admin-ui/app/redux/reducers/InitReducer.js b/admin-ui/app/redux/reducers/InitReducer.js
deleted file mode 100644
index 51a98e4e6..000000000
--- a/admin-ui/app/redux/reducers/InitReducer.js
+++ /dev/null
@@ -1,82 +0,0 @@
-import {
- GET_SCRIPTS_FOR_STAT,
- GET_SCRIPTS_FOR_STAT_RESPONSE,
- GET_SCOPES_FOR_STAT,
- GET_SCOPES_FOR_STAT_RESPONSE,
- GET_ATTRIBUTES_FOR_STAT,
- GET_ATTRIBUTES_FOR_STAT_RESPONSE,
- GET_CLIENTS_FOR_STAT,
- GET_CLIENTS_FOR_STAT_RESPONSE,
-} from '../actions/types'
-import reducerRegistry from './ReducerRegistry'
-const INIT_STATE = {
- scripts: [],
- clients: [],
- scopes: [],
- attributes: [],
- totalClientsEntries:0
-}
-
-const reducerName = 'initReducer'
-
-export default function initReducer(state = INIT_STATE, action) {
- switch (action.type) {
- case GET_SCRIPTS_FOR_STAT:
- return handleDefault()
-
- case GET_SCRIPTS_FOR_STAT_RESPONSE:
- if (action.payload.data) {
- return {
- ...state,
- scripts: action.payload.data.entries,
- }
- } else {
- return handleDefault()
- }
-
- case GET_CLIENTS_FOR_STAT:
- return handleDefault()
- case GET_CLIENTS_FOR_STAT_RESPONSE:
- if (action.payload.data) {
- return {
- ...state,
- clients: action.payload.data.entries,
- totalClientsEntries: action.payload.data.totalEntriesCount
- }
- } else {
- return handleDefault()
- }
-
- case GET_ATTRIBUTES_FOR_STAT:
- case GET_ATTRIBUTES_FOR_STAT_RESPONSE:
- if (action.payload.data) {
- return {
- ...state,
- attributes: action.payload.data.entries,
- }
- } else {
- return handleDefault()
- }
-
- case GET_SCOPES_FOR_STAT:
- return handleDefault()
- case GET_SCOPES_FOR_STAT_RESPONSE:
- if (action.payload.data) {
- return {
- ...state,
- scopes: action.payload.data,
- }
- } else {
- return handleDefault()
- }
- default:
- return handleDefault()
- }
-
- function handleDefault() {
- return {
- ...state,
- }
- }
-}
-reducerRegistry.register(reducerName, initReducer)
diff --git a/admin-ui/app/redux/reducers/LicenseDetailsReducer.js b/admin-ui/app/redux/reducers/LicenseDetailsReducer.js
deleted file mode 100644
index 7b8d32a5e..000000000
--- a/admin-ui/app/redux/reducers/LicenseDetailsReducer.js
+++ /dev/null
@@ -1,54 +0,0 @@
-import { GET_LICENSE_DETAILS, GET_LICENSE_DETAILS_RESPONSE, UPDATE_LICENSE_DETAILS, UPDATE_LICENSE_DETAILS_RESPONSE } from '../actions/types'
-import reducerRegistry from 'Redux/reducers/ReducerRegistry'
-const INIT_STATE = {
- item: {},
- loading: true,
-}
-
-const reducerName = 'licenseDetailsReducer'
-
-export default function licenseDetailsReducer(state = INIT_STATE, action) {
- switch (action.type) {
- case GET_LICENSE_DETAILS:
- return {
- ...state,
- loading: true,
- }
- case GET_LICENSE_DETAILS_RESPONSE:
- if (action.payload.data) {
- return {
- ...state,
- item: action.payload.data,
- loading: false,
- }
- } else {
- return {
- ...state,
- loading: false,
- }
- }
- case UPDATE_LICENSE_DETAILS:
- return {
- ...state,
- loading: true,
- }
- case UPDATE_LICENSE_DETAILS_RESPONSE:
- if (action.payload.data) {
- return {
- ...state,
- items: action.payload.data,
- loading: false,
- }
- } else {
- return {
- ...state,
- loading: false,
- }
- }
- default:
- return {
- ...state,
- }
- }
-}
-reducerRegistry.register(reducerName, licenseDetailsReducer)
diff --git a/admin-ui/app/redux/reducers/MauReducer.js b/admin-ui/app/redux/reducers/MauReducer.js
deleted file mode 100644
index b7f92917e..000000000
--- a/admin-ui/app/redux/reducers/MauReducer.js
+++ /dev/null
@@ -1,40 +0,0 @@
-import { GET_MAU, GET_MAU_RESPONSE } from '../actions/types'
-import reducerRegistry from './ReducerRegistry'
-const INIT_STATE = {
- stat: [],
- loading: false,
- startMonth: '',
- endMonth: '',
-}
-
-const reducerName = 'mauReducer'
-
-export default function mauReducer(state = INIT_STATE, action) {
- switch (action.type) {
- case GET_MAU:
- return {
- ...state,
- loading: true,
- startMonth: action.payload?.action?.action_data?.startMonth,
- endMonth: action.payload?.action?.action_data?.endMonth,
- }
- case GET_MAU_RESPONSE:
- if (action.payload.data) {
- return {
- ...state,
- stat: action.payload.data,
- loading: false,
- }
- } else {
- return {
- ...state,
- loading: false,
- }
- }
- default:
- return {
- ...state,
- }
- }
-}
-reducerRegistry.register(reducerName, mauReducer)
diff --git a/admin-ui/app/redux/reducers/index.js b/admin-ui/app/redux/reducers/index.js
index c13105c22..16993d8a9 100644
--- a/admin-ui/app/redux/reducers/index.js
+++ b/admin-ui/app/redux/reducers/index.js
@@ -1,14 +1,14 @@
/**
* App Reducers
*/
-import mauReducer from './MauReducer'
+import { reducer as mauReducer } from 'Plugins/admin/redux/features/mauSlice'
import healthReducer from './HealthReducer'
import authReducer from './AuthReducer'
import fidoReducer from './FidoReducer'
-import initReducer from './InitReducer'
+import { reducer as initReducer } from '../features/initSlice'
import logoutReducer from './LogoutReducer'
import licenseReducer from './LicenseReducer'
-import licenseDetailsReducer from './LicenseDetailsReducer'
+import { reducer as licenseDetailsReducer } from '../features/licenseDetailsSlice'
import oidcDiscoveryReducer from './OidcDiscoveryReducer'
import attributesReducerRoot from './AttributesReducer'
import toastReducer from './ToastReducer'
diff --git a/admin-ui/app/redux/sagas/InitSaga.js b/admin-ui/app/redux/sagas/InitSaga.js
index caa77f58e..19c588ea7 100644
--- a/admin-ui/app/redux/sagas/InitSaga.js
+++ b/admin-ui/app/redux/sagas/InitSaga.js
@@ -8,15 +8,9 @@ import {
getScriptsResponse,
getScopesResponse,
getClientsResponse,
-} from '../actions/InitActions'
+} from '../features/initSlice'
import { getAPIAccessToken } from '../actions/AuthActions'
import { postUserAction } from '../api/backend-api'
-import {
- GET_SCOPES_FOR_STAT,
- GET_SCRIPTS_FOR_STAT,
- GET_CLIENTS_FOR_STAT,
- GET_ATTRIBUTES_FOR_STAT,
-} from '../actions/types'
import { initAudit } from '../sagas/SagaUtils'
import InitApi from '../api/InitApi'
import { getClient } from '../api/base'
@@ -64,7 +58,7 @@ export function* getScripts({ payload }) {
addAdditionalData(audit, 'FETCH SCRIPTS FOR STAT', 'SCRIPT', payload)
const scriptApi = yield* initScripts()
const data = yield call(scriptApi.getScripts, payload.action.action_data)
- yield put(getScriptsResponse(data))
+ yield put(getScriptsResponse({ data }))
yield call(postUserAction, audit)
} catch (e) {
yield put(getScriptsResponse(null))
@@ -82,10 +76,9 @@ export function* getClients({ payload }) {
addAdditionalData(audit, 'FETCH CIENTS FOR STAT', 'OIDC', payload)
const openIdApi = yield* initClients()
const data = yield call(openIdApi.getClients, payload.action.action_data)
- yield put(getClientsResponse(data))
+ yield put(getClientsResponse({ data }))
yield call(postUserAction, audit)
} catch (e) {
- console.log(e)
yield put(getClientsResponse(null))
if (isFourZeroOneError(e)) {
const jwt = yield select((state) => state.authReducer.userinfo_jwt)
@@ -100,7 +93,7 @@ export function* getScopes({ payload }) {
addAdditionalData(audit, 'FETCH SCOPES FOR STAT', 'SCOPE', payload)
const scopeApi = yield* initScopes()
const data = yield call(scopeApi.getScopes, payload.action.action_data)
- yield put(getScopesResponse(data))
+ yield put(getScopesResponse({ data }))
yield call(postUserAction, audit)
} catch (e) {
yield put(getScopesResponse(null))
@@ -117,7 +110,7 @@ export function* getAttributes({ payload }) {
addAdditionalData(audit, 'FETCH ATTRIBUTES FOR STAT', 'SCOPE', payload)
const attributeApi = yield* initAttributes()
const data = yield call(attributeApi.getAttributes, payload.options)
- yield put(getAttributesResponse(data))
+ yield put(getAttributesResponse({ data }))
yield call(postUserAction, audit)
} catch (e) {
yield put(getAttributesResponse(null))
@@ -129,16 +122,16 @@ export function* getAttributes({ payload }) {
}
export function* watchGetScripts() {
- yield takeLatest(GET_SCRIPTS_FOR_STAT, getScripts)
+ yield takeLatest('init/getScripts', getScripts)
}
export function* watchGetClients() {
- yield takeLatest(GET_CLIENTS_FOR_STAT, getClients)
+ yield takeLatest('init/getClients', getClients)
}
export function* watchGetScopes() {
- yield takeLatest(GET_SCOPES_FOR_STAT, getScopes)
+ yield takeLatest('init/getScopes', getScopes)
}
export function* watchGetAttributes() {
- yield takeLatest(GET_ATTRIBUTES_FOR_STAT, getAttributes)
+ yield takeLatest('init/getAttributes', getAttributes)
}
export default function* rootSaga() {
yield all([
diff --git a/admin-ui/app/redux/sagas/LicenseDetailsSaga.js b/admin-ui/app/redux/sagas/LicenseDetailsSaga.js
index 6e4d9edf0..e37bc2350 100644
--- a/admin-ui/app/redux/sagas/LicenseDetailsSaga.js
+++ b/admin-ui/app/redux/sagas/LicenseDetailsSaga.js
@@ -1,9 +1,8 @@
import { all, call, fork, put, takeEvery, select } from 'redux-saga/effects'
-import { GET_LICENSE_DETAILS, UPDATE_LICENSE_DETAILS } from '../actions/types'
import {
getLicenseDetailsResponse,
updateLicenseDetailsResponse,
-} from '../actions/LicenseDetailsActions'
+} from '../features/licenseDetailsSlice'
import { getClient } from 'Redux/api/base'
import LicenseDetailsApi from '../api/LicenseDetailsApi'
const JansConfigApi = require('jans_config_api')
@@ -27,7 +26,7 @@ export function* getLicenseDetailsWorker({ payload }) {
//addAdditionalData(audit, FETCH, GET_LICENSE_DETAILS, payload)
const licenseApi = yield* newFunction()
const data = yield call(licenseApi.getLicenseDetails)
- yield put(getLicenseDetailsResponse(data))
+ yield put(getLicenseDetailsResponse({ data }))
yield call(postUserAction, audit)
} catch (e) {
yield put(getLicenseDetailsResponse(null))
@@ -44,7 +43,7 @@ export function* updateLicenseDetailsWorker({ payload }) {
//addAdditionalData(audit, UPDATE, UPDATE_LICENSE_DETAILS, payload)
const roleApi = yield* newFunction()
const data = yield call(roleApi.updateLicenseDetails, payload.action.action_data)
- yield put(updateLicenseDetailsResponse(data))
+ yield put(updateLicenseDetailsResponse({ data }))
yield call(postUserAction, audit)
} catch (e) {
yield put(updateLicenseDetailsResponse(null))
@@ -57,11 +56,11 @@ export function* updateLicenseDetailsWorker({ payload }) {
export function* getLicenseWatcher() {
- yield takeEvery(GET_LICENSE_DETAILS, getLicenseDetailsWorker)
+ yield takeEvery('licenseDetails/getLicenseDetails', getLicenseDetailsWorker)
}
export function* updateLicenseWatcher() {
- yield takeEvery(UPDATE_LICENSE_DETAILS, updateLicenseDetailsWorker)
+ yield takeEvery('licenseDetails/updateLicenseDetails', updateLicenseDetailsWorker)
}
export default function* rootSaga() {
diff --git a/admin-ui/app/redux/sagas/MauSaga.js b/admin-ui/app/redux/sagas/MauSaga.js
index a04dd8744..b207159af 100644
--- a/admin-ui/app/redux/sagas/MauSaga.js
+++ b/admin-ui/app/redux/sagas/MauSaga.js
@@ -1,9 +1,8 @@
import { call, all, put, fork, takeLatest, select } from 'redux-saga/effects'
import { isFourZeroOneError, addAdditionalData } from 'Utils/TokenController'
-import { getMauResponse } from '../actions/MauActions'
+import { getMauResponse } from 'Plugins/admin/redux/features/mauSlice'
import { getAPIAccessToken } from '../actions/AuthActions'
import { postUserAction } from '../api/backend-api'
-import { GET_MAU } from '../actions/types'
import MauApi from '../api/MauApi'
import { getClient } from '../api/base'
import { initAudit } from '../sagas/SagaUtils'
@@ -25,7 +24,7 @@ export function* getMau({ payload }) {
addAdditionalData(audit, 'FETCH', 'MAU', payload)
const mauApi = yield* newFunction()
const data = yield call(mauApi.getMau, payload.action.action_data)
- yield put(getMauResponse(buildData(data)))
+ yield put(getMauResponse({ data: buildData(data) }))
yield call(postUserAction, audit)
} catch (e) {
yield put(getMauResponse(null))
@@ -37,7 +36,7 @@ export function* getMau({ payload }) {
}
export function* watchGetMau() {
- yield takeLatest(GET_MAU, getMau)
+ yield takeLatest('mau/getMau', getMau)
}
export default function* rootSaga() {
diff --git a/admin-ui/app/routes/Dashboards/DashboardPage.js b/admin-ui/app/routes/Dashboards/DashboardPage.js
index a785a3e47..6dab45b72 100644
--- a/admin-ui/app/routes/Dashboards/DashboardPage.js
+++ b/admin-ui/app/routes/Dashboards/DashboardPage.js
@@ -6,8 +6,8 @@ import Box from '@mui/material/Box'
import { useMediaQuery } from 'react-responsive'
import GluuLoader from '../Apps/Gluu/GluuLoader'
import GluuViewWrapper from '../Apps/Gluu/GluuViewWrapper'
-import { getMau } from 'Redux/actions/MauActions'
-import { getClients } from 'Redux/actions/InitActions'
+import { getMau } from 'Plugins/admin/redux/features/mauSlice'
+import { getClients } from 'Redux/features/initSlice'
import {
hasBoth,
buildPayload,
@@ -16,7 +16,7 @@ import {
} from 'Utils/PermChecker'
import { useTranslation } from 'react-i18next'
import { connect } from 'react-redux'
-import { getLicenseDetails } from 'Redux/actions/LicenseDetailsActions'
+import { getLicenseDetails } from 'Redux/features/licenseDetailsSlice'
import { getHealthStatus } from 'Redux/actions/HealthAction'
import DashboardChart from './Chart/DashboardChart'
import DateRange from './DateRange'
@@ -98,7 +98,7 @@ function DashboardPage({
}
if (clients.length === 0 && count < 2) {
buildPayload(userAction, 'Fetch openid connect clients', {})
- dispatch(getClients(userAction))
+ dispatch(getClients({ action: userAction }))
}
if (Object.keys(license).length === 0 && count < 2) {
getLicense()
@@ -118,7 +118,7 @@ function DashboardPage({
options['startMonth'] = getYearMonth(startDate)
options['endMonth'] = getYearMonth(endDate)
buildPayload(userAction, 'GET MAU', options)
- dispatch(getMau(userAction))
+ dispatch(getMau({ action: userAction }))
}
function getLicense() {
diff --git a/admin-ui/app/routes/Dashboards/DateRange/index.js b/admin-ui/app/routes/Dashboards/DateRange/index.js
index 36ae8ed49..69c724421 100644
--- a/admin-ui/app/routes/Dashboards/DateRange/index.js
+++ b/admin-ui/app/routes/Dashboards/DateRange/index.js
@@ -6,7 +6,7 @@ import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
import { DatePicker } from "@mui/x-date-pickers/DatePicker";
import { useDispatch } from "react-redux";
-import { getMau } from "Redux/actions/MauActions";
+import { getMau } from "Plugins/admin/redux/features/mauSlice";
import { useTranslation } from "react-i18next";
import dayjs from "dayjs";
@@ -23,7 +23,7 @@ export default function MaterialUIPickers() {
options["startMonth"] = startDate.format("YYYYMM");
options["endMonth"] = endDate.format("YYYYMM");
buildPayload(userAction, "GET MAU", options);
- dispatch(getMau(userAction));
+ dispatch(getMau({ action: userAction }));
}, [startDate, endDate]);
const setDate = (val, type) => {
diff --git a/admin-ui/app/routes/Dashboards/Reports/Reports.js b/admin-ui/app/routes/Dashboards/Reports/Reports.js
index cee97c21c..24cd3ec95 100755
--- a/admin-ui/app/routes/Dashboards/Reports/Reports.js
+++ b/admin-ui/app/routes/Dashboards/Reports/Reports.js
@@ -7,7 +7,7 @@ import {
getScripts,
getScopes,
getClients,
-} from 'Redux/actions/InitActions'
+} from 'Redux/features/initSlice'
import ReportCard from './ReportCard'
import { useTranslation } from 'react-i18next'
@@ -64,15 +64,15 @@ function Reports({ attributes, clients, scopes, scripts, dispatch }) {
}
if (clients.length === 0 && count < 2) {
buildPayload(userAction, 'Fetch openid connect clients', {})
- dispatch(getClients(userAction))
+ dispatch(getClients({ action: userAction }))
}
if (scopes.length === 0 && count < 2) {
buildPayload(userAction, 'Fetch scopes', {})
- dispatch(getScopes(userAction))
+ dispatch(getScopes({ action: userAction }))
}
if (scripts.length === 0 && count < 2) {
buildPayload(userAction, 'Fetch custom scripts', {})
- dispatch(getScripts(userAction))
+ dispatch(getScripts({ action: userAction }))
}
count++
}, 1000)
diff --git a/admin-ui/app/routes/License/LicenseDetailsPage.js b/admin-ui/app/routes/License/LicenseDetailsPage.js
index ace34b5fb..307842f4c 100644
--- a/admin-ui/app/routes/License/LicenseDetailsPage.js
+++ b/admin-ui/app/routes/License/LicenseDetailsPage.js
@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next'
import applicationStyle from 'Routes/Apps/Gluu/styles/applicationstyle'
import GluuFormDetailRow from 'Routes/Apps/Gluu/GluuFormDetailRow'
import { LICENSE } from 'Utils/ApiResources'
-import { getLicenseDetails } from 'Redux/actions/LicenseDetailsActions'
+import { getLicenseDetails } from 'Redux/features/licenseDetailsSlice'
import { Card, CardBody, Container, Row, Col } from 'Components'
import { buildPayload } from 'Utils/PermChecker'
import GluuLoader from 'Routes/Apps/Gluu/GluuLoader'
diff --git a/admin-ui/app/styles/miltonbo/scss/bootstrap/bootstrap.scss b/admin-ui/app/styles/miltonbo/scss/bootstrap/bootstrap.scss
index 0f4366c9a..58cd18eb0 100644
--- a/admin-ui/app/styles/miltonbo/scss/bootstrap/bootstrap.scss
+++ b/admin-ui/app/styles/miltonbo/scss/bootstrap/bootstrap.scss
@@ -6,6 +6,7 @@
// some cases on OSX Jekyll - needs some investigating
@import "~bootstrap/scss/functions";
@import "~bootstrap/scss/variables";
+@import "~bootstrap/scss/variables-dark";
@import "~bootstrap/scss/maps"; // **Newly added!**
@import "~bootstrap/scss/mixins";
diff --git a/admin-ui/package.json b/admin-ui/package.json
index 7d21437a1..264118f36 100644
--- a/admin-ui/package.json
+++ b/admin-ui/package.json
@@ -109,7 +109,7 @@
"ace-builds": "^1.16.0",
"animejs": "^3.2.1",
"axios": "^1.3.4",
- "bootstrap": "^5.2.3",
+ "bootstrap": "^5.3.0",
"date-fns": "^2.29.3",
"dayjs": "^1.11.7",
"dotenv": "^16.0.3",
diff --git a/admin-ui/plugins/admin/components/CustomScripts/CustomScriptAddPage.js b/admin-ui/plugins/admin/components/CustomScripts/CustomScriptAddPage.js
index 3a31928a9..e353ce54d 100644
--- a/admin-ui/plugins/admin/components/CustomScripts/CustomScriptAddPage.js
+++ b/admin-ui/plugins/admin/components/CustomScripts/CustomScriptAddPage.js
@@ -3,7 +3,7 @@ import { connect } from 'react-redux'
import { useNavigate } from 'react-router-dom'
import { CardBody, Card } from 'Components'
import CustomScriptForm from './CustomScriptForm'
-import { addCustomScript } from 'Plugins/admin/redux/actions/CustomScriptActions'
+import { addCustomScript } from 'Plugins/admin/redux/features/customScriptSlice'
import { buildPayload } from 'Utils/PermChecker'
import GluuAlert from 'Routes/Apps/Gluu/GluuAlert'
import { useTranslation } from 'react-i18next'
@@ -27,7 +27,7 @@ function CustomScriptAddPage({ scripts, dispatch, saveOperationFlag, errorInSave
const message = data.customScript.action_message
delete data.customScript.action_message
buildPayload(userAction, message, data)
- dispatch(addCustomScript(userAction))
+ dispatch(addCustomScript({ action: userAction }))
}
}
return (
diff --git a/admin-ui/plugins/admin/components/CustomScripts/CustomScriptEditPage.js b/admin-ui/plugins/admin/components/CustomScripts/CustomScriptEditPage.js
index 45ae48028..2ea7acb0f 100644
--- a/admin-ui/plugins/admin/components/CustomScripts/CustomScriptEditPage.js
+++ b/admin-ui/plugins/admin/components/CustomScripts/CustomScriptEditPage.js
@@ -4,7 +4,7 @@ import { useNavigate } from 'react-router-dom'
import { CardBody, Card } from 'Components'
import GluuLoader from 'Routes/Apps/Gluu/GluuLoader'
import CustomScriptForm from './CustomScriptForm'
-import { editCustomScript } from 'Plugins/admin/redux/actions/CustomScriptActions'
+import { editCustomScript } from 'Plugins/admin/redux/features/customScriptSlice'
import { buildPayload } from 'Utils/PermChecker'
import GluuAlert from 'Routes/Apps/Gluu/GluuAlert'
import { useTranslation } from 'react-i18next'
@@ -33,7 +33,7 @@ function CustomScriptEditPage({
const message = data.customScript.action_message
delete data.customScript.action_message
buildPayload(userAction, message, data)
- dispatch(editCustomScript(userAction))
+ dispatch(editCustomScript({ action: userAction }))
}
}
@@ -47,7 +47,7 @@ function CustomScriptEditPage({
{
makeOptions()
- dispatch(getCustomScriptByType(options))
+ dispatch(getCustomScriptByType({ action: options }))
}, [])
if (hasPermission(permissions, SCRIPT_WRITE)) {
myActions.push((rowData) => ({
@@ -133,7 +132,7 @@ function ScriptListTable() {
isFreeAction: true,
onClick: () => {
makeOptions()
- dispatch(getCustomScriptByType(options))
+ dispatch(getCustomScriptByType({ action: options }))
},
})
}
@@ -159,21 +158,20 @@ function ScriptListTable() {
}
function handleOptionsChange(event) {
const name = event.target.name
- console.log(name, event.target.value)
if (name == 'pattern') {
memoPattern = event.target.value
} else if (name == 'type') {
memoType = event.target.value
makeOptions()
- dispatch(getCustomScriptByType(options))
+ dispatch(getCustomScriptByType({ action: options }))
}
}
function handleGoToCustomScriptAddPage() {
return navigate('/adm/script/new')
}
function handleGoToCustomScriptEditPage(row, edition) {
- dispatch(viewOnly(edition))
- dispatch(setCurrentItem(row))
+ dispatch(viewOnly({ view: edition }))
+ dispatch(setCurrentItem({ item: row }))
return navigate(`/adm/script/edit/:` + row.inum)
}
function handleCustomScriptDelete(row) {
@@ -182,7 +180,7 @@ function ScriptListTable() {
}
function onDeletionConfirmed(message) {
buildPayload(userAction, message, item.inum)
- dispatch(deleteCustomScript(userAction))
+ dispatch(deleteCustomScript({ action: userAction }))
navigate('/adm/scripts')
toggle()
}
@@ -193,15 +191,14 @@ function ScriptListTable() {
options['startIndex'] = parseInt(startCount)
options['limit'] = limit
setPageNumber(page)
- dispatch(getCustomScriptByType(options))
+ dispatch(getCustomScriptByType({ action: options }))
}
const onRowCountChangeClick = (count) => {
- console.log(count)
makeOptions()
options['limit'] = count
setPageNumber(0)
setLimit(count)
- dispatch(getCustomScriptByType(options))
+ dispatch(getCustomScriptByType({ action: options }))
}
return (
diff --git a/admin-ui/plugins/admin/components/MAU/MauGraph.js b/admin-ui/plugins/admin/components/MAU/MauGraph.js
index df4efb8ca..fac33eb0e 100644
--- a/admin-ui/plugins/admin/components/MAU/MauGraph.js
+++ b/admin-ui/plugins/admin/components/MAU/MauGraph.js
@@ -1,15 +1,13 @@
import React, { useState, useEffect, useContext } from 'react'
-import { subMonths } from 'date-fns'
import moment from 'moment'
import ActiveUsersGraph from 'Routes/Dashboards/Grapths/ActiveUsersGraph'
import Grid from '@mui/material/Grid'
-import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
-import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
-import { DatePicker } from '@mui/x-date-pickers/DatePicker';
+import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'
+import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'
+import { DatePicker } from '@mui/x-date-pickers/DatePicker'
import GluuLoader from 'Routes/Apps/Gluu/GluuLoader'
import GluuViewWrapper from 'Routes/Apps/Gluu/GluuViewWrapper'
-import { getMau } from 'Redux/actions/MauActions'
-import { getClients } from 'Redux/actions/InitActions'
+import { getMau } from 'Plugins/admin/redux/features/mauSlice'
import applicationstyle from 'Routes/Apps/Gluu/styles/applicationstyle'
import GluuLabel from 'Routes/Apps/Gluu/GluuLabel'
import {
@@ -19,13 +17,13 @@ import {
CardBody,
FormGroup,
Col,
- Row,
+ Row
} from 'Components'
import {
hasBoth,
buildPayload,
STAT_READ,
- STAT_JANS_READ,
+ STAT_JANS_READ
} from 'Utils/PermChecker'
import { useTranslation } from 'react-i18next'
import { connect } from 'react-redux'
@@ -34,28 +32,21 @@ import applicationStyle from 'Routes/Apps/Gluu/styles/applicationstyle'
import { ThemeContext } from 'Context/theme/themeContext'
import dayjs from 'dayjs'
-function MauGraph({ statData, permissions, clients, loading, dispatch }) {
+function MauGraph({ statData, permissions, loading, dispatch }) {
const { t } = useTranslation()
const theme = useContext(ThemeContext)
const selectedTheme = theme.state.theme
- const [startDate, setStartDate] = useState(dayjs().subtract(3, "months"))
+ const [startDate, setStartDate] = useState(dayjs().subtract(3, 'months'))
const [endDate, setEndDate] = useState(dayjs())
const userAction = {}
const options = {}
+
useEffect(() => {
- let count = 0
- const interval = setInterval(() => {
- if (statData.length === 0 && count < 2) {
- search()
- }
- if (clients.length === 0 && count < 2) {
- buildPayload(userAction, 'Fetch openid connect clients', {})
- dispatch(getClients(userAction))
- }
- count++
- }, 1000)
- return () => clearInterval(interval)
- }, [1000])
+ if (statData.length === 0 || !statData) {
+ search()
+ }
+ }, [])
+
SetTitle(t('fields.monthly_active_users'))
function search() {
@@ -63,11 +54,11 @@ function MauGraph({ statData, permissions, clients, loading, dispatch }) {
options['startMonth'] = getYearMonth(startDate.toDate())
options['endMonth'] = getYearMonth(endDate.toDate())
buildPayload(userAction, 'GET MAU', options)
- dispatch(getMau(userAction))
+ dispatch(getMau({ action: userAction }))
}
function doDataAugmentation(input) {
- const stat = input
+ const stat = Array.from(input)
if (stat && stat.length >= 1) {
const flattendStat = stat.map((entry) => entry['month'])
const aRange = generateDateRange(startDate.toDate(), endDate.toDate())
@@ -84,7 +75,7 @@ function MauGraph({ statData, permissions, clients, loading, dispatch }) {
}
}
return Array.from(new Set(stat)).sort(
- (a, b) => parseInt(a.month, 10) - parseInt(b.month, 10),
+ (a, b) => parseInt(a.month, 10) - parseInt(b.month, 10)
)
}
return stat
@@ -117,7 +108,7 @@ function MauGraph({ statData, permissions, clients, loading, dispatch }) {
color={`primary-${selectedTheme}`}
outline
style={applicationstyle.customButtonStyle}
- className="example-custom-input"
+ className='example-custom-input'
onClick={onClick}
ref={ref}
>
@@ -134,19 +125,23 @@ function MauGraph({ statData, permissions, clients, loading, dispatch }) {
-
+
-
+
setStartDate(date)}
/>
setEndDate(date)}
@@ -156,11 +151,15 @@ function MauGraph({ statData, permissions, clients, loading, dispatch }) {
@@ -173,7 +172,7 @@ function MauGraph({ statData, permissions, clients, loading, dispatch }) {
-
+
@@ -184,8 +183,7 @@ const mapStateToProps = (state) => {
return {
statData: state.mauReducer.stat,
loading: state.mauReducer.loading,
- clients: state.initReducer.clients,
- permissions: state.authReducer.permissions,
+ permissions: state.authReducer.permissions
}
}
diff --git a/admin-ui/plugins/admin/components/Mapping/MappingItem.js b/admin-ui/plugins/admin/components/Mapping/MappingItem.js
index 2eff3d8ea..c80604f6d 100644
--- a/admin-ui/plugins/admin/components/Mapping/MappingItem.js
+++ b/admin-ui/plugins/admin/components/Mapping/MappingItem.js
@@ -21,15 +21,16 @@ import {
updatePermissionsToServer,
updatePermissionsServerResponse,
deleteMapping,
-} from 'Plugins/admin/redux/actions/MappingActions'
+} from 'Plugins/admin/redux/features/mappingSlice'
import GluuTypeAhead from 'Routes/Apps/Gluu/GluuTypeAhead'
import applicationStyle from 'Routes/Apps/Gluu/styles/applicationstyle'
import { Formik } from 'formik'
import { ThemeContext } from 'Context/theme/themeContext'
-import { t } from 'i18next'
+import { useTranslation } from 'react-i18next'
function MappingItem({ candidate, roles }) {
const dispatch = useDispatch()
+ const { t } = useTranslation()
const autocompleteRef = useRef(null)
const permissions = useSelector((state) => state.apiPermissionReducer.items)
const authPermissions = useSelector((state) => state.authReducer.permissions)
@@ -65,7 +66,7 @@ function MappingItem({ candidate, roles }) {
}
const revertLocalChanges = () => {
- dispatch(updatePermissionsServerResponse(JSON.parse(serverPermissions)))
+ dispatch(updatePermissionsServerResponse({ data: JSON.parse(serverPermissions) }))
}
const setServerPermissionsToLocalState = () => {
@@ -82,10 +83,10 @@ function MappingItem({ candidate, roles }) {
const doRemove = (id, role) => {
dispatch(
- updateMapping({
+ updateMapping({ data: {
id,
role,
- }),
+ }}),
)
}
@@ -94,10 +95,10 @@ function MappingItem({ candidate, roles }) {
const handleAddPermission = (values, { resetForm }) => {
if (values?.mappingAddPermissions?.length) {
dispatch(
- addPermissionsToRole({
+ addPermissionsToRole({ data: {
data: values?.mappingAddPermissions,
userRole: candidate.role,
- }),
+ }}),
)
}
resetForm()
@@ -105,10 +106,10 @@ function MappingItem({ candidate, roles }) {
}
const handleDeleteRole = () => {
dispatch(
- deleteMapping({
+ deleteMapping({ data: {
role: candidate.role,
permissions: candidate.permissions,
- }),
+ }}),
)
}
@@ -222,7 +223,7 @@ function MappingItem({ candidate, roles }) {
color={`primary-${selectedTheme}`}
style={applicationStyle.buttonStyle}
onClick={() => {
- dispatch(updatePermissionsToServer(candidate))
+ dispatch(updatePermissionsToServer({ data: candidate }))
setServerPermissionsToLocalState()
}}
>
diff --git a/admin-ui/plugins/admin/components/Mapping/MappingPage.js b/admin-ui/plugins/admin/components/Mapping/MappingPage.js
index 709adadb7..5dc284177 100644
--- a/admin-ui/plugins/admin/components/Mapping/MappingPage.js
+++ b/admin-ui/plugins/admin/components/Mapping/MappingPage.js
@@ -16,9 +16,9 @@ import GluuLoader from 'Routes/Apps/Gluu/GluuLoader'
import {
getMapping,
addNewRolePermissions,
-} from 'Plugins/admin/redux/actions/MappingActions'
-import { getRoles } from 'Plugins/admin/redux/actions/ApiRoleActions'
-import { getPermissions } from 'Plugins/admin/redux/actions/ApiPermissionActions'
+} from 'Plugins/admin/redux/features/mappingSlice'
+import { getRoles } from 'Plugins/admin/redux/features/apiRoleSlice'
+import { getPermissions } from 'Plugins/admin/redux/features/apiPermissionSlice'
import MappingItem from './MappingItem'
import {
hasPermission,
@@ -48,7 +48,7 @@ function MappingPage({
function doFetchPermissionsList() {
buildPayload(userAction, 'PERMISSIONS', options)
- dispatch(getPermissions(userAction))
+ dispatch(getPermissions({ payload: userAction }))
}
useEffect(() => {
@@ -59,14 +59,14 @@ function MappingPage({
function onAddConfirmed(mappingData) {
buildPayload(userAction, 'Add new mapping', mappingData)
- dispatch(addNewRolePermissions(mappingData))
+ dispatch(addNewRolePermissions({ data: mappingData }))
toggle()
// doFetchList()
}
function doFetchList() {
buildPayload(userAction, 'ROLES_MAPPING', options)
- dispatch(getMapping(userAction))
+ dispatch(getMapping({ action: userAction }))
}
function doFetchRoles() {
buildPayload(userAction, 'ROLES', options)
diff --git a/admin-ui/plugins/admin/components/Permissions/UiPermListPage.js b/admin-ui/plugins/admin/components/Permissions/UiPermListPage.js
index 03e652381..dde6a5dd9 100644
--- a/admin-ui/plugins/admin/components/Permissions/UiPermListPage.js
+++ b/admin-ui/plugins/admin/components/Permissions/UiPermListPage.js
@@ -14,7 +14,7 @@ import {
deletePermission,
editPermission,
addPermission,
-} from 'Plugins/admin/redux/actions/ApiPermissionActions'
+} from 'Plugins/admin/redux/features/apiPermissionSlice'
import {
hasPermission,
buildPayload,
@@ -60,11 +60,11 @@ function UiPermListPage({ apiPerms, permissions, loading, dispatch }) {
}
function doFetchList() {
buildPayload(userAction, 'PERMISSIONS', options)
- dispatch(getPermissions(userAction))
+ dispatch(getPermissions({ action: userAction }))
}
function onAddConfirmed(roleData) {
buildPayload(userAction, 'message', roleData)
- dispatch(addPermission(userAction))
+ dispatch(addPermission({ action: userAction }))
toggle()
doFetchList()
}
@@ -112,14 +112,14 @@ function UiPermListPage({ apiPerms, permissions, loading, dispatch }) {
onRowUpdate: (newData, oldData) =>
new Promise((resolve, reject) => {
buildPayload(userAction, 'Edit permision', newData)
- dispatch(editPermission(userAction))
+ dispatch(editPermission({ action: userAction }))
resolve()
doFetchList()
}),
onRowDelete: (oldData) =>
new Promise((resolve, reject) => {
buildPayload(userAction, 'Remove permission', oldData)
- dispatch(deletePermission(userAction))
+ dispatch(deletePermission({ action: userAction }))
resolve()
doFetchList()
}),
diff --git a/admin-ui/plugins/admin/components/Roles/UiRoleListPage.js b/admin-ui/plugins/admin/components/Roles/UiRoleListPage.js
index ab8dc3272..b0e0c8c92 100644
--- a/admin-ui/plugins/admin/components/Roles/UiRoleListPage.js
+++ b/admin-ui/plugins/admin/components/Roles/UiRoleListPage.js
@@ -14,7 +14,7 @@ import {
addRole,
editRole,
deleteRole,
-} from 'Plugins/admin/redux/actions/ApiRoleActions'
+} from 'Plugins/admin/redux/features/apiRoleSlice'
import {
hasPermission,
buildPayload,
@@ -64,7 +64,7 @@ function UiRoleListPage({ apiRoles, permissions, loading, dispatch }) {
}
function onAddConfirmed(roleData) {
buildPayload(userAction, 'message', roleData)
- dispatch(addRole(userAction))
+ dispatch(addRole({ action: userAction }))
toggle()
doFetchList()
}
@@ -147,14 +147,14 @@ function UiRoleListPage({ apiRoles, permissions, loading, dispatch }) {
onRowUpdate: (newData, oldData) =>
new Promise((resolve, reject) => {
buildPayload(userAction, 'Edit role', newData)
- dispatch(editRole(userAction))
+ dispatch(editRole({ action: userAction }))
resolve()
doFetchList()
}),
onRowDelete: (oldData) =>
new Promise((resolve, reject) => {
buildPayload(userAction, 'remove role', oldData)
- dispatch(deleteRole(userAction))
+ dispatch(deleteRole({ action: userAction }))
resolve()
doFetchList()
}),
diff --git a/admin-ui/plugins/admin/plugin-metadata.js b/admin-ui/plugins/admin/plugin-metadata.js
index 15ad424e2..07520e472 100644
--- a/admin-ui/plugins/admin/plugin-metadata.js
+++ b/admin-ui/plugins/admin/plugin-metadata.js
@@ -14,10 +14,10 @@ import apiRoleSaga from './redux/sagas/ApiRoleSaga'
import apiPermissionSaga from './redux/sagas/ApiPermissionSaga'
import mappingSaga from './redux/sagas/MappingSaga'
-import scriptReducer from './redux/reducers/CustomScriptReducer'
-import apiRoleReducer from './redux/reducers/ApiRoleReducer'
-import apiPermissionReducer from './redux/reducers/ApiPermissionReducer'
-import mappingReducer from './redux/reducers/MappingReducer'
+import { reducer as scriptReducer } from 'Plugins/admin/redux/features/customScriptSlice'
+import { reducer as apiRoleReducer } from 'Plugins/admin/redux/features/apiRoleSlice'
+import { reducer as apiPermissionReducer } from 'Plugins/admin/redux/features/apiPermissionSlice'
+import { reducer as mappingReducer } from 'Plugins/admin/redux/features/mappingSlice'
import {
ACR_READ,
ROLE_READ,
diff --git a/admin-ui/plugins/admin/redux/actions/ApiPermissionActions.js b/admin-ui/plugins/admin/redux/actions/ApiPermissionActions.js
deleted file mode 100644
index 79d68916e..000000000
--- a/admin-ui/plugins/admin/redux/actions/ApiPermissionActions.js
+++ /dev/null
@@ -1,68 +0,0 @@
-import {
- GET_PERMISSIONS,
- GET_PERMISSIONS_RESPONSE,
- ADD_PERMISSION,
- ADD_PERMISSION_RESPONSE,
- EDIT_PERMISSION,
- EDIT_PERMISSION_RESPONSE,
- GET_PERMISSION,
- GET_PERMISSION_RESPONSE,
- DELETE_PERMISSION,
- DELETE_PERMISSION_RESPONSE,
- SET_PERMISSION_ITEM,
-} from './types'
-
-export const getPermissions = (action) => ({
- type: GET_PERMISSIONS,
- payload: { action },
-})
-
-export const getPermissionsResponse = (data) => ({
- type: GET_PERMISSIONS_RESPONSE,
- payload: { data },
-})
-
-export const addPermission = (action) => ({
- type: ADD_PERMISSION,
- payload: { action },
-})
-
-export const addPermissionResponse = (data) => ({
- type: ADD_PERMISSION_RESPONSE,
- payload: { data },
-})
-
-export const editPermission = (action) => ({
- type: EDIT_PERMISSION,
- payload: { action },
-})
-
-export const editPermissionResponse = (data) => ({
- type: EDIT_PERMISSION_RESPONSE,
- payload: { data },
-})
-
-export const getPermission = (action) => ({
- type: GET_PERMISSION,
- payload: { action },
-})
-
-export const getPermissionResponse = (data) => ({
- type: GET_PERMISSION_RESPONSE,
- payload: { data },
-})
-
-export const deletePermission = (action) => ({
- type: DELETE_PERMISSION,
- payload: { action },
-})
-
-export const deletePermissionResponse = (inum) => ({
- type: DELETE_PERMISSION_RESPONSE,
- payload: { inum },
-})
-
-export const setCurrentItem = (item) => ({
- type: SET_PERMISSION_ITEM,
- payload: { item },
-})
diff --git a/admin-ui/plugins/admin/redux/actions/ApiRoleActions.js b/admin-ui/plugins/admin/redux/actions/ApiRoleActions.js
deleted file mode 100644
index e3dc3d95b..000000000
--- a/admin-ui/plugins/admin/redux/actions/ApiRoleActions.js
+++ /dev/null
@@ -1,68 +0,0 @@
-import {
- GET_ROLES,
- GET_ROLES_RESPONSE,
- ADD_ROLE,
- ADD_ROLE_RESPONSE,
- EDIT_ROLE,
- EDIT_ROLE_RESPONSE,
- GET_ROLE,
- GET_ROLE_RESPONSE,
- DELETE_ROLE,
- DELETE_ROLE_RESPONSE,
- SET_ROLE_ITEM,
-} from './types'
-
-export const getRoles = (action) => ({
- type: GET_ROLES,
- payload: { action },
-})
-
-export const getRolesResponse = (data) => ({
- type: GET_ROLES_RESPONSE,
- payload: { data },
-})
-
-export const addRole = (action) => ({
- type: ADD_ROLE,
- payload: { action },
-})
-
-export const addRoleResponse = (data) => ({
- type: ADD_ROLE_RESPONSE,
- payload: { data },
-})
-
-export const editRole = (action) => ({
- type: EDIT_ROLE,
- payload: { action },
-})
-
-export const editRoleResponse = (data) => ({
- type: EDIT_ROLE_RESPONSE,
- payload: { data },
-})
-
-export const getRole = (action) => ({
- type: GET_ROLE,
- payload: { action },
-})
-
-export const getRoleResponse = (data) => ({
- type: GET_ROLE_RESPONSE,
- payload: { data },
-})
-
-export const deleteRole = (action) => ({
- type: DELETE_ROLE,
- payload: { action },
-})
-
-export const deleteRoleResponse = (inum) => ({
- type: DELETE_ROLE_RESPONSE,
- payload: { inum },
-})
-
-export const setCurrentItem = (item) => ({
- type: SET_ROLE_ITEM,
- payload: { item },
-})
diff --git a/admin-ui/plugins/admin/redux/actions/CustomScriptActions.js b/admin-ui/plugins/admin/redux/actions/CustomScriptActions.js
deleted file mode 100644
index 87f681b87..000000000
--- a/admin-ui/plugins/admin/redux/actions/CustomScriptActions.js
+++ /dev/null
@@ -1,86 +0,0 @@
-import {
- GET_CUSTOM_SCRIPT,
- GET_CUSTOM_SCRIPT_RESPONSE,
- ADD_CUSTOM_SCRIPT,
- ADD_CUSTOM_SCRIPT_RESPONSE,
- EDIT_CUSTOM_SCRIPT,
- EDIT_CUSTOM_SCRIPT_RESPONSE,
- GET_CUSTOM_SCRIPT_BY_INUM,
- GET_CUSTOM_SCRIPT_BY_INUM_RESPONSE,
- GET_CUSTOM_SCRIPT_BY_TYPE,
- GET_CUSTOM_SCRIPT_BY_TYPE_RESPONSE,
- DELETE_CUSTOM_SCRIPT,
- DELETE_CUSTOM_SCRIPT_RESPONSE,
- SET_SCRIPT_ITEM,
- SET_VIEW,
-} from './types'
-
-export const getCustomScripts = (action) => ({
- type: GET_CUSTOM_SCRIPT,
- payload: { action },
-})
-
-export const getCustomScriptsResponse = (data) => ({
- type: GET_CUSTOM_SCRIPT_RESPONSE,
- payload: { data },
-})
-
-export const addCustomScript = (action) => ({
- type: ADD_CUSTOM_SCRIPT,
- payload: { action },
-})
-
-export const addCustomScriptResponse = (data) => ({
- type: ADD_CUSTOM_SCRIPT_RESPONSE,
- payload: { data },
-})
-
-export const editCustomScript = (action) => ({
- type: EDIT_CUSTOM_SCRIPT,
- payload: { action },
-})
-
-export const editCustomScriptResponse = (data) => ({
- type: EDIT_CUSTOM_SCRIPT_RESPONSE,
- payload: { data },
-})
-
-export const getCustomScriptByInum = (action) => ({
- type: GET_CUSTOM_SCRIPT_BY_INUM,
- payload: { action },
-})
-
-export const getCustomScriptByInumResponse = (data) => ({
- type: GET_CUSTOM_SCRIPT_BY_INUM_RESPONSE,
- payload: { data },
-})
-
-export const getCustomScriptByType = (action) => ({
- type: GET_CUSTOM_SCRIPT_BY_TYPE,
- payload: { action },
-})
-
-export const getCustomScriptByTypeResponse = (data) => ({
- type: GET_CUSTOM_SCRIPT_BY_TYPE_RESPONSE,
- payload: { data },
-})
-
-export const deleteCustomScript = (action) => ({
- type: DELETE_CUSTOM_SCRIPT,
- payload: { action },
-})
-
-export const deleteCustomScriptResponse = (inum) => ({
- type: DELETE_CUSTOM_SCRIPT_RESPONSE,
- payload: { inum },
-})
-
-export const setCurrentItem = (item) => ({
- type: SET_SCRIPT_ITEM,
- payload: { item },
-})
-
-export const viewOnly = (view) => ({
- type: SET_VIEW,
- payload: { view },
-})
diff --git a/admin-ui/plugins/admin/redux/actions/MappingActions.js b/admin-ui/plugins/admin/redux/actions/MappingActions.js
deleted file mode 100644
index e02874462..000000000
--- a/admin-ui/plugins/admin/redux/actions/MappingActions.js
+++ /dev/null
@@ -1,55 +0,0 @@
-import {
- GET_MAPPING,
- GET_MAPPING_RESPONSE,
- UPDATE_MAPPING,
- ADD_PERMISSIONS_TO_ROLE,
- UPDATE_PERMISSIONS_TO_SERVER,
- UPDATE_PERMISSIONS_LOADING,
- UPDATE_PERMISSIONS_SERVER_RESPONSE,
- ADD_MAPPING_ROLE_PERMISSIONS,
- DELETE_MAPPING,
-} from './types'
-
-export const getMapping = (action) => ({
- type: GET_MAPPING,
- payload: { action },
-})
-
-export const getMappingResponse = (data) => ({
- type: GET_MAPPING_RESPONSE,
- payload: { data },
-})
-
-export const updateMapping = (data) => ({
- type: UPDATE_MAPPING,
- payload: { data },
-})
-
-export const updatePermissionsLoading = (data) => ({
- type: UPDATE_PERMISSIONS_LOADING,
- payload: { data },
-})
-
-export const updatePermissionsServerResponse = (data) => ({
- type: UPDATE_PERMISSIONS_SERVER_RESPONSE,
- payload: { data },
-})
-export const addPermissionsToRole = (data) => ({
- type: ADD_PERMISSIONS_TO_ROLE,
- payload: { data },
-})
-
-export const updatePermissionsToServer = (data) => ({
- type: UPDATE_PERMISSIONS_TO_SERVER,
- payload: { data },
-})
-
-export const addNewRolePermissions = (data) => ({
- type: ADD_MAPPING_ROLE_PERMISSIONS,
- payload: { data },
-})
-
-export const deleteMapping = (data) => ({
- type: DELETE_MAPPING,
- payload: { data },
-})
diff --git a/admin-ui/plugins/admin/redux/actions/types.js b/admin-ui/plugins/admin/redux/actions/types.js
deleted file mode 100644
index a558d75b4..000000000
--- a/admin-ui/plugins/admin/redux/actions/types.js
+++ /dev/null
@@ -1,63 +0,0 @@
-export const RESET = 'RESET'
-
-// Custom Script
-export const SET_VIEW = 'SET_VIEW'
-export const GET_CUSTOM_SCRIPT = 'GET_CUSTOM_SCRIPT'
-export const GET_CUSTOM_SCRIPT_RESPONSE = 'GET_CUSTOM_SCRIPT_RESPONSE'
-export const ADD_CUSTOM_SCRIPT = 'ADD_CUSTOM_SCRIPT'
-export const ADD_CUSTOM_SCRIPT_RESPONSE = 'ADD_CUSTOM_SCRIPT_RESPONSE'
-export const EDIT_CUSTOM_SCRIPT = 'EDIT_CUSTOM_SCRIPT'
-export const EDIT_CUSTOM_SCRIPT_RESPONSE = 'EDIT_CUSTOM_SCRIPT_RESPONSE'
-export const GET_CUSTOM_SCRIPT_BY_INUM = 'GET_CUSTOM_SCRIPT_BY_INUM'
-export const GET_CUSTOM_SCRIPT_BY_INUM_RESPONSE =
- 'GET_CUSTOM_SCRIPT_BY_INUM_RESPONSE'
-export const GET_CUSTOM_SCRIPT_BY_TYPE = 'GET_CUSTOM_SCRIPT_BY_TYPE'
-export const GET_CUSTOM_SCRIPT_BY_TYPE_RESPONSE =
- 'GET_CUSTOM_SCRIPT_BY_TYPE_RESPONSE'
-export const DELETE_CUSTOM_SCRIPT = 'DELETE_CUSTOM_SCRIPT'
-export const DELETE_CUSTOM_SCRIPT_RESPONSE = 'DELETE_CUSTOM_SCRIPT_RESPONSE'
-export const SET_SCRIPT_ITEM = 'SET_SCRIPT_ITEM'
-
-// API ROLES
-export const GET_ROLES = 'GET_ROLES'
-export const GET_ROLES_RESPONSE = 'GET_ROLES_RESPONSE'
-export const GET_ROLE = 'GET_ROLE'
-export const GET_ROLE_RESPONSE = 'GET_ROLE_RESPONSE'
-export const ADD_ROLE = 'ADD_ROLE'
-export const ADD_ROLE_RESPONSE = 'ADD_ROLE_RESPONSE'
-export const EDIT_ROLE = 'EDIT_ROLE'
-export const EDIT_ROLE_RESPONSE = 'EDIT_ROLE_RESPONSE'
-export const DELETE_ROLE = 'DELETE_ROLE'
-export const DELETE_ROLE_RESPONSE = 'DELETE_ROLE_RESPONSE'
-export const SET_ROLE_ITEM = 'SET_ROLE_ITEM'
-
-// API PERMISSIONS
-export const GET_PERMISSIONS = 'GET_PERMISSIONS'
-export const GET_PERMISSIONS_RESPONSE = 'GET_PERMISSIONS_RESPONSE'
-export const GET_PERMISSION = 'GET_PERMISSION'
-export const GET_PERMISSION_RESPONSE = 'GET_PERMISSION_RESPONSE'
-export const ADD_PERMISSION = 'ADD_PERMISSION'
-export const ADD_PERMISSION_RESPONSE = 'ADD_PERMISSION_RESPONSE'
-export const EDIT_PERMISSION = 'EDIT_PERMISSION'
-export const EDIT_PERMISSION_RESPONSE = 'EDIT_PERMISSION_RESPONSE'
-export const DELETE_PERMISSION = 'DELETE_PERMISSION'
-export const DELETE_PERMISSION_RESPONSE = 'DELETE_PERMISSION_RESPONSE'
-export const SET_PERMISSION_ITEM = 'SET_PERMISSION_ITEM'
-
-//ROLE-PERMISSION Mapping
-export const GET_MAPPING = 'GET_MAPPING'
-export const GET_MAPPING_RESPONSE = 'GET_MAPPING_RESPONSE'
-export const UPDATE_MAPPING = 'UPDATE_MAPPING'
-export const ADD_PERMISSIONS_TO_ROLE = 'ADD_PERMISSIONS_TO_ROLE'
-export const UPDATE_PERMISSIONS_TO_SERVER = 'UPDATE_PERMISSIONS_TO_SERVER'
-export const UPDATE_PERMISSIONS_SERVER_RESPONSE =
- 'UPDATE_PERMISSIONS_SERVER_RESPONSE'
-export const UPDATE_PERMISSIONS_LOADING = 'UPDATE_PERMISSIONS_LOADING'
-export const ADD_MAPPING_ROLE_PERMISSIONS = 'ADD_MAPPING_ROLE_PERMISSIONS'
-export const DELETE_MAPPING = 'DELETE_MAPPING'
-//License Details
-
-export const GET_LICENSE_DETAILS = 'GET_LICENSE_DETAILS'
-export const GET_LICENSE_DETAILS_RESPONSE = 'GET_LICENSE_DETAILS_RESPONSE'
-export const UPDATE_LICENSE_DETAILS = 'UPDATE_LICENSE_DETAILS'
-export const UPDATE_LICENSE_DETAILS_RESPONSE = 'UPDATE_LICENSE_DETAILS_RESPONSE'
diff --git a/admin-ui/plugins/admin/redux/features/apiPermissionSlice.js b/admin-ui/plugins/admin/redux/features/apiPermissionSlice.js
new file mode 100644
index 000000000..c8402ce14
--- /dev/null
+++ b/admin-ui/plugins/admin/redux/features/apiPermissionSlice.js
@@ -0,0 +1,111 @@
+import reducerRegistry from 'Redux/reducers/ReducerRegistry'
+import { createSlice } from '@reduxjs/toolkit'
+
+const initialState = {
+ items: [],
+ loading: true
+}
+
+const apiPermissionSlice = createSlice({
+ name: 'apiPermission',
+ initialState,
+ reducers: {
+ getPermissions: (state, action) => handleLoading(state),
+ getPermissionsResponse: (state, action) => {
+ if (action.payload?.data) {
+ return handleItems(state, action.payload.data)
+ } else {
+ return handleDefault(state)
+ }
+ },
+ addPermission: (state, action) => handleLoading(state),
+ addPermissionResponse: (state, action) => {
+ if (action.payload?.data) {
+ return {
+ ...state,
+ items: [...state.items, action.payload.data],
+ loading: false
+ }
+ } else {
+ return handleDefault(state)
+ }
+ },
+ editPermission: (state, action) => handleLoading(state),
+ editPermissionResponse: (state, action) => {
+ if (action.payload?.data) {
+ return {
+ ...state,
+ items: [...action.payload.data],
+ loading: false
+ }
+ } else {
+ return handleDefault(state)
+ }
+ },
+ getPermission: (state, action) => handleLoading(state),
+ getPermissionResponse: (state, action) => {
+ if (action.payload?.data) {
+ return handleItems(state, action.payload.data)
+ } else {
+ return handleDefault(state)
+ }
+ },
+ deletePermission: (state, action) => handleLoading(state),
+ deletePermissionResponse: (state, action) => {
+ if (action.payload?.inum) {
+ return {
+ ...state,
+ items: state.items.filter(
+ (item) => item.inum !== action.payload.inum
+ ),
+ loading: false
+ }
+ } else {
+ return handleDefault(state)
+ }
+ },
+ setCurrentItem: (state, action) => ({
+ ...state,
+ item: action.payload?.item,
+ loading: false
+ })
+ }
+})
+
+function handleItems(state, data) {
+ return {
+ ...state,
+ items: data,
+ loading: false
+ }
+}
+
+function handleDefault(state) {
+ return {
+ ...state,
+ loading: false
+ }
+}
+
+function handleLoading(state) {
+ return {
+ ...state,
+ loading: true
+ }
+}
+
+export const {
+ getPermissions,
+ getPermissionsResponse,
+ addPermission,
+ addPermissionResponse,
+ editPermission,
+ editPermissionResponse,
+ getPermission,
+ getPermissionResponse,
+ deletePermission,
+ deletePermissionResponse,
+ setCurrentItem
+} = apiPermissionSlice.actions
+export const { actions, reducer, state } = apiPermissionSlice
+reducerRegistry.register('apiPermissionReducer', reducer)
diff --git a/admin-ui/plugins/admin/redux/features/apiRoleSlice.js b/admin-ui/plugins/admin/redux/features/apiRoleSlice.js
new file mode 100644
index 000000000..7cec8648e
--- /dev/null
+++ b/admin-ui/plugins/admin/redux/features/apiRoleSlice.js
@@ -0,0 +1,83 @@
+import reducerRegistry from 'Redux/reducers/ReducerRegistry'
+import { createSlice } from '@reduxjs/toolkit'
+
+const initialState = {
+ items: [],
+ loading: false
+}
+
+const apiRoleSlice = createSlice({
+ name: 'apiRole',
+ initialState,
+ reducers: {
+ getRoles: (state, action) => {
+ state.loading = true
+ },
+ getRolesResponse: (state, action) => {
+ state.loading = false
+ if (action.payload?.data) {
+ state.items = action.payload.data
+ }
+ },
+ addRole: (state, action) => {
+ state.loading = true
+ },
+ addRoleResponse: (state, action) => {
+ state.loading = false
+ if (action.payload?.data) {
+ state.items = [...state.items, action.payload.data]
+ }
+ },
+ editRole: (state, action) => {
+ state.loading = true
+ },
+ editRoleResponse: (state, action) => {
+ state.loading = false
+ if (action.payload?.data) {
+ let currentItems = [...state.items]
+ currentItems.push(action.payload.data)
+ state.items = currentItems
+ }
+ },
+ getRole: (state, action) => {
+ state.loading = true
+ },
+ getRoleResponse: (state, action) => {
+ state.loading = false
+ if (action.payload?.data) {
+ state.items = action.payload.data
+ }
+ },
+ deleteRole: (state, action) => {
+ state.loading = true
+ },
+ deleteRoleResponse: (state, action) => {
+ state.loading = false
+ if (action.payload?.inum) {
+ state.items = state.items.filter(
+ (item) => item.inum !== action.payload.inum
+ )
+ }
+ },
+ setCurrentItem: (state, action) => {
+ state.item = action.payload.item
+ state.loading = false
+ }
+ }
+})
+
+export const {
+ getRoles,
+ getRolesResponse,
+ getRole,
+ getRoleResponse,
+ addRole,
+ addRoleResponse,
+ deleteRole,
+ deleteRoleResponse,
+ editRole,
+ editRoleResponse,
+ setCurrentItem
+} = apiRoleSlice.actions
+export const { actions, reducer, state } = apiRoleSlice
+reducerRegistry.register('apiRoleReducer', reducer)
diff --git a/admin-ui/plugins/admin/redux/features/customScriptSlice.js b/admin-ui/plugins/admin/redux/features/customScriptSlice.js
new file mode 100644
index 000000000..6b2b83859
--- /dev/null
+++ b/admin-ui/plugins/admin/redux/features/customScriptSlice.js
@@ -0,0 +1,120 @@
+import reducerRegistry from 'Redux/reducers/ReducerRegistry'
+import { createSlice } from '@reduxjs/toolkit'
+
+const initialState = {
+ items: [],
+ loading: true,
+ view: false,
+ saveOperationFlag: false,
+ errorInSaveOperationFlag: false,
+ totalItems: 0,
+ entriesCount: 0
+}
+
+const customScriptSlice = createSlice({
+ name: 'customScript',
+ initialState,
+ reducers: {
+ getCustomScripts: (state) => {
+ state.loading = true
+ state.saveOperationFlag = false
+ state.errorInSaveOperationFlag = false
+ },
+ getCustomScriptsResponse: (state, action) => {
+ state.loading = false
+ if (action.payload?.data) {
+ state.items = action.payload.data.entries
+ state.totalItems = action.payload.data.totalEntriesCount
+ state.entriesCount = action.payload.data.entriesCount
+ }
+ },
+ addCustomScript: (state) => {
+ state.loading = true
+ state.saveOperationFlag = false
+ state.errorInSaveOperationFlag = false
+ },
+ addCustomScriptResponse: (state, action) => {
+ state.loading = false
+ state.errorInSaveOperationFlag = false
+
+ if (action.payload?.data) {
+ state.items = [...state.items, action.payload.data]
+ state.saveOperationFlag = true
+ } else {
+ state.saveOperationFlag = false
+ }
+ },
+ editCustomScript: (state) => {
+ state.loading = true
+ state.saveOperationFlag = false
+ state.errorInSaveOperationFlag = false
+ },
+ editCustomScriptResponse: (state, action) => {
+ state.loading = false
+ state.saveOperationFlag = true
+ if (action.payload?.data) {
+ state.items = [...state.items]
+ state.errorInSaveOperationFlag = false
+ } else {
+ state.errorInSaveOperationFlag = true
+ }
+ },
+ // getCustomScriptByInum: () => {},
+ // getCustomScriptByInumResponse: () => {},
+ getCustomScriptByType: (state) => {
+ state.loading = true
+ state.saveOperationFlag = false
+ state.errorInSaveOperationFlag = false
+ },
+ getCustomScriptByTypeResponse: (state, action) => {
+ if (action.payload.data) {
+ state.items = action.payload.data.entries
+ }
+ state.loading = false
+ },
+ deleteCustomScript: (state) => {
+ state.loading = true
+ },
+ deleteCustomScriptResponse: (state, action) => {
+ state.loading = false
+ if (action.payload?.inum) {
+ const items = state.items.filter(
+ (item) => item.inum !== action.payload.inum
+ )
+ state.items = items
+ } else {
+ state.saveOperationFlag = false
+ state.errorInSaveOperationFlag = false
+ }
+ },
+ setCurrentItem: (state, action) => {
+ state.item = action.payload?.item
+ state.loading = false
+ },
+ viewOnly: (state, action) => {
+ state.loading = false
+ if (action.payload) {
+ state.view = action.payload.view
+ } else {
+ state.saveOperationFlag = false
+ state.errorInSaveOperationFlag = false
+ }
+ }
+ }
+})
+
+export const {
+ getCustomScriptsResponse,
+ getCustomScripts,
+ addCustomScriptResponse,
+ addCustomScript,
+ editCustomScriptResponse,
+ editCustomScript,
+ deleteCustomScript,
+ deleteCustomScriptResponse,
+ getCustomScriptByType,
+ viewOnly,
+ setCurrentItem
+} = customScriptSlice.actions
+export const { actions, reducer, state } = customScriptSlice
+reducerRegistry.register('customScriptReducer', reducer)
diff --git a/admin-ui/plugins/admin/redux/features/mappingSlice.js b/admin-ui/plugins/admin/redux/features/mappingSlice.js
new file mode 100644
index 000000000..8820244cf
--- /dev/null
+++ b/admin-ui/plugins/admin/redux/features/mappingSlice.js
@@ -0,0 +1,104 @@
+import reducerRegistry from 'Redux/reducers/ReducerRegistry'
+import { createSlice } from '@reduxjs/toolkit'
+
+const initialState = {
+ items: [],
+ serverItems: [],
+ loading: false
+}
+
+const mappingSlice = createSlice({
+ name: 'mapping',
+ initialState,
+ reducers: {
+ getMapping: (state, action) => handleLoading(state),
+ getMappingResponse: (state, action) => {
+ if (action.payload.data) {
+ return handleItems(state, action.payload.data);
+ } else {
+ return handleDefault(state);
+ }
+ },
+ addPermissionsToRole: (state, action) => {
+ const { data, userRole } = action.payload.data;
+ let roleIndex = state.items.findIndex((element) => element.role === userRole);
+ let existingPermissions = state.items[roleIndex].permissions;
+ let newArr = existingPermissions.concat(data);
+ let addedPermissions = state.items;
+ addedPermissions[roleIndex].permissions = newArr;
+ return {
+ ...state,
+ items: [...addedPermissions],
+ };
+ },
+ updatePermissionsLoading: (state, action) => ({
+ ...state,
+ loading: action.payload.data,
+ }),
+ updatePermissionsServerResponse: (state, action) => {
+ let indexToUpdatePermissions = state.items.findIndex(
+ (element) => element.role === action.payload?.data?.role,
+ );
+ let changedData = state.items;
+ changedData[indexToUpdatePermissions] = action.payload?.data;
+ return {
+ ...state,
+ items: [...changedData],
+ loading: false,
+ };
+ },
+ updateMapping: (state, action) => {
+ if (action.payload?.data) {
+ const { id, role } = action.payload.data;
+ let index = state.items.findIndex((element) => element.role === role);
+ let permissions = state.items[index].permissions;
+ permissions.splice(id, 1);
+ let changedPermissions = state.items;
+ changedPermissions[index].permissions = permissions;
+ return {
+ ...state,
+ items: [...changedPermissions],
+ };
+ }
+ },
+ updatePermissionsToServer: (state, action) => {},
+ addNewRolePermissions: (state, action) => {},
+ deleteMapping: (state, action) => {},
+ },
+ });
+
+ function handleItems(state, data) {
+ return {
+ ...state,
+ items: data,
+ loading: false,
+ };
+ }
+
+ function handleLoading(state) {
+ return {
+ ...state,
+ loading: true,
+ };
+ }
+
+ function handleDefault(state) {
+ return {
+ ...state,
+ loading: false,
+ };
+ }
+
+ export const {
+ getMapping,
+ getMappingResponse,
+ addPermissionsToRole,
+ updatePermissionsLoading,
+ updatePermissionsServerResponse,
+ updateMapping,
+ updatePermissionsToServer,
+ addNewRolePermissions,
+ deleteMapping
+ } = mappingSlice.actions;
+export const { actions, reducer, state } = mappingSlice
+reducerRegistry.register('mappingReducer', reducer)
diff --git a/admin-ui/plugins/admin/redux/features/mauSlice.js b/admin-ui/plugins/admin/redux/features/mauSlice.js
new file mode 100644
index 000000000..5c17b18a0
--- /dev/null
+++ b/admin-ui/plugins/admin/redux/features/mauSlice.js
@@ -0,0 +1,31 @@
+import reducerRegistry from 'Redux/reducers/ReducerRegistry'
+import { createSlice } from '@reduxjs/toolkit'
+
+const initialState = {
+ stat: [],
+ loading: false,
+ startMonth: '',
+ endMonth: ''
+}
+
+const mauSlice = createSlice({
+ name: 'mau',
+ initialState,
+ reducers: {
+ getMau: (state, action) => {
+ state.loading = true
+ state.startMonth = action.payload?.action?.action_data?.startMonth
+ state.endMonth = action.payload?.action?.action_data?.endMonth
+ },
+ getMauResponse: (state, action) => {
+ state.loading = false
+ if (action.payload?.data) {
+ state.stat = action.payload.data
+ }
+ }
+ }
+})
+
+export const { getMau, getMauResponse } = mauSlice.actions
+export const { actions, reducer, state } = mauSlice
+reducerRegistry.register('mauReducer', reducer)
diff --git a/admin-ui/plugins/admin/redux/reducers/ApiPermissionReducer.js b/admin-ui/plugins/admin/redux/reducers/ApiPermissionReducer.js
deleted file mode 100644
index f7032c1d6..000000000
--- a/admin-ui/plugins/admin/redux/reducers/ApiPermissionReducer.js
+++ /dev/null
@@ -1,118 +0,0 @@
-import {
- GET_PERMISSIONS,
- GET_PERMISSIONS_RESPONSE,
- GET_PERMISSION,
- GET_PERMISSION_RESPONSE,
- ADD_PERMISSION,
- ADD_PERMISSION_RESPONSE,
- EDIT_PERMISSION,
- EDIT_PERMISSION_RESPONSE,
- DELETE_PERMISSION,
- DELETE_PERMISSION_RESPONSE,
- SET_PERMISSION_ITEM,
- RESET,
-} from '../actions/types'
-import reducerRegistry from 'Redux/reducers/ReducerRegistry'
-const INIT_STATE = {
- items: [],
- loading: true,
-}
-const reducerName = 'apiPermissionReducer'
-
-export default function apiPermissionReducer(state = INIT_STATE, action) {
- switch (action.type) {
- case GET_PERMISSIONS:
- return handleLoading()
- case GET_PERMISSIONS_RESPONSE:
- if (action.payload.data) {
- return handleItems()
- } else {
- return handleDefault()
- }
- case GET_PERMISSION:
- return handleLoading()
- case GET_PERMISSION_RESPONSE:
- if (action.payload.data) {
- return handleItems()
- } else {
- return handleDefault()
- }
- case ADD_PERMISSION:
- return handleLoading()
- case ADD_PERMISSION_RESPONSE:
- if (action.payload.data) {
- return {
- ...state,
- items: [...state.items, action.payload.data],
- loading: false,
- }
- } else {
- return handleDefault()
- }
-
- case EDIT_PERMISSION:
- return handleLoading()
- case EDIT_PERMISSION_RESPONSE:
- if (action.payload.data) {
- return {
- ...state,
- items: [...action.payload.data],
- loading: false,
- }
- } else {
- return handleDefault()
- }
-
- case DELETE_PERMISSION:
- return handleLoading()
- case DELETE_PERMISSION_RESPONSE:
- if (action.payload.inum) {
- return {
- ...state,
- items: state.items.filter(
- (item) => item.inum !== action.payload.inum,
- ),
- loading: false,
- }
- } else {
- return handleDefault()
- }
- case SET_PERMISSION_ITEM:
- return {
- ...state,
- item: action.payload.item,
- loading: false,
- }
- case RESET:
- return {
- ...state,
- items: INIT_STATE.items,
- loading: INIT_STATE.loading,
- }
- default:
- return handleDefault()
- }
-
- function handleItems() {
- return {
- ...state,
- items: action.payload.data,
- loading: false,
- }
- }
-
- function handleDefault() {
- return {
- ...state,
- loading: false,
- }
- }
-
- function handleLoading() {
- return {
- ...state,
- loading: true,
- }
- }
-}
-reducerRegistry.register(reducerName, apiPermissionReducer)
diff --git a/admin-ui/plugins/admin/redux/reducers/ApiRoleReducer.js b/admin-ui/plugins/admin/redux/reducers/ApiRoleReducer.js
deleted file mode 100644
index d069de536..000000000
--- a/admin-ui/plugins/admin/redux/reducers/ApiRoleReducer.js
+++ /dev/null
@@ -1,122 +0,0 @@
-import {
- GET_ROLES,
- GET_ROLES_RESPONSE,
- GET_ROLE,
- GET_ROLE_RESPONSE,
- ADD_ROLE,
- ADD_ROLE_RESPONSE,
- EDIT_ROLE,
- EDIT_ROLE_RESPONSE,
- DELETE_ROLE,
- DELETE_ROLE_RESPONSE,
- SET_ROLE_ITEM,
- RESET,
-} from '../actions/types'
-import reducerRegistry from 'Redux/reducers/ReducerRegistry'
-
-const INIT_STATE = {
- items: [],
- loading: false,
-}
-const reducerName = 'apiRoleReducer'
-
-export default function apiRoleReducer(state = INIT_STATE, action) {
- switch (action.type) {
- case GET_ROLES:
- return handleLoading()
- case GET_ROLES_RESPONSE:
- if (action.payload.data) {
- return handleItems()
- } else {
- return handleDefault()
- }
- case GET_ROLE:
- return handleLoading()
- case GET_ROLE_RESPONSE:
- if (action.payload.data) {
- return handleItems()
- } else {
- return handleDefault()
- }
- case ADD_ROLE:
- return handleLoading()
- case ADD_ROLE_RESPONSE:
- if (action.payload.data) {
- return {
- ...state,
- items: [...state.items, action.payload.data],
- loading: false,
- }
- } else {
- return handleDefault()
- }
-
- case EDIT_ROLE:
- return handleLoading()
- case EDIT_ROLE_RESPONSE:
- if (action.payload.data) {
- let currentItems = [...state.items]
- currentItems.filter((item) => item.role === action.payload.data.role)
- currentItems.push(action.payload.data)
- return {
- ...state,
- items: currentItems,
- loading: false,
- }
- } else {
- return handleDefault()
- }
-
- case DELETE_ROLE:
- return handleLoading()
- case DELETE_ROLE_RESPONSE:
- if (action.payload.inum) {
- return {
- ...state,
- items: state.items.filter(
- (item) => item.inum !== action.payload.inum,
- ),
- loading: false,
- }
- } else {
- return handleDefault()
- }
- case SET_ROLE_ITEM:
- return {
- ...state,
- item: action.payload.item,
- loading: false,
- }
- case RESET:
- return {
- ...state,
- items: INIT_STATE.items,
- loading: INIT_STATE.loading,
- }
- default:
- return handleDefault()
- }
-
- function handleItems() {
- return {
- ...state,
- items: action.payload.data,
- loading: false,
- }
- }
-
- function handleLoading() {
- return {
- ...state,
- loading: true,
- }
- }
-
- function handleDefault() {
- return {
- ...state,
- loading: false,
- }
- }
-}
-reducerRegistry.register(reducerName, apiRoleReducer)
diff --git a/admin-ui/plugins/admin/redux/reducers/CustomScriptReducer.js b/admin-ui/plugins/admin/redux/reducers/CustomScriptReducer.js
deleted file mode 100644
index f318c6629..000000000
--- a/admin-ui/plugins/admin/redux/reducers/CustomScriptReducer.js
+++ /dev/null
@@ -1,168 +0,0 @@
-import {
- GET_CUSTOM_SCRIPT,
- GET_CUSTOM_SCRIPT_RESPONSE,
- GET_CUSTOM_SCRIPT_BY_TYPE,
- GET_CUSTOM_SCRIPT_BY_TYPE_RESPONSE,
- ADD_CUSTOM_SCRIPT,
- ADD_CUSTOM_SCRIPT_RESPONSE,
- EDIT_CUSTOM_SCRIPT,
- EDIT_CUSTOM_SCRIPT_RESPONSE,
- SET_SCRIPT_ITEM,
- DELETE_CUSTOM_SCRIPT,
- DELETE_CUSTOM_SCRIPT_RESPONSE,
- RESET,
- SET_VIEW,
-} from '../actions/types'
-import reducerRegistry from 'Redux/reducers/ReducerRegistry'
-const INIT_STATE = {
- items: [],
- loading: true,
- view: false,
- saveOperationFlag: false,
- errorInSaveOperationFlag: false,
- totalItems: 0,
- entriesCount: 0,
-}
-
-const reducerName = 'customScriptReducer'
-
-export default function customScriptReducer(state = INIT_STATE, action) {
- switch (action.type) {
- case GET_CUSTOM_SCRIPT:
- return handleLoading()
- case GET_CUSTOM_SCRIPT_RESPONSE:
- if (action.payload.data) {
- return {
- ...state,
- items: action.payload.data.entries,
- loading: false,
- totalItems: action.payload.data.totalEntriesCount,
- entriesCount: action.payload.data.entriesCount,
- }
- } else {
- return handleDefault()
- }
- case GET_CUSTOM_SCRIPT_BY_TYPE:
- return handleLoading()
- case GET_CUSTOM_SCRIPT_BY_TYPE_RESPONSE:
- if (action.payload.data) {
- return {
- ...state,
- items: action.payload.data.entries,
- loading: false,
- }
- } else {
- return handleDefault()
- }
- case ADD_CUSTOM_SCRIPT:
- return {
- ...state,
- loading: true,
- saveOperationFlag: false,
- errorInSaveOperationFlag: false,
- }
- case ADD_CUSTOM_SCRIPT_RESPONSE:
- if (action.payload.data) {
- return {
- ...state,
- items: [...state.items, action.payload.data],
- loading: false,
- saveOperationFlag: true,
- errorInSaveOperationFlag: false,
- }
- } else {
- return {
- ...state,
- loading: false,
- saveOperationFlag: true,
- errorInSaveOperationFlag: true,
- }
- }
-
- case EDIT_CUSTOM_SCRIPT:
- return {
- ...state,
- loading: true,
- saveOperationFlag: false,
- errorInSaveOperationFlag: false,
- }
- case EDIT_CUSTOM_SCRIPT_RESPONSE:
- if (action.payload.data) {
- return {
- ...state,
- items: [...state.items],
- loading: false,
- saveOperationFlag: true,
- errorInSaveOperationFlag: false,
- }
- } else {
- return {
- ...state,
- loading: false,
- saveOperationFlag: true,
- errorInSaveOperationFlag: true,
- }
- }
-
- case DELETE_CUSTOM_SCRIPT:
- return {
- ...state,
- loading: true,
- }
- case DELETE_CUSTOM_SCRIPT_RESPONSE:
- if (action.payload.inum) {
- return {
- ...state,
- items: state.items.filter(
- (item) => item.inum !== action.payload.inum,
- ),
- loading: false,
- }
- } else {
- return handleDefault()
- }
- case SET_SCRIPT_ITEM:
- return {
- ...state,
- item: action.payload.item,
- loading: false,
- }
- case RESET:
- return {
- ...state,
- items: INIT_STATE.items,
- loading: INIT_STATE.loading,
- }
- case SET_VIEW:
- if (action.payload) {
- return {
- ...state,
- view: action.payload.view,
- loading: false,
- }
- } else {
- return handleDefault()
- }
- default:
- return handleDefault()
- }
-
- function handleDefault() {
- return {
- ...state,
- loading: false,
- saveOperationFlag: false,
- errorInSaveOperationFlag: false,
- }
- }
-
- function handleLoading() {
- return {
- ...state,
- loading: true,
- saveOperationFlag: false,
- errorInSaveOperationFlag: false,
- }
- }
-}
-reducerRegistry.register(reducerName, customScriptReducer)
diff --git a/admin-ui/plugins/admin/redux/reducers/MappingReducer.js b/admin-ui/plugins/admin/redux/reducers/MappingReducer.js
deleted file mode 100644
index bfde15497..000000000
--- a/admin-ui/plugins/admin/redux/reducers/MappingReducer.js
+++ /dev/null
@@ -1,101 +0,0 @@
-import {
- GET_MAPPING,
- GET_MAPPING_RESPONSE,
- UPDATE_MAPPING,
- ADD_PERMISSIONS_TO_ROLE,
- UPDATE_PERMISSIONS_LOADING,
- RESET,
- UPDATE_PERMISSIONS_SERVER_RESPONSE,
-} from '../actions/types'
-import reducerRegistry from 'Redux/reducers/ReducerRegistry'
-
-const INIT_STATE = {
- items: [],
- serverItems: [],
- loading: false,
-}
-const reducerName = 'mappingReducer'
-
-export default function mappingReducer(state = INIT_STATE, action) {
- switch (action.type) {
- case GET_MAPPING:
- return handleLoading()
- case GET_MAPPING_RESPONSE:
- if (action.payload.data) {
- return handleItems()
- } else {
- return handleDefault()
- }
- case ADD_PERMISSIONS_TO_ROLE:
- const { data, userRole } = action.payload.data
- let roleIndex = state.items.findIndex(
- (element) => element.role == userRole,
- )
- let existingPermissions = state.items[roleIndex].permissions
- let newArr = existingPermissions.concat(data)
- let addedPermissions = state.items
- addedPermissions[roleIndex].permissions = newArr
- return {
- ...state,
- items: [...addedPermissions],
- }
- case UPDATE_PERMISSIONS_LOADING:
- return {
- ...state,
- loading: action.payload.data,
- }
- case UPDATE_PERMISSIONS_SERVER_RESPONSE:
- let indexToUpdatePermissions = state.items.findIndex(
- (element) => element.role == action.payload?.data?.role,
- )
- let changedData = state.items
- changedData[indexToUpdatePermissions] = action.payload.data
- return {
- ...state,
- items: [...changedData],
- loading: false,
- }
- case UPDATE_MAPPING:
- const { id, role } = action.payload.data
- let index = state.items.findIndex((element) => element.role == role)
- let permissions = state.items[index].permissions
- permissions.splice(id, 1)
- let changedPermissions = state.items
- changedPermissions[index].permissions = permissions
- return {
- ...state,
- items: [...changedPermissions],
- }
- case RESET:
- return {
- ...state,
- items: INIT_STATE.items,
- loading: INIT_STATE.loading,
- }
- default:
- return handleDefault()
- }
-
- function handleItems() {
- return {
- ...state,
- items: action.payload.data,
- loading: false,
- }
- }
-
- function handleLoading() {
- return {
- ...state,
- loading: true,
- }
- }
-
- function handleDefault() {
- return {
- ...state,
- loading: false,
- }
- }
-}
-reducerRegistry.register(reducerName, mappingReducer)
diff --git a/admin-ui/plugins/admin/redux/sagas/ApiPermissionSaga.js b/admin-ui/plugins/admin/redux/sagas/ApiPermissionSaga.js
index 832199383..563b2cf30 100644
--- a/admin-ui/plugins/admin/redux/sagas/ApiPermissionSaga.js
+++ b/admin-ui/plugins/admin/redux/sagas/ApiPermissionSaga.js
@@ -9,7 +9,7 @@ import {
addPermissionResponse,
editPermissionResponse,
deletePermissionResponse,
-} from '../actions/ApiPermissionActions'
+} from 'Plugins/admin/redux/features/apiPermissionSlice'
import {
CREATE,
UPDATE,
@@ -21,13 +21,6 @@ import {
addAdditionalData,
} from 'Utils/TokenController'
import {updateToast} from 'Redux/actions/ToastAction'
-import {
- GET_PERMISSIONS,
- ADD_PERMISSION,
- EDIT_PERMISSION,
- DELETE_PERMISSION,
- GET_PERMISSION,
-} from '../actions/types'
const JansConfigApi = require('jans_config_api')
import { initAudit } from 'Redux/sagas/SagaUtils'
@@ -47,7 +40,7 @@ export function* getPermissions({ payload }) {
addAdditionalData(audit, FETCH, API_PERMISSION, payload)
const permApi = yield* newFunction()
const data = yield call(permApi.getPermissions)
- yield put(getPermissionResponse(data))
+ yield put(getPermissionResponse({ data }))
yield call(postUserAction, audit)
} catch (e) {
yield put(getPermissionResponse(null))
@@ -63,7 +56,7 @@ export function* getPermission({ payload }) {
addAdditionalData(audit, FETCH, API_PERMISSION, payload)
const permApi = yield* newFunction()
const data = yield call(permApi.getPermission, payload.action.action_data)
- yield put(getPermissionResponse(data))
+ yield put(getPermissionResponse({ data }))
yield call(postUserAction, audit)
} catch (e) {
yield put(getPermissionResponse(null))
@@ -80,7 +73,7 @@ export function* addPermission({ payload }) {
const permApi = yield* newFunction()
const data = yield call(permApi.addPermission, payload.action.action_data)
yield put(updateToast(true, 'success'))
- yield put(addPermissionResponse(data))
+ yield put(addPermissionResponse({ data }))
yield call(postUserAction, audit)
} catch (e) {
yield put(updateToast(true, 'error'))
@@ -98,7 +91,7 @@ export function* editPermission({ payload }) {
const permApi = yield* newFunction()
const data = yield call(permApi.editPermission, payload.action.action_data)
yield put(updateToast(true, 'success'))
- yield put(editPermissionResponse(data))
+ yield put(editPermissionResponse({ data }))
yield call(postUserAction, audit)
} catch (e) {
yield put(updateToast(true, 'error'))
@@ -117,7 +110,7 @@ export function* deletePermission({ payload }) {
const permApi = yield* newFunction()
yield call(permApi.deletePermission, payload.action.action_data)
yield put(updateToast(true, 'success'))
- yield put(deletePermissionResponse(payload.action.action_data))
+ yield put(deletePermissionResponse({ inum: payload.action.action_data }))
yield call(postUserAction, audit)
} catch (e) {
yield put(updateToast(true, 'error'))
@@ -130,21 +123,21 @@ export function* deletePermission({ payload }) {
}
export function* watchGetPermissions() {
- yield takeLatest(GET_PERMISSIONS, getPermissions)
+ yield takeLatest('apiPermission/getPermissions', getPermissions)
}
export function* watchAddPermission() {
- yield takeLatest(ADD_PERMISSION, addPermission)
+ yield takeLatest('apiPermission/addPermission', addPermission)
}
export function* watchEditPermission() {
- yield takeLatest(EDIT_PERMISSION, editPermission)
+ yield takeLatest('apiPermission/editPermission', editPermission)
}
export function* watchDeletePermission() {
- yield takeLatest(DELETE_PERMISSION, deletePermission)
+ yield takeLatest('apiPermission/deletePermission', deletePermission)
}
export function* watchGetPermission() {
- yield takeLatest(GET_PERMISSION, getPermission)
+ yield takeLatest('apiPermission/getPermission', getPermission)
}
export default function* rootSaga() {
yield all([
diff --git a/admin-ui/plugins/admin/redux/sagas/ApiRoleSaga.js b/admin-ui/plugins/admin/redux/sagas/ApiRoleSaga.js
index 8f1ad5dd8..33ed8cf6b 100644
--- a/admin-ui/plugins/admin/redux/sagas/ApiRoleSaga.js
+++ b/admin-ui/plugins/admin/redux/sagas/ApiRoleSaga.js
@@ -5,7 +5,7 @@ import {
addRoleResponse,
editRoleResponse,
deleteRoleResponse,
-} from '../actions/ApiRoleActions'
+} from 'Plugins/admin/redux/features/apiRoleSlice'
import { API_ROLE } from '../audit/Resources'
import {
CREATE,
@@ -19,13 +19,6 @@ import {
isFourZeroOneError,
addAdditionalData,
} from 'Utils/TokenController'
-import {
- GET_ROLES,
- GET_ROLE,
- ADD_ROLE,
- EDIT_ROLE,
- DELETE_ROLE,
-} from '../actions/types'
import RoleApi from '../api/RoleApi'
import { getClient } from 'Redux/api/base'
import { postUserAction } from 'Redux/api/backend-api'
@@ -47,7 +40,7 @@ export function* getRoles({ payload }) {
addAdditionalData(audit, FETCH, API_ROLE, payload)
const roleApi = yield* newFunction()
const data = yield call(roleApi.getRoles)
- yield put(getRolesResponse(data))
+ yield put(getRolesResponse({ data }))
yield call(postUserAction, audit)
} catch (e) {
yield put(getRolesResponse(null))
@@ -63,7 +56,7 @@ export function* getRole({ payload }) {
addAdditionalData(audit, FETCH, API_ROLE, payload)
const roleApi = yield* newFunction()
const data = yield call(roleApi.getRole, payload.action.action_data)
- yield put(getRoleResponse(data))
+ yield put(getRoleResponse({ data }))
yield call(postUserAction, audit)
} catch (e) {
yield put(getRoleResponse(null))
@@ -130,21 +123,21 @@ export function* deleteRole({ payload }) {
}
export function* watchGetRoles() {
- yield takeLatest(GET_ROLES, getRoles)
+ yield takeLatest('apiRole/getRoles', getRoles)
}
export function* watchAddRole() {
- yield takeLatest(ADD_ROLE, addRole)
+ yield takeLatest('apiRole/addRole', addRole)
}
export function* watchEditRole() {
- yield takeLatest(EDIT_ROLE, editRole)
+ yield takeLatest('apiRole/editRole', editRole)
}
export function* watchDeleteRole() {
- yield takeLatest(DELETE_ROLE, deleteRole)
+ yield takeLatest('apiRole/deleteRole', deleteRole)
}
export function* watchGetRole() {
- yield takeLatest(GET_ROLE, getRole)
+ yield takeLatest('apiRole/getRole', getRole)
}
export default function* rootSaga() {
yield all([
diff --git a/admin-ui/plugins/admin/redux/sagas/CustomScriptSaga.js b/admin-ui/plugins/admin/redux/sagas/CustomScriptSaga.js
index 2726b6b1d..f06e36844 100644
--- a/admin-ui/plugins/admin/redux/sagas/CustomScriptSaga.js
+++ b/admin-ui/plugins/admin/redux/sagas/CustomScriptSaga.js
@@ -4,7 +4,7 @@ import {
addCustomScriptResponse,
editCustomScriptResponse,
deleteCustomScriptResponse,
-} from '../actions/CustomScriptActions'
+} from 'Plugins/admin/redux/features/customScriptSlice'
import { SCRIPT } from '../audit/Resources'
import {
CREATE,
@@ -15,13 +15,6 @@ import {
import { getAPIAccessToken } from 'Redux/actions/AuthActions'
import { isFourZeroOneError, addAdditionalData } from 'Utils/TokenController'
import {updateToast} from 'Redux/actions/ToastAction'
-import {
- GET_CUSTOM_SCRIPT,
- GET_CUSTOM_SCRIPT_BY_TYPE,
- ADD_CUSTOM_SCRIPT,
- EDIT_CUSTOM_SCRIPT,
- DELETE_CUSTOM_SCRIPT,
-} from '../actions/types'
import ScriptApi from '../api/ScriptApi'
import { getClient } from 'Redux/api/base'
import { postUserAction } from 'Redux/api/backend-api'
@@ -44,7 +37,7 @@ export function* getCustomScripts({ payload }) {
addAdditionalData(audit, FETCH, SCRIPT, payload)
const scriptApi = yield* newFunction()
const data = yield call(scriptApi.getAllCustomScript, payload.action)
- yield put(getCustomScriptsResponse(data))
+ yield put(getCustomScriptsResponse({ data }))
yield call(postUserAction, audit)
} catch (e) {
yield put(getCustomScriptsResponse(null))
@@ -60,7 +53,7 @@ export function* getScriptsByType({ payload }) {
addAdditionalData(audit, FETCH, SCRIPT, payload)
const scriptApi = yield* newFunction()
const data = yield call(scriptApi.getScriptsByType, payload.action)
- yield put(getCustomScriptsResponse(data))
+ yield put(getCustomScriptsResponse({ data }))
yield call(postUserAction, audit)
} catch (e) {
yield put(getCustomScriptsResponse(null))
@@ -79,7 +72,7 @@ export function* addScript({ payload }) {
scriptApi.addCustomScript,
payload.action.action_data,
)
- yield put(addCustomScriptResponse(data))
+ yield put(addCustomScriptResponse({ data }))
yield call(postUserAction, audit)
yield put(updateToast(true, 'success'))
} catch (e) {
@@ -100,7 +93,7 @@ export function* editScript({ payload }) {
scriptApi.editCustomScript,
payload.action.action_data,
)
- yield put(editCustomScriptResponse(data))
+ yield put(editCustomScriptResponse({ data }))
yield call(postUserAction, audit)
yield put(updateToast(true, 'success'))
} catch (e) {
@@ -120,7 +113,7 @@ export function* deleteScript({ payload }) {
const scriptApi = yield* newFunction()
yield call(scriptApi.deleteCustomScript, payload.action.action_data)
yield put(updateToast(true, 'success'))
- yield put(deleteCustomScriptResponse(payload.action.action_data))
+ yield put(deleteCustomScriptResponse({ inum: payload.action.action_data }))
yield call(postUserAction, audit)
} catch (e) {
yield put(updateToast(true, 'error'))
@@ -133,21 +126,21 @@ export function* deleteScript({ payload }) {
}
export function* watchGetAllCustomScripts() {
- yield takeLatest(GET_CUSTOM_SCRIPT, getCustomScripts)
+ yield takeLatest('customScript/getCustomScripts', getCustomScripts)
}
export function* watchAddScript() {
- yield takeLatest(ADD_CUSTOM_SCRIPT, addScript)
+ yield takeLatest('customScript/addCustomScript', addScript)
}
export function* watchEditScript() {
- yield takeLatest(EDIT_CUSTOM_SCRIPT, editScript)
+ yield takeLatest('customScript/editCustomScript', editScript)
}
export function* watchDeleteScript() {
- yield takeLatest(DELETE_CUSTOM_SCRIPT, deleteScript)
+ yield takeLatest('customScript/deleteCustomScript', deleteScript)
}
export function* watchScriptsByType() {
- yield takeLatest(GET_CUSTOM_SCRIPT_BY_TYPE, getScriptsByType)
+ yield takeLatest('customScript/getCustomScriptByType', getScriptsByType)
}
export default function* rootSaga() {
yield all([
diff --git a/admin-ui/plugins/admin/redux/sagas/MappingSaga.js b/admin-ui/plugins/admin/redux/sagas/MappingSaga.js
index 2ae011536..0f77fec1a 100644
--- a/admin-ui/plugins/admin/redux/sagas/MappingSaga.js
+++ b/admin-ui/plugins/admin/redux/sagas/MappingSaga.js
@@ -12,7 +12,7 @@ import {
updatePermissionsServerResponse,
updatePermissionsLoading,
getMapping,
-} from '../actions/MappingActions'
+} from 'Plugins/admin/redux/features/mappingSlice'
import { API_MAPPING } from '../audit/Resources'
import { FETCH } from '../../../../app/audit/UserActionType'
import { getAPIAccessToken } from 'Redux/actions/AuthActions'
@@ -21,12 +21,6 @@ import {
isFourZeroOneError,
addAdditionalData,
} from 'Utils/TokenController'
-import {
- GET_MAPPING,
- UPDATE_PERMISSIONS_TO_SERVER,
- ADD_MAPPING_ROLE_PERMISSIONS,
- DELETE_MAPPING,
-} from '../actions/types'
import MappingApi from '../api/MappingApi'
import { getClient } from 'Redux/api/base'
import { postUserAction } from 'Redux/api/backend-api'
@@ -48,7 +42,7 @@ export function* fetchMapping({ payload }) {
addAdditionalData(audit, FETCH, API_MAPPING, payload)
const mappingApi = yield* newFunction()
const data = yield call(mappingApi.getMappings)
- yield put(getMappingResponse(data))
+ yield put(getMappingResponse({ data }))
yield call(postUserAction, audit)
} catch (e) {
yield put(getMappingResponse(null))
@@ -60,15 +54,15 @@ export function* fetchMapping({ payload }) {
}
export function* updateMapping({ payload }) {
- yield put(updatePermissionsLoading(true))
+ yield put(updatePermissionsLoading({ data: true }))
try {
const mappingApi = yield* newFunction()
const data = yield call(mappingApi.updateMapping, payload.data)
yield put(updateToast(true, 'success'))
- yield put(updatePermissionsServerResponse(data))
+ yield put(updatePermissionsServerResponse({ data }))
} catch (e) {
yield put(updateToast(true, 'error'))
- yield put(updatePermissionsLoading(false))
+ yield put(updatePermissionsLoading({ data: false }))
yield put(getMappingResponse(null))
if (isFourZeroOneError(e)) {
const jwt = yield select((state) => state.authReducer.userinfo_jwt)
@@ -77,7 +71,7 @@ export function* updateMapping({ payload }) {
}
}
export function* addMapping({ payload }) {
- yield put(updatePermissionsLoading(true))
+ yield put(updatePermissionsLoading({ data: true }))
try {
const mappingApi = yield* newFunction()
const data = yield call(mappingApi.addMapping, payload.data)
@@ -85,7 +79,7 @@ export function* addMapping({ payload }) {
yield put(getMapping({}))
} catch (e) {
yield put(updateToast(true, 'error'))
- yield put(updatePermissionsLoading(false))
+ yield put(updatePermissionsLoading({ data: false }))
// yield put(getMappingResponse(null))
if (isFourZeroOneError(e)) {
const jwt = yield select((state) => state.authReducer.userinfo_jwt)
@@ -95,7 +89,7 @@ export function* addMapping({ payload }) {
}
export function* deleteMapping({ payload }) {
- yield put(updatePermissionsLoading(true))
+ yield put(updatePermissionsLoading({ data: true }))
try {
const mappingApi = yield* newFunction()
const data = yield call(mappingApi.deleteMapping, payload.data)
@@ -103,7 +97,7 @@ export function* deleteMapping({ payload }) {
yield put(getMapping({}))
} catch (e) {
yield put(updateToast(true, 'error'))
- yield put(updatePermissionsLoading(false))
+ yield put(updatePermissionsLoading({ data: false }))
// yield put(getMappingResponse(null))
if (isFourZeroOneError(e)) {
const jwt = yield select((state) => state.authReducer.userinfo_jwt)
@@ -113,10 +107,10 @@ export function* deleteMapping({ payload }) {
}
export function* watchGetMapping() {
- yield takeLatest(GET_MAPPING, fetchMapping)
- yield takeEvery(UPDATE_PERMISSIONS_TO_SERVER, updateMapping)
- yield takeEvery(ADD_MAPPING_ROLE_PERMISSIONS, addMapping)
- yield takeEvery(DELETE_MAPPING, deleteMapping)
+ yield takeLatest('mapping/getMapping', fetchMapping)
+ yield takeEvery('mapping/updatePermissionsToServer', updateMapping)
+ yield takeEvery('mapping/addNewRolePermissions', addMapping)
+ yield takeEvery('mapping/deleteMapping', deleteMapping)
}
export default function* rootSaga() {
diff --git a/admin-ui/plugins/auth-server/components/AuthN/AuthNListPage.js b/admin-ui/plugins/auth-server/components/AuthN/AuthNListPage.js
index 92d9ef04a..3d0311106 100644
--- a/admin-ui/plugins/auth-server/components/AuthN/AuthNListPage.js
+++ b/admin-ui/plugins/auth-server/components/AuthN/AuthNListPage.js
@@ -14,7 +14,7 @@ import { ThemeContext } from 'Context/theme/themeContext'
import getThemeColor from 'Context/theme/config'
import AuthNDetailPage from './AuthNDetailPage'
import { getLdapConfig } from 'Plugins/services/redux/actions/LdapActions'
-import { getCustomScriptByType } from 'Plugins/admin/redux/actions/CustomScriptActions'
+import { getCustomScriptByType } from 'Plugins/admin/redux/features/customScriptSlice'
import { setCurrentItem } from '../../redux/actions/AuthnActions'
import { getAcrsConfig } from 'Plugins/auth-server/redux/actions/AcrsActions'
@@ -56,7 +56,7 @@ function AuthNListPage() {
useEffect(() => {
dispatch(getLdapConfig())
- dispatch(getCustomScriptByType({ type: 'person_authentication' }))
+ dispatch(getCustomScriptByType({ action: { type: 'person_authentication' } }))
dispatch(getAcrsConfig())
return () => {
diff --git a/admin-ui/plugins/auth-server/components/Clients/ClientAddPage.js b/admin-ui/plugins/auth-server/components/Clients/ClientAddPage.js
index f7e315a2d..59c367965 100644
--- a/admin-ui/plugins/auth-server/components/Clients/ClientAddPage.js
+++ b/admin-ui/plugins/auth-server/components/Clients/ClientAddPage.js
@@ -6,7 +6,7 @@ import { useNavigate } from 'react-router-dom'
import { addNewClientAction } from 'Plugins/auth-server/redux/actions/OIDCActions'
import { getOidcDiscovery } from 'Redux/actions/OidcDiscoveryActions'
import { getScopes } from 'Plugins/auth-server/redux/features/scopeSlice'
-import { getScripts } from 'Redux/actions/InitActions'
+import { getScripts } from 'Redux/features/initSlice'
import { buildPayload } from 'Utils/PermChecker'
import GluuAlert from 'Routes/Apps/Gluu/GluuAlert'
import { useTranslation } from 'react-i18next'
@@ -32,7 +32,7 @@ function ClientAddPage({
dispatch(getScopes({ action: userAction }))
}
if (scripts.length < 1) {
- dispatch(getScripts(userAction))
+ dispatch(getScripts({ action: userAction }))
}
dispatch(getOidcDiscovery())
}, [])
diff --git a/admin-ui/plugins/auth-server/components/Clients/ClientAddPage.test.js b/admin-ui/plugins/auth-server/components/Clients/ClientAddPage.test.js
index 54fca205d..efa595a69 100644
--- a/admin-ui/plugins/auth-server/components/Clients/ClientAddPage.test.js
+++ b/admin-ui/plugins/auth-server/components/Clients/ClientAddPage.test.js
@@ -5,7 +5,7 @@ import { BrowserRouter as Router } from 'react-router-dom'
import { Provider } from 'react-redux'
import i18n from '../../../../app/i18n'
import { I18nextProvider } from 'react-i18next'
-import initReducer from 'Redux/reducers/InitReducer'
+import { reducer as initReducer } from 'Redux/features/initSlice'
import oidcDiscoveryReducer from 'Redux/reducers/OidcDiscoveryReducer'
import { reducer as scopeReducer} from 'Plugins/auth-server/redux/features/scopeSlice'
import umaResourceReducer from 'Plugins/auth-server/redux/reducers/UMAResourceReducer'
diff --git a/admin-ui/plugins/auth-server/components/Clients/ClientEditPage.js b/admin-ui/plugins/auth-server/components/Clients/ClientEditPage.js
index 50aad493b..42bc9f815 100644
--- a/admin-ui/plugins/auth-server/components/Clients/ClientEditPage.js
+++ b/admin-ui/plugins/auth-server/components/Clients/ClientEditPage.js
@@ -7,7 +7,7 @@ import { editClient } from 'Plugins/auth-server/redux/actions/OIDCActions'
import { getScopes, getScopeByCreator } from 'Plugins/auth-server/redux/features/scopeSlice'
import { getOidcDiscovery } from 'Redux/actions/OidcDiscoveryActions'
import { getUMAResourcesByClient } from 'Plugins/auth-server/redux/actions/UMAResourceActions'
-import { getScripts } from 'Redux/actions/InitActions'
+import { getScripts } from 'Redux/features/initSlice'
import { buildPayload } from 'Utils/PermChecker'
import GluuAlert from 'Routes/Apps/Gluu/GluuAlert'
import { useTranslation } from 'react-i18next'
@@ -39,7 +39,7 @@ function ClientEditPage({
dispatch(getScopes({ action: options }))
}
if (scripts.length < 1) {
- dispatch(getScripts(options))
+ dispatch(getScripts({ action: options }))
}
if (isEmpty(umaResources)) {
dispatch(getUMAResourcesByClient(clientData?.inum))
diff --git a/admin-ui/plugins/auth-server/components/Clients/ClientEditPage.test.js b/admin-ui/plugins/auth-server/components/Clients/ClientEditPage.test.js
index 7e133a2d4..eef0de7e7 100644
--- a/admin-ui/plugins/auth-server/components/Clients/ClientEditPage.test.js
+++ b/admin-ui/plugins/auth-server/components/Clients/ClientEditPage.test.js
@@ -3,7 +3,7 @@ import { render, screen } from '@testing-library/react'
import ClientEditPage from './ClientEditPage'
import { Provider } from 'react-redux'
import clients from './clients.test'
-import initReducer from 'Redux/reducers/InitReducer'
+import { reducer as initReducer } from 'Redux/features/initSlice'
import oidcDiscoveryReducer from 'Redux/reducers/OidcDiscoveryReducer'
import { reducer as scopeReducer} from 'Plugins/auth-server/redux/features/scopeSlice'
import umaResourceReducer from 'Plugins/auth-server/redux/reducers/UMAResourceReducer'
diff --git a/admin-ui/plugins/auth-server/components/Configuration/ConfigPage.js b/admin-ui/plugins/auth-server/components/Configuration/ConfigPage.js
index 8cf8c1de7..d1700c9f0 100644
--- a/admin-ui/plugins/auth-server/components/Configuration/ConfigPage.js
+++ b/admin-ui/plugins/auth-server/components/Configuration/ConfigPage.js
@@ -23,7 +23,7 @@ import applicationStyle from 'Routes/Apps/Gluu/styles/applicationstyle'
import DefaultAcrInput from './DefaultAcrInput'
import { SIMPLE_PASSWORD_AUTH, FETCHING_SCRIPTS } from 'Plugins/auth-server/common/Constants'
import { getAcrsConfig, editAcrs } from 'Plugins/auth-server/redux/actions/AcrsActions'
-import { getScripts } from 'Redux/actions/InitActions'
+import { getScripts } from 'Redux/features/initSlice'
function ConfigPage({ acrs, scripts, configuration, dispatch, permissions }) {
const { t } = useTranslation()
@@ -49,7 +49,7 @@ function ConfigPage({ acrs, scripts, configuration, dispatch, permissions }) {
buildPayload(userAction, FETCHING_JSON_PROPERTIES, {})
dispatch(getJsonConfig(userAction))
dispatch(getAcrsConfig())
- dispatch(getScripts(userAction))
+ dispatch(getScripts({ action: userAction }))
}, [])
useEffect(() => {
return () => {
diff --git a/admin-ui/plugins/auth-server/components/Scopes/ScopeAddPage.js b/admin-ui/plugins/auth-server/components/Scopes/ScopeAddPage.js
index bab62a08d..8add13e42 100644
--- a/admin-ui/plugins/auth-server/components/Scopes/ScopeAddPage.js
+++ b/admin-ui/plugins/auth-server/components/Scopes/ScopeAddPage.js
@@ -6,7 +6,7 @@ import ScopeForm from './ScopeForm'
import { addScope } from 'Plugins/auth-server/redux/features/scopeSlice'
import { buildPayload } from 'Utils/PermChecker'
import GluuLoader from 'Routes/Apps/Gluu/GluuLoader'
-import { getAttributes, getScripts } from 'Redux/actions/InitActions'
+import { getAttributes, getScripts } from 'Redux/features/initSlice'
import GluuAlert from 'Routes/Apps/Gluu/GluuAlert'
import { useTranslation } from 'react-i18next'
import applicationStyle from 'Routes/Apps/Gluu/styles/applicationstyle'
@@ -29,7 +29,7 @@ function ScopeAddPage({
}
if (scripts.length === 0) {
buildPayload(userAction, 'Fetch custom scripts', {})
- dispatch(getScripts(userAction))
+ dispatch(getScripts({ action: userAction }))
}
}, [])
diff --git a/admin-ui/plugins/auth-server/components/Scopes/ScopeEditPage.js b/admin-ui/plugins/auth-server/components/Scopes/ScopeEditPage.js
index b60845497..e2c8e92fb 100644
--- a/admin-ui/plugins/auth-server/components/Scopes/ScopeEditPage.js
+++ b/admin-ui/plugins/auth-server/components/Scopes/ScopeEditPage.js
@@ -8,7 +8,7 @@ import { buildPayload } from 'Utils/PermChecker'
import {
getAttributes,
getScripts
-} from 'Redux/actions/InitActions'
+} from 'Redux/features/initSlice'
import GluuAlert from 'Routes/Apps/Gluu/GluuAlert'
import { useTranslation } from 'react-i18next'
import applicationStyle from 'Routes/Apps/Gluu/styles/applicationstyle'
@@ -33,7 +33,7 @@ function ScopeEditPage({ scope, loading, dispatch, scripts, attributes, saveOper
}
if (scripts.length === 0) {
buildPayload(userAction, 'Fetch custom scripts', {})
- dispatch(getScripts(userAction))
+ dispatch(getScripts({ action: userAction }))
}
}, [])
useEffect(() => {
@@ -62,7 +62,7 @@ function ScopeEditPage({ scope, loading, dispatch, scripts, attributes, saveOper
{
state.loading = false
state.saveOperationFlag = true
- if (action.payload.data) {
+ if (action.payload?.data) {
state.items = [...state.items]
state.errorInSaveOperationFlag = false
} else {
diff --git a/admin-ui/plugins/user-management/components/UserManagement/UserList.js b/admin-ui/plugins/user-management/components/UserManagement/UserList.js
index ded6e9e16..77db4ff78 100644
--- a/admin-ui/plugins/user-management/components/UserManagement/UserList.js
+++ b/admin-ui/plugins/user-management/components/UserManagement/UserList.js
@@ -25,7 +25,7 @@ import {
import GluuAdvancedSearch from 'Routes/Apps/Gluu/GluuAdvancedSearch'
import GluuCommitDialog from '../../../../app/routes/Apps/Gluu/GluuCommitDialog'
import SetTitle from 'Utils/SetTitle'
-import { getRoles } from '../../../admin/redux/actions/ApiRoleActions'
+import { getRoles } from 'Plugins/admin/redux/features/apiRoleSlice'
import GluuLoader from 'Routes/Apps/Gluu/GluuLoader'
import { ThemeContext } from 'Context/theme/themeContext'
import getThemeColor from 'Context/theme/config'