PromucFlow_constructor/app/client/src/reducers/entityReducers/datasourceReducer.ts

298 lines
7.6 KiB
TypeScript
Raw Normal View History

2019-11-25 05:07:27 +00:00
import { createReducer } from "utils/AppsmithUtils";
2020-01-27 13:53:33 +00:00
import {
ReduxActionTypes,
ReduxAction,
ReduxActionErrorTypes,
} from "constants/ReduxActionConstants";
[Feature #4542] : simple nav unify api/datasource (#4987) * temp commit * using onsubmit to continue using action on form * added recaptcha site key to env example file * moved the recaptcha lib loading logic to signup page * removed unnecessary edit * handle the case where the recaptcha token is not provided as env var * added proper env var config for client * recaptcha config for ansible * recaptcha config for heroku * recaptcha config for k8s * updated app.json * fixed the typos * added more description for env vars * removed api key * minor typo fix * added new integration button * updated the add int default link * added active and create new tabs * added the empty components to tabs. will control the section manually. * added proper grid for integrations page * added vertical tabs * Added secondary tabs to integrations page * added separate page for new apis * classname changes * added new components for active queries, new queries etc. * added a separate component for data source list * adding screen component conditionally, to be showing upon user's choice * 1. Added grid styling to datasource home 2. Added connect buttons to em * fixed data source security banner * updated the styling for new api page * added tertiary menu for active integrations * updated styling for active connections * updated collapse component to work properly * added show more option to active data sources * removed apis/db tabs and replaced em with integrations tab * removed the unnecessary + integrations btn * Ordered the action entries under integrations * updated the getURL with proper params * updated the link of create datasource btn * updated the back btn link from data source editor * added scrollable content to create new * added on click scroll to create new page * fixed a bug, creating new datasource twice * added new action creator for integrations. * updated the query editor to match the over all theme * updated the query editor tabs * Added the run btn to empty response screens * minor fix * updated the bg color of api type drop down * updated the url being visited after delete api/query * removed log * removed unnecessary junk from integrations editor index * clean up, removed unnecessary files * removed useless routes * for debugger only checking if integrations editor * Removed all the links for api/query home pages * not routing to integrations on create query/api * removed the query/datasource/api home pages * fixed scrolling issue * will show a list of queries and apis for action picker * showing icons for each action under integrations * added a way to list data sources in action creators * cam show icons for datasources * linked integration tab movement to URL * fixed the create new query bug * removed search * added the auto redirection mode * added new mode to support showing mock data bases * on click show more works properly * removed extra padding * removed height * showing all the data sources on active tab * fixed the creation of google sheet * updated the proper routing for curl * fixed page height * removed loader * added a spinner for creating a new api * will be showing edit/add query permanantly * updated the redirection on save and delete datasource * fixed the redirection logic on delete * will not show security banner * added empty state for active data sources * updated the hover state * minor fix to redirect on delete from entity pane * fixed a cy command to create new api * fixed a command to select api/query from lightning menu * updated the navigate to data source editor * removed add btns for new int creation * updated the testSaveDeleteDatasource command * fixed bind table text pagination spec * more test case fixes for deleting a query using context menu * update curl test * updated curl post import spec * fixed click from apis to integrations * updated execute db query command + updated delete query mech * updated CreationOfUniqueAPIcheck command * updated query datasource spec * fixed an action creator bug. * fixed curl api creation bug * removed irrelavent part of the test * fixed the button colors * updated back link from datasource page * Revert url validation changes for the debugger since this is used to check whether we are on a query or an api and show its dependencies * updated a test case to open integrations option in action selectors * Update app/client/src/pages/Editor/IntegrationEditor/DatasourceCard.tsx Co-authored-by: Rishabh Saxena <rishabh.robben@gmail.com> * separated msg * styling fixes for collapse component * renamed a file * declared a new const in theme * updated border * removed a faint line from collapse card * removed unnecessary condition * updated component name * log removed * split action creator file * updated the icon usage in action creators * can properly fetch mock data sources * can show mock databases in create new * can use mock db sources * fixed the scrollbars * updated the api icon for both global search + action creator * updated integrations name in datasources * added a back to canvas ribbon * updated query and api editor to show back to canvas ribbon * added a ribbon to go back * updated button styles * updated the action creator and test commands/classes * updates to show the proper mock databases * added proper type for mock datasources * removed unnecessary log * updated a test case to work with new nav * minor updates for tests * updated a command to properly delete a datasource * minor redirection fix * made the mock db api call unblocking * fixed scroll bars all over * fixed bg colors for back ribbons * declared a constant for thin scrollbar * removed unnecessary action. Co-authored-by: Akash N <akash@codemonk.in> Co-authored-by: Rishabh Saxena <rishabh.robben@gmail.com>
2021-06-30 18:21:52 +00:00
import {
Datasource,
DatasourceStructure,
MockDatasource,
} from "entities/Datasource";
2019-11-07 09:32:38 +00:00
export interface DatasourceDataState {
list: Datasource[];
loading: boolean;
isTesting: boolean;
isDeleting: boolean;
fetchingDatasourceStructure: boolean;
isRefreshingStructure: boolean;
structure: Record<string, DatasourceStructure>;
[Feature #4542] : simple nav unify api/datasource (#4987) * temp commit * using onsubmit to continue using action on form * added recaptcha site key to env example file * moved the recaptcha lib loading logic to signup page * removed unnecessary edit * handle the case where the recaptcha token is not provided as env var * added proper env var config for client * recaptcha config for ansible * recaptcha config for heroku * recaptcha config for k8s * updated app.json * fixed the typos * added more description for env vars * removed api key * minor typo fix * added new integration button * updated the add int default link * added active and create new tabs * added the empty components to tabs. will control the section manually. * added proper grid for integrations page * added vertical tabs * Added secondary tabs to integrations page * added separate page for new apis * classname changes * added new components for active queries, new queries etc. * added a separate component for data source list * adding screen component conditionally, to be showing upon user's choice * 1. Added grid styling to datasource home 2. Added connect buttons to em * fixed data source security banner * updated the styling for new api page * added tertiary menu for active integrations * updated styling for active connections * updated collapse component to work properly * added show more option to active data sources * removed apis/db tabs and replaced em with integrations tab * removed the unnecessary + integrations btn * Ordered the action entries under integrations * updated the getURL with proper params * updated the link of create datasource btn * updated the back btn link from data source editor * added scrollable content to create new * added on click scroll to create new page * fixed a bug, creating new datasource twice * added new action creator for integrations. * updated the query editor to match the over all theme * updated the query editor tabs * Added the run btn to empty response screens * minor fix * updated the bg color of api type drop down * updated the url being visited after delete api/query * removed log * removed unnecessary junk from integrations editor index * clean up, removed unnecessary files * removed useless routes * for debugger only checking if integrations editor * Removed all the links for api/query home pages * not routing to integrations on create query/api * removed the query/datasource/api home pages * fixed scrolling issue * will show a list of queries and apis for action picker * showing icons for each action under integrations * added a way to list data sources in action creators * cam show icons for datasources * linked integration tab movement to URL * fixed the create new query bug * removed search * added the auto redirection mode * added new mode to support showing mock data bases * on click show more works properly * removed extra padding * removed height * showing all the data sources on active tab * fixed the creation of google sheet * updated the proper routing for curl * fixed page height * removed loader * added a spinner for creating a new api * will be showing edit/add query permanantly * updated the redirection on save and delete datasource * fixed the redirection logic on delete * will not show security banner * added empty state for active data sources * updated the hover state * minor fix to redirect on delete from entity pane * fixed a cy command to create new api * fixed a command to select api/query from lightning menu * updated the navigate to data source editor * removed add btns for new int creation * updated the testSaveDeleteDatasource command * fixed bind table text pagination spec * more test case fixes for deleting a query using context menu * update curl test * updated curl post import spec * fixed click from apis to integrations * updated execute db query command + updated delete query mech * updated CreationOfUniqueAPIcheck command * updated query datasource spec * fixed an action creator bug. * fixed curl api creation bug * removed irrelavent part of the test * fixed the button colors * updated back link from datasource page * Revert url validation changes for the debugger since this is used to check whether we are on a query or an api and show its dependencies * updated a test case to open integrations option in action selectors * Update app/client/src/pages/Editor/IntegrationEditor/DatasourceCard.tsx Co-authored-by: Rishabh Saxena <rishabh.robben@gmail.com> * separated msg * styling fixes for collapse component * renamed a file * declared a new const in theme * updated border * removed a faint line from collapse card * removed unnecessary condition * updated component name * log removed * split action creator file * updated the icon usage in action creators * can properly fetch mock data sources * can show mock databases in create new * can use mock db sources * fixed the scrollbars * updated the api icon for both global search + action creator * updated integrations name in datasources * added a back to canvas ribbon * updated query and api editor to show back to canvas ribbon * added a ribbon to go back * updated button styles * updated the action creator and test commands/classes * updates to show the proper mock databases * added proper type for mock datasources * removed unnecessary log * updated a test case to work with new nav * minor updates for tests * updated a command to properly delete a datasource * minor redirection fix * made the mock db api call unblocking * fixed scroll bars all over * fixed bg colors for back ribbons * declared a constant for thin scrollbar * removed unnecessary action. Co-authored-by: Akash N <akash@codemonk.in> Co-authored-by: Rishabh Saxena <rishabh.robben@gmail.com>
2021-06-30 18:21:52 +00:00
isFetchingMockDataSource: false;
mockDatasourceList: any[];
}
2019-11-07 09:32:38 +00:00
const initialState: DatasourceDataState = {
list: [],
loading: false,
isTesting: false,
isDeleting: false,
fetchingDatasourceStructure: false,
isRefreshingStructure: false,
structure: {},
[Feature #4542] : simple nav unify api/datasource (#4987) * temp commit * using onsubmit to continue using action on form * added recaptcha site key to env example file * moved the recaptcha lib loading logic to signup page * removed unnecessary edit * handle the case where the recaptcha token is not provided as env var * added proper env var config for client * recaptcha config for ansible * recaptcha config for heroku * recaptcha config for k8s * updated app.json * fixed the typos * added more description for env vars * removed api key * minor typo fix * added new integration button * updated the add int default link * added active and create new tabs * added the empty components to tabs. will control the section manually. * added proper grid for integrations page * added vertical tabs * Added secondary tabs to integrations page * added separate page for new apis * classname changes * added new components for active queries, new queries etc. * added a separate component for data source list * adding screen component conditionally, to be showing upon user's choice * 1. Added grid styling to datasource home 2. Added connect buttons to em * fixed data source security banner * updated the styling for new api page * added tertiary menu for active integrations * updated styling for active connections * updated collapse component to work properly * added show more option to active data sources * removed apis/db tabs and replaced em with integrations tab * removed the unnecessary + integrations btn * Ordered the action entries under integrations * updated the getURL with proper params * updated the link of create datasource btn * updated the back btn link from data source editor * added scrollable content to create new * added on click scroll to create new page * fixed a bug, creating new datasource twice * added new action creator for integrations. * updated the query editor to match the over all theme * updated the query editor tabs * Added the run btn to empty response screens * minor fix * updated the bg color of api type drop down * updated the url being visited after delete api/query * removed log * removed unnecessary junk from integrations editor index * clean up, removed unnecessary files * removed useless routes * for debugger only checking if integrations editor * Removed all the links for api/query home pages * not routing to integrations on create query/api * removed the query/datasource/api home pages * fixed scrolling issue * will show a list of queries and apis for action picker * showing icons for each action under integrations * added a way to list data sources in action creators * cam show icons for datasources * linked integration tab movement to URL * fixed the create new query bug * removed search * added the auto redirection mode * added new mode to support showing mock data bases * on click show more works properly * removed extra padding * removed height * showing all the data sources on active tab * fixed the creation of google sheet * updated the proper routing for curl * fixed page height * removed loader * added a spinner for creating a new api * will be showing edit/add query permanantly * updated the redirection on save and delete datasource * fixed the redirection logic on delete * will not show security banner * added empty state for active data sources * updated the hover state * minor fix to redirect on delete from entity pane * fixed a cy command to create new api * fixed a command to select api/query from lightning menu * updated the navigate to data source editor * removed add btns for new int creation * updated the testSaveDeleteDatasource command * fixed bind table text pagination spec * more test case fixes for deleting a query using context menu * update curl test * updated curl post import spec * fixed click from apis to integrations * updated execute db query command + updated delete query mech * updated CreationOfUniqueAPIcheck command * updated query datasource spec * fixed an action creator bug. * fixed curl api creation bug * removed irrelavent part of the test * fixed the button colors * updated back link from datasource page * Revert url validation changes for the debugger since this is used to check whether we are on a query or an api and show its dependencies * updated a test case to open integrations option in action selectors * Update app/client/src/pages/Editor/IntegrationEditor/DatasourceCard.tsx Co-authored-by: Rishabh Saxena <rishabh.robben@gmail.com> * separated msg * styling fixes for collapse component * renamed a file * declared a new const in theme * updated border * removed a faint line from collapse card * removed unnecessary condition * updated component name * log removed * split action creator file * updated the icon usage in action creators * can properly fetch mock data sources * can show mock databases in create new * can use mock db sources * fixed the scrollbars * updated the api icon for both global search + action creator * updated integrations name in datasources * added a back to canvas ribbon * updated query and api editor to show back to canvas ribbon * added a ribbon to go back * updated button styles * updated the action creator and test commands/classes * updates to show the proper mock databases * added proper type for mock datasources * removed unnecessary log * updated a test case to work with new nav * minor updates for tests * updated a command to properly delete a datasource * minor redirection fix * made the mock db api call unblocking * fixed scroll bars all over * fixed bg colors for back ribbons * declared a constant for thin scrollbar * removed unnecessary action. Co-authored-by: Akash N <akash@codemonk.in> Co-authored-by: Rishabh Saxena <rishabh.robben@gmail.com>
2021-06-30 18:21:52 +00:00
isFetchingMockDataSource: false,
mockDatasourceList: [],
};
2019-11-07 09:32:38 +00:00
const datasourceReducer = createReducer(initialState, {
[Feature #4542] : simple nav unify api/datasource (#4987) * temp commit * using onsubmit to continue using action on form * added recaptcha site key to env example file * moved the recaptcha lib loading logic to signup page * removed unnecessary edit * handle the case where the recaptcha token is not provided as env var * added proper env var config for client * recaptcha config for ansible * recaptcha config for heroku * recaptcha config for k8s * updated app.json * fixed the typos * added more description for env vars * removed api key * minor typo fix * added new integration button * updated the add int default link * added active and create new tabs * added the empty components to tabs. will control the section manually. * added proper grid for integrations page * added vertical tabs * Added secondary tabs to integrations page * added separate page for new apis * classname changes * added new components for active queries, new queries etc. * added a separate component for data source list * adding screen component conditionally, to be showing upon user's choice * 1. Added grid styling to datasource home 2. Added connect buttons to em * fixed data source security banner * updated the styling for new api page * added tertiary menu for active integrations * updated styling for active connections * updated collapse component to work properly * added show more option to active data sources * removed apis/db tabs and replaced em with integrations tab * removed the unnecessary + integrations btn * Ordered the action entries under integrations * updated the getURL with proper params * updated the link of create datasource btn * updated the back btn link from data source editor * added scrollable content to create new * added on click scroll to create new page * fixed a bug, creating new datasource twice * added new action creator for integrations. * updated the query editor to match the over all theme * updated the query editor tabs * Added the run btn to empty response screens * minor fix * updated the bg color of api type drop down * updated the url being visited after delete api/query * removed log * removed unnecessary junk from integrations editor index * clean up, removed unnecessary files * removed useless routes * for debugger only checking if integrations editor * Removed all the links for api/query home pages * not routing to integrations on create query/api * removed the query/datasource/api home pages * fixed scrolling issue * will show a list of queries and apis for action picker * showing icons for each action under integrations * added a way to list data sources in action creators * cam show icons for datasources * linked integration tab movement to URL * fixed the create new query bug * removed search * added the auto redirection mode * added new mode to support showing mock data bases * on click show more works properly * removed extra padding * removed height * showing all the data sources on active tab * fixed the creation of google sheet * updated the proper routing for curl * fixed page height * removed loader * added a spinner for creating a new api * will be showing edit/add query permanantly * updated the redirection on save and delete datasource * fixed the redirection logic on delete * will not show security banner * added empty state for active data sources * updated the hover state * minor fix to redirect on delete from entity pane * fixed a cy command to create new api * fixed a command to select api/query from lightning menu * updated the navigate to data source editor * removed add btns for new int creation * updated the testSaveDeleteDatasource command * fixed bind table text pagination spec * more test case fixes for deleting a query using context menu * update curl test * updated curl post import spec * fixed click from apis to integrations * updated execute db query command + updated delete query mech * updated CreationOfUniqueAPIcheck command * updated query datasource spec * fixed an action creator bug. * fixed curl api creation bug * removed irrelavent part of the test * fixed the button colors * updated back link from datasource page * Revert url validation changes for the debugger since this is used to check whether we are on a query or an api and show its dependencies * updated a test case to open integrations option in action selectors * Update app/client/src/pages/Editor/IntegrationEditor/DatasourceCard.tsx Co-authored-by: Rishabh Saxena <rishabh.robben@gmail.com> * separated msg * styling fixes for collapse component * renamed a file * declared a new const in theme * updated border * removed a faint line from collapse card * removed unnecessary condition * updated component name * log removed * split action creator file * updated the icon usage in action creators * can properly fetch mock data sources * can show mock databases in create new * can use mock db sources * fixed the scrollbars * updated the api icon for both global search + action creator * updated integrations name in datasources * added a back to canvas ribbon * updated query and api editor to show back to canvas ribbon * added a ribbon to go back * updated button styles * updated the action creator and test commands/classes * updates to show the proper mock databases * added proper type for mock datasources * removed unnecessary log * updated a test case to work with new nav * minor updates for tests * updated a command to properly delete a datasource * minor redirection fix * made the mock db api call unblocking * fixed scroll bars all over * fixed bg colors for back ribbons * declared a constant for thin scrollbar * removed unnecessary action. Co-authored-by: Akash N <akash@codemonk.in> Co-authored-by: Rishabh Saxena <rishabh.robben@gmail.com>
2021-06-30 18:21:52 +00:00
[ReduxActionTypes.FETCH_MOCK_DATASOURCES_INIT]: (
state: DatasourceDataState,
) => {
return { ...state, isFetchingMockDataSource: true };
},
[ReduxActionTypes.FETCH_MOCK_DATASOURCES_SUCCESS]: (
state: DatasourceDataState,
action: ReduxAction<any>,
) => {
const mockDatasourceList = Object.keys(action.payload).map((dbKey) => ({
...action.payload[dbKey],
name: dbKey,
})) as MockDatasource[];
return { ...state, isFetchingMockDataSource: false, mockDatasourceList };
},
[ReduxActionErrorTypes.FETCH_MOCK_DATASOURCES_ERROR]: (
state: DatasourceDataState,
) => {
return { ...state, isFetchingMockDataSource: false };
},
[ReduxActionTypes.ADD_MOCK_DATASOURCES_INIT]: (
state: DatasourceDataState,
) => {
return { ...state, loading: true };
},
[ReduxActionTypes.ADD_MOCK_DATASOURCES_SUCCESS]: (
state: DatasourceDataState,
action: ReduxAction<Datasource>,
) => {
return {
...state,
loading: false,
list: state.list.concat(action.payload),
};
},
[ReduxActionErrorTypes.FETCH_MOCK_DATASOURCES_ERROR]: (
state: DatasourceDataState,
) => {
return { ...state, loading: false };
},
2019-11-07 09:32:38 +00:00
[ReduxActionTypes.FETCH_DATASOURCES_INIT]: (state: DatasourceDataState) => {
return { ...state, loading: true };
},
2019-11-07 09:32:38 +00:00
[ReduxActionTypes.CREATE_DATASOURCE_INIT]: (state: DatasourceDataState) => {
return { ...state, loading: true };
},
[ReduxActionTypes.CREATE_DATASOURCE_FROM_FORM_INIT]: (
state: DatasourceDataState,
) => {
return { ...state, loading: true };
},
[ReduxActionTypes.UPDATE_DATASOURCE_INIT]: (state: DatasourceDataState) => {
return { ...state, loading: true };
},
[ReduxActionTypes.TEST_DATASOURCE_INIT]: (state: DatasourceDataState) => {
return { ...state, isTesting: true };
},
[ReduxActionTypes.DELETE_DATASOURCE_INIT]: (state: DatasourceDataState) => {
return { ...state, isDeleting: true };
},
[ReduxActionTypes.REFRESH_DATASOURCE_STRUCTURE_INIT]: (
state: DatasourceDataState,
) => {
return { ...state, isRefreshingStructure: true };
},
[ReduxActionTypes.FETCH_DATASOURCE_STRUCTURE_INIT]: (
state: DatasourceDataState,
) => {
return { ...state, fetchingDatasourceStructure: true };
},
[ReduxActionTypes.FETCH_DATASOURCE_STRUCTURE_SUCCESS]: (
state: DatasourceDataState,
action: ReduxAction<{ data: DatasourceStructure; datasourceId: string }>,
) => {
return {
...state,
fetchingDatasourceStructure: false,
structure: {
...state.structure,
[action.payload.datasourceId]: action.payload.data,
},
};
},
[ReduxActionTypes.REFRESH_DATASOURCE_STRUCTURE_SUCCESS]: (
state: DatasourceDataState,
action: ReduxAction<{ data: DatasourceStructure; datasourceId: string }>,
) => {
return {
...state,
isRefreshingStructure: false,
structure: {
...state.structure,
[action.payload.datasourceId]: action.payload.data,
},
};
},
[ReduxActionErrorTypes.FETCH_DATASOURCE_STRUCTURE_ERROR]: (
state: DatasourceDataState,
) => {
return {
...state,
fetchingDatasourceStructure: false,
};
},
2019-11-07 09:32:38 +00:00
[ReduxActionTypes.FETCH_DATASOURCES_SUCCESS]: (
state: DatasourceDataState,
action: ReduxAction<Datasource[]>,
) => {
return {
...state,
loading: false,
list: action.payload,
};
},
[ReduxActionTypes.PREFILL_DATASOURCE]: (
state: DatasourceDataState,
action: ReduxAction<Datasource[]>,
) => {
return {
...state,
loading: false,
list: action.payload,
};
},
[ReduxActionTypes.TEST_DATASOURCE_SUCCESS]: (
state: DatasourceDataState,
action: ReduxAction<{
show: boolean;
id?: string;
messages?: Array<string>;
error?: any;
}>,
): DatasourceDataState => {
if (action.payload.id) {
const list = state.list.map((datasource) => {
if (datasource.id === action.payload.id) {
return { ...datasource, messages: action.payload.messages };
}
return datasource;
});
return {
...state,
isTesting: false,
list: list,
};
}
return {
...state,
isTesting: false,
};
},
[ReduxActionTypes.DELETE_DATASOURCE_SUCCESS]: (
state: DatasourceDataState,
action: ReduxAction<Datasource>,
) => {
return {
...state,
isDeleting: false,
list: state.list.filter(
2020-12-24 04:32:25 +00:00
(datasource) => datasource.id !== action.payload.id,
),
};
},
2019-11-07 09:32:38 +00:00
[ReduxActionTypes.CREATE_DATASOURCE_SUCCESS]: (
state: DatasourceDataState,
action: ReduxAction<Datasource>,
) => {
return {
...state,
loading: false,
list: state.list.concat(action.payload),
};
},
[ReduxActionTypes.UPDATE_DATASOURCE_SUCCESS]: (
state: DatasourceDataState,
action: ReduxAction<Datasource>,
): DatasourceDataState => {
return {
...state,
loading: false,
2020-12-24 04:32:25 +00:00
list: state.list.map((datasource) => {
if (datasource.id === action.payload.id) return action.payload;
return datasource;
}),
};
},
2020-08-26 05:24:44 +00:00
[ReduxActionTypes.SAVE_DATASOURCE_NAME_SUCCESS]: (
state: DatasourceDataState,
action: ReduxAction<Datasource>,
): DatasourceDataState => {
return {
...state,
loading: false,
2020-12-24 04:32:25 +00:00
list: state.list.map((datasource) => {
2020-08-26 05:24:44 +00:00
if (datasource.id === action.payload.id) return action.payload;
return datasource;
}),
};
},
2020-01-27 13:53:33 +00:00
[ReduxActionErrorTypes.CREATE_DATASOURCE_ERROR]: (
state: DatasourceDataState,
) => {
return {
...state,
loading: false,
};
},
[ReduxActionErrorTypes.DELETE_DATASOURCE_ERROR]: (
state: DatasourceDataState,
) => {
return { ...state, isDeleting: false };
},
[ReduxActionErrorTypes.TEST_DATASOURCE_ERROR]: (
state: DatasourceDataState,
action: ReduxAction<{
show: boolean;
id?: string;
messages?: Array<string>;
error?: any;
}>,
): DatasourceDataState => {
if (action.payload.id) {
const list = state.list.map((datasource) => {
if (datasource.id === action.payload.id) {
return { ...datasource, messages: action.payload.messages };
}
return datasource;
});
return {
...state,
isTesting: false,
list: list,
};
}
return {
...state,
isTesting: false,
};
},
[ReduxActionErrorTypes.UPDATE_DATASOURCE_ERROR]: (
state: DatasourceDataState,
): DatasourceDataState => {
return {
...state,
loading: false,
};
},
[ReduxActionErrorTypes.REFRESH_DATASOURCE_STRUCTURE_ERROR]: (
state: DatasourceDataState,
) => {
return {
...state,
isRefreshingStructure: false,
};
},
});
2019-11-07 09:32:38 +00:00
export default datasourceReducer;