Use loadash get function to add fall back value to datasource url (#5285)

This commit is contained in:
arunvjn 2021-06-22 11:56:18 +05:30 committed by GitHub
parent 114ad2642b
commit f4b1daa459
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -158,7 +158,7 @@ class EmbeddedDatasourcePathComponent extends React.Component<Props> {
};
}
if (datasource && datasource.hasOwnProperty("id")) {
const datasourceUrl = datasource.datasourceConfiguration.url;
const datasourceUrl = get(datasource, "datasourceConfiguration.url", "");
if (value.includes(datasourceUrl)) {
return {
datasourceUrl,
@ -204,7 +204,7 @@ class EmbeddedDatasourcePathComponent extends React.Component<Props> {
"id" in datasource &&
datasource.id
) {
const end = datasource.datasourceConfiguration.url.length;
const end = get(datasource, "datasourceConfiguration.url", "").length;
editorInstance.markText(
{ ch: 0, line: 0 },
{ ch: end, line: 0 },