chore: code split for EE PR 2169 (#26669)
## Description Code split for EE PR [#2169](https://github.com/appsmithorg/appsmith-ee/pull/2169) #### PR fixes following issue(s) Fixes [#2164 EE issue](https://github.com/appsmithorg/appsmith-ee/issues/2164)
This commit is contained in:
parent
2c2849b9df
commit
9f5cd47f0d
|
|
@ -1,2 +1,8 @@
|
||||||
// Redux action to show the environment info modal before deploy
|
// Redux action to show the environment info modal before deploy
|
||||||
export const showEnvironmentDeployInfoModal = () => ({});
|
export const showEnvironmentDeployInfoModal = () => ({});
|
||||||
|
|
||||||
|
// Redux action to update the current editing environment ID
|
||||||
|
export const setCurrentEditingEnvironmentID = (currentEditingId: string) => ({
|
||||||
|
type: "",
|
||||||
|
payload: { currentEditingId },
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,7 @@ import { getAppsmithConfigs } from "@appsmith/configs";
|
||||||
import * as Sentry from "@sentry/react";
|
import * as Sentry from "@sentry/react";
|
||||||
import { CONTENT_TYPE_HEADER_KEY } from "constants/ApiEditorConstants/CommonApiConstants";
|
import { CONTENT_TYPE_HEADER_KEY } from "constants/ApiEditorConstants/CommonApiConstants";
|
||||||
import { isAirgapped } from "@appsmith/utils/airgapHelpers";
|
import { isAirgapped } from "@appsmith/utils/airgapHelpers";
|
||||||
import {
|
import { getCurrentEnvironmentId } from "@appsmith/selectors/environmentSelectors";
|
||||||
getCurrentEnvironment,
|
|
||||||
getCurrentEditingEnvID,
|
|
||||||
} from "@appsmith/utils/Environments";
|
|
||||||
|
|
||||||
const executeActionRegex = /actions\/execute/;
|
const executeActionRegex = /actions\/execute/;
|
||||||
const timeoutErrorRegex = /timeout of (\d+)ms exceeded/;
|
const timeoutErrorRegex = /timeout of (\d+)ms exceeded/;
|
||||||
|
|
@ -49,6 +46,17 @@ export const BLOCKED_ROUTES_REGEX = new RegExp(
|
||||||
`^(${BLOCKED_ROUTES.join("|")})($|/)`,
|
`^(${BLOCKED_ROUTES.join("|")})($|/)`,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const ENV_ENABLED_ROUTES = [
|
||||||
|
"v1/datasources/[a-z0-9]+/structure",
|
||||||
|
"/v1/datasources/[a-z0-9]+/trigger",
|
||||||
|
"v1/actions/execute",
|
||||||
|
"v1/saas",
|
||||||
|
];
|
||||||
|
|
||||||
|
export const ENV_ENABLED_ROUTES_REGEX = new RegExp(
|
||||||
|
`^(${ENV_ENABLED_ROUTES.join("|")})($|/)`,
|
||||||
|
);
|
||||||
|
|
||||||
const makeExecuteActionResponse = (response: any): ActionExecutionResponse => ({
|
const makeExecuteActionResponse = (response: any): ActionExecutionResponse => ({
|
||||||
...response.data,
|
...response.data,
|
||||||
clientMeta: {
|
clientMeta: {
|
||||||
|
|
@ -86,8 +94,8 @@ export const apiRequestInterceptor = (config: AxiosRequestConfig) => {
|
||||||
config.headers["X-Requested-By"] = "Appsmith";
|
config.headers["X-Requested-By"] = "Appsmith";
|
||||||
}
|
}
|
||||||
|
|
||||||
const branch =
|
const state = store.getState();
|
||||||
getCurrentGitBranch(store.getState()) || getQueryParamsObject().branch;
|
const branch = getCurrentGitBranch(state) || getQueryParamsObject().branch;
|
||||||
if (branch && config.headers) {
|
if (branch && config.headers) {
|
||||||
config.headers.branchName = branch;
|
config.headers.branchName = branch;
|
||||||
}
|
}
|
||||||
|
|
@ -95,13 +103,11 @@ export const apiRequestInterceptor = (config: AxiosRequestConfig) => {
|
||||||
config.timeout = 1000 * 120; // increase timeout for git specific APIs
|
config.timeout = 1000 * 120; // increase timeout for git specific APIs
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add header for environment name
|
if (ENV_ENABLED_ROUTES_REGEX.test(config.url?.split("?")[0] || "")) {
|
||||||
const activeEnv = getCurrentEnvironment();
|
// Add header for environment name
|
||||||
|
const activeEnv = getCurrentEnvironmentId(state);
|
||||||
|
|
||||||
if (activeEnv && config.headers) {
|
if (activeEnv && config.headers) {
|
||||||
if (config.url?.indexOf("/code") !== -1) {
|
|
||||||
config.headers.environmentId = getCurrentEditingEnvID();
|
|
||||||
} else {
|
|
||||||
config.headers.environmentId = activeEnv;
|
config.headers.environmentId = activeEnv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1973,10 +1973,10 @@ export const MOVE_TO_BUSINESS_EDITION = (trailingChar: string) =>
|
||||||
|
|
||||||
//Datasource environment
|
//Datasource environment
|
||||||
export const START_SWITCH_ENVIRONMENT = (environment: string) =>
|
export const START_SWITCH_ENVIRONMENT = (environment: string) =>
|
||||||
`Switching your environment to ${environment}, and running all associated pageload actions`;
|
`Switching your environment to ${environment.toLowerCase()}, and running all associated pageload actions`;
|
||||||
export const SWITCH_ENVIRONMENT_SUCCESS = (environment: string) =>
|
export const SWITCH_ENVIRONMENT_SUCCESS = (environment: string) =>
|
||||||
`Environment switched to ${environment} successfully`;
|
`Environment switched to ${environment.toLowerCase()} successfully`;
|
||||||
export const SWITCH_ENV_DISABLED_TOOLTIP_TEXT = () =>
|
export const SWITCH_ENV_DISABLED_TOOLTIP_TEXT = (): string =>
|
||||||
"To access environments for datasources, try out our ";
|
"To access environments for datasources, try out our ";
|
||||||
|
|
||||||
export const TEST_DATASOURCE_SUCCESS = (
|
export const TEST_DATASOURCE_SUCCESS = (
|
||||||
|
|
@ -1984,7 +1984,7 @@ export const TEST_DATASOURCE_SUCCESS = (
|
||||||
environmentName: string,
|
environmentName: string,
|
||||||
) => {
|
) => {
|
||||||
return environmentName
|
return environmentName
|
||||||
? `Test was successful, ${datasourceName} ${environmentName} environment is correctly configured.`
|
? `Test was successful, ${datasourceName} ${environmentName.toLowerCase()} environment is correctly configured.`
|
||||||
: `Test was successful, ${datasourceName} is correctly configured.`;
|
: `Test was successful, ${datasourceName} is correctly configured.`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -122,10 +122,10 @@ import {
|
||||||
keysOfNavigationSetting,
|
keysOfNavigationSetting,
|
||||||
} from "constants/AppConstants";
|
} from "constants/AppConstants";
|
||||||
import { setAllEntityCollapsibleStates } from "actions/editorContextActions";
|
import { setAllEntityCollapsibleStates } from "actions/editorContextActions";
|
||||||
import { getCurrentEnvironment } from "@appsmith/utils/Environments";
|
|
||||||
import { selectFeatureFlagCheck } from "@appsmith/selectors/featureFlagsSelectors";
|
import { selectFeatureFlagCheck } from "@appsmith/selectors/featureFlagsSelectors";
|
||||||
import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag";
|
import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag";
|
||||||
import { generateReactKey } from "utils/generators";
|
import { generateReactKey } from "utils/generators";
|
||||||
|
import { getCurrentEnvironmentId } from "@appsmith/selectors/environmentSelectors";
|
||||||
|
|
||||||
export const getDefaultPageId = (
|
export const getDefaultPageId = (
|
||||||
pages?: ApplicationPagePayload[],
|
pages?: ApplicationPagePayload[],
|
||||||
|
|
@ -877,7 +877,7 @@ export function* fetchUnconfiguredDatasourceList(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function* initializeDatasourceWithDefaultValues(datasource: Datasource) {
|
export function* initializeDatasourceWithDefaultValues(datasource: Datasource) {
|
||||||
let currentEnvironment = getCurrentEnvironment();
|
let currentEnvironment: string = yield select(getCurrentEnvironmentId);
|
||||||
if (!datasource.datasourceStorages.hasOwnProperty(currentEnvironment)) {
|
if (!datasource.datasourceStorages.hasOwnProperty(currentEnvironment)) {
|
||||||
// if the currentEnvironemnt is not present for use here, take the first key from datasourceStorages
|
// if the currentEnvironemnt is not present for use here, take the first key from datasourceStorages
|
||||||
currentEnvironment = Object.keys(datasource.datasourceStorages)[0];
|
currentEnvironment = Object.keys(datasource.datasourceStorages)[0];
|
||||||
|
|
|
||||||
3
app/client/src/ce/sagas/EnvironmentSagas.ts
Normal file
3
app/client/src/ce/sagas/EnvironmentSagas.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
export function* waitForFetchEnvironments() {
|
||||||
|
yield true;
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,19 @@
|
||||||
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||||
import type { AppState } from "@appsmith/reducers";
|
import type { AppState } from "@appsmith/reducers";
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
export const areEnvironmentsFetched = (state: AppState, workspaceId: string) =>
|
export const areEnvironmentsFetched = (state: AppState, workspaceId: string) =>
|
||||||
true;
|
true;
|
||||||
|
|
||||||
|
export const getDefaultEnvironmentId = (state: AppState) => "unused_env";
|
||||||
|
|
||||||
|
export const getCurrentEnvironmentId = (state: AppState) => "unused_env";
|
||||||
|
|
||||||
|
export const getCurrentEnvironmentName = (state: AppState) => "";
|
||||||
|
|
||||||
|
export const getCurrentEditingEnvironmentId = (state: AppState) => "unused_env";
|
||||||
|
|
||||||
|
export const getCurrentEnvironmentDetails = (state: AppState) => ({
|
||||||
|
id: "unused_env",
|
||||||
|
name: "",
|
||||||
|
editingId: "unused_env",
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -7,27 +7,11 @@ export const getUserPreferenceFromStorage = () => {
|
||||||
return "true";
|
return "true";
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getCurrentEditingEnvID = () => {
|
|
||||||
// Get the values of environment ID being edited
|
|
||||||
return getCurrentEnvironment();
|
|
||||||
};
|
|
||||||
|
|
||||||
// function to get the current environment from the URL
|
|
||||||
export const getCurrentEnvironment = () => {
|
|
||||||
return "unused_env";
|
|
||||||
};
|
|
||||||
|
|
||||||
// function to get the current environment from the URL
|
|
||||||
export const getCurrentEnvName = () => {
|
|
||||||
return "";
|
|
||||||
};
|
|
||||||
|
|
||||||
// function to check if the datasource is created for the current environment
|
// function to check if the datasource is created for the current environment
|
||||||
export const isStorageEnvironmentCreated = (
|
export const isStorageEnvironmentCreated = (
|
||||||
datasource: Datasource | null,
|
datasource: Datasource | null,
|
||||||
environment?: string,
|
environment: string,
|
||||||
) => {
|
) => {
|
||||||
!environment && (environment = getCurrentEnvironment());
|
|
||||||
return (
|
return (
|
||||||
!!datasource &&
|
!!datasource &&
|
||||||
datasource.hasOwnProperty("datasourceStorages") &&
|
datasource.hasOwnProperty("datasourceStorages") &&
|
||||||
|
|
@ -43,9 +27,8 @@ export const isStorageEnvironmentCreated = (
|
||||||
// function to check if the datasource is configured for the current environment
|
// function to check if the datasource is configured for the current environment
|
||||||
export const isEnvironmentConfigured = (
|
export const isEnvironmentConfigured = (
|
||||||
datasource: Datasource | null,
|
datasource: Datasource | null,
|
||||||
environment?: string,
|
environment: string,
|
||||||
) => {
|
) => {
|
||||||
!environment && (environment = getCurrentEnvironment());
|
|
||||||
const isConfigured =
|
const isConfigured =
|
||||||
!!datasource &&
|
!!datasource &&
|
||||||
!!datasource.datasourceStorages &&
|
!!datasource.datasourceStorages &&
|
||||||
|
|
@ -54,11 +37,7 @@ export const isEnvironmentConfigured = (
|
||||||
};
|
};
|
||||||
|
|
||||||
// function to check if the datasource is configured for any environment
|
// function to check if the datasource is configured for any environment
|
||||||
export const doesAnyDsConfigExist = (
|
export const doesAnyDsConfigExist = (datasource: Datasource | null) => {
|
||||||
datasource: Datasource | null,
|
|
||||||
environment?: string,
|
|
||||||
) => {
|
|
||||||
!environment && (environment = getCurrentEnvironment());
|
|
||||||
let isConfigured = false;
|
let isConfigured = false;
|
||||||
if (!!datasource && !!datasource.datasourceStorages) {
|
if (!!datasource && !!datasource.datasourceStorages) {
|
||||||
const envsList = Object.keys(datasource.datasourceStorages);
|
const envsList = Object.keys(datasource.datasourceStorages);
|
||||||
|
|
@ -76,9 +55,8 @@ export const doesAnyDsConfigExist = (
|
||||||
// function to check if the datasource is valid for the current environment
|
// function to check if the datasource is valid for the current environment
|
||||||
export const isEnvironmentValid = (
|
export const isEnvironmentValid = (
|
||||||
datasource: Datasource | null,
|
datasource: Datasource | null,
|
||||||
environment?: string,
|
environment: string,
|
||||||
) => {
|
) => {
|
||||||
!environment && (environment = getCurrentEnvironment());
|
|
||||||
const isValid =
|
const isValid =
|
||||||
datasource &&
|
datasource &&
|
||||||
datasource.datasourceStorages &&
|
datasource.datasourceStorages &&
|
||||||
|
|
@ -86,16 +64,12 @@ export const isEnvironmentValid = (
|
||||||
return isValid ? isValid : false;
|
return isValid ? isValid : false;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const onUpdateFilterSuccess = (id: string) => {
|
|
||||||
return id;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Functiont to check get the datasource configuration for current ENV
|
* Functiont to check get the datasource configuration for current ENV
|
||||||
*/
|
*/
|
||||||
export const getEnvironmentConfiguration = (
|
export const getEnvironmentConfiguration = (
|
||||||
datasource: Datasource | null,
|
datasource: Datasource | null,
|
||||||
environment = getCurrentEnvironment(),
|
environment: string,
|
||||||
) => {
|
) => {
|
||||||
return datasource?.datasourceStorages?.[environment]?.datasourceConfiguration;
|
return datasource?.datasourceStorages?.[environment]?.datasourceConfiguration;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -37,12 +37,12 @@ import type { AppState } from "@appsmith/reducers";
|
||||||
import { DatasourceCreateEntryPoints } from "constants/Datasource";
|
import { DatasourceCreateEntryPoints } from "constants/Datasource";
|
||||||
import { getCurrentWorkspaceId } from "@appsmith/selectors/workspaceSelectors";
|
import { getCurrentWorkspaceId } from "@appsmith/selectors/workspaceSelectors";
|
||||||
import {
|
import {
|
||||||
getCurrentEnvironment,
|
|
||||||
getEnvironmentConfiguration,
|
getEnvironmentConfiguration,
|
||||||
isEnvironmentValid,
|
isEnvironmentValid,
|
||||||
} from "@appsmith/utils/Environments";
|
} from "@appsmith/utils/Environments";
|
||||||
import type { ActionDataState } from "reducers/entityReducers/actionsReducer";
|
import type { ActionDataState } from "reducers/entityReducers/actionsReducer";
|
||||||
import { getDatatype } from "utils/AppsmithUtils";
|
import { getDatatype } from "utils/AppsmithUtils";
|
||||||
|
import { getCurrentEnvironmentId } from "@appsmith/selectors/environmentSelectors";
|
||||||
|
|
||||||
enum SortingWeights {
|
enum SortingWeights {
|
||||||
alphabetical = 1,
|
alphabetical = 1,
|
||||||
|
|
@ -131,6 +131,7 @@ export function useDatasource(searchText: string) {
|
||||||
const plugins = useSelector(getPlugins);
|
const plugins = useSelector(getPlugins);
|
||||||
|
|
||||||
const workspaceId = useSelector(getCurrentWorkspaceId);
|
const workspaceId = useSelector(getCurrentWorkspaceId);
|
||||||
|
const currentEnvironment: string = useSelector(getCurrentEnvironmentId);
|
||||||
|
|
||||||
const [actualDatasourceOptions, mockDatasourceOptions] = useMemo(() => {
|
const [actualDatasourceOptions, mockDatasourceOptions] = useMemo(() => {
|
||||||
const availableDatasources = datasources.filter(({ pluginId }) =>
|
const availableDatasources = datasources.filter(({ pluginId }) =>
|
||||||
|
|
@ -147,12 +148,12 @@ export function useDatasource(searchText: string) {
|
||||||
value: datasource.name,
|
value: datasource.name,
|
||||||
data: {
|
data: {
|
||||||
pluginId: datasource.pluginId,
|
pluginId: datasource.pluginId,
|
||||||
isValid: isEnvironmentValid(datasource, getCurrentEnvironment()),
|
isValid: isEnvironmentValid(datasource, currentEnvironment),
|
||||||
pluginPackageName: pluginsPackageNamesMap[datasource.pluginId],
|
pluginPackageName: pluginsPackageNamesMap[datasource.pluginId],
|
||||||
isSample: false,
|
isSample: false,
|
||||||
connectionMode: getEnvironmentConfiguration(
|
connectionMode: getEnvironmentConfiguration(
|
||||||
datasource,
|
datasource,
|
||||||
getCurrentEnvironment(),
|
currentEnvironment,
|
||||||
)?.connection?.mode,
|
)?.connection?.mode,
|
||||||
},
|
},
|
||||||
icon: (
|
icon: (
|
||||||
|
|
|
||||||
|
|
@ -54,12 +54,10 @@ import { TEMP_DATASOURCE_ID } from "constants/Datasource";
|
||||||
import LazyCodeEditor from "components/editorComponents/LazyCodeEditor";
|
import LazyCodeEditor from "components/editorComponents/LazyCodeEditor";
|
||||||
import { getCodeMirrorNamespaceFromEditor } from "utils/getCodeMirrorNamespace";
|
import { getCodeMirrorNamespaceFromEditor } from "utils/getCodeMirrorNamespace";
|
||||||
import { isDynamicValue } from "utils/DynamicBindingUtils";
|
import { isDynamicValue } from "utils/DynamicBindingUtils";
|
||||||
import {
|
import { isEnvironmentValid } from "@appsmith/utils/Environments";
|
||||||
getCurrentEnvironment,
|
|
||||||
isEnvironmentValid,
|
|
||||||
} from "@appsmith/utils/Environments";
|
|
||||||
import { DEFAULT_DATASOURCE_NAME } from "constants/ApiEditorConstants/ApiEditorConstants";
|
import { DEFAULT_DATASOURCE_NAME } from "constants/ApiEditorConstants/ApiEditorConstants";
|
||||||
import { isString } from "lodash";
|
import { isString } from "lodash";
|
||||||
|
import { getCurrentEnvironmentId } from "@appsmith/selectors/environmentSelectors";
|
||||||
|
|
||||||
type ReduxStateProps = {
|
type ReduxStateProps = {
|
||||||
workspaceId: string;
|
workspaceId: string;
|
||||||
|
|
@ -590,7 +588,7 @@ const mapStateToProps = (
|
||||||
const datasourceFromAction = apiFormValueSelector(state, "datasource");
|
const datasourceFromAction = apiFormValueSelector(state, "datasource");
|
||||||
let datasourceMerged = datasourceFromAction || {};
|
let datasourceMerged = datasourceFromAction || {};
|
||||||
let datasourceFromDataSourceList: Datasource | undefined;
|
let datasourceFromDataSourceList: Datasource | undefined;
|
||||||
const currentEnvironment = getCurrentEnvironment();
|
const currentEnvironment = getCurrentEnvironmentId(state);
|
||||||
// Todo: fix this properly later in #2164
|
// Todo: fix this properly later in #2164
|
||||||
if (datasourceFromAction && "id" in datasourceFromAction) {
|
if (datasourceFromAction && "id" in datasourceFromAction) {
|
||||||
datasourceFromDataSourceList = getDatasource(
|
datasourceFromDataSourceList = getDatasource(
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ import {
|
||||||
createMessage,
|
createMessage,
|
||||||
} from "@appsmith/constants/messages";
|
} from "@appsmith/constants/messages";
|
||||||
import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag";
|
import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag";
|
||||||
import { getCurrentEditingEnvID } from "@appsmith/utils/Environments";
|
|
||||||
|
|
||||||
// This function checks if the form is dirty
|
// This function checks if the form is dirty
|
||||||
// We needed this in the cases where datasources are created from APIs and the initial value
|
// We needed this in the cases where datasources are created from APIs and the initial value
|
||||||
|
|
@ -29,11 +28,12 @@ export const getIsFormDirty = (
|
||||||
formData: any,
|
formData: any,
|
||||||
isNewDatasource: boolean,
|
isNewDatasource: boolean,
|
||||||
isRestPlugin: boolean,
|
isRestPlugin: boolean,
|
||||||
|
currentEditingEnvId: string,
|
||||||
) => {
|
) => {
|
||||||
const url = isRestPlugin
|
const url = isRestPlugin
|
||||||
? get(
|
? get(
|
||||||
formData,
|
formData,
|
||||||
`datastoreStorages.${getCurrentEditingEnvID}.datasourceConfiguration.url`,
|
`datastoreStorages.${currentEditingEnvId}.datasourceConfiguration.url`,
|
||||||
"",
|
"",
|
||||||
)
|
)
|
||||||
: "";
|
: "";
|
||||||
|
|
|
||||||
1
app/client/src/ee/sagas/EnvironmentSagas.ts
Normal file
1
app/client/src/ee/sagas/EnvironmentSagas.ts
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
export * from "ce/sagas/EnvironmentSagas";
|
||||||
|
|
@ -65,6 +65,7 @@ import { isAirgapped } from "@appsmith/utils/airgapHelpers";
|
||||||
import { getAIPromptTriggered } from "utils/storage";
|
import { getAIPromptTriggered } from "utils/storage";
|
||||||
import { trackOpenEditorTabs } from "../../utils/editor/browserTabsTracking";
|
import { trackOpenEditorTabs } from "../../utils/editor/browserTabsTracking";
|
||||||
import { EditorModes } from "components/editorComponents/CodeEditor/EditorConfig";
|
import { EditorModes } from "components/editorComponents/CodeEditor/EditorConfig";
|
||||||
|
import { waitForFetchEnvironments } from "@appsmith/sagas/EnvironmentSagas";
|
||||||
|
|
||||||
export default class AppEditorEngine extends AppEngine {
|
export default class AppEditorEngine extends AppEngine {
|
||||||
constructor(mode: APP_MODE) {
|
constructor(mode: APP_MODE) {
|
||||||
|
|
@ -149,6 +150,7 @@ export default class AppEditorEngine extends AppEngine {
|
||||||
|
|
||||||
yield call(waitForFetchUserSuccess);
|
yield call(waitForFetchUserSuccess);
|
||||||
yield call(waitForSegmentInit, true);
|
yield call(waitForSegmentInit, true);
|
||||||
|
yield call(waitForFetchEnvironments);
|
||||||
yield put(fetchAllPageEntityCompletion([executePageLoadActions()]));
|
yield put(fetchAllPageEntityCompletion([executePageLoadActions()]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ import {
|
||||||
waitForSegmentInit,
|
waitForSegmentInit,
|
||||||
waitForFetchUserSuccess,
|
waitForFetchUserSuccess,
|
||||||
} from "@appsmith/sagas/userSagas";
|
} from "@appsmith/sagas/userSagas";
|
||||||
|
import { waitForFetchEnvironments } from "@appsmith/sagas/EnvironmentSagas";
|
||||||
|
|
||||||
export default class AppViewerEngine extends AppEngine {
|
export default class AppViewerEngine extends AppEngine {
|
||||||
constructor(mode: APP_MODE) {
|
constructor(mode: APP_MODE) {
|
||||||
|
|
@ -119,6 +120,7 @@ export default class AppViewerEngine extends AppEngine {
|
||||||
|
|
||||||
yield call(waitForFetchUserSuccess);
|
yield call(waitForFetchUserSuccess);
|
||||||
yield call(waitForSegmentInit, true);
|
yield call(waitForSegmentInit, true);
|
||||||
|
yield call(waitForFetchEnvironments);
|
||||||
yield put(fetchAllPageEntityCompletion([executePageLoadActions()]));
|
yield put(fetchAllPageEntityCompletion([executePageLoadActions()]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ import {
|
||||||
hasManageDatasourcePermission,
|
hasManageDatasourcePermission,
|
||||||
} from "@appsmith/utils/permissionHelpers";
|
} from "@appsmith/utils/permissionHelpers";
|
||||||
import { Icon, Text } from "design-system";
|
import { Icon, Text } from "design-system";
|
||||||
import { getCurrentEnvironment } from "@appsmith/utils/Environments";
|
import { getCurrentEnvironmentId } from "@appsmith/selectors/environmentSelectors";
|
||||||
interface ReduxStateProps {
|
interface ReduxStateProps {
|
||||||
datasource: EmbeddedRestDatasource;
|
datasource: EmbeddedRestDatasource;
|
||||||
}
|
}
|
||||||
|
|
@ -129,7 +129,7 @@ function ApiAuthentication(props: Props): JSX.Element {
|
||||||
const mapStateToProps = (state: AppState, ownProps: any): ReduxStateProps => {
|
const mapStateToProps = (state: AppState, ownProps: any): ReduxStateProps => {
|
||||||
const apiFormValueSelector = formValueSelector(ownProps.formName);
|
const apiFormValueSelector = formValueSelector(ownProps.formName);
|
||||||
const datasourceFromAction = apiFormValueSelector(state, "datasource");
|
const datasourceFromAction = apiFormValueSelector(state, "datasource");
|
||||||
const currentEnvironment = getCurrentEnvironment();
|
const currentEnvironment = getCurrentEnvironmentId(state);
|
||||||
let datasourceMerged: EmbeddedRestDatasource = datasourceFromAction;
|
let datasourceMerged: EmbeddedRestDatasource = datasourceFromAction;
|
||||||
if (datasourceFromAction && "id" in datasourceFromAction) {
|
if (datasourceFromAction && "id" in datasourceFromAction) {
|
||||||
const datasourceFromDataSourceList = state.entities.datasources.list.find(
|
const datasourceFromDataSourceList = state.entities.datasources.list.find(
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ import isUndefined from "lodash/isUndefined";
|
||||||
import { Button, Tab, TabPanel, Tabs, TabsList, Tag } from "design-system";
|
import { Button, Tab, TabPanel, Tabs, TabsList, Tag } from "design-system";
|
||||||
import { DatasourceStructureContext } from "../Explorer/Datasources/DatasourceStructureContainer";
|
import { DatasourceStructureContext } from "../Explorer/Datasources/DatasourceStructureContainer";
|
||||||
import type { Datasource } from "entities/Datasource";
|
import type { Datasource } from "entities/Datasource";
|
||||||
import { getCurrentEnvironment } from "@appsmith/utils/Environments";
|
import { getCurrentEnvironmentId } from "@appsmith/selectors/environmentSelectors";
|
||||||
|
|
||||||
const EmptyDatasourceContainer = styled.div`
|
const EmptyDatasourceContainer = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -189,7 +189,7 @@ function ApiRightPane(props: any) {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const { hasDependencies } = useEntityDependencies(props.actionName);
|
const { hasDependencies } = useEntityDependencies(props.actionName);
|
||||||
const selectedTab = useSelector(getApiRightPaneSelectedTab);
|
const selectedTab = useSelector(getApiRightPaneSelectedTab);
|
||||||
const currentEnvironmentId = getCurrentEnvironment();
|
const currentEnvironmentId = useSelector(getCurrentEnvironmentId);
|
||||||
|
|
||||||
const setSelectedTab = useCallback((selectedIndex: string) => {
|
const setSelectedTab = useCallback((selectedIndex: string) => {
|
||||||
dispatch(setApiRightPaneSelectedTab(selectedIndex));
|
dispatch(setApiRightPaneSelectedTab(selectedIndex));
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import { isEmpty } from "lodash";
|
||||||
import type { CommonFormProps } from "./CommonEditorForm";
|
import type { CommonFormProps } from "./CommonEditorForm";
|
||||||
import CommonEditorForm from "./CommonEditorForm";
|
import CommonEditorForm from "./CommonEditorForm";
|
||||||
import Pagination from "./Pagination";
|
import Pagination from "./Pagination";
|
||||||
import { getCurrentEnvironment } from "@appsmith/utils/Environments";
|
import { getCurrentEnvironmentId } from "@appsmith/selectors/environmentSelectors";
|
||||||
|
|
||||||
const NoBodyMessage = styled.div`
|
const NoBodyMessage = styled.div`
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
|
|
@ -101,7 +101,7 @@ export default connect((state: AppState, props: { pluginId: string }) => {
|
||||||
// get messages from action itself
|
// get messages from action itself
|
||||||
const actionId = selector(state, "id");
|
const actionId = selector(state, "id");
|
||||||
const action = getAction(state, actionId);
|
const action = getAction(state, actionId);
|
||||||
const currentEnvironment = getCurrentEnvironment();
|
const currentEnvironment = getCurrentEnvironmentId(state);
|
||||||
const hintMessages = action?.messages;
|
const hintMessages = action?.messages;
|
||||||
|
|
||||||
const datasourceHeaders =
|
const datasourceHeaders =
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ import {
|
||||||
} from "@appsmith/constants/messages";
|
} from "@appsmith/constants/messages";
|
||||||
import { isEnvironmentValid } from "@appsmith/utils/Environments";
|
import { isEnvironmentValid } from "@appsmith/utils/Environments";
|
||||||
import { setDatasourceViewModeFlag } from "actions/datasourceActions";
|
import { setDatasourceViewModeFlag } from "actions/datasourceActions";
|
||||||
|
import { getCurrentEnvironmentId } from "@appsmith/selectors/environmentSelectors";
|
||||||
|
|
||||||
const { cloudHosting } = getAppsmithConfigs();
|
const { cloudHosting } = getAppsmithConfigs();
|
||||||
|
|
||||||
|
|
@ -222,7 +223,9 @@ const mapStateToProps = (state: AppState, props: any) => {
|
||||||
|
|
||||||
const hintMessages = datasource && datasource.messages;
|
const hintMessages = datasource && datasource.messages;
|
||||||
|
|
||||||
const isDatasourceValid = isEnvironmentValid(datasource) || false;
|
const currentEnvironmentId = getCurrentEnvironmentId(state);
|
||||||
|
const isDatasourceValid =
|
||||||
|
isEnvironmentValid(datasource, currentEnvironmentId) || false;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
messages: hintMessages,
|
messages: hintMessages,
|
||||||
|
|
|
||||||
|
|
@ -8,14 +8,12 @@ import { ComparisonOperationsEnum } from "components/formControls/BaseControl";
|
||||||
import type { AppState } from "@appsmith/reducers";
|
import type { AppState } from "@appsmith/reducers";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { datasourceEnvEnabled } from "@appsmith/selectors/featureFlagsSelectors";
|
import { datasourceEnvEnabled } from "@appsmith/selectors/featureFlagsSelectors";
|
||||||
import {
|
import { DB_NOT_SUPPORTED } from "@appsmith/utils/Environments";
|
||||||
DB_NOT_SUPPORTED,
|
|
||||||
getCurrentEnvironment,
|
|
||||||
} from "@appsmith/utils/Environments";
|
|
||||||
import { getPlugin } from "selectors/entitiesSelector";
|
import { getPlugin } from "selectors/entitiesSelector";
|
||||||
import type { PluginType } from "entities/Action";
|
import type { PluginType } from "entities/Action";
|
||||||
import { getDefaultEnvId } from "@appsmith/api/ApiUtils";
|
import { getDefaultEnvId } from "@appsmith/api/ApiUtils";
|
||||||
import { EnvConfigSection } from "@appsmith/components/EnvConfigSection";
|
import { EnvConfigSection } from "@appsmith/components/EnvConfigSection";
|
||||||
|
import { getCurrentEnvironmentId } from "@appsmith/selectors/environmentSelectors";
|
||||||
|
|
||||||
const Key = styled.div`
|
const Key = styled.div`
|
||||||
color: var(--ads-v2-color-fg-muted);
|
color: var(--ads-v2-color-fg-muted);
|
||||||
|
|
@ -259,8 +257,9 @@ const mapStateToProps = (state: AppState, ownProps: any) => {
|
||||||
const isEnvEnabled = DB_NOT_SUPPORTED.includes(pluginType as PluginType)
|
const isEnvEnabled = DB_NOT_SUPPORTED.includes(pluginType as PluginType)
|
||||||
? false
|
? false
|
||||||
: datasourceEnvEnabled(state);
|
: datasourceEnvEnabled(state);
|
||||||
|
const currentEnvironmentId = getCurrentEnvironmentId(state);
|
||||||
return {
|
return {
|
||||||
currentEnv: isEnvEnabled ? getCurrentEnvironment() : getDefaultEnvId(),
|
currentEnv: isEnvEnabled ? currentEnvironmentId : getDefaultEnvId(),
|
||||||
isEnvEnabled,
|
isEnvEnabled,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import { getCurrentPageId } from "selectors/editorSelectors";
|
||||||
import type { Datasource } from "entities/Datasource";
|
import type { Datasource } from "entities/Datasource";
|
||||||
import type { EventLocation } from "@appsmith/utils/analyticsUtilTypes";
|
import type { EventLocation } from "@appsmith/utils/analyticsUtilTypes";
|
||||||
import { noop } from "utils/AppsmithUtils";
|
import { noop } from "utils/AppsmithUtils";
|
||||||
import { getCurrentEnvironment } from "@appsmith/utils/Environments";
|
import { getCurrentEnvironmentId } from "@appsmith/selectors/environmentSelectors";
|
||||||
import WalkthroughContext from "components/featureWalkthrough/walkthroughContext";
|
import WalkthroughContext from "components/featureWalkthrough/walkthroughContext";
|
||||||
import { getIsFirstTimeUserOnboardingEnabled } from "selectors/onboardingSelectors";
|
import { getIsFirstTimeUserOnboardingEnabled } from "selectors/onboardingSelectors";
|
||||||
import { getFeatureWalkthroughShown } from "utils/storage";
|
import { getFeatureWalkthroughShown } from "utils/storage";
|
||||||
|
|
@ -39,7 +39,7 @@ function NewActionButton(props: NewActionButtonProps) {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const actionExist = useSelector(actionsExistInCurrentPage);
|
const actionExist = useSelector(actionsExistInCurrentPage);
|
||||||
const currentPageId = useSelector(getCurrentPageId);
|
const currentPageId = useSelector(getCurrentPageId);
|
||||||
const currentEnvironment = getCurrentEnvironment();
|
const currentEnvironment = useSelector(getCurrentEnvironmentId);
|
||||||
|
|
||||||
const signpostingEnabled = useSelector(getIsFirstTimeUserOnboardingEnabled);
|
const signpostingEnabled = useSelector(getIsFirstTimeUserOnboardingEnabled);
|
||||||
const adapativeSignposting = useSelector(adaptiveSignpostingEnabled);
|
const adapativeSignposting = useSelector(adaptiveSignpostingEnabled);
|
||||||
|
|
|
||||||
|
|
@ -42,10 +42,6 @@ import { ENTITY_TYPE } from "entities/AppsmithConsole";
|
||||||
import { TEMP_DATASOURCE_ID } from "constants/Datasource";
|
import { TEMP_DATASOURCE_ID } from "constants/Datasource";
|
||||||
import { hasManageDatasourcePermission } from "@appsmith/utils/permissionHelpers";
|
import { hasManageDatasourcePermission } from "@appsmith/utils/permissionHelpers";
|
||||||
import { Form } from "./DBForm";
|
import { Form } from "./DBForm";
|
||||||
import {
|
|
||||||
getCurrentEnvName,
|
|
||||||
getCurrentEnvironment,
|
|
||||||
} from "@appsmith/utils/Environments";
|
|
||||||
|
|
||||||
interface DatasourceRestApiEditorProps {
|
interface DatasourceRestApiEditorProps {
|
||||||
initializeReplayEntity: (id: string, data: any) => void;
|
initializeReplayEntity: (id: string, data: any) => void;
|
||||||
|
|
@ -55,6 +51,7 @@ interface DatasourceRestApiEditorProps {
|
||||||
onSuccess?: ReduxAction<unknown>,
|
onSuccess?: ReduxAction<unknown>,
|
||||||
) => void;
|
) => void;
|
||||||
currentEnvironment: string;
|
currentEnvironment: string;
|
||||||
|
currentEnvironmentName: string;
|
||||||
isSaving: boolean;
|
isSaving: boolean;
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
datasourceId: string;
|
datasourceId: string;
|
||||||
|
|
@ -204,7 +201,11 @@ class DatasourceRestAPIEditor extends React.Component<Props> {
|
||||||
};
|
};
|
||||||
|
|
||||||
getSanitizedFormData = () =>
|
getSanitizedFormData = () =>
|
||||||
formValuesToDatasource(this.props.datasource, this.props.formData);
|
formValuesToDatasource(
|
||||||
|
this.props.datasource,
|
||||||
|
this.props.formData,
|
||||||
|
this.props.currentEnvironment,
|
||||||
|
);
|
||||||
|
|
||||||
save = (onSuccess?: ReduxAction<unknown>) => {
|
save = (onSuccess?: ReduxAction<unknown>) => {
|
||||||
this.props.toggleSaveActionFlag(true);
|
this.props.toggleSaveActionFlag(true);
|
||||||
|
|
@ -213,8 +214,8 @@ class DatasourceRestAPIEditor extends React.Component<Props> {
|
||||||
AnalyticsUtil.logEvent("SAVE_DATA_SOURCE_CLICK", {
|
AnalyticsUtil.logEvent("SAVE_DATA_SOURCE_CLICK", {
|
||||||
pageId: this.props.pageId,
|
pageId: this.props.pageId,
|
||||||
appId: this.props.applicationId,
|
appId: this.props.applicationId,
|
||||||
environmentId: getCurrentEnvironment(),
|
environmentId: this.props.currentEnvironment,
|
||||||
environmentName: getCurrentEnvName(),
|
environmentName: this.props.currentEnvironmentName,
|
||||||
pluginName: this.props.pluginName || "",
|
pluginName: this.props.pluginName || "",
|
||||||
pluginPackageName: this.props.pluginPackageName || "",
|
pluginPackageName: this.props.pluginPackageName || "",
|
||||||
});
|
});
|
||||||
|
|
@ -1035,11 +1036,11 @@ class DatasourceRestAPIEditor extends React.Component<Props> {
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapStateToProps = (state: AppState, props: any) => {
|
const mapStateToProps = (state: AppState, props: any) => {
|
||||||
const { datasource, formName } = props;
|
const { currentEnvironment, datasource, formName } = props;
|
||||||
const hintMessages = datasource && datasource.messages;
|
const hintMessages = datasource && datasource.messages;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
initialValues: datasourceToFormValues(datasource),
|
initialValues: datasourceToFormValues(datasource, currentEnvironment),
|
||||||
formMeta: getFormMeta(formName)(state),
|
formMeta: getFormMeta(formName)(state),
|
||||||
messages: hintMessages,
|
messages: hintMessages,
|
||||||
datasourceName: datasource?.name ?? "",
|
datasourceName: datasource?.name ?? "",
|
||||||
|
|
|
||||||
|
|
@ -90,15 +90,14 @@ import type { PluginType } from "entities/Action";
|
||||||
import { PluginPackageName } from "entities/Action";
|
import { PluginPackageName } from "entities/Action";
|
||||||
import DSDataFilter from "@appsmith/components/DSDataFilter";
|
import DSDataFilter from "@appsmith/components/DSDataFilter";
|
||||||
import { DEFAULT_ENV_ID } from "@appsmith/api/ApiUtils";
|
import { DEFAULT_ENV_ID } from "@appsmith/api/ApiUtils";
|
||||||
import {
|
import { isStorageEnvironmentCreated } from "@appsmith/utils/Environments";
|
||||||
isStorageEnvironmentCreated,
|
|
||||||
onUpdateFilterSuccess,
|
|
||||||
} from "@appsmith/utils/Environments";
|
|
||||||
import type { CalloutKind } from "design-system";
|
import type { CalloutKind } from "design-system";
|
||||||
import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag";
|
import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag";
|
||||||
import { selectFeatureFlagCheck } from "@appsmith/selectors/featureFlagsSelectors";
|
import { selectFeatureFlagCheck } from "@appsmith/selectors/featureFlagsSelectors";
|
||||||
import AnalyticsUtil from "utils/AnalyticsUtil";
|
import AnalyticsUtil from "utils/AnalyticsUtil";
|
||||||
import { DATASOURCES_ALLOWED_FOR_PREVIEW_MODE } from "constants/QueryEditorConstants";
|
import { DATASOURCES_ALLOWED_FOR_PREVIEW_MODE } from "constants/QueryEditorConstants";
|
||||||
|
import { setCurrentEditingEnvironmentID } from "@appsmith/actions/environmentAction";
|
||||||
|
import { getCurrentEnvironmentDetails } from "@appsmith/selectors/environmentSelectors";
|
||||||
|
|
||||||
interface ReduxStateProps {
|
interface ReduxStateProps {
|
||||||
canCreateDatasourceActions: boolean;
|
canCreateDatasourceActions: boolean;
|
||||||
|
|
@ -215,6 +214,7 @@ export interface DatasourcePaneFunctions {
|
||||||
resetForm: (formName: string) => void;
|
resetForm: (formName: string) => void;
|
||||||
initializeFormWithDefaults: (pluginType: string) => void;
|
initializeFormWithDefaults: (pluginType: string) => void;
|
||||||
datasourceDiscardAction: (pluginId: string) => void;
|
datasourceDiscardAction: (pluginId: string) => void;
|
||||||
|
setCurrentEditingEnvironmentID: (id: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
class DatasourceEditorRouter extends React.Component<Props, State> {
|
class DatasourceEditorRouter extends React.Component<Props, State> {
|
||||||
|
|
@ -508,28 +508,33 @@ class DatasourceEditorRouter extends React.Component<Props, State> {
|
||||||
}
|
}
|
||||||
|
|
||||||
updateFilter = (id: string, name: string, userPermissions: string[]) => {
|
updateFilter = (id: string, name: string, userPermissions: string[]) => {
|
||||||
if (id.length > 0 && this.state.filterParams.id !== id) {
|
if (id.length > 0) {
|
||||||
if (
|
if (!this.props.viewMode) {
|
||||||
!isEmpty(this.props.formData) &&
|
this.props.setCurrentEditingEnvironmentID(id);
|
||||||
this.props.isFormDirty &&
|
}
|
||||||
this.state.filterParams.id.length > 0
|
if (this.state.filterParams.id !== id) {
|
||||||
) {
|
if (
|
||||||
this.setState({
|
!isEmpty(this.props.formData) &&
|
||||||
showDialog: true,
|
this.props.isFormDirty &&
|
||||||
switchFilterBlocked: true,
|
this.state.filterParams.id.length > 0
|
||||||
navigation: () => {
|
) {
|
||||||
this.updateFilterSuccess(id, name, userPermissions);
|
this.setState({
|
||||||
},
|
showDialog: true,
|
||||||
});
|
switchFilterBlocked: true,
|
||||||
return false;
|
navigation: () => {
|
||||||
} else {
|
this.updateFilterSuccess(id, name, userPermissions);
|
||||||
this.props.resetForm(this.props.formName);
|
},
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
this.props.resetForm(this.props.formName);
|
||||||
|
}
|
||||||
|
return this.updateFilterSuccess(id, name, userPermissions);
|
||||||
|
} else if (
|
||||||
|
!isStorageEnvironmentCreated(this.props.formData as Datasource, id)
|
||||||
|
) {
|
||||||
|
return this.updateFilterSuccess(id, name, userPermissions);
|
||||||
}
|
}
|
||||||
return this.updateFilterSuccess(id, name, userPermissions);
|
|
||||||
} else if (
|
|
||||||
!isStorageEnvironmentCreated(this.props.formData as Datasource, id)
|
|
||||||
) {
|
|
||||||
return this.updateFilterSuccess(id, name, userPermissions);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
@ -539,7 +544,6 @@ class DatasourceEditorRouter extends React.Component<Props, State> {
|
||||||
name: string,
|
name: string,
|
||||||
userPermissions: string[],
|
userPermissions: string[],
|
||||||
) => {
|
) => {
|
||||||
onUpdateFilterSuccess(id);
|
|
||||||
const { datasourceStorages } = this.props.datasource as Datasource;
|
const { datasourceStorages } = this.props.datasource as Datasource;
|
||||||
// check all datasource storages and remove the ones which do not have an id object
|
// check all datasource storages and remove the ones which do not have an id object
|
||||||
const datasourceStoragesWithId = Object.keys(datasourceStorages).reduce(
|
const datasourceStoragesWithId = Object.keys(datasourceStorages).reduce(
|
||||||
|
|
@ -706,6 +710,7 @@ class DatasourceEditorRouter extends React.Component<Props, State> {
|
||||||
<RestAPIDatasourceForm
|
<RestAPIDatasourceForm
|
||||||
applicationId={this.props.applicationId}
|
applicationId={this.props.applicationId}
|
||||||
currentEnvironment={this.state.filterParams.id}
|
currentEnvironment={this.state.filterParams.id}
|
||||||
|
currentEnvironmentName={this.state.filterParams.name}
|
||||||
datasource={datasource}
|
datasource={datasource}
|
||||||
datasourceId={datasourceId}
|
datasourceId={datasourceId}
|
||||||
formData={formData}
|
formData={formData}
|
||||||
|
|
@ -756,6 +761,7 @@ class DatasourceEditorRouter extends React.Component<Props, State> {
|
||||||
return formValuesToDatasource(
|
return formValuesToDatasource(
|
||||||
this.props.datasource as Datasource,
|
this.props.datasource as Datasource,
|
||||||
this.props.formData as ApiDatasourceForm,
|
this.props.formData as ApiDatasourceForm,
|
||||||
|
this.state.filterParams.id,
|
||||||
);
|
);
|
||||||
else
|
else
|
||||||
return getTrimmedData({
|
return getTrimmedData({
|
||||||
|
|
@ -945,11 +951,13 @@ const mapStateToProps = (state: AppState, props: any): ReduxStateProps => {
|
||||||
const isNewDatasource = datasourcePane.newDatasource === TEMP_DATASOURCE_ID;
|
const isNewDatasource = datasourcePane.newDatasource === TEMP_DATASOURCE_ID;
|
||||||
const pluginDatasourceForm =
|
const pluginDatasourceForm =
|
||||||
plugin?.datasourceComponent ?? DatasourceComponentTypes.AutoForm;
|
plugin?.datasourceComponent ?? DatasourceComponentTypes.AutoForm;
|
||||||
|
const currentEnvDetails = getCurrentEnvironmentDetails(state);
|
||||||
const isFormDirty = getIsFormDirty(
|
const isFormDirty = getIsFormDirty(
|
||||||
isDirty(formName)(state),
|
isDirty(formName)(state),
|
||||||
formData,
|
formData,
|
||||||
isNewDatasource,
|
isNewDatasource,
|
||||||
pluginDatasourceForm === DatasourceComponentTypes.RestAPIDatasourceForm,
|
pluginDatasourceForm === DatasourceComponentTypes.RestAPIDatasourceForm,
|
||||||
|
currentEnvDetails.editingId,
|
||||||
);
|
);
|
||||||
const initialValue = getFormInitialValues(formName)(state) as
|
const initialValue = getFormInitialValues(formName)(state) as
|
||||||
| Datasource
|
| Datasource
|
||||||
|
|
@ -979,7 +987,11 @@ const mapStateToProps = (state: AppState, props: any): ReduxStateProps => {
|
||||||
const isPluginAuthorized =
|
const isPluginAuthorized =
|
||||||
pluginPackageName === PluginPackageName.GOOGLE_SHEETS
|
pluginPackageName === PluginPackageName.GOOGLE_SHEETS
|
||||||
? plugin &&
|
? plugin &&
|
||||||
isDatasourceAuthorizedForQueryCreation(formData as Datasource, plugin)
|
isDatasourceAuthorizedForQueryCreation(
|
||||||
|
formData as Datasource,
|
||||||
|
plugin,
|
||||||
|
currentEnvDetails.id,
|
||||||
|
)
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
const datasourceButtonConfiguration = getDatasourceFormButtonConfig(
|
const datasourceButtonConfiguration = getDatasourceFormButtonConfig(
|
||||||
|
|
@ -1064,6 +1076,8 @@ const mapDispatchToProps = (
|
||||||
dispatch(initializeDatasourceFormDefaults(pluginType)),
|
dispatch(initializeDatasourceFormDefaults(pluginType)),
|
||||||
datasourceDiscardAction: (pluginId) =>
|
datasourceDiscardAction: (pluginId) =>
|
||||||
dispatch(datasourceDiscardAction(pluginId)),
|
dispatch(datasourceDiscardAction(pluginId)),
|
||||||
|
setCurrentEditingEnvironmentID: (id: string) =>
|
||||||
|
dispatch(setCurrentEditingEnvironmentID(id)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@ import { get } from "lodash";
|
||||||
import { SQL_PLUGINS_DEFAULT_TEMPLATE_TYPE } from "constants/Datasource";
|
import { SQL_PLUGINS_DEFAULT_TEMPLATE_TYPE } from "constants/Datasource";
|
||||||
import TemplateMenu from "./QueryEditor/TemplateMenu";
|
import TemplateMenu from "./QueryEditor/TemplateMenu";
|
||||||
import { SQL_DATASOURCES } from "../../constants/QueryEditorConstants";
|
import { SQL_DATASOURCES } from "../../constants/QueryEditorConstants";
|
||||||
import { getCurrentEditingEnvID } from "@appsmith/utils/Environments";
|
|
||||||
import type { Datasource, DatasourceStructure } from "entities/Datasource";
|
import type { Datasource, DatasourceStructure } from "entities/Datasource";
|
||||||
|
import { getCurrentEditingEnvironmentId } from "@appsmith/selectors/environmentSelectors";
|
||||||
|
|
||||||
export interface FormControlProps {
|
export interface FormControlProps {
|
||||||
config: ControlProps;
|
config: ControlProps;
|
||||||
|
|
@ -47,6 +47,7 @@ function FormControl(props: FormControlProps) {
|
||||||
);
|
);
|
||||||
|
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const currentEditingEnvId = useSelector(getCurrentEditingEnvironmentId);
|
||||||
|
|
||||||
// adding this to prevent excessive rerendering
|
// adding this to prevent excessive rerendering
|
||||||
const [convertFormToRaw, setConvertFormToRaw] = useState(false);
|
const [convertFormToRaw, setConvertFormToRaw] = useState(false);
|
||||||
|
|
@ -55,7 +56,7 @@ function FormControl(props: FormControlProps) {
|
||||||
let formValueForEvaluatingHiddenObj = formValues;
|
let formValueForEvaluatingHiddenObj = formValues;
|
||||||
if (!!formValues && formValues.hasOwnProperty("datasourceStorages")) {
|
if (!!formValues && formValues.hasOwnProperty("datasourceStorages")) {
|
||||||
formValueForEvaluatingHiddenObj = (formValues as Datasource)
|
formValueForEvaluatingHiddenObj = (formValues as Datasource)
|
||||||
.datasourceStorages[getCurrentEditingEnvID()];
|
.datasourceStorages[currentEditingEnvId];
|
||||||
}
|
}
|
||||||
const hidden = isHidden(formValueForEvaluatingHiddenObj, props.config.hidden);
|
const hidden = isHidden(formValueForEvaluatingHiddenObj, props.config.hidden);
|
||||||
const configErrors: EvaluationError[] = useSelector(
|
const configErrors: EvaluationError[] = useSelector(
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,9 @@ import { CONNECT_NEW_DATASOURCE_OPTION_ID } from "../DataSourceOption";
|
||||||
import type { executeDatasourceQuerySuccessPayload } from "actions/datasourceActions";
|
import type { executeDatasourceQuerySuccessPayload } from "actions/datasourceActions";
|
||||||
import { executeDatasourceQuery } from "actions/datasourceActions";
|
import { executeDatasourceQuery } from "actions/datasourceActions";
|
||||||
import type { DropdownOption } from "design-system-old";
|
import type { DropdownOption } from "design-system-old";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { getCurrentEnvironment } from "@appsmith/utils/Environments";
|
|
||||||
import { PluginPackageName } from "entities/Action";
|
import { PluginPackageName } from "entities/Action";
|
||||||
|
import { getCurrentEnvironmentId } from "@appsmith/selectors/environmentSelectors";
|
||||||
|
|
||||||
export const FAKE_DATASOURCE_OPTION = {
|
export const FAKE_DATASOURCE_OPTION = {
|
||||||
CONNECT_NEW_DATASOURCE_OPTION: {
|
CONNECT_NEW_DATASOURCE_OPTION: {
|
||||||
|
|
@ -35,7 +35,7 @@ export const useDatasourceOptions = ({
|
||||||
const [dataSourceOptions, setDataSourceOptions] = useState<DropdownOptions>(
|
const [dataSourceOptions, setDataSourceOptions] = useState<DropdownOptions>(
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
const currentEnvironment = getCurrentEnvironment();
|
const currentEnvironment = useSelector(getCurrentEnvironmentId);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// On mount of component and on change of datasources, Update the list.
|
// On mount of component and on change of datasources, Update the list.
|
||||||
|
|
|
||||||
|
|
@ -48,11 +48,11 @@ import { MenuWrapper, StyledMenu } from "components/utils/formComponents";
|
||||||
import { DatasourceEditEntryPoints } from "constants/Datasource";
|
import { DatasourceEditEntryPoints } from "constants/Datasource";
|
||||||
import {
|
import {
|
||||||
isEnvironmentConfigured,
|
isEnvironmentConfigured,
|
||||||
getCurrentEnvironment,
|
|
||||||
doesAnyDsConfigExist,
|
doesAnyDsConfigExist,
|
||||||
DB_NOT_SUPPORTED,
|
DB_NOT_SUPPORTED,
|
||||||
} from "@appsmith/utils/Environments";
|
} from "@appsmith/utils/Environments";
|
||||||
import { getCurrentApplication } from "@appsmith/selectors/applicationSelectors";
|
import { getCurrentApplication } from "@appsmith/selectors/applicationSelectors";
|
||||||
|
import { getCurrentEnvironmentId } from "@appsmith/selectors/environmentSelectors";
|
||||||
|
|
||||||
const Wrapper = styled.div`
|
const Wrapper = styled.div`
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
|
|
@ -202,7 +202,7 @@ function DatasourceCard(props: DatasourceCardProps) {
|
||||||
datasourceFormConfigs[datasource?.pluginId ?? ""];
|
datasourceFormConfigs[datasource?.pluginId ?? ""];
|
||||||
const QUERY = queriesWithThisDatasource > 1 ? "queries" : "query";
|
const QUERY = queriesWithThisDatasource > 1 ? "queries" : "query";
|
||||||
|
|
||||||
const currentEnv = getCurrentEnvironment();
|
const currentEnv = useSelector(getCurrentEnvironmentId);
|
||||||
|
|
||||||
const editDatasource = useCallback(() => {
|
const editDatasource = useCallback(() => {
|
||||||
AnalyticsUtil.logEvent("DATASOURCE_CARD_EDIT_ACTION");
|
AnalyticsUtil.logEvent("DATASOURCE_CARD_EDIT_ACTION");
|
||||||
|
|
@ -264,6 +264,7 @@ function DatasourceCard(props: DatasourceCardProps) {
|
||||||
const isDSAuthorizedForQueryCreation = isDatasourceAuthorizedForQueryCreation(
|
const isDSAuthorizedForQueryCreation = isDatasourceAuthorizedForQueryCreation(
|
||||||
datasource,
|
datasource,
|
||||||
plugin,
|
plugin,
|
||||||
|
currentEnv,
|
||||||
);
|
);
|
||||||
|
|
||||||
const showReconnectButton = !(
|
const showReconnectButton = !(
|
||||||
|
|
@ -272,7 +273,7 @@ function DatasourceCard(props: DatasourceCardProps) {
|
||||||
);
|
);
|
||||||
|
|
||||||
const showCreateNewActionButton = envSupportedDs
|
const showCreateNewActionButton = envSupportedDs
|
||||||
? doesAnyDsConfigExist(datasource, currentEnv)
|
? doesAnyDsConfigExist(datasource)
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -50,10 +50,7 @@ import { getConfigInitialValues } from "components/formControls/utils";
|
||||||
import { merge } from "lodash";
|
import { merge } from "lodash";
|
||||||
import { getPathAndValueFromActionDiffObject } from "../../../utils/getPathAndValueFromActionDiffObject";
|
import { getPathAndValueFromActionDiffObject } from "../../../utils/getPathAndValueFromActionDiffObject";
|
||||||
import { DatasourceCreateEntryPoints } from "constants/Datasource";
|
import { DatasourceCreateEntryPoints } from "constants/Datasource";
|
||||||
import {
|
import { getCurrentEnvironmentDetails } from "@appsmith/selectors/environmentSelectors";
|
||||||
getCurrentEnvName,
|
|
||||||
getCurrentEnvironment,
|
|
||||||
} from "@appsmith/utils/Environments";
|
|
||||||
|
|
||||||
const EmptyStateContainer = styled.div`
|
const EmptyStateContainer = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -106,6 +103,8 @@ type ReduxStateProps = {
|
||||||
actionObjectDiff?: any;
|
actionObjectDiff?: any;
|
||||||
isSaas: boolean;
|
isSaas: boolean;
|
||||||
datasourceId?: string;
|
datasourceId?: string;
|
||||||
|
currentEnvironmentId: string;
|
||||||
|
currentEnvironmentName: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type StateAndRouteProps = RouteComponentProps<QueryEditorRouteParams>;
|
type StateAndRouteProps = RouteComponentProps<QueryEditorRouteParams>;
|
||||||
|
|
@ -167,8 +166,8 @@ class QueryEditor extends React.Component<Props> {
|
||||||
AnalyticsUtil.logEvent("RUN_QUERY_CLICK", {
|
AnalyticsUtil.logEvent("RUN_QUERY_CLICK", {
|
||||||
actionId: this.props.actionId,
|
actionId: this.props.actionId,
|
||||||
dataSourceSize: dataSources.length,
|
dataSourceSize: dataSources.length,
|
||||||
environmentId: getCurrentEnvironment(),
|
environmentId: this.props.currentEnvironmentId,
|
||||||
environmentName: getCurrentEnvName(),
|
environmentName: this.props.currentEnvironmentName,
|
||||||
pluginName: pluginName,
|
pluginName: pluginName,
|
||||||
datasourceId: datasource?.id,
|
datasourceId: datasource?.id,
|
||||||
isMock: !!datasource?.isMock,
|
isMock: !!datasource?.isMock,
|
||||||
|
|
@ -330,8 +329,12 @@ const mapStateToProps = (state: AppState, props: any): ReduxStateProps => {
|
||||||
let uiComponent = UIComponentTypes.DbEditorForm;
|
let uiComponent = UIComponentTypes.DbEditorForm;
|
||||||
if (!!pluginId) uiComponent = getUIComponent(pluginId, allPlugins);
|
if (!!pluginId) uiComponent = getUIComponent(pluginId, allPlugins);
|
||||||
|
|
||||||
|
const currentEnvDetails = getCurrentEnvironmentDetails(state);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
actionId,
|
actionId,
|
||||||
|
currentEnvironmentId: currentEnvDetails?.id || "",
|
||||||
|
currentEnvironmentName: currentEnvDetails?.name || "",
|
||||||
pluginId,
|
pluginId,
|
||||||
plugins: allPlugins,
|
plugins: allPlugins,
|
||||||
runErrorMessage,
|
runErrorMessage,
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,6 @@ import Debugger, {
|
||||||
} from "../DataSourceEditor/Debugger";
|
} from "../DataSourceEditor/Debugger";
|
||||||
import { showDebuggerFlag } from "selectors/debuggerSelectors";
|
import { showDebuggerFlag } from "selectors/debuggerSelectors";
|
||||||
import { Form, ViewModeWrapper } from "../DataSourceEditor/DBForm";
|
import { Form, ViewModeWrapper } from "../DataSourceEditor/DBForm";
|
||||||
import { getCurrentEditingEnvID } from "@appsmith/utils/Environments";
|
|
||||||
import DSDataFilter from "@appsmith/components/DSDataFilter";
|
import DSDataFilter from "@appsmith/components/DSDataFilter";
|
||||||
import { DSEditorWrapper } from "../DataSourceEditor";
|
import { DSEditorWrapper } from "../DataSourceEditor";
|
||||||
import type { DatasourceFilterState } from "../DataSourceEditor";
|
import type { DatasourceFilterState } from "../DataSourceEditor";
|
||||||
|
|
@ -88,6 +87,7 @@ import GoogleSheetSchema from "./GoogleSheetSchema";
|
||||||
import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag";
|
import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag";
|
||||||
import { selectFeatureFlagCheck } from "@appsmith/selectors/featureFlagsSelectors";
|
import { selectFeatureFlagCheck } from "@appsmith/selectors/featureFlagsSelectors";
|
||||||
import AnalyticsUtil from "utils/AnalyticsUtil";
|
import AnalyticsUtil from "utils/AnalyticsUtil";
|
||||||
|
import { getDefaultEnvironmentId } from "@appsmith/selectors/environmentSelectors";
|
||||||
|
|
||||||
const ViewModeContainer = styled.div`
|
const ViewModeContainer = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -172,6 +172,7 @@ type State = {
|
||||||
type SaasEditorWrappperProps = RouteProps & {
|
type SaasEditorWrappperProps = RouteProps & {
|
||||||
hiddenHeader?: boolean; // for reconnect modal
|
hiddenHeader?: boolean; // for reconnect modal
|
||||||
isInsideReconnectModal?: boolean; // for reconnect modal
|
isInsideReconnectModal?: boolean; // for reconnect modal
|
||||||
|
currentEnvironment: string;
|
||||||
};
|
};
|
||||||
type RouteProps = {
|
type RouteProps = {
|
||||||
datasourceId: string;
|
datasourceId: string;
|
||||||
|
|
@ -182,7 +183,6 @@ type RouteProps = {
|
||||||
type SaasEditorWrappperState = {
|
type SaasEditorWrappperState = {
|
||||||
requiredFields: Record<string, ControlProps>;
|
requiredFields: Record<string, ControlProps>;
|
||||||
configDetails: Record<string, string>;
|
configDetails: Record<string, string>;
|
||||||
currentEditingEnvironment: string;
|
|
||||||
};
|
};
|
||||||
class SaasEditorWrapper extends React.Component<
|
class SaasEditorWrapper extends React.Component<
|
||||||
SaasEditorWrappperProps,
|
SaasEditorWrappperProps,
|
||||||
|
|
@ -193,7 +193,6 @@ class SaasEditorWrapper extends React.Component<
|
||||||
this.state = {
|
this.state = {
|
||||||
requiredFields: {},
|
requiredFields: {},
|
||||||
configDetails: {},
|
configDetails: {},
|
||||||
currentEditingEnvironment: getCurrentEditingEnvID(),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -225,7 +224,6 @@ class SaasEditorWrapper extends React.Component<
|
||||||
<SaaSEditor
|
<SaaSEditor
|
||||||
{...this.props}
|
{...this.props}
|
||||||
configDetails={this.state.configDetails}
|
configDetails={this.state.configDetails}
|
||||||
currentEnvironment={this.state.currentEditingEnvironment}
|
|
||||||
requiredFields={this.state.requiredFields}
|
requiredFields={this.state.requiredFields}
|
||||||
setupConfig={this.setupConfig}
|
setupConfig={this.setupConfig}
|
||||||
/>
|
/>
|
||||||
|
|
@ -506,7 +504,11 @@ class DatasourceSaaSEditor extends JSONtoForm<Props, State> {
|
||||||
if we want to extend this functionality for other plugins, we should be able
|
if we want to extend this functionality for other plugins, we should be able
|
||||||
to extend this function for other plugins
|
to extend this function for other plugins
|
||||||
*/
|
*/
|
||||||
const authErrorMessage = getDatasourceErrorMessage(formData, plugin);
|
const authErrorMessage = getDatasourceErrorMessage(
|
||||||
|
formData,
|
||||||
|
plugin,
|
||||||
|
this.state.filterParams.id,
|
||||||
|
);
|
||||||
|
|
||||||
const googleSheetsInfoMessage = createMessage(
|
const googleSheetsInfoMessage = createMessage(
|
||||||
GOOGLE_SHEETS_INFO_BANNER_MESSAGE,
|
GOOGLE_SHEETS_INFO_BANNER_MESSAGE,
|
||||||
|
|
@ -625,7 +627,7 @@ class DatasourceSaaSEditor extends JSONtoForm<Props, State> {
|
||||||
{/* Render datasource form call-to-actions */}
|
{/* Render datasource form call-to-actions */}
|
||||||
{datasource && (
|
{datasource && (
|
||||||
<DatasourceAuth
|
<DatasourceAuth
|
||||||
currentEnvironment={this.props.currentEnvironment}
|
currentEnvironment={this.state.filterParams.id}
|
||||||
datasource={datasource}
|
datasource={datasource}
|
||||||
datasourceButtonConfiguration={
|
datasourceButtonConfiguration={
|
||||||
datasourceButtonConfiguration
|
datasourceButtonConfiguration
|
||||||
|
|
@ -740,13 +742,15 @@ const mapStateToProps = (state: AppState, props: any) => {
|
||||||
viewMode = viewModeFromURLParams === "true";
|
viewMode = viewModeFromURLParams === "true";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { currentEnvironment } = props;
|
||||||
|
|
||||||
// Returning false to isPluginAuthorized if there exists no plugin or formdata.
|
// Returning false to isPluginAuthorized if there exists no plugin or formdata.
|
||||||
const isPluginAuthorized =
|
const isPluginAuthorized =
|
||||||
!!plugin && !!formData
|
!!plugin && !!formData
|
||||||
? isDatasourceAuthorizedForQueryCreation(
|
? isDatasourceAuthorizedForQueryCreation(
|
||||||
formData,
|
formData,
|
||||||
plugin,
|
plugin,
|
||||||
getCurrentEditingEnvID(),
|
currentEnvironment,
|
||||||
)
|
)
|
||||||
: false;
|
: false;
|
||||||
|
|
||||||
|
|
@ -757,7 +761,7 @@ const mapStateToProps = (state: AppState, props: any) => {
|
||||||
? isDatasourceAuthorizedForQueryCreation(
|
? isDatasourceAuthorizedForQueryCreation(
|
||||||
formData,
|
formData,
|
||||||
plugin,
|
plugin,
|
||||||
getCurrentEditingEnvID(),
|
currentEnvironment,
|
||||||
[
|
[
|
||||||
AuthenticationStatus.FAILURE,
|
AuthenticationStatus.FAILURE,
|
||||||
AuthenticationStatus.FAILURE_ACCESS_DENIED,
|
AuthenticationStatus.FAILURE_ACCESS_DENIED,
|
||||||
|
|
@ -845,4 +849,6 @@ const SaaSEditor = connect(
|
||||||
})(DatasourceSaaSEditor),
|
})(DatasourceSaaSEditor),
|
||||||
);
|
);
|
||||||
|
|
||||||
export default SaasEditorWrapper;
|
export default connect((state) => ({
|
||||||
|
currentEnvironment: getDefaultEnvironmentId(state),
|
||||||
|
}))(SaasEditorWrapper);
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ import {
|
||||||
import { getDatasourcePropertyValue } from "utils/editorContextUtils";
|
import { getDatasourcePropertyValue } from "utils/editorContextUtils";
|
||||||
import { GOOGLE_SHEET_SPECIFIC_SHEETS_SCOPE } from "constants/Datasource";
|
import { GOOGLE_SHEET_SPECIFIC_SHEETS_SCOPE } from "constants/Datasource";
|
||||||
import { PluginPackageName } from "entities/Action";
|
import { PluginPackageName } from "entities/Action";
|
||||||
import { getCurrentEnvironment } from "@appsmith/utils/Environments";
|
|
||||||
import { get } from "lodash";
|
import { get } from "lodash";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -23,8 +22,8 @@ import { get } from "lodash";
|
||||||
export function isAuthorisedFilesEmptyGsheet(
|
export function isAuthorisedFilesEmptyGsheet(
|
||||||
datasource: Datasource,
|
datasource: Datasource,
|
||||||
propertyKey: string,
|
propertyKey: string,
|
||||||
|
currentEnvironment: string,
|
||||||
): boolean {
|
): boolean {
|
||||||
const currentEnvironment = getCurrentEnvironment();
|
|
||||||
const value = get(
|
const value = get(
|
||||||
datasource,
|
datasource,
|
||||||
`datasourceStorages.${currentEnvironment}.datasourceConfiguration.authentication.scopeString`,
|
`datasourceStorages.${currentEnvironment}.datasourceConfiguration.authentication.scopeString`,
|
||||||
|
|
@ -64,6 +63,7 @@ export function isAuthorisedFilesEmptyGsheet(
|
||||||
export function getDatasourceErrorMessage(
|
export function getDatasourceErrorMessage(
|
||||||
datasource: Datasource,
|
datasource: Datasource,
|
||||||
plugin: Plugin | undefined,
|
plugin: Plugin | undefined,
|
||||||
|
currentEnvironment: string,
|
||||||
): string {
|
): string {
|
||||||
if (!datasource) return "";
|
if (!datasource) return "";
|
||||||
|
|
||||||
|
|
@ -74,6 +74,7 @@ export function getDatasourceErrorMessage(
|
||||||
const authorisedFilesEmptyGsheet = isAuthorisedFilesEmptyGsheet(
|
const authorisedFilesEmptyGsheet = isAuthorisedFilesEmptyGsheet(
|
||||||
datasource,
|
datasource,
|
||||||
createMessage(GSHEET_AUTHORISED_FILE_IDS_KEY),
|
createMessage(GSHEET_AUTHORISED_FILE_IDS_KEY),
|
||||||
|
currentEnvironment,
|
||||||
);
|
);
|
||||||
|
|
||||||
authErrorMessage = authorisedFilesEmptyGsheet
|
authErrorMessage = authorisedFilesEmptyGsheet
|
||||||
|
|
|
||||||
|
|
@ -63,18 +63,17 @@ import {
|
||||||
Button,
|
Button,
|
||||||
Text,
|
Text,
|
||||||
} from "design-system";
|
} from "design-system";
|
||||||
import {
|
import { isEnvironmentConfigured } from "@appsmith/utils/Environments";
|
||||||
isEnvironmentConfigured,
|
|
||||||
getCurrentEnvironment,
|
|
||||||
getCurrentEnvName,
|
|
||||||
} from "@appsmith/utils/Environments";
|
|
||||||
import { keyBy } from "lodash";
|
import { keyBy } from "lodash";
|
||||||
import type { Plugin } from "api/PluginApi";
|
import type { Plugin } from "api/PluginApi";
|
||||||
import {
|
import {
|
||||||
isDatasourceAuthorizedForQueryCreation,
|
isDatasourceAuthorizedForQueryCreation,
|
||||||
isGoogleSheetPluginDS,
|
isGoogleSheetPluginDS,
|
||||||
} from "utils/editorContextUtils";
|
} from "utils/editorContextUtils";
|
||||||
import { areEnvironmentsFetched } from "@appsmith/selectors/environmentSelectors";
|
import {
|
||||||
|
areEnvironmentsFetched,
|
||||||
|
getCurrentEnvironmentDetails,
|
||||||
|
} from "@appsmith/selectors/environmentSelectors";
|
||||||
import type { AppState } from "@appsmith/reducers";
|
import type { AppState } from "@appsmith/reducers";
|
||||||
|
|
||||||
const Section = styled.div`
|
const Section = styled.div`
|
||||||
|
|
@ -271,6 +270,7 @@ function ReconnectDatasourceModal() {
|
||||||
);
|
);
|
||||||
// getting query from redirection url
|
// getting query from redirection url
|
||||||
const userWorkspaces = useSelector(getUserApplicationsWorkspacesList);
|
const userWorkspaces = useSelector(getUserApplicationsWorkspacesList);
|
||||||
|
const currentEnvDetails = useSelector(getCurrentEnvironmentDetails);
|
||||||
const queryParams = useQuery();
|
const queryParams = useQuery();
|
||||||
const queryAppId =
|
const queryAppId =
|
||||||
queryParams.get("appId") || (pendingApp ? pendingApp.appId : null);
|
queryParams.get("appId") || (pendingApp ? pendingApp.appId : null);
|
||||||
|
|
@ -299,9 +299,13 @@ function ReconnectDatasourceModal() {
|
||||||
if (!ds || pluginsArray.length === 0) return false;
|
if (!ds || pluginsArray.length === 0) return false;
|
||||||
const plugin = plugins[ds.pluginId];
|
const plugin = plugins[ds.pluginId];
|
||||||
const output = isGoogleSheetPluginDS(plugin?.packageName)
|
const output = isGoogleSheetPluginDS(plugin?.packageName)
|
||||||
? isDatasourceAuthorizedForQueryCreation(ds, plugin as Plugin)
|
? isDatasourceAuthorizedForQueryCreation(
|
||||||
|
ds,
|
||||||
|
plugin as Plugin,
|
||||||
|
currentEnvDetails.id,
|
||||||
|
)
|
||||||
: ds.datasourceStorages
|
: ds.datasourceStorages
|
||||||
? isEnvironmentConfigured(ds, getCurrentEnvironment())
|
? isEnvironmentConfigured(ds, currentEnvDetails.id)
|
||||||
: false;
|
: false;
|
||||||
return output;
|
return output;
|
||||||
};
|
};
|
||||||
|
|
@ -320,8 +324,8 @@ function ReconnectDatasourceModal() {
|
||||||
AnalyticsUtil.logEvent("DATASOURCE_AUTH_COMPLETE", {
|
AnalyticsUtil.logEvent("DATASOURCE_AUTH_COMPLETE", {
|
||||||
applicationId: queryAppId,
|
applicationId: queryAppId,
|
||||||
datasourceId: queryDatasourceId,
|
datasourceId: queryDatasourceId,
|
||||||
environmentId: getCurrentEnvironment(),
|
environmentId: currentEnvDetails.id,
|
||||||
environmentName: getCurrentEnvName(),
|
environmentName: currentEnvDetails.name,
|
||||||
pageId: queryPageId,
|
pageId: queryPageId,
|
||||||
oAuthPassOrFailVerdict: status,
|
oAuthPassOrFailVerdict: status,
|
||||||
workspaceId: orgId,
|
workspaceId: orgId,
|
||||||
|
|
@ -524,6 +528,7 @@ function ReconnectDatasourceModal() {
|
||||||
const mappedDataSources = datasources.map((ds: Datasource) => {
|
const mappedDataSources = datasources.map((ds: Datasource) => {
|
||||||
return (
|
return (
|
||||||
<ListItemWrapper
|
<ListItemWrapper
|
||||||
|
currentEnvironment={currentEnvDetails.id}
|
||||||
ds={ds}
|
ds={ds}
|
||||||
key={ds.id}
|
key={ds.id}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,7 @@ import type { Datasource } from "entities/Datasource";
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
import { getAssetUrl } from "@appsmith/utils/airgapHelpers";
|
import { getAssetUrl } from "@appsmith/utils/airgapHelpers";
|
||||||
import { PluginImage } from "pages/Editor/DataSourceEditor/DSFormHeader";
|
import { PluginImage } from "pages/Editor/DataSourceEditor/DSFormHeader";
|
||||||
import {
|
import { isEnvironmentConfigured } from "@appsmith/utils/Environments";
|
||||||
getCurrentEnvironment,
|
|
||||||
isEnvironmentConfigured,
|
|
||||||
} from "@appsmith/utils/Environments";
|
|
||||||
import type { Plugin } from "api/PluginApi";
|
import type { Plugin } from "api/PluginApi";
|
||||||
import {
|
import {
|
||||||
isDatasourceAuthorizedForQueryCreation,
|
isDatasourceAuthorizedForQueryCreation,
|
||||||
|
|
@ -58,15 +55,20 @@ const DsTitle = styled.div`
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
function ListItemWrapper(props: {
|
function ListItemWrapper(props: {
|
||||||
|
currentEnvironment: string;
|
||||||
ds: Datasource;
|
ds: Datasource;
|
||||||
selected?: boolean;
|
selected?: boolean;
|
||||||
plugin: Plugin;
|
plugin: Plugin;
|
||||||
onClick: (ds: Datasource) => void;
|
onClick: (ds: Datasource) => void;
|
||||||
}) {
|
}) {
|
||||||
const { ds, onClick, plugin, selected } = props;
|
const { currentEnvironment, ds, onClick, plugin, selected } = props;
|
||||||
const isPluginAuthorized = isGoogleSheetPluginDS(plugin?.packageName)
|
const isPluginAuthorized = isGoogleSheetPluginDS(plugin?.packageName)
|
||||||
? isDatasourceAuthorizedForQueryCreation(ds, plugin ?? {})
|
? isDatasourceAuthorizedForQueryCreation(
|
||||||
: isEnvironmentConfigured(ds, getCurrentEnvironment());
|
ds,
|
||||||
|
plugin ?? {},
|
||||||
|
currentEnvironment,
|
||||||
|
)
|
||||||
|
: isEnvironmentConfigured(ds, currentEnvironment);
|
||||||
return (
|
return (
|
||||||
<ListItem
|
<ListItem
|
||||||
className={`t--ds-list ${selected ? "active" : ""}`}
|
className={`t--ds-list ${selected ? "active" : ""}`}
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,7 @@ import { integrationEditorURL } from "RouteBuilder";
|
||||||
import { getQueryParams } from "utils/URLUtils";
|
import { getQueryParams } from "utils/URLUtils";
|
||||||
import type { AppsmithLocationState } from "utils/history";
|
import type { AppsmithLocationState } from "utils/history";
|
||||||
import type { PluginType } from "entities/Action";
|
import type { PluginType } from "entities/Action";
|
||||||
import {
|
import { getCurrentEnvironmentDetails } from "@appsmith/selectors/environmentSelectors";
|
||||||
getCurrentEnvName,
|
|
||||||
getCurrentEditingEnvID,
|
|
||||||
} from "@appsmith/utils/Environments";
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
datasource: Datasource;
|
datasource: Datasource;
|
||||||
|
|
@ -167,6 +164,8 @@ function DatasourceAuth({
|
||||||
datasourcePermissions,
|
datasourcePermissions,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const currentEnvDetails = useSelector(getCurrentEnvironmentDetails);
|
||||||
|
|
||||||
// hooks
|
// hooks
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
|
@ -236,7 +235,7 @@ function DatasourceAuth({
|
||||||
}, [triggerSave]);
|
}, [triggerSave]);
|
||||||
const isAuthorized =
|
const isAuthorized =
|
||||||
datasource?.datasourceStorages && authType === AuthType.OAUTH2
|
datasource?.datasourceStorages && authType === AuthType.OAUTH2
|
||||||
? datasource?.datasourceStorages[getCurrentEditingEnvID()]
|
? datasource?.datasourceStorages[currentEnvDetails.editingId]
|
||||||
?.datasourceConfiguration?.authentication?.isAuthorized
|
?.datasourceConfiguration?.authentication?.isAuthorized
|
||||||
: datasource?.datasourceStorages[currentEnvironment]
|
: datasource?.datasourceStorages[currentEnvironment]
|
||||||
?.datasourceConfiguration?.authentication?.authenticationStatus ===
|
?.datasourceConfiguration?.authentication?.authenticationStatus ===
|
||||||
|
|
@ -251,7 +250,7 @@ function DatasourceAuth({
|
||||||
appId: applicationId,
|
appId: applicationId,
|
||||||
datasourceId: datasourceId,
|
datasourceId: datasourceId,
|
||||||
environmentId: currentEnvironment,
|
environmentId: currentEnvironment,
|
||||||
environmentName: getCurrentEnvName(),
|
environmentName: currentEnvDetails.name,
|
||||||
pluginName: pluginName,
|
pluginName: pluginName,
|
||||||
});
|
});
|
||||||
dispatch(testDatasource(getSanitizedFormData()));
|
dispatch(testDatasource(getSanitizedFormData()));
|
||||||
|
|
@ -264,7 +263,7 @@ function DatasourceAuth({
|
||||||
pageId: pageId,
|
pageId: pageId,
|
||||||
appId: applicationId,
|
appId: applicationId,
|
||||||
environmentId: currentEnvironment,
|
environmentId: currentEnvironment,
|
||||||
environmentName: getCurrentEnvName(),
|
environmentName: currentEnvDetails.name,
|
||||||
pluginName: pluginName || "",
|
pluginName: pluginName || "",
|
||||||
pluginPackageName: pluginPackageName || "",
|
pluginPackageName: pluginPackageName || "",
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -153,11 +153,11 @@ import { handleStoreOperations } from "./StoreActionSaga";
|
||||||
import { fetchPage } from "actions/pageActions";
|
import { fetchPage } from "actions/pageActions";
|
||||||
import type { Datasource } from "entities/Datasource";
|
import type { Datasource } from "entities/Datasource";
|
||||||
import { softRefreshDatasourceStructure } from "actions/datasourceActions";
|
import { softRefreshDatasourceStructure } from "actions/datasourceActions";
|
||||||
import {
|
|
||||||
getCurrentEnvName,
|
|
||||||
getCurrentEnvironment,
|
|
||||||
} from "@appsmith/utils/Environments";
|
|
||||||
import { changeQuery } from "actions/queryPaneActions";
|
import { changeQuery } from "actions/queryPaneActions";
|
||||||
|
import {
|
||||||
|
getCurrentEnvironmentDetails,
|
||||||
|
getCurrentEnvironmentName,
|
||||||
|
} from "@appsmith/selectors/environmentSelectors";
|
||||||
|
|
||||||
enum ActionResponseDataTypes {
|
enum ActionResponseDataTypes {
|
||||||
BINARY = "BINARY",
|
BINARY = "BINARY",
|
||||||
|
|
@ -520,6 +520,10 @@ export default function* executePluginActionTriggerSaga(
|
||||||
const datasource: Datasource = yield select(getDatasource, datasourceId);
|
const datasource: Datasource = yield select(getDatasource, datasourceId);
|
||||||
const plugin: Plugin = yield select(getPlugin, action?.pluginId);
|
const plugin: Plugin = yield select(getPlugin, action?.pluginId);
|
||||||
const currentApp: ApplicationPayload = yield select(getCurrentApplication);
|
const currentApp: ApplicationPayload = yield select(getCurrentApplication);
|
||||||
|
|
||||||
|
const currentEnvDetails: { id: string; name: string } = yield select(
|
||||||
|
getCurrentEnvironmentDetails,
|
||||||
|
);
|
||||||
AnalyticsUtil.logEvent("EXECUTE_ACTION", {
|
AnalyticsUtil.logEvent("EXECUTE_ACTION", {
|
||||||
type: action?.pluginType,
|
type: action?.pluginType,
|
||||||
name: action?.name,
|
name: action?.name,
|
||||||
|
|
@ -527,8 +531,8 @@ export default function* executePluginActionTriggerSaga(
|
||||||
appId: currentApp.id,
|
appId: currentApp.id,
|
||||||
appMode: appMode,
|
appMode: appMode,
|
||||||
appName: currentApp.name,
|
appName: currentApp.name,
|
||||||
environmentId: getCurrentEnvironment(),
|
environmentId: currentEnvDetails.id,
|
||||||
environmentName: getCurrentEnvName(),
|
environmentName: currentEnvDetails.name,
|
||||||
isExampleApp: currentApp.appIsExample,
|
isExampleApp: currentApp.appIsExample,
|
||||||
pluginName: plugin?.name,
|
pluginName: plugin?.name,
|
||||||
datasourceId: datasourceId,
|
datasourceId: datasourceId,
|
||||||
|
|
@ -567,7 +571,7 @@ export default function* executePluginActionTriggerSaga(
|
||||||
iconId: action.pluginId,
|
iconId: action.pluginId,
|
||||||
logType: LOG_TYPE.ACTION_EXECUTION_ERROR,
|
logType: LOG_TYPE.ACTION_EXECUTION_ERROR,
|
||||||
text: `Execution failed with status ${payload.statusCode}`,
|
text: `Execution failed with status ${payload.statusCode}`,
|
||||||
environmentName: getCurrentEnvName() || "",
|
environmentName: currentEnvDetails.name,
|
||||||
source: {
|
source: {
|
||||||
type: ENTITY_TYPE.ACTION,
|
type: ENTITY_TYPE.ACTION,
|
||||||
name: action.name,
|
name: action.name,
|
||||||
|
|
@ -601,8 +605,8 @@ export default function* executePluginActionTriggerSaga(
|
||||||
appId: currentApp.id,
|
appId: currentApp.id,
|
||||||
appMode: appMode,
|
appMode: appMode,
|
||||||
appName: currentApp.name,
|
appName: currentApp.name,
|
||||||
environmentId: getCurrentEnvironment(),
|
environmentId: currentEnvDetails.id,
|
||||||
environmentName: getCurrentEnvName(),
|
environmentName: currentEnvDetails.name,
|
||||||
isExampleApp: currentApp.appIsExample,
|
isExampleApp: currentApp.appIsExample,
|
||||||
pluginName: plugin?.name,
|
pluginName: plugin?.name,
|
||||||
datasourceId: datasourceId,
|
datasourceId: datasourceId,
|
||||||
|
|
@ -630,8 +634,8 @@ export default function* executePluginActionTriggerSaga(
|
||||||
appId: currentApp.id,
|
appId: currentApp.id,
|
||||||
appMode: appMode,
|
appMode: appMode,
|
||||||
appName: currentApp.name,
|
appName: currentApp.name,
|
||||||
environmentId: getCurrentEnvironment(),
|
environmentId: currentEnvDetails.id,
|
||||||
environmentName: getCurrentEnvName(),
|
environmentName: currentEnvDetails.name,
|
||||||
isExampleApp: currentApp.appIsExample,
|
isExampleApp: currentApp.appIsExample,
|
||||||
pluginName: plugin?.name,
|
pluginName: plugin?.name,
|
||||||
datasourceId: datasourceId,
|
datasourceId: datasourceId,
|
||||||
|
|
@ -743,6 +747,10 @@ function* runActionSaga(
|
||||||
yield take(ReduxActionTypes.UPDATE_ACTION_SUCCESS);
|
yield take(ReduxActionTypes.UPDATE_ACTION_SUCCESS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const currentEnvDetails: { id: string; name: string } = yield select(
|
||||||
|
getCurrentEnvironmentDetails,
|
||||||
|
);
|
||||||
const actionObject = shouldBeDefined<Action>(
|
const actionObject = shouldBeDefined<Action>(
|
||||||
yield select(getAction, actionId),
|
yield select(getAction, actionId),
|
||||||
`action not found for id - ${actionId}`,
|
`action not found for id - ${actionId}`,
|
||||||
|
|
@ -897,7 +905,7 @@ function* runActionSaga(
|
||||||
id: actionId,
|
id: actionId,
|
||||||
iconId: actionObject.pluginId,
|
iconId: actionObject.pluginId,
|
||||||
logType: LOG_TYPE.ACTION_EXECUTION_ERROR,
|
logType: LOG_TYPE.ACTION_EXECUTION_ERROR,
|
||||||
environmentName: getCurrentEnvName() || "",
|
environmentName: currentEnvDetails.name,
|
||||||
text: `Execution failed${
|
text: `Execution failed${
|
||||||
payload.statusCode ? ` with status ${payload.statusCode}` : ""
|
payload.statusCode ? ` with status ${payload.statusCode}` : ""
|
||||||
}`,
|
}`,
|
||||||
|
|
@ -933,8 +941,8 @@ function* runActionSaga(
|
||||||
AnalyticsUtil.logEvent(failureEventName, {
|
AnalyticsUtil.logEvent(failureEventName, {
|
||||||
actionId,
|
actionId,
|
||||||
actionName: actionObject.name,
|
actionName: actionObject.name,
|
||||||
environmentId: getCurrentEnvironment(),
|
environmentId: currentEnvDetails.id,
|
||||||
environmentName: getCurrentEnvName(),
|
environmentName: currentEnvDetails.name,
|
||||||
pageName: pageName,
|
pageName: pageName,
|
||||||
apiType: "INTERNAL",
|
apiType: "INTERNAL",
|
||||||
datasourceId: datasource?.id,
|
datasourceId: datasource?.id,
|
||||||
|
|
@ -956,8 +964,8 @@ function* runActionSaga(
|
||||||
AnalyticsUtil.logEvent(eventName, {
|
AnalyticsUtil.logEvent(eventName, {
|
||||||
actionId,
|
actionId,
|
||||||
actionName: actionObject.name,
|
actionName: actionObject.name,
|
||||||
environmentId: getCurrentEnvironment(),
|
environmentId: currentEnvDetails.id,
|
||||||
environmentName: getCurrentEnvName(),
|
environmentName: currentEnvDetails.name,
|
||||||
pageName: pageName,
|
pageName: pageName,
|
||||||
responseTime: payload.duration,
|
responseTime: payload.duration,
|
||||||
apiType: "INTERNAL",
|
apiType: "INTERNAL",
|
||||||
|
|
@ -1061,6 +1069,9 @@ function* executeOnPageLoadJSAction(pageAction: PageAction) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function* executePageLoadAction(pageAction: PageAction) {
|
function* executePageLoadAction(pageAction: PageAction) {
|
||||||
|
const currentEnvDetails: { id: string; name: string } = yield select(
|
||||||
|
getCurrentEnvironmentDetails,
|
||||||
|
);
|
||||||
if (pageAction.hasOwnProperty("collectionId")) {
|
if (pageAction.hasOwnProperty("collectionId")) {
|
||||||
yield call(executeOnPageLoadJSAction, pageAction);
|
yield call(executeOnPageLoadJSAction, pageAction);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1086,8 +1097,8 @@ function* executePageLoadAction(pageAction: PageAction) {
|
||||||
appId: currentApp.id,
|
appId: currentApp.id,
|
||||||
onPageLoad: true,
|
onPageLoad: true,
|
||||||
appName: currentApp.name,
|
appName: currentApp.name,
|
||||||
environmentId: getCurrentEnvironment(),
|
environmentId: currentEnvDetails.id,
|
||||||
environmentName: getCurrentEnvName(),
|
environmentName: currentEnvDetails.name,
|
||||||
isExampleApp: currentApp.appIsExample,
|
isExampleApp: currentApp.appIsExample,
|
||||||
pluginName: plugin?.name,
|
pluginName: plugin?.name,
|
||||||
datasourceId: datasourceId,
|
datasourceId: datasourceId,
|
||||||
|
|
@ -1130,7 +1141,7 @@ function* executePageLoadAction(pageAction: PageAction) {
|
||||||
id: pageAction.id,
|
id: pageAction.id,
|
||||||
iconId: action.pluginId,
|
iconId: action.pluginId,
|
||||||
logType: LOG_TYPE.ACTION_EXECUTION_ERROR,
|
logType: LOG_TYPE.ACTION_EXECUTION_ERROR,
|
||||||
environmentName: getCurrentEnvName() || "",
|
environmentName: currentEnvDetails.name,
|
||||||
text: `Execution failed with status ${payload.statusCode}`,
|
text: `Execution failed with status ${payload.statusCode}`,
|
||||||
source: {
|
source: {
|
||||||
type: ENTITY_TYPE.ACTION,
|
type: ENTITY_TYPE.ACTION,
|
||||||
|
|
@ -1175,8 +1186,8 @@ function* executePageLoadAction(pageAction: PageAction) {
|
||||||
appId: currentApp.id,
|
appId: currentApp.id,
|
||||||
onPageLoad: true,
|
onPageLoad: true,
|
||||||
appName: currentApp.name,
|
appName: currentApp.name,
|
||||||
environmentId: getCurrentEnvironment(),
|
environmentId: currentEnvDetails.id,
|
||||||
environmentName: getCurrentEnvName(),
|
environmentName: currentEnvDetails.name,
|
||||||
isExampleApp: currentApp.appIsExample,
|
isExampleApp: currentApp.appIsExample,
|
||||||
pluginName: plugin?.name,
|
pluginName: plugin?.name,
|
||||||
datasourceId: datasourceId,
|
datasourceId: datasourceId,
|
||||||
|
|
@ -1194,8 +1205,8 @@ function* executePageLoadAction(pageAction: PageAction) {
|
||||||
appId: currentApp.id,
|
appId: currentApp.id,
|
||||||
onPageLoad: true,
|
onPageLoad: true,
|
||||||
appName: currentApp.name,
|
appName: currentApp.name,
|
||||||
environmentId: getCurrentEnvironment(),
|
environmentId: currentEnvDetails.id,
|
||||||
environmentName: getCurrentEnvName(),
|
environmentName: currentEnvDetails.name,
|
||||||
isExampleApp: currentApp.appIsExample,
|
isExampleApp: currentApp.appIsExample,
|
||||||
pluginName: plugin?.name,
|
pluginName: plugin?.name,
|
||||||
datasourceId: datasourceId,
|
datasourceId: datasourceId,
|
||||||
|
|
@ -1527,7 +1538,8 @@ function* softRefreshActionsSaga() {
|
||||||
if (isQueryPane) {
|
if (isQueryPane) {
|
||||||
yield put(changeQuery(isQueryPane.params.queryId));
|
yield put(changeQuery(isQueryPane.params.queryId));
|
||||||
}
|
}
|
||||||
toast.show(createMessage(SWITCH_ENVIRONMENT_SUCCESS, getCurrentEnvName()), {
|
const currentEnvName: string = yield select(getCurrentEnvironmentName);
|
||||||
|
toast.show(createMessage(SWITCH_ENVIRONMENT_SUCCESS, currentEnvName), {
|
||||||
kind: "success",
|
kind: "success",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -146,11 +146,6 @@ import { toast } from "design-system";
|
||||||
import { fetchPluginFormConfig } from "actions/pluginActions";
|
import { fetchPluginFormConfig } from "actions/pluginActions";
|
||||||
import { addClassToDocumentRoot } from "pages/utils";
|
import { addClassToDocumentRoot } from "pages/utils";
|
||||||
import { AuthorizationStatus } from "pages/common/datasourceAuth";
|
import { AuthorizationStatus } from "pages/common/datasourceAuth";
|
||||||
import {
|
|
||||||
getCurrentEditingEnvID,
|
|
||||||
getCurrentEnvName,
|
|
||||||
getCurrentEnvironment,
|
|
||||||
} from "@appsmith/utils/Environments";
|
|
||||||
import {
|
import {
|
||||||
getFormDiffPaths,
|
getFormDiffPaths,
|
||||||
getFormName,
|
getFormName,
|
||||||
|
|
@ -160,6 +155,10 @@ import { getDefaultEnvId } from "@appsmith/api/ApiUtils";
|
||||||
import type { DatasourceStructureContext } from "pages/Editor/Explorer/Datasources/DatasourceStructureContainer";
|
import type { DatasourceStructureContext } from "pages/Editor/Explorer/Datasources/DatasourceStructureContainer";
|
||||||
import { MAX_DATASOURCE_SUGGESTIONS } from "pages/Editor/Explorer/hooks";
|
import { MAX_DATASOURCE_SUGGESTIONS } from "pages/Editor/Explorer/hooks";
|
||||||
import { klona } from "klona/lite";
|
import { klona } from "klona/lite";
|
||||||
|
import {
|
||||||
|
getCurrentEditingEnvironmentId,
|
||||||
|
getCurrentEnvironmentDetails,
|
||||||
|
} from "@appsmith/selectors/environmentSelectors";
|
||||||
|
|
||||||
function* fetchDatasourcesSaga(
|
function* fetchDatasourcesSaga(
|
||||||
action: ReduxAction<{ workspaceId?: string } | undefined>,
|
action: ReduxAction<{ workspaceId?: string } | undefined>,
|
||||||
|
|
@ -434,9 +433,12 @@ function* updateDatasourceSaga(
|
||||||
>,
|
>,
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
|
const currentEnvDetails: { id: string; name: string } = yield select(
|
||||||
|
getCurrentEnvironmentDetails,
|
||||||
|
);
|
||||||
const queryParams = getQueryParams();
|
const queryParams = getQueryParams();
|
||||||
const currentEnvironment =
|
const currentEnvironment =
|
||||||
actionPayload.payload?.currEditingEnvId || getCurrentEnvironment();
|
actionPayload.payload?.currEditingEnvId || currentEnvDetails.id;
|
||||||
const datasourcePayload = omit(actionPayload.payload, "name");
|
const datasourcePayload = omit(actionPayload.payload, "name");
|
||||||
const datasourceStoragePayload =
|
const datasourceStoragePayload =
|
||||||
datasourcePayload.datasourceStorages[currentEnvironment];
|
datasourcePayload.datasourceStorages[currentEnvironment];
|
||||||
|
|
@ -510,7 +512,7 @@ function* updateDatasourceSaga(
|
||||||
datasourceId: responseData?.id,
|
datasourceId: responseData?.id,
|
||||||
datasourceName: responseData.name,
|
datasourceName: responseData.name,
|
||||||
environmentId: currentEnvironment,
|
environmentId: currentEnvironment,
|
||||||
environmentName: getCurrentEnvName(),
|
environmentName: currentEnvDetails.name,
|
||||||
pluginName: plugin?.name || "",
|
pluginName: plugin?.name || "",
|
||||||
pluginPackageName: plugin?.packageName || "",
|
pluginPackageName: plugin?.packageName || "",
|
||||||
isFormValid: isFormValid,
|
isFormValid: isFormValid,
|
||||||
|
|
@ -596,7 +598,10 @@ function* redirectAuthorizationCodeSaga(
|
||||||
const isImport: string = yield select(getWorkspaceIdForImport);
|
const isImport: string = yield select(getWorkspaceIdForImport);
|
||||||
|
|
||||||
if (pluginType === PluginType.API) {
|
if (pluginType === PluginType.API) {
|
||||||
window.location.href = `/api/v1/datasources/${datasourceId}/pages/${pageId}/code?environmentId=${getCurrentEditingEnvID()}`;
|
const currentEnvironment: string = yield select(
|
||||||
|
getCurrentEditingEnvironmentId,
|
||||||
|
);
|
||||||
|
window.location.href = `/api/v1/datasources/${datasourceId}/pages/${pageId}/code?environmentId=${currentEnvironment}`;
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
// Get an "appsmith token" from the server
|
// Get an "appsmith token" from the server
|
||||||
|
|
@ -666,11 +671,14 @@ function* getOAuthAccessTokenSaga(
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
const currentEnvDetails: { id: string; name: string } = yield select(
|
||||||
|
getCurrentEnvironmentDetails,
|
||||||
|
);
|
||||||
AnalyticsUtil.logEvent("DATASOURCE_AUTH_COMPLETE", {
|
AnalyticsUtil.logEvent("DATASOURCE_AUTH_COMPLETE", {
|
||||||
applicationId: applicationId,
|
applicationId: applicationId,
|
||||||
datasourceId: datasourceId,
|
datasourceId: datasourceId,
|
||||||
environmentId: getCurrentEnvironment(),
|
environmentId: currentEnvDetails.id,
|
||||||
environmentName: getCurrentEnvName(),
|
environmentName: currentEnvDetails.name,
|
||||||
pageId: pageId,
|
pageId: pageId,
|
||||||
oAuthPassOrFailVerdict: "success",
|
oAuthPassOrFailVerdict: "success",
|
||||||
workspaceId: response.data.datasource?.workspaceId,
|
workspaceId: response.data.datasource?.workspaceId,
|
||||||
|
|
@ -743,7 +751,9 @@ function* testDatasourceSaga(actionPayload: ReduxAction<Datasource>) {
|
||||||
yield select(getDatasource, actionPayload.payload.id),
|
yield select(getDatasource, actionPayload.payload.id),
|
||||||
`Datasource not found for id - ${actionPayload.payload.id}`,
|
`Datasource not found for id - ${actionPayload.payload.id}`,
|
||||||
);
|
);
|
||||||
const currentEnvironment = getCurrentEditingEnvID();
|
const currentEnvironment: string = yield select(
|
||||||
|
getCurrentEditingEnvironmentId,
|
||||||
|
);
|
||||||
const payload = {
|
const payload = {
|
||||||
...actionPayload.payload,
|
...actionPayload.payload,
|
||||||
id: actionPayload.payload.id as any,
|
id: actionPayload.payload.id as any,
|
||||||
|
|
@ -767,6 +777,9 @@ function* testDatasourceSaga(actionPayload: ReduxAction<Datasource>) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const currentEnvDetails: { id: string; name: string } = yield select(
|
||||||
|
getCurrentEnvironmentDetails,
|
||||||
|
);
|
||||||
try {
|
try {
|
||||||
const response: ApiResponse<Datasource> =
|
const response: ApiResponse<Datasource> =
|
||||||
yield DatasourcesApi.testDatasource(
|
yield DatasourcesApi.testDatasource(
|
||||||
|
|
@ -790,7 +803,7 @@ function* testDatasourceSaga(actionPayload: ReduxAction<Datasource>) {
|
||||||
AnalyticsUtil.logEvent("TEST_DATA_SOURCE_FAILED", {
|
AnalyticsUtil.logEvent("TEST_DATA_SOURCE_FAILED", {
|
||||||
datasoureId: datasource?.id,
|
datasoureId: datasource?.id,
|
||||||
environmentId: currentEnvironment,
|
environmentId: currentEnvironment,
|
||||||
environmentName: getCurrentEnvName(),
|
environmentName: currentEnvDetails.name,
|
||||||
pluginName: plugin?.name,
|
pluginName: plugin?.name,
|
||||||
errorMessages: responseData.invalids,
|
errorMessages: responseData.invalids,
|
||||||
messages: responseData.messages,
|
messages: responseData.messages,
|
||||||
|
|
@ -828,7 +841,7 @@ function* testDatasourceSaga(actionPayload: ReduxAction<Datasource>) {
|
||||||
datasourceName: payload.name,
|
datasourceName: payload.name,
|
||||||
datasoureId: datasource?.id,
|
datasoureId: datasource?.id,
|
||||||
environmentId: currentEnvironment,
|
environmentId: currentEnvironment,
|
||||||
environmentName: getCurrentEnvName(),
|
environmentName: currentEnvDetails.name,
|
||||||
pluginName: plugin?.name,
|
pluginName: plugin?.name,
|
||||||
});
|
});
|
||||||
toast.show(createMessage(DATASOURCE_VALID, payload.name), {
|
toast.show(createMessage(DATASOURCE_VALID, payload.name), {
|
||||||
|
|
@ -861,7 +874,7 @@ function* testDatasourceSaga(actionPayload: ReduxAction<Datasource>) {
|
||||||
AnalyticsUtil.logEvent("TEST_DATA_SOURCE_FAILED", {
|
AnalyticsUtil.logEvent("TEST_DATA_SOURCE_FAILED", {
|
||||||
datasoureId: datasource?.id,
|
datasoureId: datasource?.id,
|
||||||
environmentId: currentEnvironment,
|
environmentId: currentEnvironment,
|
||||||
environmentName: getCurrentEnvName(),
|
environmentName: currentEnvDetails.name,
|
||||||
pluginName: plugin?.name,
|
pluginName: plugin?.name,
|
||||||
errorMessages: (error as any)?.message,
|
errorMessages: (error as any)?.message,
|
||||||
});
|
});
|
||||||
|
|
@ -962,7 +975,9 @@ function* createDatasourceFromFormSaga(
|
||||||
getPluginForm,
|
getPluginForm,
|
||||||
actionPayload.payload.pluginId,
|
actionPayload.payload.pluginId,
|
||||||
);
|
);
|
||||||
const currentEnvironment = getCurrentEditingEnvID();
|
const currentEnvironment: string = yield select(
|
||||||
|
getCurrentEditingEnvironmentId,
|
||||||
|
);
|
||||||
|
|
||||||
const initialValues: unknown = yield call(
|
const initialValues: unknown = yield call(
|
||||||
getConfigInitialValues,
|
getConfigInitialValues,
|
||||||
|
|
@ -1000,6 +1015,9 @@ function* createDatasourceFromFormSaga(
|
||||||
workspaceId,
|
workspaceId,
|
||||||
});
|
});
|
||||||
const isValidResponse: boolean = yield validateResponse(response);
|
const isValidResponse: boolean = yield validateResponse(response);
|
||||||
|
const currentEnvDetails: { id: string; name: string } = yield select(
|
||||||
|
getCurrentEnvironmentDetails,
|
||||||
|
);
|
||||||
if (isValidResponse) {
|
if (isValidResponse) {
|
||||||
const plugin: Plugin = yield select(getPlugin, response?.data?.pluginId);
|
const plugin: Plugin = yield select(getPlugin, response?.data?.pluginId);
|
||||||
const formName: string = getFormName(plugin);
|
const formName: string = getFormName(plugin);
|
||||||
|
|
@ -1014,7 +1032,7 @@ function* createDatasourceFromFormSaga(
|
||||||
datasourceId: response?.data?.id,
|
datasourceId: response?.data?.id,
|
||||||
datasourceName: response?.data?.name,
|
datasourceName: response?.data?.name,
|
||||||
environmentId: currentEnvironment,
|
environmentId: currentEnvironment,
|
||||||
environmentName: getCurrentEnvName(),
|
environmentName: currentEnvDetails.name,
|
||||||
pluginName: plugin?.name || "",
|
pluginName: plugin?.name || "",
|
||||||
pluginPackageName: plugin?.packageName || "",
|
pluginPackageName: plugin?.packageName || "",
|
||||||
isFormValid: isFormValid,
|
isFormValid: isFormValid,
|
||||||
|
|
@ -1171,7 +1189,11 @@ function* storeAsDatasourceSaga() {
|
||||||
let datasource = get(values, "datasource");
|
let datasource = get(values, "datasource");
|
||||||
datasource = omit(datasource, ["name"]);
|
datasource = omit(datasource, ["name"]);
|
||||||
const originalHeaders = get(values, "actionConfiguration.headers", []);
|
const originalHeaders = get(values, "actionConfiguration.headers", []);
|
||||||
const currentEnvironment = getCurrentEnvironment();
|
|
||||||
|
const currentEnvDetails: { id: string; name: string } = yield select(
|
||||||
|
getCurrentEnvironmentDetails,
|
||||||
|
);
|
||||||
|
const currentEnvironment = currentEnvDetails.id;
|
||||||
const [datasourceHeaders, actionHeaders] = partition(
|
const [datasourceHeaders, actionHeaders] = partition(
|
||||||
originalHeaders,
|
originalHeaders,
|
||||||
({ key, value }: { key: string; value: string }) => {
|
({ key, value }: { key: string; value: string }) => {
|
||||||
|
|
@ -1348,11 +1370,14 @@ function* fetchDatasourceStructureSaga(
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
const currentEnvDetails: { id: string; name: string } = yield select(
|
||||||
|
getCurrentEnvironmentDetails,
|
||||||
|
);
|
||||||
AnalyticsUtil.logEvent("DATASOURCE_SCHEMA_FETCH", {
|
AnalyticsUtil.logEvent("DATASOURCE_SCHEMA_FETCH", {
|
||||||
datasourceId: datasource?.id,
|
datasourceId: datasource?.id,
|
||||||
pluginName: plugin?.name,
|
pluginName: plugin?.name,
|
||||||
environmentId: getCurrentEnvironment(),
|
environmentId: currentEnvDetails.id,
|
||||||
environmentName: getCurrentEnvName(),
|
environmentName: currentEnvDetails.name,
|
||||||
errorMessage: errorMessage,
|
errorMessage: errorMessage,
|
||||||
isSuccess: isSuccess,
|
isSuccess: isSuccess,
|
||||||
source: action.payload.schemaFetchContext,
|
source: action.payload.schemaFetchContext,
|
||||||
|
|
@ -1462,12 +1487,15 @@ function* refreshDatasourceStructure(
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
const currentEnvDetails: { id: string; name: string } = yield select(
|
||||||
|
getCurrentEnvironmentDetails,
|
||||||
|
);
|
||||||
|
|
||||||
AnalyticsUtil.logEvent("DATASOURCE_SCHEMA_FETCH", {
|
AnalyticsUtil.logEvent("DATASOURCE_SCHEMA_FETCH", {
|
||||||
datasourceId: datasource?.id,
|
datasourceId: datasource?.id,
|
||||||
pluginName: plugin?.name,
|
pluginName: plugin?.name,
|
||||||
environmentId: getCurrentEnvironment(),
|
environmentId: currentEnvDetails.id,
|
||||||
environmentName: getCurrentEnvName(),
|
environmentName: currentEnvDetails.name,
|
||||||
errorMessage: errorMessage,
|
errorMessage: errorMessage,
|
||||||
isSuccess: isSuccess,
|
isSuccess: isSuccess,
|
||||||
source: action.payload.schemaRefreshContext,
|
source: action.payload.schemaRefreshContext,
|
||||||
|
|
@ -1580,7 +1608,9 @@ function* filePickerActionCallbackSaga(
|
||||||
const plugin: Plugin = yield select(getPlugin, datasource?.pluginId);
|
const plugin: Plugin = yield select(getPlugin, datasource?.pluginId);
|
||||||
const applicationId: string = yield select(getCurrentApplicationId);
|
const applicationId: string = yield select(getCurrentApplicationId);
|
||||||
const pageId: string = yield select(getCurrentPageId);
|
const pageId: string = yield select(getCurrentPageId);
|
||||||
const currentEnvironment = getCurrentEnvironment();
|
const currentEnvDetails: { id: string; name: string } = yield select(
|
||||||
|
getCurrentEnvironmentDetails,
|
||||||
|
);
|
||||||
|
|
||||||
// update authentication status based on whether files were picked or not
|
// update authentication status based on whether files were picked or not
|
||||||
const authStatus =
|
const authStatus =
|
||||||
|
|
@ -1591,7 +1621,7 @@ function* filePickerActionCallbackSaga(
|
||||||
// Once files are selected in case of import, set this flag
|
// Once files are selected in case of import, set this flag
|
||||||
set(
|
set(
|
||||||
datasource,
|
datasource,
|
||||||
`datasourceStorages.${currentEnvironment}.datasourceConfiguration.authentication.authenticationStatus`,
|
`datasourceStorages.${currentEnvDetails.id}.datasourceConfiguration.authentication.authenticationStatus`,
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1600,8 +1630,8 @@ function* filePickerActionCallbackSaga(
|
||||||
applicationId: applicationId,
|
applicationId: applicationId,
|
||||||
pageId: pageId,
|
pageId: pageId,
|
||||||
datasourceId: datasource?.id,
|
datasourceId: datasource?.id,
|
||||||
environmentId: currentEnvironment,
|
environmentId: currentEnvDetails.id,
|
||||||
environmentName: getCurrentEnvName(),
|
environmentName: currentEnvDetails.name,
|
||||||
oAuthPassOrFailVerdict:
|
oAuthPassOrFailVerdict:
|
||||||
authStatus === AuthenticationStatus.FAILURE_FILE_NOT_SELECTED
|
authStatus === AuthenticationStatus.FAILURE_FILE_NOT_SELECTED
|
||||||
? createMessage(FILES_NOT_SELECTED_EVENT)
|
? createMessage(FILES_NOT_SELECTED_EVENT)
|
||||||
|
|
@ -1617,7 +1647,7 @@ function* filePickerActionCallbackSaga(
|
||||||
// using the second index specifically for file ids.
|
// using the second index specifically for file ids.
|
||||||
set(
|
set(
|
||||||
datasource,
|
datasource,
|
||||||
`datasourceStorages.${currentEnvironment}.datasourceConfiguration.properties[1]`,
|
`datasourceStorages.${currentEnvDetails.id}.datasourceConfiguration.properties[1]`,
|
||||||
{
|
{
|
||||||
key: createMessage(GSHEET_AUTHORISED_FILE_IDS_KEY),
|
key: createMessage(GSHEET_AUTHORISED_FILE_IDS_KEY),
|
||||||
value: fileIds,
|
value: fileIds,
|
||||||
|
|
@ -1854,7 +1884,9 @@ function* updateDatasourceAuthStateSaga(
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
const { authStatus, datasource } = actionPayload.payload;
|
const { authStatus, datasource } = actionPayload.payload;
|
||||||
const currentEnvironment = getCurrentEditingEnvID();
|
const currentEnvironment: string = yield select(
|
||||||
|
getCurrentEditingEnvironmentId,
|
||||||
|
);
|
||||||
set(
|
set(
|
||||||
datasource,
|
datasource,
|
||||||
`datasourceStorages.${currentEnvironment}.datasourceConfiguration.authentication.authenticationStatus`,
|
`datasourceStorages.${currentEnvironment}.datasourceConfiguration.authentication.authenticationStatus`,
|
||||||
|
|
@ -2019,5 +2051,13 @@ export function* watchDatasourcesSagas() {
|
||||||
ReduxActionTypes.SET_DATASOURCE_EDITOR_MODE,
|
ReduxActionTypes.SET_DATASOURCE_EDITOR_MODE,
|
||||||
setDatasourceViewModeSaga,
|
setDatasourceViewModeSaga,
|
||||||
),
|
),
|
||||||
|
takeEvery(
|
||||||
|
ReduxActionTypes.SOFT_REFRESH_DATASOURCE_STRUCTURE,
|
||||||
|
handleFetchDatasourceStructureOnLoad,
|
||||||
|
),
|
||||||
|
takeEvery(
|
||||||
|
ReduxActionTypes.SET_DATASOURCE_EDITOR_MODE,
|
||||||
|
setDatasourceViewModeSaga,
|
||||||
|
),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,10 +63,7 @@ import {
|
||||||
isAction,
|
isAction,
|
||||||
isWidget,
|
isWidget,
|
||||||
} from "@appsmith/workers/Evaluation/evaluationUtils";
|
} from "@appsmith/workers/Evaluation/evaluationUtils";
|
||||||
import {
|
import { getCurrentEnvironmentDetails } from "@appsmith/selectors/environmentSelectors";
|
||||||
getCurrentEnvName,
|
|
||||||
getCurrentEnvironment,
|
|
||||||
} from "@appsmith/utils/Environments";
|
|
||||||
|
|
||||||
// Saga to format action request values to be shown in the debugger
|
// Saga to format action request values to be shown in the debugger
|
||||||
function* formatActionRequestSaga(
|
function* formatActionRequestSaga(
|
||||||
|
|
@ -488,14 +485,17 @@ function* addDebuggerErrorLogsSaga(action: ReduxAction<Log[]>) {
|
||||||
// Log analytics for new error messages
|
// Log analytics for new error messages
|
||||||
//errorID has timestamp for 1:1 mapping with new and resolved errors
|
//errorID has timestamp for 1:1 mapping with new and resolved errors
|
||||||
if (errorMessages.length && errorLog) {
|
if (errorMessages.length && errorLog) {
|
||||||
|
const currentEnvDetails: { id: string; name: string } = yield select(
|
||||||
|
getCurrentEnvironmentDetails,
|
||||||
|
);
|
||||||
yield all(
|
yield all(
|
||||||
errorMessages.map((errorMessage) =>
|
errorMessages.map((errorMessage) =>
|
||||||
put({
|
put({
|
||||||
type: ReduxActionTypes.DEBUGGER_ERROR_ANALYTICS,
|
type: ReduxActionTypes.DEBUGGER_ERROR_ANALYTICS,
|
||||||
payload: {
|
payload: {
|
||||||
...analyticsPayload,
|
...analyticsPayload,
|
||||||
environmentId: getCurrentEnvironment(),
|
environmentId: currentEnvDetails.id,
|
||||||
environmentName: getCurrentEnvName(),
|
environmentName: currentEnvDetails.name,
|
||||||
eventName: "DEBUGGER_NEW_ERROR_MESSAGE",
|
eventName: "DEBUGGER_NEW_ERROR_MESSAGE",
|
||||||
errorId: errorLog.id + "_" + errorLog.timestamp,
|
errorId: errorLog.id + "_" + errorLog.timestamp,
|
||||||
errorMessage: errorMessage.message,
|
errorMessage: errorMessage.message,
|
||||||
|
|
@ -510,6 +510,9 @@ function* addDebuggerErrorLogsSaga(action: ReduxAction<Log[]>) {
|
||||||
} else {
|
} else {
|
||||||
const updatedErrorMessages = messages ?? [];
|
const updatedErrorMessages = messages ?? [];
|
||||||
const existingErrorMessages = currentDebuggerErrors[id].messages ?? [];
|
const existingErrorMessages = currentDebuggerErrors[id].messages ?? [];
|
||||||
|
const currentEnvDetails: { id: string; name: string } = yield select(
|
||||||
|
getCurrentEnvironmentDetails,
|
||||||
|
);
|
||||||
// Log new error messages
|
// Log new error messages
|
||||||
yield all(
|
yield all(
|
||||||
updatedErrorMessages.map((updatedErrorMessage) => {
|
updatedErrorMessages.map((updatedErrorMessage) => {
|
||||||
|
|
@ -526,8 +529,8 @@ function* addDebuggerErrorLogsSaga(action: ReduxAction<Log[]>) {
|
||||||
type: ReduxActionTypes.DEBUGGER_ERROR_ANALYTICS,
|
type: ReduxActionTypes.DEBUGGER_ERROR_ANALYTICS,
|
||||||
payload: {
|
payload: {
|
||||||
...analyticsPayload,
|
...analyticsPayload,
|
||||||
environmentId: getCurrentEnvironment(),
|
environmentId: currentEnvDetails.id,
|
||||||
environmentName: getCurrentEnvName(),
|
environmentName: currentEnvDetails.name,
|
||||||
eventName: "DEBUGGER_NEW_ERROR_MESSAGE",
|
eventName: "DEBUGGER_NEW_ERROR_MESSAGE",
|
||||||
errorId: errorLog.id + "_" + errorLog.timestamp,
|
errorId: errorLog.id + "_" + errorLog.timestamp,
|
||||||
errorMessage: updatedErrorMessage.message,
|
errorMessage: updatedErrorMessage.message,
|
||||||
|
|
@ -555,8 +558,8 @@ function* addDebuggerErrorLogsSaga(action: ReduxAction<Log[]>) {
|
||||||
type: ReduxActionTypes.DEBUGGER_ERROR_ANALYTICS,
|
type: ReduxActionTypes.DEBUGGER_ERROR_ANALYTICS,
|
||||||
payload: {
|
payload: {
|
||||||
...analyticsPayload,
|
...analyticsPayload,
|
||||||
environmentId: getCurrentEnvironment(),
|
environmentId: currentEnvDetails.id,
|
||||||
environmentName: getCurrentEnvName(),
|
environmentName: currentEnvDetails.name,
|
||||||
eventName: "DEBUGGER_RESOLVED_ERROR_MESSAGE",
|
eventName: "DEBUGGER_RESOLVED_ERROR_MESSAGE",
|
||||||
errorId:
|
errorId:
|
||||||
currentDebuggerErrors[id].id +
|
currentDebuggerErrors[id].id +
|
||||||
|
|
@ -618,6 +621,9 @@ function* deleteDebuggerErrorLogsSaga(
|
||||||
});
|
});
|
||||||
|
|
||||||
if (errorMessages) {
|
if (errorMessages) {
|
||||||
|
const currentEnvDetails: { id: string; name: string } = yield select(
|
||||||
|
getCurrentEnvironmentDetails,
|
||||||
|
);
|
||||||
//errorID has timestamp for 1:1 mapping with new and resolved errors
|
//errorID has timestamp for 1:1 mapping with new and resolved errors
|
||||||
yield all(
|
yield all(
|
||||||
errorMessages.map((errorMessage) => {
|
errorMessages.map((errorMessage) => {
|
||||||
|
|
@ -625,8 +631,8 @@ function* deleteDebuggerErrorLogsSaga(
|
||||||
type: ReduxActionTypes.DEBUGGER_ERROR_ANALYTICS,
|
type: ReduxActionTypes.DEBUGGER_ERROR_ANALYTICS,
|
||||||
payload: {
|
payload: {
|
||||||
...analyticsPayload,
|
...analyticsPayload,
|
||||||
environmentId: getCurrentEnvironment(),
|
environmentId: currentEnvDetails.id,
|
||||||
environmentName: getCurrentEnvName(),
|
environmentName: currentEnvDetails.name,
|
||||||
eventName: "DEBUGGER_RESOLVED_ERROR_MESSAGE",
|
eventName: "DEBUGGER_RESOLVED_ERROR_MESSAGE",
|
||||||
errorId: error.id + "_" + error.timestamp,
|
errorId: error.id + "_" + error.timestamp,
|
||||||
errorMessage: errorMessage.message,
|
errorMessage: errorMessage.message,
|
||||||
|
|
|
||||||
|
|
@ -81,10 +81,8 @@ import { getIsGeneratePageInitiator } from "utils/GenerateCrudUtil";
|
||||||
import { toast } from "design-system";
|
import { toast } from "design-system";
|
||||||
import type { CreateDatasourceSuccessAction } from "actions/datasourceActions";
|
import type { CreateDatasourceSuccessAction } from "actions/datasourceActions";
|
||||||
import { createDefaultActionPayload } from "./ActionSagas";
|
import { createDefaultActionPayload } from "./ActionSagas";
|
||||||
import {
|
import { DB_NOT_SUPPORTED } from "@appsmith/utils/Environments";
|
||||||
DB_NOT_SUPPORTED,
|
import { getCurrentEnvironmentId } from "@appsmith/selectors/environmentSelectors";
|
||||||
getCurrentEnvironment,
|
|
||||||
} from "@appsmith/utils/Environments";
|
|
||||||
|
|
||||||
// Called whenever the query being edited is changed via the URL or query pane
|
// Called whenever the query being edited is changed via the URL or query pane
|
||||||
function* changeQuerySaga(actionPayload: ReduxAction<{ id: string }>) {
|
function* changeQuerySaga(actionPayload: ReduxAction<{ id: string }>) {
|
||||||
|
|
@ -266,7 +264,7 @@ function* formValueChangeSaga(
|
||||||
|
|
||||||
// Editing form fields triggers evaluations.
|
// Editing form fields triggers evaluations.
|
||||||
// We pass the action to run form evaluations when the dataTree evaluation is complete
|
// We pass the action to run form evaluations when the dataTree evaluation is complete
|
||||||
let currentEnvironment = getCurrentEnvironment();
|
let currentEnvironment: string = yield select(getCurrentEnvironmentId);
|
||||||
const pluginType = plugin?.type;
|
const pluginType = plugin?.type;
|
||||||
if (
|
if (
|
||||||
(!!pluginType && DB_NOT_SUPPORTED.includes(pluginType)) ||
|
(!!pluginType && DB_NOT_SUPPORTED.includes(pluginType)) ||
|
||||||
|
|
|
||||||
|
|
@ -76,10 +76,10 @@ import { AppThemingMode } from "selectors/appThemingSelectors";
|
||||||
import { generateAutoHeightLayoutTreeAction } from "actions/autoHeightActions";
|
import { generateAutoHeightLayoutTreeAction } from "actions/autoHeightActions";
|
||||||
import { SelectionRequestType } from "sagas/WidgetSelectUtils";
|
import { SelectionRequestType } from "sagas/WidgetSelectUtils";
|
||||||
import { startFormEvaluations } from "actions/evaluationActions";
|
import { startFormEvaluations } from "actions/evaluationActions";
|
||||||
import { getCurrentEnvironment } from "@appsmith/utils/Environments";
|
|
||||||
import { getUIComponent } from "pages/Editor/QueryEditor/helpers";
|
import { getUIComponent } from "pages/Editor/QueryEditor/helpers";
|
||||||
import type { Plugin } from "api/PluginApi";
|
import type { Plugin } from "api/PluginApi";
|
||||||
import { UIComponentTypes } from "api/PluginApi";
|
import { UIComponentTypes } from "api/PluginApi";
|
||||||
|
import { getCurrentEnvironmentId } from "@appsmith/selectors/environmentSelectors";
|
||||||
|
|
||||||
export type UndoRedoPayload = {
|
export type UndoRedoPayload = {
|
||||||
operation: ReplayReduxActionTypes;
|
operation: ReplayReduxActionTypes;
|
||||||
|
|
@ -317,7 +317,7 @@ function* replayActionSaga(
|
||||||
* Update all the diffs in the action object.
|
* Update all the diffs in the action object.
|
||||||
* We need this for debugger logs, dynamicBindingPathList and to call relevant APIs */
|
* We need this for debugger logs, dynamicBindingPathList and to call relevant APIs */
|
||||||
|
|
||||||
const currentEnvironment = getCurrentEnvironment();
|
const currentEnvironment: string = yield select(getCurrentEnvironmentId);
|
||||||
const plugins: Plugin[] = yield select(getPlugins);
|
const plugins: Plugin[] = yield select(getPlugins);
|
||||||
const uiComponent = getUIComponent(replayEntity.pluginId, plugins);
|
const uiComponent = getUIComponent(replayEntity.pluginId, plugins);
|
||||||
const datasource: Datasource | undefined = yield select(
|
const datasource: Datasource | undefined = yield select(
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,4 @@
|
||||||
import {
|
import { isEnvironmentValid } from "@appsmith/utils/Environments";
|
||||||
getCurrentEditingEnvID,
|
|
||||||
isEnvironmentValid,
|
|
||||||
} from "@appsmith/utils/Environments";
|
|
||||||
import type { Property } from "entities/Action";
|
import type { Property } from "entities/Action";
|
||||||
import type { Datasource, DatasourceStorage } from "entities/Datasource";
|
import type { Datasource, DatasourceStorage } from "entities/Datasource";
|
||||||
import type {
|
import type {
|
||||||
|
|
@ -20,8 +17,8 @@ import { get, set } from "lodash";
|
||||||
|
|
||||||
export const datasourceToFormValues = (
|
export const datasourceToFormValues = (
|
||||||
datasource: Datasource,
|
datasource: Datasource,
|
||||||
|
currentEnvironment: string,
|
||||||
): ApiDatasourceForm => {
|
): ApiDatasourceForm => {
|
||||||
const currentEnvironment = getCurrentEditingEnvID();
|
|
||||||
const authType = get(
|
const authType = get(
|
||||||
datasource,
|
datasource,
|
||||||
`datasourceStorages.${currentEnvironment}.datasourceConfiguration.authentication.authenticationType`,
|
`datasourceStorages.${currentEnvironment}.datasourceConfiguration.authentication.authenticationType`,
|
||||||
|
|
@ -46,7 +43,11 @@ export const datasourceToFormValues = (
|
||||||
connection.ssl.authType === SSLType.SELF_SIGNED_CERTIFICATE,
|
connection.ssl.authType === SSLType.SELF_SIGNED_CERTIFICATE,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const authentication = datasourceToFormAuthentication(authType, datasource);
|
const authentication = datasourceToFormAuthentication(
|
||||||
|
authType,
|
||||||
|
datasource,
|
||||||
|
currentEnvironment,
|
||||||
|
);
|
||||||
const isSendSessionEnabled =
|
const isSendSessionEnabled =
|
||||||
get(
|
get(
|
||||||
datasource,
|
datasource,
|
||||||
|
|
@ -86,8 +87,8 @@ export const datasourceToFormValues = (
|
||||||
export const formValuesToDatasource = (
|
export const formValuesToDatasource = (
|
||||||
datasource: Datasource,
|
datasource: Datasource,
|
||||||
form: ApiDatasourceForm,
|
form: ApiDatasourceForm,
|
||||||
|
currentEnvironment: string,
|
||||||
): Datasource => {
|
): Datasource => {
|
||||||
const currentEnvironment = getCurrentEditingEnvID();
|
|
||||||
const authentication = formToDatasourceAuthentication(
|
const authentication = formToDatasourceAuthentication(
|
||||||
form.authType,
|
form.authType,
|
||||||
form.authentication,
|
form.authentication,
|
||||||
|
|
@ -223,8 +224,8 @@ const formToDatasourceAuthentication = (
|
||||||
const datasourceToFormAuthentication = (
|
const datasourceToFormAuthentication = (
|
||||||
authType: AuthType,
|
authType: AuthType,
|
||||||
datasource: Datasource,
|
datasource: Datasource,
|
||||||
|
currentEnvironment: string,
|
||||||
): Authentication | undefined => {
|
): Authentication | undefined => {
|
||||||
const currentEnvironment = getCurrentEditingEnvID();
|
|
||||||
if (
|
if (
|
||||||
!datasource ||
|
!datasource ||
|
||||||
!datasource.datasourceStorages[currentEnvironment]
|
!datasource.datasourceStorages[currentEnvironment]
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,7 @@ import {
|
||||||
DATASOURCE_REST_API_FORM,
|
DATASOURCE_REST_API_FORM,
|
||||||
DATASOURCE_SAAS_FORM,
|
DATASOURCE_SAAS_FORM,
|
||||||
} from "@appsmith/constants/forms";
|
} from "@appsmith/constants/forms";
|
||||||
import {
|
import { DB_NOT_SUPPORTED } from "@appsmith/utils/Environments";
|
||||||
DB_NOT_SUPPORTED,
|
|
||||||
getCurrentEnvironment,
|
|
||||||
} from "@appsmith/utils/Environments";
|
|
||||||
import { diff } from "deep-diff";
|
import { diff } from "deep-diff";
|
||||||
import { PluginName, PluginPackageName, PluginType } from "entities/Action";
|
import { PluginName, PluginPackageName, PluginType } from "entities/Action";
|
||||||
import type {
|
import type {
|
||||||
|
|
@ -104,7 +101,7 @@ export function getPropertyControlFocusElement(
|
||||||
export function isDatasourceAuthorizedForQueryCreation(
|
export function isDatasourceAuthorizedForQueryCreation(
|
||||||
datasource: Datasource,
|
datasource: Datasource,
|
||||||
plugin: Plugin,
|
plugin: Plugin,
|
||||||
currentEnvironment = getCurrentEnvironment(),
|
currentEnvironment: string,
|
||||||
validStatusArr: Array<AuthenticationStatus> = [AuthenticationStatus.SUCCESS],
|
validStatusArr: Array<AuthenticationStatus> = [AuthenticationStatus.SUCCESS],
|
||||||
): boolean {
|
): boolean {
|
||||||
if (!datasource || !datasource.hasOwnProperty("datasourceStorages"))
|
if (!datasource || !datasource.hasOwnProperty("datasourceStorages"))
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ export const STORAGE_KEYS: {
|
||||||
USER_SIGN_UP: "USER_SIGN_UP",
|
USER_SIGN_UP: "USER_SIGN_UP",
|
||||||
VERSION_UPDATE_STATE: "VERSION_UPDATE_STATE",
|
VERSION_UPDATE_STATE: "VERSION_UPDATE_STATE",
|
||||||
AI_RECENT_QUERIES: "AI_RECENT_QUERIES",
|
AI_RECENT_QUERIES: "AI_RECENT_QUERIES",
|
||||||
|
CURRENT_ENV: "CURRENT_ENV",
|
||||||
AI_KNOWLEDGE_BASE: "AI_KNOWLEDGE_BASE",
|
AI_KNOWLEDGE_BASE: "AI_KNOWLEDGE_BASE",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -113,6 +114,42 @@ export const getCopiedWidgets = async () => {
|
||||||
return [];
|
return [];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Function to save the current environment and the appId in indexedDB
|
||||||
|
export const saveCurrentEnvironment = async (envId: string, appId: string) => {
|
||||||
|
try {
|
||||||
|
await store.setItem(STORAGE_KEYS.CURRENT_ENV, { envId, appId });
|
||||||
|
return true;
|
||||||
|
} catch (error) {
|
||||||
|
log.error("An error occurred when storing current env: ", error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Function to fetch the current environment and related appId from indexedDB
|
||||||
|
export const getSavedCurrentEnvironmentDetails = async () => {
|
||||||
|
try {
|
||||||
|
return (
|
||||||
|
(await store.getItem(STORAGE_KEYS.CURRENT_ENV)) || {
|
||||||
|
envId: "",
|
||||||
|
appId: "",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
log.error("An error occurred when fetching current env: ", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Function to reset the current environment and related appId from indexedDB
|
||||||
|
export const resetCurrentEnvironment = async () => {
|
||||||
|
try {
|
||||||
|
await store.removeItem(STORAGE_KEYS.CURRENT_ENV);
|
||||||
|
return true;
|
||||||
|
} catch (error) {
|
||||||
|
log.error("An error occurred when resetting current env: ", error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export const setPostWelcomeTourState = async (flag: boolean) => {
|
export const setPostWelcomeTourState = async (flag: boolean) => {
|
||||||
try {
|
try {
|
||||||
await store.setItem(STORAGE_KEYS.POST_WELCOME_TOUR, flag);
|
await store.setItem(STORAGE_KEYS.POST_WELCOME_TOUR, flag);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user