mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Prettier: Upgrade to 2 (#30387)
* Updated package json but not updated source files * Update eslint plugin * updated files
This commit is contained in:
@@ -55,7 +55,7 @@ export class MysqlDatasource {
|
||||
): MysqlQueryForInterpolation[] {
|
||||
let expandedQueries = queries;
|
||||
if (queries && queries.length > 0) {
|
||||
expandedQueries = queries.map(query => {
|
||||
expandedQueries = queries.map((query) => {
|
||||
const expandedQuery = {
|
||||
...query,
|
||||
datasource: this.name,
|
||||
@@ -69,9 +69,9 @@ export class MysqlDatasource {
|
||||
}
|
||||
|
||||
query(options: any): Observable<MysqlResponse> {
|
||||
const queries = _.filter(options.targets, target => {
|
||||
const queries = _.filter(options.targets, (target) => {
|
||||
return target.hide !== true;
|
||||
}).map(target => {
|
||||
}).map((target) => {
|
||||
const queryModel = new MysqlQuery(target, this.templateSrv, options.scopedVars);
|
||||
|
||||
return {
|
||||
@@ -194,7 +194,7 @@ export class MysqlDatasource {
|
||||
})
|
||||
.pipe(
|
||||
mapTo({ status: 'success', message: 'Database Connection OK' }),
|
||||
catchError(err => {
|
||||
catchError((err) => {
|
||||
console.error(err);
|
||||
if (err.data && err.data.message) {
|
||||
return of({ status: 'error', message: err.data.message });
|
||||
|
||||
@@ -125,14 +125,14 @@ export class MysqlQueryCtrl extends QueryCtrl {
|
||||
|
||||
updateProjection() {
|
||||
this.selectParts = _.map(this.target.select, (parts: any) => {
|
||||
return _.map(parts, sqlPart.create).filter(n => n);
|
||||
return _.map(parts, sqlPart.create).filter((n) => n);
|
||||
});
|
||||
this.whereParts = _.map(this.target.where, sqlPart.create).filter(n => n);
|
||||
this.groupParts = _.map(this.target.group, sqlPart.create).filter(n => n);
|
||||
this.whereParts = _.map(this.target.where, sqlPart.create).filter((n) => n);
|
||||
this.groupParts = _.map(this.target.group, sqlPart.create).filter((n) => n);
|
||||
}
|
||||
|
||||
updatePersistedParts() {
|
||||
this.target.select = _.map(this.selectParts, selectParts => {
|
||||
this.target.select = _.map(this.selectParts, (selectParts) => {
|
||||
return _.map(selectParts, (part: any) => {
|
||||
return { type: part.def.type, datatype: part.datatype, params: part.params };
|
||||
});
|
||||
@@ -292,7 +292,7 @@ export class MysqlQueryCtrl extends QueryCtrl {
|
||||
|
||||
transformToSegments(config: any) {
|
||||
return (results: any) => {
|
||||
const segments = _.map(results, segment => {
|
||||
const segments = _.map(results, (segment) => {
|
||||
return this.uiSegmentSrv.newSegment({
|
||||
value: segment.text,
|
||||
expandable: segment.expandable,
|
||||
@@ -492,10 +492,10 @@ export class MysqlQueryCtrl extends QueryCtrl {
|
||||
|
||||
// add aggregates when adding group by
|
||||
for (const selectParts of this.selectParts) {
|
||||
if (!selectParts.some(part => part.def.type === 'aggregate')) {
|
||||
if (!selectParts.some((part) => part.def.type === 'aggregate')) {
|
||||
const aggregate = sqlPart.create({ type: 'aggregate', params: ['avg'] });
|
||||
selectParts.splice(1, 0, aggregate);
|
||||
if (!selectParts.some(part => part.def.type === 'alias')) {
|
||||
if (!selectParts.some((part) => part.def.type === 'alias')) {
|
||||
const alias = sqlPart.create({ type: 'alias', params: [selectParts[0].part.params[0]] });
|
||||
selectParts.push(alias);
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ export default class ResponseParser {
|
||||
|
||||
const unique = Array.from(new Set(res));
|
||||
|
||||
return _.map(unique, value => {
|
||||
return _.map(unique, (value) => {
|
||||
return { text: value };
|
||||
});
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ describe('MySQLDatasource', () => {
|
||||
const variable = { ...initialCustomVariableModelState };
|
||||
|
||||
jest.clearAllMocks();
|
||||
fetchMock.mockImplementation(options => of(createFetchResponse(response)));
|
||||
fetchMock.mockImplementation((options) => of(createFetchResponse(response)));
|
||||
|
||||
const ds = new MysqlDatasource(instanceSettings, templateSrv, timeSrvMock);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user