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:
parent
58cfe737f7
commit
c6dd79c805
|
@ -58,7 +58,7 @@ export default Ember.Component.extend({
|
||||||
return this.params[this.get("info.identifier")];
|
return this.params[this.get("info.identifier")];
|
||||||
},
|
},
|
||||||
set(key, value) {
|
set(key, value) {
|
||||||
this.params[this.get("info.identifier")] = value.toString();
|
this.params[this.get("info.identifier")] = value?.toString();
|
||||||
return value;
|
return value;
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -238,7 +238,8 @@ table.group-reports {
|
||||||
|
|
||||||
.query-params {
|
.query-params {
|
||||||
border: 1px solid var(--header_primary-medium);
|
border: 1px solid var(--header_primary-medium);
|
||||||
.param > input {
|
.param > input,
|
||||||
|
.param > .select-kit {
|
||||||
margin: 9px;
|
margin: 9px;
|
||||||
}
|
}
|
||||||
.invalid > input {
|
.invalid > input {
|
||||||
|
@ -257,7 +258,8 @@ table.group-reports {
|
||||||
width: 100px !important; // override an inline style
|
width: 100px !important; // override an inline style
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
input {
|
input,
|
||||||
|
.select-kit {
|
||||||
width: 190px;
|
width: 190px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,6 +117,26 @@ acceptance("Data Explorer Plugin | Run Query", function (needs) {
|
||||||
hidden: false,
|
hidden: false,
|
||||||
user_id: -1,
|
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;
|
let paramsMonthsAgo = JSON.parse(searchParams.get("params")).months_ago;
|
||||||
assert.equal(paramsMonthsAgo, monthsAgoValue);
|
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"));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue