本文整理汇总了TypeScript中app/core/core.coreModule.controller方法的典型用法代码示例。如果您正苦于以下问题:TypeScript coreModule.controller方法的具体用法?TypeScript coreModule.controller怎么用?TypeScript coreModule.controller使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app/core/core.coreModule
的用法示例。
在下文中一共展示了coreModule.controller方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
import { coreModule, NavModelSrv } from 'app/core/core';
import { BackendSrv } from 'app/core/services/backend_srv';
export class AlertNotificationsListCtrl {
notifications: any;
navModel: any;
/** @ngInject */
constructor(private backendSrv: BackendSrv, navModelSrv: NavModelSrv) {
this.loadNotifications();
this.navModel = navModelSrv.getNav('alerting', 'channels');
}
loadNotifications() {
this.backendSrv.get(`/api/alert-notifications`).then((result: any) => {
this.notifications = result;
});
}
deleteNotification(id: number) {
this.backendSrv.delete(`/api/alert-notifications/${id}`).then(() => {
this.notifications = this.notifications.filter((notification: any) => {
return notification.id !== id;
});
});
}
}
coreModule.controller('AlertNotificationsListCtrl', AlertNotificationsListCtrl);
示例2: toJS
this.navModel = toJS(store.nav);
if (this.$routeParams.id) {
this.getDatasourceById(this.$routeParams.id);
}
}
getDatasourceById(id) {
this.backendSrv
.get('/api/datasources/' + id)
.then(ds => {
this.current = ds;
})
.then(this.getPluginInfo.bind(this));
}
updateNav() {
store.nav.initDatasourceEditNav(this.current, this.datasourceMeta, 'datasource-dashboards');
this.navModel = toJS(store.nav);
}
getPluginInfo() {
return this.backendSrv.get('/api/plugins/' + this.current.type + '/settings').then(pluginInfo => {
this.datasourceMeta = pluginInfo;
this.updateNav();
});
}
}
coreModule.controller('DataSourceDashboardsCtrl', DataSourceDashboardsCtrl);
示例3: delete
}
delete(s) {
appEvents.emit('confirm-modal', {
title: 'Delete',
text: 'Are you sure you want to delete this datasource?',
yesText: "Delete",
icon: "fa-trash",
onConfirm: () => {
this.confirmDelete();
}
});
}
}
coreModule.controller('DataSourceEditCtrl', DataSourceEditCtrl);
coreModule.directive('datasourceHttpSettings', function() {
return {
scope: {
current: "=",
suggestUrl: "@",
},
templateUrl: 'public/app/features/plugins/partials/ds_http_settings.html',
link: {
pre: function($scope, elem, attrs) {
$scope.getSuggestUrls = function() {
return [$scope.suggestUrl];
};
}
}
示例4: getUserOrgs
this.user.theme = user.theme || 'dark';
});
}
getUserOrgs() {
this.backendSrv.get('/api/user/orgs').then(orgs => {
this.orgs = orgs;
});
}
setUsingOrg(org) {
this.backendSrv.post('/api/user/using/' + org.orgId).then(() => {
window.location.href = config.appSubUrl + '/profile';
});
}
update() {
if (!this.userForm.$valid) { return; }
this.backendSrv.put('/api/user/', this.user).then(() => {
this.contextSrv.user.name = this.user.name || this.user.login;
if (this.old_theme !== this.user.theme) {
window.location.href = config.appSubUrl + this.$location.path();
}
});
}
}
coreModule.controller('ProfileCtrl', ProfileCtrl);