FIX: Do not stringify null parameters (#151)
Sometimes the query page did not load if one of the query was null because it called null.toString() and raised an exception.
This commit is contained in:
@@ -117,6 +117,26 @@ acceptance("Data Explorer Plugin | Run Query", function (needs) {
|
||||
hidden: false,
|
||||
user_id: -1,
|
||||
},
|
||||
{
|
||||
id: -7,
|
||||
sql: "-- [params]\n-- user_id :user\n\nSELECT :user_id\n\n",
|
||||
name: "Invalid Query",
|
||||
description: "",
|
||||
param_info: [
|
||||
{
|
||||
identifier: "user",
|
||||
type: "user_id",
|
||||
default: null,
|
||||
nullable: false,
|
||||
},
|
||||
],
|
||||
created_at: "2022-01-14T16:40:05.458Z",
|
||||
username: "bianca",
|
||||
group_ids: [],
|
||||
last_run_at: "2022-01-14T16:47:34.244Z",
|
||||
hidden: false,
|
||||
user_id: 1,
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
@@ -201,4 +221,10 @@ acceptance("Data Explorer Plugin | Run Query", function (needs) {
|
||||
let paramsMonthsAgo = JSON.parse(searchParams.get("params")).months_ago;
|
||||
assert.equal(paramsMonthsAgo, monthsAgoValue);
|
||||
});
|
||||
|
||||
test("it loads the page if one of the parameter is null", async function (assert) {
|
||||
await visit('admin/plugins/explorer?id=-7¶ms={"user":null}');
|
||||
assert.ok(exists(".query-params .user-chooser"));
|
||||
assert.ok(exists(".query-run .btn.btn-primary"));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user