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")) {
|
||||
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 },
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user