bosun.org@v0.0.0-20210513094433-e25bc3e69a1f/cmd/bosun/web/static/js/items.ts (about)

     1  /// <reference path="0-bosun.ts" />
     2  
     3  interface IItemsScope extends ng.IScope {
     4  	metrics: string[];
     5  	hosts: string[];
     6  	filterMetrics: string;
     7  	filterHosts: string;
     8  	status: string;
     9  }
    10  
    11  bosunControllers.controller('ItemsCtrl', ['$scope', '$http', function($scope: IItemsScope, $http: ng.IHttpService) {
    12  	$http.get('/api/metric')
    13  		.success(function(data: string[]) {
    14  			$scope.metrics = data;
    15  		})
    16  		.error(function(error) {
    17  			$scope.status = 'Unable to fetch metrics: ' + error;
    18  		});
    19  	$http.get('/api/tagv/host?since=default')
    20  		.success(function(data: string[]) {
    21  			$scope.hosts = data;
    22  		})
    23  		.error(function(error) {
    24  			$scope.status = 'Unable to fetch hosts: ' + error;
    25  		});
    26  }]);