Use loadash get function to add fall back value to datasource url (#5285)
This commit is contained in:
parent
114ad2642b
commit
f4b1daa459
|
|
@ -158,7 +158,7 @@ class EmbeddedDatasourcePathComponent extends React.Component<Props> {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (datasource && datasource.hasOwnProperty("id")) {
|
if (datasource && datasource.hasOwnProperty("id")) {
|
||||||
const datasourceUrl = datasource.datasourceConfiguration.url;
|
const datasourceUrl = get(datasource, "datasourceConfiguration.url", "");
|
||||||
if (value.includes(datasourceUrl)) {
|
if (value.includes(datasourceUrl)) {
|
||||||
return {
|
return {
|
||||||
datasourceUrl,
|
datasourceUrl,
|
||||||
|
|
@ -204,7 +204,7 @@ class EmbeddedDatasourcePathComponent extends React.Component<Props> {
|
||||||
"id" in datasource &&
|
"id" in datasource &&
|
||||||
datasource.id
|
datasource.id
|
||||||
) {
|
) {
|
||||||
const end = datasource.datasourceConfiguration.url.length;
|
const end = get(datasource, "datasourceConfiguration.url", "").length;
|
||||||
editorInstance.markText(
|
editorInstance.markText(
|
||||||
{ ch: 0, line: 0 },
|
{ ch: 0, line: 0 },
|
||||||
{ ch: end, line: 0 },
|
{ ch: end, line: 0 },
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user