diff --git a/public/app/plugins/datasource/mssql/response_parser.ts b/public/app/plugins/datasource/mssql/response_parser.ts index d56ef88d0ff..ca456ebc9bf 100644 --- a/public/app/plugins/datasource/mssql/response_parser.ts +++ b/public/app/plugins/datasource/mssql/response_parser.ts @@ -69,14 +69,13 @@ export default class ResponseParser { for (let i = 0; i < rows.length; i++) { for (let j = 0; j < rows[i].length; j++) { - const value = rows[i][j]; - if (res.indexOf(value) === -1) { - res.push(value); - } + res.push(rows[i][j]); } } - return _.map(res, value => { + const unique = Array.from(new Set(res)); + + return _.map(unique, value => { return { text: value }; }); } diff --git a/public/app/plugins/datasource/mysql/response_parser.ts b/public/app/plugins/datasource/mysql/response_parser.ts index 48c4d3a5b87..b3bb6a1aa99 100644 --- a/public/app/plugins/datasource/mysql/response_parser.ts +++ b/public/app/plugins/datasource/mysql/response_parser.ts @@ -90,14 +90,13 @@ export default class ResponseParser { for (let i = 0; i < rows.length; i++) { for (let j = 0; j < rows[i].length; j++) { - const value = rows[i][j]; - if (res.indexOf(value) === -1) { - res.push(value); - } + res.push(rows[i][j]); } } - return _.map(res, value => { + const unique = Array.from(new Set(res)); + + return _.map(unique, value => { return { text: value }; }); } diff --git a/public/app/plugins/datasource/postgres/response_parser.ts b/public/app/plugins/datasource/postgres/response_parser.ts index f4e3485a7ca..79401560f22 100644 --- a/public/app/plugins/datasource/postgres/response_parser.ts +++ b/public/app/plugins/datasource/postgres/response_parser.ts @@ -72,14 +72,13 @@ export default class ResponseParser { for (let i = 0; i < rows.length; i++) { for (let j = 0; j < rows[i].length; j++) { - const value = rows[i][j]; - if (res.indexOf(value) === -1) { - res.push(value); - } + res.push(rows[i][j]); } } - return _.map(res, value => { + const unique = Array.from(new Set(res)); + + return _.map(unique, value => { return { text: value }; }); }