mirror of
https://github.com/grafana/grafana.git
synced 2025-09-22 17:42:53 +08:00
Prettier: Upgrade to 2 (#30387)
* Updated package json but not updated source files * Update eslint plugin * updated files
This commit is contained in:
@ -123,14 +123,14 @@ export class PostgresQueryCtrl 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 };
|
||||
});
|
||||
@ -325,7 +325,7 @@ export class PostgresQueryCtrl extends QueryCtrl {
|
||||
|
||||
transformToSegments(config: { addNone?: any; addTemplateVars?: any; templateQuoter?: any }) {
|
||||
return (results: any) => {
|
||||
const segments = _.map(results, segment => {
|
||||
const segments = _.map(results, (segment) => {
|
||||
return this.uiSegmentSrv.newSegment({
|
||||
value: segment.text,
|
||||
expandable: segment.expandable,
|
||||
@ -525,10 +525,10 @@ export class PostgresQueryCtrl 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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user