当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript coreModule.controller方法代码示例

本文整理汇总了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);
开发者ID:grafana,项目名称:grafana,代码行数:29,代码来源:NotificationsListCtrl.ts

示例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);
开发者ID:GPegel,项目名称:grafana,代码行数:30,代码来源:ds_dashboards_ctrl.ts

示例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];
        };
      }
    }
开发者ID:rbak1,项目名称:grafana,代码行数:31,代码来源:ds_edit_ctrl.ts

示例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);
开发者ID:0x01feng,项目名称:grafana,代码行数:30,代码来源:profile_ctrl.ts


注:本文中的app/core/core.coreModule.controller方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。