mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore/Tech debt: Remove (most) instances of $q angular service use (#20668)
* Chore/Tech debt: Remove (most) instances of $q angular service use Removes instances where the angular $q service is used and replaces it with native Promises.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import _ from 'lodash';
|
||||
import coreModule from '../../core_module';
|
||||
import { ISCEService, IQService } from 'angular';
|
||||
import { ISCEService } from 'angular';
|
||||
|
||||
function typeaheadMatcher(this: any, item: string) {
|
||||
let str = this.query;
|
||||
@@ -38,13 +38,7 @@ export class FormDropdownCtrl {
|
||||
debounce: number;
|
||||
|
||||
/** @ngInject */
|
||||
constructor(
|
||||
private $scope: any,
|
||||
$element: JQLite,
|
||||
private $sce: ISCEService,
|
||||
private templateSrv: any,
|
||||
private $q: IQService
|
||||
) {
|
||||
constructor(private $scope: any, $element: JQLite, private $sce: ISCEService, private templateSrv: any) {
|
||||
this.inputElement = $element.find('input').first();
|
||||
this.linkElement = $element.find('a').first();
|
||||
this.linkMode = true;
|
||||
@@ -108,10 +102,7 @@ export class FormDropdownCtrl {
|
||||
|
||||
getOptionsInternal(query: string) {
|
||||
const result = this.getOptions({ $query: query });
|
||||
if (this.isPromiseLike(result)) {
|
||||
return result;
|
||||
}
|
||||
return this.$q.when(result);
|
||||
return Promise.resolve(result);
|
||||
}
|
||||
|
||||
isPromiseLike(obj: any) {
|
||||
|
Reference in New Issue
Block a user