diff --git a/public/app/core/controllers/grafana_ctrl.ts b/public/app/core/controllers/grafana_ctrl.ts index a6b7d021e81..a3377ee049b 100644 --- a/public/app/core/controllers/grafana_ctrl.ts +++ b/public/app/core/controllers/grafana_ctrl.ts @@ -1,9 +1,10 @@ /// -import angular = require('angular'); -import $ = require('jquery'); import config = require('app/core/config'); import store = require('app/core/store'); + +import angular from 'angular'; +import $ from 'jquery'; import coreModule from '../core_module'; coreModule.controller('GrafanaCtrl', function($scope, alertSrv, utilSrv, $rootScope, $controller, contextSrv) { diff --git a/public/app/core/core.ts b/public/app/core/core.ts index 849438e2344..d50f330ad53 100644 --- a/public/app/core/core.ts +++ b/public/app/core/core.ts @@ -1,31 +1,31 @@ /// /// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// +import "./directives/annotation_tooltip"; +import "./directives/body_class"; +import "./directives/config_modal"; +import "./directives/confirm_click"; +import "./directives/dash_edit_link"; +import "./directives/dash_upload"; +import "./directives/dropdown_typeahead"; +import "./directives/grafana_version_check"; +import "./directives/metric_segment"; +import "./directives/misc"; +import "./directives/ng_model_on_blur"; +import "./directives/password_strenght"; +import "./directives/spectrum_picker"; +import "./directives/tags"; +import "./directives/topnav"; +import "./directives/value_select_dropdown"; +import './jquery_extended'; +import './partials'; import {arrayJoin} from './directives/array_join'; import * as controllers from 'app/core/controllers/all'; import * as services from 'app/core/services/all'; import * as routes from 'app/core/routes/all'; +import './filters/filters'; // export * from './directives/give_focus' -// export * from './filters/filters' export {arrayJoin, controllers, services, routes}; diff --git a/public/app/core/core_module.ts b/public/app/core/core_module.ts index 08f6fc737c9..8ac4ae6e91f 100644 --- a/public/app/core/core_module.ts +++ b/public/app/core/core_module.ts @@ -1,5 +1,4 @@ /// -import angular = require('angular'); - +import angular from 'angular'; export default angular.module('grafana.core', ['ngRoute']); diff --git a/public/app/core/directives/annotation_tooltip.js b/public/app/core/directives/annotation_tooltip.js index c79ca97189c..38c0a34826f 100644 --- a/public/app/core/directives/annotation_tooltip.js +++ b/public/app/core/directives/annotation_tooltip.js @@ -6,7 +6,7 @@ define([ function ($, _, coreModule) { 'use strict'; - coreModule.directive('annotationTooltip', function($sanitize, dashboardSrv, $compile) { + coreModule.default.directive('annotationTooltip', function($sanitize, dashboardSrv, $compile) { function sanitizeString(str) { try { diff --git a/public/app/core/directives/array_join.ts b/public/app/core/directives/array_join.ts index ff27a0e9e25..43b6646c90e 100644 --- a/public/app/core/directives/array_join.ts +++ b/public/app/core/directives/array_join.ts @@ -1,7 +1,8 @@ /// -import angular = require('angular'); import _ = require('lodash'); + +import angular from 'angular'; import coreModule from '../core_module'; export function arrayJoin() { diff --git a/public/app/core/directives/body_class.js b/public/app/core/directives/body_class.js index 3a0699c297e..fdee7ed4752 100644 --- a/public/app/core/directives/body_class.js +++ b/public/app/core/directives/body_class.js @@ -6,7 +6,7 @@ define([ function (_, $, coreModule) { 'use strict'; - coreModule.directive('bodyClass', function() { + coreModule.default.directive('bodyClass', function() { return { link: function($scope, elem) { diff --git a/public/app/core/directives/config_modal.js b/public/app/core/directives/config_modal.js index 36129b0cc96..e37d6797fc4 100644 --- a/public/app/core/directives/config_modal.js +++ b/public/app/core/directives/config_modal.js @@ -6,7 +6,7 @@ define([ function (_, $, coreModule) { 'use strict'; - coreModule.directive('configModal', function($modal, $q, $timeout) { + coreModule.default.directive('configModal', function($modal, $q, $timeout) { return { restrict: 'A', link: function(scope, elem, attrs) { diff --git a/public/app/core/directives/confirm_click.js b/public/app/core/directives/confirm_click.js index f73a847af45..95b60347e10 100644 --- a/public/app/core/directives/confirm_click.js +++ b/public/app/core/directives/confirm_click.js @@ -4,7 +4,7 @@ define([ function (coreModule) { 'use strict'; - coreModule.directive('confirmClick', function() { + coreModule.default.directive('confirmClick', function() { return { restrict: 'A', link: function(scope, elem, attrs) { diff --git a/public/app/core/directives/dash_edit_link.js b/public/app/core/directives/dash_edit_link.js index 9ab74fe6d74..846eca6f1e4 100644 --- a/public/app/core/directives/dash_edit_link.js +++ b/public/app/core/directives/dash_edit_link.js @@ -11,7 +11,7 @@ function ($, coreModule) { 'templating': { src: 'app/features/templating/partials/editor.html', title: "Templating" } }; - coreModule.directive('dashEditorLink', function($timeout) { + coreModule.default.directive('dashEditorLink', function($timeout) { return { restrict: 'A', link: function(scope, elem, attrs) { @@ -27,7 +27,7 @@ function ($, coreModule) { }; }); - coreModule.directive('dashEditorView', function($compile, $location) { + coreModule.default.directive('dashEditorView', function($compile, $location) { return { restrict: 'A', link: function(scope, elem) { diff --git a/public/app/core/directives/dash_upload.js b/public/app/core/directives/dash_upload.js index ed4253c71ca..b03bc201e83 100644 --- a/public/app/core/directives/dash_upload.js +++ b/public/app/core/directives/dash_upload.js @@ -5,7 +5,7 @@ define([ function (coreModule, kbn) { 'use strict'; - coreModule.directive('dashUpload', function(timer, alertSrv, $location) { + coreModule.default.directive('dashUpload', function(timer, alertSrv, $location) { return { restrict: 'A', link: function(scope) { diff --git a/public/app/core/directives/dropdown_typeahead.js b/public/app/core/directives/dropdown_typeahead.js index ad484bb18d7..8b052cc2697 100644 --- a/public/app/core/directives/dropdown_typeahead.js +++ b/public/app/core/directives/dropdown_typeahead.js @@ -6,7 +6,7 @@ define([ function (_, $, coreModule) { 'use strict'; - coreModule.directive('dropdownTypeahead', function($compile) { + coreModule.default.directive('dropdownTypeahead', function($compile) { var inputTemplate = ''; @@ -157,7 +157,7 @@ function (_, $, coreModule) { }; }); - coreModule.directive('metricSegmentModel', function(uiSegmentSrv, $q) { + coreModule.default.directive('metricSegmentModel', function(uiSegmentSrv, $q) { return { template: '', restrict: 'E', diff --git a/public/app/core/directives/misc.js b/public/app/core/directives/misc.js index 0fe18f922f7..97361ed02d3 100644 --- a/public/app/core/directives/misc.js +++ b/public/app/core/directives/misc.js @@ -6,7 +6,7 @@ define([ function (angular, coreModule, kbn) { 'use strict'; - coreModule.directive('tip', function($compile) { + coreModule.default.directive('tip', function($compile) { return { restrict: 'E', link: function(scope, elem, attrs) { @@ -18,7 +18,7 @@ function (angular, coreModule, kbn) { }; }); - coreModule.directive('watchChange', function() { + coreModule.default.directive('watchChange', function() { return { scope: { onchange: '&watchChange' }, link: function(scope, element) { @@ -31,7 +31,7 @@ function (angular, coreModule, kbn) { }; }); - coreModule.directive('editorOptBool', function($compile) { + coreModule.default.directive('editorOptBool', function($compile) { return { restrict: 'E', link: function(scope, elem, attrs) { @@ -51,7 +51,7 @@ function (angular, coreModule, kbn) { }; }); - coreModule.directive('editorCheckbox', function($compile, $interpolate) { + coreModule.default.directive('editorCheckbox', function($compile, $interpolate) { return { restrict: 'E', link: function(scope, elem, attrs) { @@ -73,7 +73,7 @@ function (angular, coreModule, kbn) { }; }); - coreModule.directive('gfDropdown', function ($parse, $compile, $timeout) { + coreModule.default.directive('gfDropdown', function ($parse, $compile, $timeout) { function buildTemplate(items, placement) { var upclass = placement === 'top' ? 'dropup' : ''; var ul = [ diff --git a/public/app/core/directives/ng_model_on_blur.js b/public/app/core/directives/ng_model_on_blur.js index c4a645732c5..1e3ebc38a25 100644 --- a/public/app/core/directives/ng_model_on_blur.js +++ b/public/app/core/directives/ng_model_on_blur.js @@ -6,7 +6,7 @@ define([ function (coreModule, kbn, rangeUtil) { 'use strict'; - coreModule.directive('ngModelOnblur', function() { + coreModule.default.directive('ngModelOnblur', function() { return { restrict: 'A', priority: 1, @@ -26,7 +26,7 @@ function (coreModule, kbn, rangeUtil) { }; }); - coreModule.directive('emptyToNull', function () { + coreModule.default.directive('emptyToNull', function () { return { restrict: 'A', require: 'ngModel', @@ -39,7 +39,7 @@ function (coreModule, kbn, rangeUtil) { }; }); - coreModule.directive('validTimeSpan', function() { + coreModule.default.directive('validTimeSpan', function() { return { require: 'ngModel', link: function(scope, elm, attrs, ctrl) { diff --git a/public/app/core/directives/password_strenght.js b/public/app/core/directives/password_strenght.js index b53113f9365..fa3f8638ba1 100644 --- a/public/app/core/directives/password_strenght.js +++ b/public/app/core/directives/password_strenght.js @@ -4,7 +4,7 @@ define([ function (coreModule) { 'use strict'; - coreModule.directive('passwordStrength', function() { + coreModule.default.directive('passwordStrength', function() { var template = '
' + '{{strengthText}}' + '
'; diff --git a/public/app/core/directives/spectrum_picker.js b/public/app/core/directives/spectrum_picker.js index 92fc3982d7a..fa1d0a82a47 100644 --- a/public/app/core/directives/spectrum_picker.js +++ b/public/app/core/directives/spectrum_picker.js @@ -6,7 +6,7 @@ define([ function (angular, coreModule) { 'use strict'; - coreModule.directive('spectrumPicker', function() { + coreModule.default.directive('spectrumPicker', function() { return { restrict: 'E', require: 'ngModel', diff --git a/public/app/core/directives/tags.js b/public/app/core/directives/tags.js index 01f4c4f3c37..627d516128a 100644 --- a/public/app/core/directives/tags.js +++ b/public/app/core/directives/tags.js @@ -39,7 +39,7 @@ function (angular, $, coreModule) { element.css("border-color", borderColor); } - coreModule.directive('tagColorFromName', function() { + coreModule.default.directive('tagColorFromName', function() { return { scope: { tagColorFromName: "=" }, link: function (scope, element) { @@ -48,7 +48,7 @@ function (angular, $, coreModule) { }; }); - coreModule.directive('bootstrapTagsinput', function() { + coreModule.default.directive('bootstrapTagsinput', function() { function getItemProperty(scope, property) { if (!property) { diff --git a/public/app/core/directives/topnav.js b/public/app/core/directives/topnav.js index 38aa9a9e6b3..826bb5e0a67 100644 --- a/public/app/core/directives/topnav.js +++ b/public/app/core/directives/topnav.js @@ -4,7 +4,7 @@ define([ function (coreModule) { 'use strict'; - coreModule.directive('topnav', function($rootScope, contextSrv) { + coreModule.default.directive('topnav', function($rootScope, contextSrv) { return { restrict: 'E', transclude: true, diff --git a/public/app/core/directives/value_select_dropdown.js b/public/app/core/directives/value_select_dropdown.js index 873174c6fc6..1e82239ff87 100644 --- a/public/app/core/directives/value_select_dropdown.js +++ b/public/app/core/directives/value_select_dropdown.js @@ -6,7 +6,7 @@ define([ function (angular, _, coreModule) { 'use strict'; - coreModule.controller('ValueSelectDropdownCtrl', function($q) { + coreModule.default.controller('ValueSelectDropdownCtrl', function($q) { var vm = this; vm.show = function() { @@ -224,7 +224,7 @@ function (angular, _, coreModule) { }); - coreModule.directive('valueSelectDropdown', function($compile, $window, $timeout, $rootScope) { + coreModule.default.directive('valueSelectDropdown', function($compile, $window, $timeout, $rootScope) { return { scope: { variable: "=", onUpdated: "&", getValuesForTag: "&" }, templateUrl: 'app/partials/valueSelectDropdown.html', diff --git a/public/app/core/filters/filters.ts b/public/app/core/filters/filters.ts index f1bcc0edaa0..1855453c2e6 100644 --- a/public/app/core/filters/filters.ts +++ b/public/app/core/filters/filters.ts @@ -1,9 +1,10 @@ /// -import angular = require('angular'); import jquery = require('jquery'); -import moment = require('moment'); import _ = require('lodash'); + +import angular from 'angular'; +import moment from 'moment'; import coreModule from '../core_module'; coreModule.filter('stringSort', function() { diff --git a/public/app/core/utils/datemath.ts b/public/app/core/utils/datemath.ts index 54365dcc87c..60e92ad8c96 100644 --- a/public/app/core/utils/datemath.ts +++ b/public/app/core/utils/datemath.ts @@ -1,7 +1,7 @@ /// import _ = require('lodash'); -import moment = require('moment'); +import moment from 'moment'; var units = ['y', 'M', 'w', 'd', 'h', 'm', 's']; var unitsAsc = _.sortBy(units, function (unit) { diff --git a/public/app/grafana_app.ts b/public/app/grafana_app.ts index 096c4aaa5ee..e864801ad7c 100644 --- a/public/app/grafana_app.ts +++ b/public/app/grafana_app.ts @@ -10,11 +10,11 @@ import 'angular-bindonce'; import 'angular-ui'; import 'app/core/core'; +import $ from 'jquery'; +import angular from 'angular'; import _ = require('lodash'); -import $ = require('jquery'); import bootstrap = require('bootstrap'); import kbn = require('app/core/utils/kbn'); -import angular = require('angular'); import config = require('app/core/config'); export class GrafanaApp { @@ -66,8 +66,7 @@ export class GrafanaApp { this.useModule(angular.module(moduleName, [])); }); - //var preBootRequires = [System.import('app/features/all')]; - var preBootRequires = []; + var preBootRequires = [System.import('app/features/all')]; var pluginModules = config.bootData.pluginModules || []; // add plugin modules diff --git a/public/app/headers/common.d.ts b/public/app/headers/common.d.ts index ea5b20e6ef1..eb6c8dea934 100644 --- a/public/app/headers/common.d.ts +++ b/public/app/headers/common.d.ts @@ -1,5 +1,4 @@ /// -/// /// /// @@ -11,18 +10,23 @@ declare module 'app/core/config' { declare var System: any; +declare module 'moment' { + var moment : any; + export default moment; +} + declare module 'angular' { - var angular : any; - export = angular; + var angular: any; + export default angular; } declare module 'jquery' { - var jquery : any; - export = jquery; + var jquery: any; + export default jquery; } declare module 'app/core/utils/kbn' { - var kbn : any; + var kbn: any; export = kbn; } diff --git a/public/app/systemjs.conf.js b/public/app/systemjs.conf.js index 88de2c164b3..2fb127405be 100644 --- a/public/app/systemjs.conf.js +++ b/public/app/systemjs.conf.js @@ -1,7 +1,7 @@ System.config({ defaultJSExtenions: true, paths: { - moment: 'public/vendor/moment.js', + 'moment': 'public/vendor/moment.js', "jquery": "public/vendor/jquery/dist/jquery.js", 'lodash-src': 'public/vendor/lodash.js', "lodash": 'public/app/core/lodash_extended.js', @@ -14,7 +14,6 @@ System.config({ "angular-dragdrop": "public/vendor/angular-native-dragdrop/draganddrop.js", "angular-bindonce": "public/vendor/angular-bindonce/bindonce.js", "spectrum": "public/vendor/spectrum.js", - "filesaver": "public/vendor/filesaver.js", "bootstrap-tagsinput": "public/vendor/tagsinput/bootstrap-tagsinput.js", "jquery.flot": "vendor/flot/jquery.flot", "jquery.flot.pie": "vendor/flot/jquery.flot.pie", @@ -31,6 +30,9 @@ System.config({ app: { defaultExtension: 'js', }, + vendor: { + defaultExtension: 'js', + }, }, map: { @@ -44,8 +46,7 @@ System.config({ format: 'amd', deps: ['jquery'], exports: 'angular', - } - + }, } }); diff --git a/public/vendor/moment.js b/public/vendor/moment.js index 03a2460105d..da4fa163449 100644 --- a/public/vendor/moment.js +++ b/public/vendor/moment.js @@ -2788,6 +2788,7 @@ globalScope.moment = moment; } } + debugger; // CommonJS module is defined if (hasModule) {