fix: Block Action execution for Post UQI datasources like oracle (#24363)
The configProperty path for Post UQI datasource's body field is stored in actionConfiguration.formData.body.data, other older pre UQI format SQL datasources actionConfiguration.body. This adds a check for such post UQI datasources like Oracle.
This commit is contained in:
parent
22fb6c4376
commit
74faf24fab
|
|
@ -15,14 +15,30 @@ describe("Block Action Execution when no field is present", () => {
|
|||
apiPage.AssertRunButtonDisability(false);
|
||||
});
|
||||
|
||||
it("1. Ensure Run button is disabled when no SQL body field is present", () => {
|
||||
it("2. Ensure Run button is disabled when no SQL body field is present", () => {
|
||||
let name: any;
|
||||
dataSources.CreateDataSource("MySql", true, false);
|
||||
cy.get("@dsName").then(($dsName) => {
|
||||
name = $dsName;
|
||||
|
||||
agHelper.Sleep(1000);
|
||||
dataSources.NavigateFromActiveDS(name, true);
|
||||
dataSources.CreateQueryAfterDSSaved();
|
||||
agHelper.GetNClick(dataSources._templateMenu);
|
||||
dataSources.EnterQuery("SELECT * from users");
|
||||
dataSources.AssertRunButtonDisability(false);
|
||||
dataSources.EnterQuery("");
|
||||
dataSources.AssertRunButtonDisability(true);
|
||||
});
|
||||
});
|
||||
|
||||
it("3. Ensure Run button is disabled for Post UQI Datasources e.g. Oracle when no body data is present", () => {
|
||||
let name: any;
|
||||
dataSources.CreateDataSource("Oracle", true, false);
|
||||
cy.get("@dsName").then(($dsName) => {
|
||||
name = $dsName;
|
||||
|
||||
agHelper.Sleep(1000);
|
||||
dataSources.CreateQueryAfterDSSaved();
|
||||
agHelper.GetNClick(dataSources._templateMenu);
|
||||
dataSources.EnterQuery("SELECT * from users");
|
||||
dataSources.AssertRunButtonDisability(false);
|
||||
|
|
|
|||
|
|
@ -48,6 +48,12 @@
|
|||
"redis-host": "host.docker.internal",
|
||||
"redis-port": "6379",
|
||||
|
||||
"oracle-host": "random-data",
|
||||
"oracle-port": "40",
|
||||
"oracle-name": "random-name",
|
||||
"oracle-username": "random-username",
|
||||
"oracle-password": "random-password",
|
||||
|
||||
"OAuth_Username": "testuser@appsmith.com",
|
||||
"OAuth_Host": "http://localhost:6001",
|
||||
"OAuth_ApiUrl": "http://host.docker.internal:6001",
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ const DataSourceKVP = {
|
|||
Firestore: "Firestore",
|
||||
Elasticsearch: "Elasticsearch",
|
||||
Redis: "Redis",
|
||||
Oracle: "Oracle",
|
||||
}; //DataSources KeyValuePair
|
||||
|
||||
export enum Widgets {
|
||||
|
|
@ -433,6 +434,32 @@ export class DataSources {
|
|||
);
|
||||
}
|
||||
|
||||
public FillOracleDSForm(
|
||||
shouldAddTrailingSpaces = false,
|
||||
username = "",
|
||||
password = "",
|
||||
) {
|
||||
const hostAddress = shouldAddTrailingSpaces
|
||||
? datasourceFormData["oracle-host"] + " "
|
||||
: datasourceFormData["oracle-host"];
|
||||
const databaseName = shouldAddTrailingSpaces
|
||||
? datasourceFormData["oracle-name"] + " "
|
||||
: datasourceFormData["oracle-name"];
|
||||
this.agHelper.UpdateInputValue(this._host, hostAddress);
|
||||
this.agHelper.UpdateInputValue(
|
||||
this._port,
|
||||
datasourceFormData["oracle-port"].toString(),
|
||||
);
|
||||
cy.get(this._databaseName).clear().type(databaseName);
|
||||
this.ExpandSectionByName("Authentication");
|
||||
cy.get(this._username).type(
|
||||
username == "" ? datasourceFormData["oracle-username"] : username,
|
||||
);
|
||||
cy.get(this._password).type(
|
||||
password == "" ? datasourceFormData["oracle-password"] : password,
|
||||
);
|
||||
}
|
||||
|
||||
public FillMongoDSForm(shouldAddTrailingSpaces = false) {
|
||||
const hostAddress = shouldAddTrailingSpaces
|
||||
? datasourceFormData["mongo-host"] + " "
|
||||
|
|
@ -927,7 +954,8 @@ export class DataSources {
|
|||
| "Arango"
|
||||
| "Firestore"
|
||||
| "Elasticsearch"
|
||||
| "Redis",
|
||||
| "Redis"
|
||||
| "Oracle",
|
||||
navigateToCreateNewDs = true,
|
||||
testNSave = true,
|
||||
) {
|
||||
|
|
@ -943,6 +971,7 @@ export class DataSources {
|
|||
dataSourceName = dsType + " " + guid;
|
||||
this.agHelper.RenameWithInPane(dataSourceName, false);
|
||||
if (DataSourceKVP[dsType] == "PostgreSQL") this.FillPostgresDSForm();
|
||||
else if (DataSourceKVP[dsType] == "Oracle") this.FillOracleDSForm();
|
||||
else if (DataSourceKVP[dsType] == "MySQL") this.FillMySqlDSForm();
|
||||
else if (DataSourceKVP[dsType] == "MongoDB") this.FillMongoDSForm();
|
||||
else if (DataSourceKVP[dsType] == "Microsoft SQL Server")
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ export const SQL_DATASOURCES: Array<string> = [
|
|||
PluginName.MS_SQL,
|
||||
PluginName.MY_SQL,
|
||||
PluginName.ORACLE,
|
||||
PluginName.SNOWFLAKE,
|
||||
PluginName.ARANGODB,
|
||||
PluginName.REDSHIFT,
|
||||
];
|
||||
|
||||
export const PLUGIN_PACKAGE_DBS = [
|
||||
|
|
|
|||
|
|
@ -34,6 +34,9 @@ export enum PluginName {
|
|||
GOOGLE_SHEETS = "Google Sheets",
|
||||
FIRESTORE = "Firestore",
|
||||
ORACLE = "Oracle",
|
||||
SNOWFLAKE = "Snowflake",
|
||||
ARANGODB = "ArangoDB",
|
||||
REDSHIFT = "Redshift",
|
||||
}
|
||||
|
||||
export enum PaginationType {
|
||||
|
|
|
|||
|
|
@ -434,8 +434,17 @@ export function EditorJSONtoForm(props: Props) {
|
|||
getPluginNameFromId(state, currentActionConfig?.pluginId || ""),
|
||||
);
|
||||
|
||||
// this gets the url of the current action
|
||||
const actionBody = currentActionConfig?.actionConfiguration?.body || "";
|
||||
let actionBody = "";
|
||||
if (!!currentActionConfig?.actionConfiguration) {
|
||||
if ("formData" in currentActionConfig?.actionConfiguration) {
|
||||
// if the action has a formData (the action is postUQI e.g. Oracle)
|
||||
actionBody =
|
||||
currentActionConfig.actionConfiguration.formData?.body?.data || "";
|
||||
} else {
|
||||
// if the action is pre UQI, the path is different e.g. mySQL
|
||||
actionBody = currentActionConfig.actionConfiguration?.body || "";
|
||||
}
|
||||
}
|
||||
|
||||
// if (the body is empty and the action is an sql datasource) or the user does not have permission, block action execution.
|
||||
const blockExecution =
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user