///
import coreModule from 'app/core/core_module';
var template = `
`;
export class DashboardSelectorCtrl {
model: any;
options: any;
/** @ngInject */
constructor(private backendSrv) {
}
$onInit() {
this.options = [{value: 0, text: 'Default'}];
return this.backendSrv.search({starred: true}).then(res => {
res.forEach(dash => {
this.options.push({value: dash.id, text: dash.title});
});
});
}
}
export function dashboardSelector() {
return {
restrict: 'E',
controller: DashboardSelectorCtrl,
bindToController: true,
controllerAs: 'ctrl',
template: template,
scope: {
model: '='
}
};
}
coreModule.directive('dashboardSelector', dashboardSelector);