當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript core.NavModelSrv類代碼示例

本文整理匯總了TypeScript中app/core/core.NavModelSrv的典型用法代碼示例。如果您正苦於以下問題:TypeScript NavModelSrv類的具體用法?TypeScript NavModelSrv怎麽用?TypeScript NavModelSrv使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了NavModelSrv類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: constructor

  /** @ngInject */
  constructor($scope: any, backendSrv: BackendSrv, navModelSrv: NavModelSrv) {
    this.navModel = navModelSrv.getNav('admin', 'server-settings');

    backendSrv.get('/api/admin/settings').then((settings: any) => {
      $scope.settings = settings;
    });
  }
開發者ID:grafana,項目名稱:grafana,代碼行數:8,代碼來源:index.ts

示例2: constructor

 /** @ngInject */
 constructor(private backendSrv: BackendSrv, navModelSrv: NavModelSrv) {
   this.loadNotifications();
   this.navModel = navModelSrv.getNav('alerting', 'channels');
 }
開發者ID:grafana,項目名稱:grafana,代碼行數:5,代碼來源:NotificationsListCtrl.ts

示例3: constructor

  /** @ngInject */
  constructor($scope: any, $routeParams: any, backendSrv: BackendSrv, $location: any, navModelSrv: NavModelSrv) {
    $scope.user = {};
    $scope.newOrg = { name: '', role: 'Editor' };
    $scope.permissions = {};
    $scope.navModel = navModelSrv.getNav('admin', 'global-users');

    $scope.init = () => {
      if ($routeParams.id) {
        $scope.getUser($routeParams.id);
        $scope.getUserOrgs($routeParams.id);
      }
    };

    $scope.getUser = (id: number) => {
      backendSrv.get('/api/users/' + id).then((user: User) => {
        $scope.user = user;
        $scope.user_id = id;
        $scope.permissions.isGrafanaAdmin = user.isGrafanaAdmin;
      });
    };

    $scope.setPassword = () => {
      if (!$scope.passwordForm.$valid) {
        return;
      }

      const payload = { password: $scope.password };
      backendSrv.put('/api/admin/users/' + $scope.user_id + '/password', payload).then(() => {
        $location.path('/admin/users');
      });
    };

    $scope.updatePermissions = () => {
      const payload = $scope.permissions;

      backendSrv.put('/api/admin/users/' + $scope.user_id + '/permissions', payload).then(() => {
        $location.path('/admin/users');
      });
    };

    $scope.create = () => {
      if (!$scope.userForm.$valid) {
        return;
      }

      backendSrv.post('/api/admin/users', $scope.user).then(() => {
        $location.path('/admin/users');
      });
    };

    $scope.getUserOrgs = (id: number) => {
      backendSrv.get('/api/users/' + id + '/orgs').then((orgs: any) => {
        $scope.orgs = orgs;
      });
    };

    $scope.update = () => {
      if (!$scope.userForm.$valid) {
        return;
      }

      backendSrv.put('/api/users/' + $scope.user_id, $scope.user).then(() => {
        $location.path('/admin/users');
      });
    };

    $scope.updateOrgUser = (orgUser: { orgId: string }) => {
      backendSrv.patch('/api/orgs/' + orgUser.orgId + '/users/' + $scope.user_id, orgUser).then(() => {});
    };

    $scope.removeOrgUser = (orgUser: { orgId: string }) => {
      backendSrv.delete('/api/orgs/' + orgUser.orgId + '/users/' + $scope.user_id).then(() => {
        $scope.getUser($scope.user_id);
        $scope.getUserOrgs($scope.user_id);
      });
    };

    $scope.orgsSearchCache = [];

    $scope.searchOrgs = (queryStr: any, callback: any) => {
      if ($scope.orgsSearchCache.length > 0) {
        callback(_.map($scope.orgsSearchCache, 'name'));
        return;
      }

      backendSrv.get('/api/orgs', { query: '' }).then((result: any) => {
        $scope.orgsSearchCache = result;
        callback(_.map(result, 'name'));
      });
    };

    $scope.addOrgUser = () => {
      if (!$scope.addOrgForm.$valid) {
        return;
      }

      const orgInfo: any = _.find($scope.orgsSearchCache, {
        name: $scope.newOrg.name,
      });
//.........這裏部分代碼省略.........
開發者ID:grafana,項目名稱:grafana,代碼行數:101,代碼來源:AdminEditUserCtrl.ts

示例4:

    $scope.init = () => {
      $scope.navModel = navModelSrv.getNav('admin', 'global-orgs');

      if ($routeParams.id) {
        $scope.getOrg($routeParams.id);
        $scope.getOrgUsers($routeParams.id);
      }
    };
開發者ID:grafana,項目名稱:grafana,代碼行數:8,代碼來源:AdminEditOrgCtrl.ts

示例5:

 $scope.init = () => {
   $scope.navModel = navModelSrv.getNav('admin', 'global-orgs');
   $scope.getOrgs();
 };
開發者ID:grafana,項目名稱:grafana,代碼行數:4,代碼來源:AdminListOrgsCtrl.ts


注:本文中的app/core/core.NavModelSrv類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。