mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
tech(typescript): its looking good
This commit is contained in:
@@ -104,8 +104,8 @@ function (angular, $, _, appLevelRequire) {
|
||||
_.each(pre_boot_modules, function (module) {
|
||||
_.extend(module, register_fns);
|
||||
});
|
||||
pre_boot_modules = false;
|
||||
|
||||
pre_boot_modules = false;
|
||||
$rootScope.requireContext = appLevelRequire;
|
||||
$rootScope.require = function (deps, fn) {
|
||||
var $scope = this;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
require.config({
|
||||
urlArgs: 'bust=' + (new Date().getTime()),
|
||||
baseUrl: 'public/.app_gen',
|
||||
baseUrl: 'public/app',
|
||||
|
||||
paths: {
|
||||
config: 'components/config',
|
||||
|
||||
@@ -8,6 +8,7 @@ function (angular) {
|
||||
|
||||
var module = angular.module('grafana.controllers');
|
||||
|
||||
|
||||
module.controller('ErrorCtrl', function($scope, contextSrv) {
|
||||
|
||||
var showSideMenu = contextSrv.sidemenu;
|
||||
|
||||
@@ -4,13 +4,10 @@ define([
|
||||
'lodash',
|
||||
'jquery',
|
||||
'store',
|
||||
'./testCtrl',
|
||||
],
|
||||
function (angular, config, _, $, store, TestCtrl) {
|
||||
function (angular, config, _, $, store) {
|
||||
"use strict";
|
||||
|
||||
console.log(new TestCtrl().getName());
|
||||
|
||||
var module = angular.module('grafana.controllers');
|
||||
|
||||
module.controller('GrafanaCtrl', function($scope, alertSrv, utilSrv, $rootScope, $controller, contextSrv) {
|
||||
|
||||
6
public/app/core/core.ts
Normal file
6
public/app/core/core.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
export * from './time_series'
|
||||
export * from './directives/cool_dir'
|
||||
export * from './routes/module_loader'
|
||||
|
||||
|
||||
7
public/app/core/directives/cool_dir.ts
Normal file
7
public/app/core/directives/cool_dir.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
export class CoolDir {
|
||||
getName() : string {
|
||||
return "CoolDir";
|
||||
}
|
||||
}
|
||||
|
||||
19
public/app/core/routes/module_loader.ts
Normal file
19
public/app/core/routes/module_loader.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
///<reference path="../../headers/require.d.ts" />
|
||||
|
||||
export class ModuleLoader {
|
||||
lazy: any
|
||||
|
||||
constructor(moduleName) {
|
||||
|
||||
this.lazy = ["$q", "$route", "$rootScope", function($q, $route, $rootScope) {
|
||||
var defered = $q.defer();
|
||||
|
||||
require([moduleName], function () {
|
||||
defered.resolve();
|
||||
});
|
||||
|
||||
return defered.promise;
|
||||
}];
|
||||
|
||||
}
|
||||
}
|
||||
6
public/app/core/time_series.ts
Normal file
6
public/app/core/time_series.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export class TimeSeries {
|
||||
getName() : string {
|
||||
return "TimeSeries";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,5 @@ define([
|
||||
'./profile/profileCtrl',
|
||||
'./profile/changePasswordCtrl',
|
||||
'./profile/selectOrgCtrl',
|
||||
'./org/all',
|
||||
'./admin/all',
|
||||
], function () {});
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
define([
|
||||
'angular',
|
||||
'../core/core',
|
||||
'./dashLoadControllers',
|
||||
], function(angular) {
|
||||
], function(angular, core) {
|
||||
"use strict";
|
||||
|
||||
var module = angular.module('grafana.routes');
|
||||
@@ -41,30 +42,37 @@ define([
|
||||
.when('/datasources', {
|
||||
templateUrl: 'app/features/org/partials/datasources.html',
|
||||
controller : 'DataSourcesCtrl',
|
||||
resolve: new core.ModuleLoader("features/org/all"),
|
||||
})
|
||||
.when('/datasources/edit/:id', {
|
||||
templateUrl: 'app/features/org/partials/datasourceEdit.html',
|
||||
controller : 'DataSourceEditCtrl',
|
||||
resolve: new core.ModuleLoader("features/org/all"),
|
||||
})
|
||||
.when('/datasources/new', {
|
||||
templateUrl: 'app/features/org/partials/datasourceEdit.html',
|
||||
controller : 'DataSourceEditCtrl',
|
||||
resolve: new core.ModuleLoader("features/org/all"),
|
||||
})
|
||||
.when('/org', {
|
||||
templateUrl: 'app/features/org/partials/orgDetails.html',
|
||||
controller : 'OrgDetailsCtrl',
|
||||
resolve: new core.ModuleLoader("features/org/all"),
|
||||
})
|
||||
.when('/org/new', {
|
||||
templateUrl: 'app/features/org/partials/newOrg.html',
|
||||
controller : 'NewOrgCtrl',
|
||||
resolve: new core.ModuleLoader("features/org/all"),
|
||||
})
|
||||
.when('/org/users', {
|
||||
templateUrl: 'app/features/org/partials/orgUsers.html',
|
||||
controller : 'OrgUsersCtrl',
|
||||
resolve: new core.ModuleLoader("features/org/all"),
|
||||
})
|
||||
.when('/org/apikeys', {
|
||||
templateUrl: 'app/features/org/partials/orgApiKeys.html',
|
||||
controller : 'OrgApiKeysCtrl',
|
||||
resolve: new core.ModuleLoader("features/org/all"),
|
||||
})
|
||||
.when('/profile', {
|
||||
templateUrl: 'app/features/profile/partials/profile.html',
|
||||
|
||||
Reference in New Issue
Block a user