Skip to content

Commit

Permalink
Merge pull request #598 from Altinity/fix-595-587
Browse files Browse the repository at this point in the history
Bugfixes #595 and #587
  • Loading branch information
Slach authored Jul 22, 2024
2 parents 9b200ab + 826bcde commit d2edcc4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/datasource/response_parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default class ResponseParser {
constructor() {}

parse(query: string, results: any): any[] {
if (!results || results.data.length === 0) {
if (!results || !results.data || results.data?.length === 0) {
return [];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ jsonData, onSwitchToggle, onFieldChange, externalProps

useEffect(() => {
const doRequest = async () => {
if (!jsonData.useDefaultConfiguration || (!jsonData.dataSourceUrl.startsWith('http://') && !jsonData.dataSourceUrl.startsWith('https://'))) {
return;
}

try {
const data = await getOptions(TABLES_QUERY, jsonData.dataSourceUrl)

Expand Down Expand Up @@ -46,7 +50,7 @@ jsonData, onSwitchToggle, onFieldChange, externalProps
}

doRequest()
}, [jsonData.dataSourceUrl]);
}, [jsonData.dataSourceUrl, jsonData.useDefaultConfiguration]);

return <div className="gf-form-group">
<InlineField
Expand Down

0 comments on commit d2edcc4

Please sign in to comment.