mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Postgres/MySQL: Fixes issue with toggle query editor mode (#35890)
* Postgres/MySQL: Fixes issue with toggle query editor mode * PostGres/MySQL: Use $evalAsync instead of manual $digest Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
This commit is contained in:
parent
fe61d20794
commit
eea3ea9755
@ -164,12 +164,20 @@ export class MysqlQueryCtrl extends QueryCtrl {
|
||||
icon: 'exclamation-triangle',
|
||||
yesText: 'Switch',
|
||||
onConfirm: () => {
|
||||
this.target.rawQuery = !this.target.rawQuery;
|
||||
// This could be called from React, so wrap in $evalAsync.
|
||||
// Will then either run as part of the current digest cycle or trigger a new one.
|
||||
this.$scope.$evalAsync(() => {
|
||||
this.target.rawQuery = !this.target.rawQuery;
|
||||
});
|
||||
},
|
||||
})
|
||||
);
|
||||
} else {
|
||||
this.target.rawQuery = !this.target.rawQuery;
|
||||
// This could be called from React, so wrap in $evalAsync.
|
||||
// Will then either run as part of the current digest cycle or trigger a new one.
|
||||
this.$scope.$evalAsync(() => {
|
||||
this.target.rawQuery = !this.target.rawQuery;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -196,12 +196,20 @@ export class PostgresQueryCtrl extends QueryCtrl {
|
||||
icon: 'exclamation-triangle',
|
||||
yesText: 'Switch',
|
||||
onConfirm: () => {
|
||||
this.target.rawQuery = !this.target.rawQuery;
|
||||
// This could be called from React, so wrap in $evalAsync.
|
||||
// Will then either run as part of the current digest cycle or trigger a new one.
|
||||
this.$scope.$evalAsync(() => {
|
||||
this.target.rawQuery = !this.target.rawQuery;
|
||||
});
|
||||
},
|
||||
})
|
||||
);
|
||||
} else {
|
||||
this.target.rawQuery = !this.target.rawQuery;
|
||||
// This could be called from React, so wrap in $evalAsync.
|
||||
// Will then either run as part of the current digest cycle or trigger a new one.
|
||||
this.$scope.$evalAsync(() => {
|
||||
this.target.rawQuery = !this.target.rawQuery;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user