From c7158da79f032421520b863d041906143ff9c3f6 Mon Sep 17 00:00:00 2001 From: Sangeeth Sivan <74818788+berzerkeer@users.noreply.github.com> Date: Mon, 22 Aug 2022 23:07:59 +0530 Subject: [PATCH] chore: code split sagas and reducers for abac (#16134) * chore: code splitted sagas and reducers * chore: add comment instead of disabling rule for empty function --- app/client/src/ce/reducers/aclReducer.ts | 27 ++++++++++++++++++++++++ app/client/src/ce/sagas/AclSagas.tsx | 3 +++ app/client/src/ee/reducers/aclReducer.ts | 5 +++++ app/client/src/ee/sagas/AclSagas.tsx | 5 +++++ app/client/src/reducers/index.tsx | 3 +++ app/client/src/sagas/index.tsx | 2 ++ 6 files changed, 45 insertions(+) create mode 100644 app/client/src/ce/reducers/aclReducer.ts create mode 100644 app/client/src/ce/sagas/AclSagas.tsx create mode 100644 app/client/src/ee/reducers/aclReducer.ts create mode 100644 app/client/src/ee/sagas/AclSagas.tsx diff --git a/app/client/src/ce/reducers/aclReducer.ts b/app/client/src/ce/reducers/aclReducer.ts new file mode 100644 index 0000000000..bfd158c872 --- /dev/null +++ b/app/client/src/ce/reducers/aclReducer.ts @@ -0,0 +1,27 @@ +import { createReducer } from "utils/ReducerUtils"; + +export const initialState: AclReduxState = { + isLoading: false, + isSaving: false, + users: [], + groups: [], + roles: [], + selectedUser: null, + selectedGroup: null, + selectedRole: null, +}; + +export interface AclReduxState { + isLoading: boolean; + isSaving: boolean; + users: any[]; + groups: any[]; + roles: any[]; + selectedUser: any; + selectedGroup: any; + selectedRole: any; +} + +export const handlers = {}; + +export default createReducer(initialState, handlers); diff --git a/app/client/src/ce/sagas/AclSagas.tsx b/app/client/src/ce/sagas/AclSagas.tsx new file mode 100644 index 0000000000..fd28d1a4f0 --- /dev/null +++ b/app/client/src/ce/sagas/AclSagas.tsx @@ -0,0 +1,3 @@ +export default function* AclSagas() { + // No sagas for CE yet +} diff --git a/app/client/src/ee/reducers/aclReducer.ts b/app/client/src/ee/reducers/aclReducer.ts new file mode 100644 index 0000000000..91361ef84b --- /dev/null +++ b/app/client/src/ee/reducers/aclReducer.ts @@ -0,0 +1,5 @@ +export * from "ce/reducers/aclReducer"; +import { handlers, initialState } from "ce/reducers/aclReducer"; +import { createReducer } from "utils/ReducerUtils"; + +export default createReducer(initialState, handlers); diff --git a/app/client/src/ee/sagas/AclSagas.tsx b/app/client/src/ee/sagas/AclSagas.tsx new file mode 100644 index 0000000000..6179921d09 --- /dev/null +++ b/app/client/src/ee/sagas/AclSagas.tsx @@ -0,0 +1,5 @@ +export * from "ce/sagas/AclSagas"; + +export default function* AclSagas() { + // No sagas for CE yet +} diff --git a/app/client/src/reducers/index.tsx b/app/client/src/reducers/index.tsx index e649cab1b5..1e1822c442 100644 --- a/app/client/src/reducers/index.tsx +++ b/app/client/src/reducers/index.tsx @@ -59,6 +59,7 @@ import { MainCanvasReduxState } from "./uiReducers/mainCanvasReducer"; import SettingsReducer, { SettingsReduxState, } from "@appsmith/reducers/settingsReducer"; +import aclReducer, { AclReduxState } from "@appsmith/reducers/aclReducer"; import { TriggerValuesEvaluationState } from "./evaluationReducers/triggerReducer"; import { CanvasWidgetStructure } from "widgets/constants"; @@ -68,6 +69,7 @@ const appReducer = combineReducers({ evaluations: evaluationsReducer, form: formReducer, settings: SettingsReducer, + acl: aclReducer, }); export default appReducer; @@ -138,4 +140,5 @@ export interface AppState { [key: string]: any; }; settings: SettingsReduxState; + acl: AclReduxState; } diff --git a/app/client/src/sagas/index.tsx b/app/client/src/sagas/index.tsx index 424ebedf5e..46a8f90ec4 100644 --- a/app/client/src/sagas/index.tsx +++ b/app/client/src/sagas/index.tsx @@ -42,6 +42,7 @@ import * as sentry from "@sentry/react"; import formEvaluationChangeListener from "./FormEvaluationSaga"; import SuperUserSagas from "@appsmith/sagas/SuperUserSagas"; import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants"; +import AclSagas from "@appsmith/sagas/AclSagas"; const sagas = [ initSagas, @@ -84,6 +85,7 @@ const sagas = [ gitSyncSagas, SuperUserSagas, appThemingSaga, + AclSagas, ]; export function* rootSaga(sagasToRun = sagas): any {