import type { IComponentOptions , IController } from 'angular' ; import { module } from 'angular' ; import { REST , SETTINGS } from '@spinnaker/core' ; class CanaryAnalysisNameSelectorController implements IController { public nameList : string [ ] = [ ] ; public queryListUrl : string ; public $onInit ( ) { this . queryListUrl = SETTINGS . canaryConfig ? SETTINGS . canaryConfig . queryListUrl : null ; REST ( '/canaryConfig/names' ) . get ( ) . then ( ( results ) => ( this . nameList = results . sort ( ) ) ) . catch ( ( ) => { this . nameList = [ ] ; } ) ; } } const canaryAnalysisNameSelectorComponent = { bindings : { model : '=' , className : '@' , } , controller : CanaryAnalysisNameSelectorController , templateUrl : require ( './canaryAnalysisNameSelector.component.html' ) , } ; export const CANARY_ANALYSIS_NAME_SELECTOR_COMPONENT = 'spinnaker.canary.canaryAnalysisNameSelector.component' ; module ( CANARY_ANALYSIS_NAME_SELECTOR_COMPONENT , [ ] ) . component ( 'canaryAnalysisNameSelector' , canaryAnalysisNameSelectorComponent ) ;