2021-02-11 12:28:06 +00:00
|
|
|
import {
|
|
|
|
|
ReduxAction,
|
|
|
|
|
ReduxActionTypes,
|
|
|
|
|
ReduxActionWithCallbacks,
|
|
|
|
|
} from "constants/ReduxActionConstants";
|
2021-01-12 04:17:28 +00:00
|
|
|
import { CreateDatasourceConfig } from "api/DatasourcesApi";
|
|
|
|
|
import { Datasource } from "entities/Datasource";
|
2020-04-28 06:52:53 +00:00
|
|
|
|
2020-05-07 04:44:52 +00:00
|
|
|
export const createDatasourceFromForm = (payload: CreateDatasourceConfig) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.CREATE_DATASOURCE_FROM_FORM_INIT,
|
|
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-02-11 12:28:06 +00:00
|
|
|
export const updateDatasource = (
|
|
|
|
|
payload: Datasource,
|
|
|
|
|
onSuccess?: ReduxAction<unknown>,
|
|
|
|
|
onError?: ReduxAction<unknown>,
|
|
|
|
|
): ReduxActionWithCallbacks<Datasource, unknown, unknown> => {
|
2020-04-28 06:52:53 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.UPDATE_DATASOURCE_INIT,
|
2020-09-02 06:07:18 +00:00
|
|
|
payload,
|
2021-02-11 12:28:06 +00:00
|
|
|
onSuccess,
|
|
|
|
|
onError,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-04-19 13:17:27 +00:00
|
|
|
export type UpdateDatasourceSuccessAction = {
|
|
|
|
|
type: string;
|
|
|
|
|
payload: Datasource;
|
|
|
|
|
redirect: boolean;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const updateDatasourceSuccess = (
|
|
|
|
|
payload: Datasource,
|
|
|
|
|
redirect = true,
|
|
|
|
|
): UpdateDatasourceSuccessAction => ({
|
|
|
|
|
type: ReduxActionTypes.UPDATE_DATASOURCE_SUCCESS,
|
|
|
|
|
payload,
|
|
|
|
|
redirect,
|
|
|
|
|
});
|
|
|
|
|
|
2021-02-16 12:28:03 +00:00
|
|
|
export const redirectAuthorizationCode = (
|
|
|
|
|
pageId: string,
|
|
|
|
|
datasourceId: string,
|
|
|
|
|
) => {
|
2021-02-11 12:28:06 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.REDIRECT_AUTHORIZATION_CODE,
|
|
|
|
|
payload: {
|
2021-02-16 12:28:03 +00:00
|
|
|
pageId,
|
|
|
|
|
datasourceId,
|
2021-02-11 12:28:06 +00:00
|
|
|
},
|
2020-04-28 06:52:53 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-09-21 09:11:42 +00:00
|
|
|
export const fetchDatasourceStructure = (id: string) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.FETCH_DATASOURCE_STRUCTURE_INIT,
|
|
|
|
|
payload: {
|
|
|
|
|
id,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-10-12 12:43:35 +00:00
|
|
|
export const expandDatasourceEntity = (id: string) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.EXPAND_DATASOURCE_ENTITY,
|
|
|
|
|
payload: id,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-09-29 04:17:25 +00:00
|
|
|
export const refreshDatasourceStructure = (id: string) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.REFRESH_DATASOURCE_STRUCTURE_INIT,
|
|
|
|
|
payload: {
|
|
|
|
|
id,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-08-26 05:24:44 +00:00
|
|
|
export const saveDatasourceName = (payload: { id: string; name: string }) => ({
|
|
|
|
|
type: ReduxActionTypes.SAVE_DATASOURCE_NAME,
|
|
|
|
|
payload: payload,
|
|
|
|
|
});
|
|
|
|
|
|
2020-05-19 06:10:59 +00:00
|
|
|
export const changeDatasource = (payload: Datasource) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.CHANGE_DATASOURCE,
|
|
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
export const switchDatasource = (id: string) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.SWITCH_DATASOURCE,
|
|
|
|
|
payload: { datasourceId: id },
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-04-28 06:52:53 +00:00
|
|
|
export const testDatasource = (payload: Partial<Datasource>) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.TEST_DATASOURCE_INIT,
|
|
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-04-29 10:03:56 +00:00
|
|
|
export const deleteDatasource = (payload: Partial<Datasource>) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.DELETE_DATASOURCE_INIT,
|
|
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-10-12 13:37:18 +00:00
|
|
|
export const setDatsourceEditorMode = (payload: {
|
|
|
|
|
id: string;
|
|
|
|
|
viewMode: boolean;
|
|
|
|
|
}) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.SET_DATASOURCE_EDITOR_MODE,
|
|
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-04-28 06:52:53 +00:00
|
|
|
export const fetchDatasources = () => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.FETCH_DATASOURCES_INIT,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const selectPlugin = (pluginId: string) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.SELECT_PLUGIN,
|
|
|
|
|
payload: {
|
|
|
|
|
pluginId,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const initDatasourcePane = (
|
|
|
|
|
pluginType: string,
|
|
|
|
|
urlId?: string,
|
|
|
|
|
): ReduxAction<{ pluginType: string; id?: string }> => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.INIT_DATASOURCE_PANE,
|
|
|
|
|
payload: { id: urlId, pluginType },
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-06-03 05:40:48 +00:00
|
|
|
export const storeAsDatasource = () => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.STORE_AS_DATASOURCE_INIT,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-04-28 06:52:53 +00:00
|
|
|
export default {
|
|
|
|
|
fetchDatasources,
|
|
|
|
|
initDatasourcePane,
|
|
|
|
|
selectPlugin,
|
|
|
|
|
};
|