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:
kay delaney
2019-12-05 09:04:03 +00:00
committed by GitHub
parent 62f0aca3e6
commit 880fbcb09a
58 changed files with 320 additions and 467 deletions

View File

@@ -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) {