mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge branch 'typescript'
This commit is contained in:
commit
286b4c0e46
2
.gitignore
vendored
2
.gitignore
vendored
@ -4,6 +4,7 @@ coverage/
|
||||
awsconfig
|
||||
/dist
|
||||
/emails/dist
|
||||
/public_gen
|
||||
/tmp
|
||||
|
||||
docs/AWS_S3_BUCKET
|
||||
@ -29,3 +30,4 @@ conf/custom.ini
|
||||
fig.yml
|
||||
profile.cov
|
||||
grafana
|
||||
tsconfig.json
|
||||
|
@ -6,6 +6,7 @@ module.exports = function (grunt) {
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
baseDir: '.',
|
||||
srcDir: 'public',
|
||||
genDir: 'public_gen',
|
||||
destDir: 'dist',
|
||||
tempDir: 'tmp',
|
||||
arch: os.arch(),
|
||||
|
@ -24,7 +24,7 @@
|
||||
"grunt-contrib-htmlmin": "~0.1.3",
|
||||
"grunt-contrib-jshint": "~0.10.0",
|
||||
"grunt-contrib-less": "~0.7.0",
|
||||
"grunt-contrib-requirejs": "~0.4.1",
|
||||
"grunt-contrib-requirejs": "~0.4.4",
|
||||
"grunt-contrib-uglify": "~0.8.0",
|
||||
"grunt-contrib-watch": "^0.6.1",
|
||||
"grunt-filerev": "^0.2.1",
|
||||
@ -32,6 +32,8 @@
|
||||
"grunt-karma": "~0.8.3",
|
||||
"grunt-ng-annotate": "^0.9.2",
|
||||
"grunt-string-replace": "~0.2.4",
|
||||
"grunt-tslint": "^2.5.0",
|
||||
"grunt-typescript": "^0.7.0",
|
||||
"grunt-usemin": "3.0.0",
|
||||
"jshint-stylish": "~0.1.5",
|
||||
"karma": "~0.12.31",
|
||||
@ -47,7 +49,8 @@
|
||||
"load-grunt-tasks": "0.2.0",
|
||||
"mocha": "2.2.4",
|
||||
"requirejs": "2.1.17",
|
||||
"rjs-build-analysis": "0.0.3"
|
||||
"rjs-build-analysis": "0.0.3",
|
||||
"tslint": "^2.5.0-beta"
|
||||
},
|
||||
"engines": {
|
||||
"node": "0.10.x",
|
||||
@ -60,6 +63,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"grunt-jscs": "~1.5.x",
|
||||
"grunt-sync": "^0.4.1",
|
||||
"karma-sinon": "^1.0.3",
|
||||
"lodash": "^2.4.1",
|
||||
"sinon": "1.10.3"
|
||||
|
@ -355,6 +355,23 @@ func setHomePath(args *CommandLineArgs) {
|
||||
}
|
||||
}
|
||||
|
||||
func getStaticRootPath(configValue string) string {
|
||||
if configValue != "public" {
|
||||
return configValue
|
||||
}
|
||||
|
||||
if _, err := os.Stat(path.Join(HomePath, configValue, "css")); err == nil {
|
||||
return configValue
|
||||
}
|
||||
|
||||
if _, err := os.Stat(path.Join(HomePath, "public_gen", "css")); err == nil {
|
||||
return "public_gen"
|
||||
}
|
||||
|
||||
log.Fatal(3, "Failed to detect generated css or javascript files in static root (%s), have you executed default grunt task?", configValue)
|
||||
return ""
|
||||
}
|
||||
|
||||
func NewConfigContext(args *CommandLineArgs) {
|
||||
setHomePath(args)
|
||||
loadConfiguration(args)
|
||||
@ -374,7 +391,7 @@ func NewConfigContext(args *CommandLineArgs) {
|
||||
Domain = server.Key("domain").MustString("localhost")
|
||||
HttpAddr = server.Key("http_addr").MustString("0.0.0.0")
|
||||
HttpPort = server.Key("http_port").MustString("3000")
|
||||
StaticRootPath = makeAbsolute(server.Key("static_root_path").String(), HomePath)
|
||||
StaticRootPath = makeAbsolute(getStaticRootPath(server.Key("static_root_path").String()), HomePath)
|
||||
RouterLogging = server.Key("router_logging").MustBool(false)
|
||||
EnableGzip = server.Key("enable_gzip").MustBool(false)
|
||||
EnforceDomain = server.Key("enforce_domain").MustBool(false)
|
||||
|
@ -80,11 +80,11 @@ function (angular, $, _, appLevelRequire) {
|
||||
});
|
||||
|
||||
var preBootRequires = [
|
||||
'core/core',
|
||||
'services/all',
|
||||
'features/all',
|
||||
'controllers/all',
|
||||
'directives/all',
|
||||
'filters/all',
|
||||
'components/partials',
|
||||
'routes/all',
|
||||
];
|
||||
@ -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,9 +1,13 @@
|
||||
define([
|
||||
],
|
||||
function () {
|
||||
"use strict";
|
||||
class PanelMeta {
|
||||
description: any;
|
||||
fullscreen: any;
|
||||
editIcon: any;
|
||||
panelName: any;
|
||||
menu: any;
|
||||
editorTabs: any;
|
||||
extendedMenu: any;
|
||||
|
||||
function PanelMeta(options) {
|
||||
constructor(options : any) {
|
||||
this.description = options.description;
|
||||
this.fullscreen = options.fullscreen;
|
||||
this.editIcon = options.editIcon;
|
||||
@ -29,18 +33,17 @@ function () {
|
||||
this.addExtendedMenuItem('Panel JSON', '', 'editPanelJson(); dismiss();');
|
||||
}
|
||||
|
||||
PanelMeta.prototype.addMenuItem = function(text, icon, click, role) {
|
||||
addMenuItem (text, icon, click, role?) {
|
||||
this.menu.push({text: text, icon: icon, click: click, role: role});
|
||||
};
|
||||
}
|
||||
|
||||
PanelMeta.prototype.addExtendedMenuItem = function(text, icon, click, role) {
|
||||
addExtendedMenuItem (text, icon, click, role?) {
|
||||
this.extendedMenu.push({text: text, icon: icon, click: click, role: role});
|
||||
};
|
||||
}
|
||||
|
||||
PanelMeta.prototype.addEditorTab = function(title, src) {
|
||||
addEditorTab (title, src) {
|
||||
this.editorTabs.push({title: title, src: src});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return PanelMeta;
|
||||
|
||||
});
|
||||
export = PanelMeta;
|
@ -1,49 +0,0 @@
|
||||
define([
|
||||
'angular',
|
||||
'config',
|
||||
],
|
||||
function (angular, config) {
|
||||
'use strict';
|
||||
|
||||
var module = angular.module('grafana.controllers');
|
||||
|
||||
module.controller('SignUpCtrl', function($scope, $location, contextSrv, backendSrv) {
|
||||
|
||||
contextSrv.sidemenu = false;
|
||||
|
||||
$scope.formModel = {};
|
||||
|
||||
$scope.init = function() {
|
||||
var params = $location.search();
|
||||
$scope.formModel.orgName = params.email;
|
||||
$scope.formModel.email = params.email;
|
||||
$scope.formModel.username = params.email;
|
||||
$scope.formModel.code = params.code;
|
||||
|
||||
$scope.verifyEmailEnabled = false;
|
||||
$scope.autoAssignOrg = false;
|
||||
|
||||
backendSrv.get('/api/user/signup/options').then(function(options) {
|
||||
$scope.verifyEmailEnabled = options.verifyEmailEnabled;
|
||||
$scope.autoAssignOrg = options.autoAssignOrg;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.submit = function() {
|
||||
if (!$scope.signUpForm.$valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
backendSrv.post('/api/user/signup/step2', $scope.formModel).then(function(rsp) {
|
||||
if (rsp.code === 'redirect-to-select-org') {
|
||||
window.location.href = config.appSubUrl + '/profile/select-org?signup=1';
|
||||
} else {
|
||||
window.location.href = config.appSubUrl + '/';
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.init();
|
||||
|
||||
});
|
||||
});
|
55
public/app/controllers/signupCtrl.ts
Normal file
55
public/app/controllers/signupCtrl.ts
Normal file
@ -0,0 +1,55 @@
|
||||
///<reference path="../headers/require/require.d.ts" />
|
||||
///<reference path="../headers/angularjs/angularjs.d.ts" />
|
||||
///<amd-dependency path="angular"/>
|
||||
///<amd-dependency path="config"/>
|
||||
|
||||
var angular = require('angular');
|
||||
var config = require('config');
|
||||
|
||||
var module = angular.module('grafana.controllers');
|
||||
|
||||
export class SignUpCtrl {
|
||||
|
||||
constructor(
|
||||
private $scope : any,
|
||||
private $location : any,
|
||||
private contextSrv : any,
|
||||
private backendSrv : any) {
|
||||
|
||||
contextSrv.sidemenu = false;
|
||||
$scope.ctrl = this;
|
||||
|
||||
$scope.formModel = {};
|
||||
|
||||
var params = $location.search();
|
||||
$scope.formModel.orgName = params.email;
|
||||
$scope.formModel.email = params.email;
|
||||
$scope.formModel.username = params.email;
|
||||
$scope.formModel.code = params.code;
|
||||
|
||||
$scope.verifyEmailEnabled = false;
|
||||
$scope.autoAssignOrg = false;
|
||||
|
||||
backendSrv.get('/api/user/signup/options').then(options => {
|
||||
$scope.verifyEmailEnabled = options.verifyEmailEnabled;
|
||||
$scope.autoAssignOrg = options.autoAssignOrg;
|
||||
});
|
||||
}
|
||||
|
||||
submit () {
|
||||
if (!this.$scope.signUpForm.$valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.backendSrv.post('/api/user/signup/step2', this.$scope.formModel).then(rsp => {
|
||||
if (rsp.code === 'redirect-to-select-org') {
|
||||
window.location.href = config.appSubUrl + '/profile/select-org?signup=1';
|
||||
} else {
|
||||
window.location.href = config.appSubUrl + '/';
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
module.controller('SignUpCtrl', SignUpCtrl);
|
||||
|
6
public/app/core/core.ts
Normal file
6
public/app/core/core.ts
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
export * from './directives/cool_dir'
|
||||
export * from './routes/module_loader'
|
||||
export * from './filters/filters'
|
||||
|
||||
|
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";
|
||||
}
|
||||
}
|
||||
|
77
public/app/core/filters/filters.ts
Normal file
77
public/app/core/filters/filters.ts
Normal file
@ -0,0 +1,77 @@
|
||||
///<reference path="../../headers/common.d.ts" />
|
||||
//
|
||||
import angular = require('angular');
|
||||
import jquery = require('jquery');
|
||||
import moment = require('moment');
|
||||
import _ = require('lodash');
|
||||
|
||||
var module = angular.module('grafana.filters');
|
||||
|
||||
module.filter('stringSort', function() {
|
||||
return function(input) {
|
||||
return input.sort();
|
||||
};
|
||||
});
|
||||
|
||||
module.filter('slice', function() {
|
||||
return function(arr, start, end) {
|
||||
if (!_.isUndefined(arr)) {
|
||||
return arr.slice(start, end);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
module.filter('stringify', function() {
|
||||
return function(arr) {
|
||||
if (_.isObject(arr) && !_.isArray(arr)) {
|
||||
return angular.toJson(arr);
|
||||
} else {
|
||||
return _.isNull(arr) ? null : arr.toString();
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
module.filter('moment', function() {
|
||||
return function(date, mode) {
|
||||
switch (mode) {
|
||||
case 'ago':
|
||||
return moment(date).fromNow();
|
||||
}
|
||||
return moment(date).fromNow();
|
||||
};
|
||||
});
|
||||
|
||||
module.filter('noXml', function() {
|
||||
var noXml = function(text) {
|
||||
return _.isString(text)
|
||||
? text
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/'/g, ''')
|
||||
.replace(/"/g, '"')
|
||||
: text;
|
||||
};
|
||||
return function(text) {
|
||||
return _.isArray(text)
|
||||
? _.map(text, noXml)
|
||||
: noXml(text);
|
||||
};
|
||||
});
|
||||
|
||||
module.filter('interpolateTemplateVars', function(templateSrv) {
|
||||
var interpolateTemplateVars : any = function (text, scope) {
|
||||
if (scope.panel) {
|
||||
return templateSrv.replaceWithText(text, scope.panel.scopedVars);
|
||||
} else {
|
||||
return templateSrv.replaceWithText(text, scope.row.scopedVars);
|
||||
}
|
||||
};
|
||||
|
||||
interpolateTemplateVars.$stateful = true;
|
||||
|
||||
return interpolateTemplateVars;
|
||||
});
|
||||
|
||||
// dummy export
|
||||
export {};
|
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/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;
|
||||
}];
|
||||
|
||||
}
|
||||
}
|
@ -8,6 +8,5 @@ define([
|
||||
'./profile/profileCtrl',
|
||||
'./profile/changePasswordCtrl',
|
||||
'./profile/selectOrgCtrl',
|
||||
'./org/all',
|
||||
'./admin/all',
|
||||
], function () {});
|
||||
|
@ -1,72 +0,0 @@
|
||||
define(['angular', 'jquery', 'lodash', 'moment'], function (angular, $, _, moment) {
|
||||
'use strict';
|
||||
|
||||
var module = angular.module('grafana.filters');
|
||||
|
||||
module.filter('stringSort', function() {
|
||||
return function(input) {
|
||||
return input.sort();
|
||||
};
|
||||
});
|
||||
|
||||
module.filter('slice', function() {
|
||||
return function(arr, start, end) {
|
||||
if(!_.isUndefined(arr)) {
|
||||
return arr.slice(start, end);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
module.filter('stringify', function() {
|
||||
return function(arr) {
|
||||
if(_.isObject(arr) && !_.isArray(arr)) {
|
||||
return angular.toJson(arr);
|
||||
} else {
|
||||
return _.isNull(arr) ? null : arr.toString();
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
module.filter('moment', function() {
|
||||
return function(date,mode) {
|
||||
switch(mode) {
|
||||
case 'ago':
|
||||
return moment(date).fromNow();
|
||||
}
|
||||
return moment(date).fromNow();
|
||||
};
|
||||
});
|
||||
|
||||
module.filter('noXml', function() {
|
||||
var noXml = function(text) {
|
||||
return _.isString(text)
|
||||
? text
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/'/g, ''')
|
||||
.replace(/"/g, '"')
|
||||
: text;
|
||||
};
|
||||
return function(text) {
|
||||
return _.isArray(text)
|
||||
? _.map(text, noXml)
|
||||
: noXml(text);
|
||||
};
|
||||
});
|
||||
|
||||
module.filter('interpolateTemplateVars', function(templateSrv) {
|
||||
function interpolateTemplateVars(text, scope) {
|
||||
if (scope.panel) {
|
||||
return templateSrv.replaceWithText(text, scope.panel.scopedVars);
|
||||
} else {
|
||||
return templateSrv.replaceWithText(text, scope.row.scopedVars);
|
||||
}
|
||||
}
|
||||
|
||||
interpolateTemplateVars.$stateful = true;
|
||||
|
||||
return interpolateTemplateVars;
|
||||
});
|
||||
|
||||
});
|
1746
public/app/headers/angularjs/angularjs.d.ts
vendored
Normal file
1746
public/app/headers/angularjs/angularjs.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4
public/app/headers/common.d.ts
vendored
Normal file
4
public/app/headers/common.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
///<reference path="require/require.d.ts" />
|
||||
///<reference path="angularjs/angularjs.d.ts" />
|
||||
///<reference path="lodash/lodash.d.ts" />
|
||||
///<reference path="moment/moment.d.ts" />
|
3178
public/app/headers/jquery/jquery.d.ts
vendored
Normal file
3178
public/app/headers/jquery/jquery.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
8521
public/app/headers/lodash/lodash.d.ts
vendored
Normal file
8521
public/app/headers/lodash/lodash.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
479
public/app/headers/moment/moment-node.d.ts
vendored
Normal file
479
public/app/headers/moment/moment-node.d.ts
vendored
Normal file
@ -0,0 +1,479 @@
|
||||
// Type definitions for Moment.js 2.8.0
|
||||
// Project: https://github.com/timrwood/moment
|
||||
// Definitions by: Michael Lakerveld <https://github.com/Lakerfield>, Aaron King <https://github.com/kingdango>, Hiroki Horiuchi <https://github.com/horiuchi>, Dick van den Brink <https://github.com/DickvdBrink>, Adi Dahiya <https://github.com/adidahiya>, Matt Brooks <https://github.com/EnableSoftware>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module moment {
|
||||
|
||||
interface MomentInput {
|
||||
|
||||
/** Year */
|
||||
years?: number;
|
||||
/** Year */
|
||||
year?: number;
|
||||
/** Year */
|
||||
y?: number;
|
||||
|
||||
/** Month */
|
||||
months?: number;
|
||||
/** Month */
|
||||
month?: number;
|
||||
/** Month */
|
||||
M?: number;
|
||||
|
||||
/** Day/Date */
|
||||
days?: number;
|
||||
/** Day/Date */
|
||||
day?: number;
|
||||
/** Day/Date */
|
||||
date?: number;
|
||||
/** Day/Date */
|
||||
d?: number;
|
||||
|
||||
/** Hour */
|
||||
hours?: number;
|
||||
/** Hour */
|
||||
hour?: number;
|
||||
/** Hour */
|
||||
h?: number;
|
||||
|
||||
/** Minute */
|
||||
minutes?: number;
|
||||
/** Minute */
|
||||
minute?: number;
|
||||
/** Minute */
|
||||
m?: number;
|
||||
|
||||
/** Second */
|
||||
seconds?: number;
|
||||
/** Second */
|
||||
second?: number;
|
||||
/** Second */
|
||||
s?: number;
|
||||
|
||||
/** Millisecond */
|
||||
milliseconds?: number;
|
||||
/** Millisecond */
|
||||
millisecond?: number;
|
||||
/** Millisecond */
|
||||
ms?: number;
|
||||
|
||||
}
|
||||
|
||||
interface Duration {
|
||||
|
||||
humanize(withSuffix?: boolean): string;
|
||||
|
||||
as(units: string): number;
|
||||
|
||||
milliseconds(): number;
|
||||
asMilliseconds(): number;
|
||||
|
||||
seconds(): number;
|
||||
asSeconds(): number;
|
||||
|
||||
minutes(): number;
|
||||
asMinutes(): number;
|
||||
|
||||
hours(): number;
|
||||
asHours(): number;
|
||||
|
||||
days(): number;
|
||||
asDays(): number;
|
||||
|
||||
months(): number;
|
||||
asMonths(): number;
|
||||
|
||||
years(): number;
|
||||
asYears(): number;
|
||||
|
||||
add(n: number, p: string): Duration;
|
||||
add(n: number): Duration;
|
||||
add(d: Duration): Duration;
|
||||
|
||||
subtract(n: number, p: string): Duration;
|
||||
subtract(n: number): Duration;
|
||||
subtract(d: Duration): Duration;
|
||||
|
||||
toISOString(): string;
|
||||
toJSON(): string;
|
||||
|
||||
}
|
||||
|
||||
interface Moment {
|
||||
|
||||
format(format: string): string;
|
||||
format(): string;
|
||||
|
||||
fromNow(withoutSuffix?: boolean): string;
|
||||
|
||||
startOf(unitOfTime: string): Moment;
|
||||
endOf(unitOfTime: string): Moment;
|
||||
|
||||
/**
|
||||
* Mutates the original moment by adding time. (deprecated in 2.8.0)
|
||||
*
|
||||
* @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc)
|
||||
* @param amount the amount you want to add
|
||||
*/
|
||||
add(unitOfTime: string, amount: number): Moment;
|
||||
/**
|
||||
* Mutates the original moment by adding time.
|
||||
*
|
||||
* @param amount the amount you want to add
|
||||
* @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc)
|
||||
*/
|
||||
add(amount: number, unitOfTime: string): Moment;
|
||||
/**
|
||||
* Mutates the original moment by adding time. Note that the order of arguments can be flipped.
|
||||
*
|
||||
* @param amount the amount you want to add
|
||||
* @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc)
|
||||
*/
|
||||
add(amount: string, unitOfTime: string): Moment;
|
||||
/**
|
||||
* Mutates the original moment by adding time.
|
||||
*
|
||||
* @param objectLiteral an object literal that describes multiple time units {days:7,months:1}
|
||||
*/
|
||||
add(objectLiteral: MomentInput): Moment;
|
||||
/**
|
||||
* Mutates the original moment by adding time.
|
||||
*
|
||||
* @param duration a length of time
|
||||
*/
|
||||
add(duration: Duration): Moment;
|
||||
|
||||
/**
|
||||
* Mutates the original moment by subtracting time. (deprecated in 2.8.0)
|
||||
*
|
||||
* @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc)
|
||||
* @param amount the amount you want to subtract
|
||||
*/
|
||||
subtract(unitOfTime: string, amount: number): Moment;
|
||||
/**
|
||||
* Mutates the original moment by subtracting time.
|
||||
*
|
||||
* @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc)
|
||||
* @param amount the amount you want to subtract
|
||||
*/
|
||||
subtract(amount: number, unitOfTime: string): Moment;
|
||||
/**
|
||||
* Mutates the original moment by subtracting time. Note that the order of arguments can be flipped.
|
||||
*
|
||||
* @param amount the amount you want to add
|
||||
* @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc)
|
||||
*/
|
||||
subtract(amount: string, unitOfTime: string): Moment;
|
||||
/**
|
||||
* Mutates the original moment by subtracting time.
|
||||
*
|
||||
* @param objectLiteral an object literal that describes multiple time units {days:7,months:1}
|
||||
*/
|
||||
subtract(objectLiteral: MomentInput): Moment;
|
||||
/**
|
||||
* Mutates the original moment by subtracting time.
|
||||
*
|
||||
* @param duration a length of time
|
||||
*/
|
||||
subtract(duration: Duration): Moment;
|
||||
|
||||
calendar(): string;
|
||||
calendar(start: Moment): string;
|
||||
|
||||
clone(): Moment;
|
||||
|
||||
/**
|
||||
* @return Unix timestamp, or milliseconds since the epoch.
|
||||
*/
|
||||
valueOf(): number;
|
||||
|
||||
local(): Moment; // current date/time in local mode
|
||||
|
||||
utc(): Moment; // current date/time in UTC mode
|
||||
|
||||
isValid(): boolean;
|
||||
invalidAt(): number;
|
||||
|
||||
year(y: number): Moment;
|
||||
year(): number;
|
||||
quarter(): number;
|
||||
quarter(q: number): Moment;
|
||||
month(M: number): Moment;
|
||||
month(M: string): Moment;
|
||||
month(): number;
|
||||
day(d: number): Moment;
|
||||
day(d: string): Moment;
|
||||
day(): number;
|
||||
date(d: number): Moment;
|
||||
date(): number;
|
||||
hour(h: number): Moment;
|
||||
hour(): number;
|
||||
hours(h: number): Moment;
|
||||
hours(): number;
|
||||
minute(m: number): Moment;
|
||||
minute(): number;
|
||||
minutes(m: number): Moment;
|
||||
minutes(): number;
|
||||
second(s: number): Moment;
|
||||
second(): number;
|
||||
seconds(s: number): Moment;
|
||||
seconds(): number;
|
||||
millisecond(ms: number): Moment;
|
||||
millisecond(): number;
|
||||
milliseconds(ms: number): Moment;
|
||||
milliseconds(): number;
|
||||
weekday(): number;
|
||||
weekday(d: number): Moment;
|
||||
isoWeekday(): number;
|
||||
isoWeekday(d: number): Moment;
|
||||
weekYear(): number;
|
||||
weekYear(d: number): Moment;
|
||||
isoWeekYear(): number;
|
||||
isoWeekYear(d: number): Moment;
|
||||
week(): number;
|
||||
week(d: number): Moment;
|
||||
weeks(): number;
|
||||
weeks(d: number): Moment;
|
||||
isoWeek(): number;
|
||||
isoWeek(d: number): Moment;
|
||||
isoWeeks(): number;
|
||||
isoWeeks(d: number): Moment;
|
||||
weeksInYear(): number;
|
||||
isoWeeksInYear(): number;
|
||||
dayOfYear(): number;
|
||||
dayOfYear(d: number): Moment;
|
||||
|
||||
from(f: Moment|string|number|Date|number[], suffix?: boolean): string;
|
||||
to(f: Moment|string|number|Date|number[], suffix?: boolean): string;
|
||||
|
||||
diff(b: Moment): number;
|
||||
diff(b: Moment, unitOfTime: string): number;
|
||||
diff(b: Moment, unitOfTime: string, round: boolean): number;
|
||||
|
||||
toArray(): number[];
|
||||
toDate(): Date;
|
||||
toISOString(): string;
|
||||
toJSON(): string;
|
||||
unix(): number;
|
||||
|
||||
isLeapYear(): boolean;
|
||||
zone(): number;
|
||||
zone(b: number): Moment;
|
||||
zone(b: string): Moment;
|
||||
utcOffset(): number;
|
||||
utcOffset(b: number): Moment;
|
||||
utcOffset(b: string): Moment;
|
||||
daysInMonth(): number;
|
||||
isDST(): boolean;
|
||||
|
||||
isBefore(): boolean;
|
||||
isBefore(b: Moment|string|number|Date|number[], granularity?: string): boolean;
|
||||
|
||||
isAfter(): boolean;
|
||||
isAfter(b: Moment|string|number|Date|number[], granularity?: string): boolean;
|
||||
|
||||
isSame(b: Moment|string|number|Date|number[], granularity?: string): boolean;
|
||||
isBetween(a: Moment|string|number|Date|number[], b: Moment|string|number|Date|number[], granularity?: string): boolean;
|
||||
|
||||
// Deprecated as of 2.8.0.
|
||||
lang(language: string): Moment;
|
||||
lang(reset: boolean): Moment;
|
||||
lang(): MomentLanguage;
|
||||
|
||||
locale(language: string): Moment;
|
||||
locale(reset: boolean): Moment;
|
||||
locale(): string;
|
||||
|
||||
localeData(language: string): Moment;
|
||||
localeData(reset: boolean): Moment;
|
||||
localeData(): MomentLanguage;
|
||||
|
||||
// Deprecated as of 2.7.0.
|
||||
max(date: Moment|string|number|Date|any[]): Moment;
|
||||
max(date: string, format: string): Moment;
|
||||
|
||||
// Deprecated as of 2.7.0.
|
||||
min(date: Moment|string|number|Date|any[]): Moment;
|
||||
min(date: string, format: string): Moment;
|
||||
|
||||
get(unit: string): number;
|
||||
set(unit: string, value: number): Moment;
|
||||
|
||||
}
|
||||
|
||||
interface MomentCalendar {
|
||||
|
||||
lastDay: any;
|
||||
sameDay: any;
|
||||
nextDay: any;
|
||||
lastWeek: any;
|
||||
nextWeek: any;
|
||||
sameElse: any;
|
||||
|
||||
}
|
||||
|
||||
interface BaseMomentLanguage {
|
||||
months ?: any;
|
||||
monthsShort ?: any;
|
||||
weekdays ?: any;
|
||||
weekdaysShort ?: any;
|
||||
weekdaysMin ?: any;
|
||||
relativeTime ?: MomentRelativeTime;
|
||||
meridiem ?: (hour: number, minute: number, isLowercase: boolean) => string;
|
||||
calendar ?: MomentCalendar;
|
||||
ordinal ?: (num: number) => string;
|
||||
}
|
||||
|
||||
interface MomentLanguage extends BaseMomentLanguage {
|
||||
longDateFormat?: MomentLongDateFormat;
|
||||
}
|
||||
|
||||
interface MomentLanguageData extends BaseMomentLanguage {
|
||||
/**
|
||||
* @param formatType should be L, LL, LLL, LLLL.
|
||||
*/
|
||||
longDateFormat(formatType: string): string;
|
||||
}
|
||||
|
||||
interface MomentLongDateFormat {
|
||||
|
||||
L: string;
|
||||
LL: string;
|
||||
LLL: string;
|
||||
LLLL: string;
|
||||
LT: string;
|
||||
l?: string;
|
||||
ll?: string;
|
||||
lll?: string;
|
||||
llll?: string;
|
||||
lt?: string;
|
||||
|
||||
}
|
||||
|
||||
interface MomentRelativeTime {
|
||||
|
||||
future: any;
|
||||
past: any;
|
||||
s: any;
|
||||
m: any;
|
||||
mm: any;
|
||||
h: any;
|
||||
hh: any;
|
||||
d: any;
|
||||
dd: any;
|
||||
M: any;
|
||||
MM: any;
|
||||
y: any;
|
||||
yy: any;
|
||||
|
||||
}
|
||||
|
||||
interface MomentStatic {
|
||||
|
||||
version: string;
|
||||
fn: Moment;
|
||||
|
||||
(): Moment;
|
||||
(date: number): Moment;
|
||||
(date: number[]): Moment;
|
||||
(date: string, format?: string, strict?: boolean): Moment;
|
||||
(date: string, format?: string, language?: string, strict?: boolean): Moment;
|
||||
(date: string, formats: string[], strict?: boolean): Moment;
|
||||
(date: string, formats: string[], language?: string, strict?: boolean): Moment;
|
||||
(date: string, specialFormat: () => void, strict?: boolean): Moment;
|
||||
(date: string, specialFormat: () => void, language?: string, strict?: boolean): Moment;
|
||||
(date: string, formatsIncludingSpecial: any[], strict?: boolean): Moment;
|
||||
(date: string, formatsIncludingSpecial: any[], language?: string, strict?: boolean): Moment;
|
||||
(date: Date): Moment;
|
||||
(date: Moment): Moment;
|
||||
(date: Object): Moment;
|
||||
|
||||
utc(): Moment;
|
||||
utc(date: number): Moment;
|
||||
utc(date: number[]): Moment;
|
||||
utc(date: string, format?: string, strict?: boolean): Moment;
|
||||
utc(date: string, format?: string, language?: string, strict?: boolean): Moment;
|
||||
utc(date: string, formats: string[], strict?: boolean): Moment;
|
||||
utc(date: string, formats: string[], language?: string, strict?: boolean): Moment;
|
||||
utc(date: Date): Moment;
|
||||
utc(date: Moment): Moment;
|
||||
utc(date: Object): Moment;
|
||||
|
||||
unix(timestamp: number): Moment;
|
||||
|
||||
invalid(parsingFlags?: Object): Moment;
|
||||
isMoment(): boolean;
|
||||
isMoment(m: any): boolean;
|
||||
isDate(m: any): boolean;
|
||||
isDuration(): boolean;
|
||||
isDuration(d: any): boolean;
|
||||
|
||||
// Deprecated in 2.8.0.
|
||||
lang(language?: string): string;
|
||||
lang(language?: string, definition?: MomentLanguage): string;
|
||||
|
||||
locale(language?: string): string;
|
||||
locale(language?: string[]): string;
|
||||
locale(language?: string, definition?: MomentLanguage): string;
|
||||
|
||||
localeData(language?: string): MomentLanguageData;
|
||||
|
||||
longDateFormat: any;
|
||||
relativeTime: any;
|
||||
meridiem: (hour: number, minute: number, isLowercase: boolean) => string;
|
||||
calendar: any;
|
||||
ordinal: (num: number) => string;
|
||||
|
||||
duration(milliseconds: Number): Duration;
|
||||
duration(num: Number, unitOfTime: string): Duration;
|
||||
duration(input: MomentInput): Duration;
|
||||
duration(object: any): Duration;
|
||||
duration(): Duration;
|
||||
|
||||
parseZone(date: string): Moment;
|
||||
|
||||
months(): string[];
|
||||
months(index: number): string;
|
||||
months(format: string): string[];
|
||||
months(format: string, index: number): string;
|
||||
monthsShort(): string[];
|
||||
monthsShort(index: number): string;
|
||||
monthsShort(format: string): string[];
|
||||
monthsShort(format: string, index: number): string;
|
||||
|
||||
weekdays(): string[];
|
||||
weekdays(index: number): string;
|
||||
weekdays(format: string): string[];
|
||||
weekdays(format: string, index: number): string;
|
||||
weekdaysShort(): string[];
|
||||
weekdaysShort(index: number): string;
|
||||
weekdaysShort(format: string): string[];
|
||||
weekdaysShort(format: string, index: number): string;
|
||||
weekdaysMin(): string[];
|
||||
weekdaysMin(index: number): string;
|
||||
weekdaysMin(format: string): string[];
|
||||
weekdaysMin(format: string, index: number): string;
|
||||
|
||||
min(moments: Moment[]): Moment;
|
||||
max(moments: Moment[]): Moment;
|
||||
|
||||
normalizeUnits(unit: string): string;
|
||||
relativeTimeThreshold(threshold: string): number|boolean;
|
||||
relativeTimeThreshold(threshold: string, limit:number): boolean;
|
||||
|
||||
/**
|
||||
* Constant used to enable explicit ISO_8601 format parsing.
|
||||
*/
|
||||
ISO_8601(): void;
|
||||
|
||||
defaultFormat: string;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare module 'moment' {
|
||||
var moment: moment.MomentStatic;
|
||||
export = moment;
|
||||
}
|
8
public/app/headers/moment/moment.d.ts
vendored
Normal file
8
public/app/headers/moment/moment.d.ts
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
// Type definitions for Moment.js 2.8.0
|
||||
// Project: https://github.com/timrwood/moment
|
||||
// Definitions by: Michael Lakerveld <https://github.com/Lakerfield>, Aaron King <https://github.com/kingdango>, Hiroki Horiuchi <https://github.com/horiuchi>, Dick van den Brink <https://github.com/DickvdBrink>, Adi Dahiya <https://github.com/adidahiya>, Matt Brooks <https://github.com/EnableSoftware>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="moment-node.d.ts" />
|
||||
|
||||
declare var moment: moment.MomentStatic;
|
369
public/app/headers/require/require.d.ts
vendored
Normal file
369
public/app/headers/require/require.d.ts
vendored
Normal file
@ -0,0 +1,369 @@
|
||||
// Type definitions for RequireJS 2.1.8
|
||||
// Project: http://requirejs.org/
|
||||
// Definitions by: Josh Baldwin <https://github.com/jbaldwin/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/*
|
||||
require-2.1.8.d.ts may be freely distributed under the MIT license.
|
||||
|
||||
Copyright (c) 2013 Josh Baldwin https://github.com/jbaldwin/require.d.ts
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
declare module 'module' {
|
||||
var mod: {
|
||||
config: () => any;
|
||||
id: string;
|
||||
uri: string;
|
||||
}
|
||||
export = mod;
|
||||
}
|
||||
|
||||
interface RequireError extends Error {
|
||||
|
||||
/**
|
||||
* The error ID that maps to an ID on a web page.
|
||||
**/
|
||||
requireType: string;
|
||||
|
||||
/**
|
||||
* Required modules.
|
||||
**/
|
||||
requireModules: string[];
|
||||
|
||||
/**
|
||||
* The original error, if there is one (might be null).
|
||||
**/
|
||||
originalError: Error;
|
||||
}
|
||||
|
||||
interface RequireShim {
|
||||
|
||||
/**
|
||||
* List of dependencies.
|
||||
**/
|
||||
deps?: string[];
|
||||
|
||||
/**
|
||||
* Name the module will be exported as.
|
||||
**/
|
||||
exports?: string;
|
||||
|
||||
/**
|
||||
* Initialize function with all dependcies passed in,
|
||||
* if the function returns a value then that value is used
|
||||
* as the module export value instead of the object
|
||||
* found via the 'exports' string.
|
||||
* @param dependencies
|
||||
* @return
|
||||
**/
|
||||
init?: (...dependencies: any[]) => any;
|
||||
}
|
||||
|
||||
interface RequireConfig {
|
||||
|
||||
// The root path to use for all module lookups.
|
||||
baseUrl?: string;
|
||||
|
||||
// Path mappings for module names not found directly under
|
||||
// baseUrl.
|
||||
paths?: { [key: string]: any; };
|
||||
|
||||
// Dictionary of Shim's.
|
||||
// does not cover case of key->string[]
|
||||
shim?: { [key: string]: RequireShim; };
|
||||
|
||||
/**
|
||||
* For the given module prefix, instead of loading the
|
||||
* module with the given ID, substitude a different
|
||||
* module ID.
|
||||
*
|
||||
* @example
|
||||
* requirejs.config({
|
||||
* map: {
|
||||
* 'some/newmodule': {
|
||||
* 'foo': 'foo1.2'
|
||||
* },
|
||||
* 'some/oldmodule': {
|
||||
* 'foo': 'foo1.0'
|
||||
* }
|
||||
* }
|
||||
* });
|
||||
**/
|
||||
map?: {
|
||||
[id: string]: {
|
||||
[id: string]: string;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* AMD configurations, use module.config() to access in
|
||||
* define() functions
|
||||
**/
|
||||
config?: { [id: string]: {}; };
|
||||
|
||||
/**
|
||||
* Configures loading modules from CommonJS packages.
|
||||
**/
|
||||
packages?: {};
|
||||
|
||||
/**
|
||||
* The number of seconds to wait before giving up on loading
|
||||
* a script. The default is 7 seconds.
|
||||
**/
|
||||
waitSeconds?: number;
|
||||
|
||||
/**
|
||||
* A name to give to a loading context. This allows require.js
|
||||
* to load multiple versions of modules in a page, as long as
|
||||
* each top-level require call specifies a unique context string.
|
||||
**/
|
||||
context?: string;
|
||||
|
||||
/**
|
||||
* An array of dependencies to load.
|
||||
**/
|
||||
deps?: string[];
|
||||
|
||||
/**
|
||||
* A function to pass to require that should be require after
|
||||
* deps have been loaded.
|
||||
* @param modules
|
||||
**/
|
||||
callback?: (...modules: any[]) => void;
|
||||
|
||||
/**
|
||||
* If set to true, an error will be thrown if a script loads
|
||||
* that does not call define() or have shim exports string
|
||||
* value that can be checked.
|
||||
**/
|
||||
enforceDefine?: boolean;
|
||||
|
||||
/**
|
||||
* If set to true, document.createElementNS() will be used
|
||||
* to create script elements.
|
||||
**/
|
||||
xhtml?: boolean;
|
||||
|
||||
/**
|
||||
* Extra query string arguments appended to URLs that RequireJS
|
||||
* uses to fetch resources. Most useful to cachce bust when
|
||||
* the browser or server is not configured correcty.
|
||||
*
|
||||
* @example
|
||||
* urlArgs: "bust= + (new Date()).getTime()
|
||||
**/
|
||||
urlArgs?: string;
|
||||
|
||||
/**
|
||||
* Specify the value for the type="" attribute used for script
|
||||
* tags inserted into the document by RequireJS. Default is
|
||||
* "text/javascript". To use Firefox's JavasScript 1.8
|
||||
* features, use "text/javascript;version=1.8".
|
||||
**/
|
||||
scriptType?: string;
|
||||
|
||||
}
|
||||
|
||||
// todo: not sure what to do with this guy
|
||||
interface RequireModule {
|
||||
|
||||
/**
|
||||
*
|
||||
**/
|
||||
config(): {};
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
**/
|
||||
interface RequireMap {
|
||||
|
||||
/**
|
||||
*
|
||||
**/
|
||||
prefix: string;
|
||||
|
||||
/**
|
||||
*
|
||||
**/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
*
|
||||
**/
|
||||
parentMap: RequireMap;
|
||||
|
||||
/**
|
||||
*
|
||||
**/
|
||||
url: string;
|
||||
|
||||
/**
|
||||
*
|
||||
**/
|
||||
originalName: string;
|
||||
|
||||
/**
|
||||
*
|
||||
**/
|
||||
fullName: string;
|
||||
}
|
||||
|
||||
interface Require {
|
||||
|
||||
/**
|
||||
* Configure require.js
|
||||
**/
|
||||
config(config: RequireConfig): Require;
|
||||
|
||||
/**
|
||||
* CommonJS require call
|
||||
* @param module Module to load
|
||||
* @return The loaded module
|
||||
*/
|
||||
(module: string): any;
|
||||
|
||||
/**
|
||||
* Start the main app logic.
|
||||
* Callback is optional.
|
||||
* Can alternatively use deps and callback.
|
||||
* @param modules Required modules to load.
|
||||
**/
|
||||
(modules: string[]): void;
|
||||
|
||||
/**
|
||||
* @see Require()
|
||||
* @param ready Called when required modules are ready.
|
||||
**/
|
||||
(modules: string[], ready: Function): void;
|
||||
|
||||
/**
|
||||
* @see http://requirejs.org/docs/api.html#errbacks
|
||||
* @param ready Called when required modules are ready.
|
||||
**/
|
||||
(modules: string[], ready: Function, errback: Function): void;
|
||||
|
||||
/**
|
||||
* Generate URLs from require module
|
||||
* @param module Module to URL
|
||||
* @return URL string
|
||||
**/
|
||||
toUrl(module: string): string;
|
||||
|
||||
/**
|
||||
* Returns true if the module has already been loaded and defined.
|
||||
* @param module Module to check
|
||||
**/
|
||||
defined(module: string): boolean;
|
||||
|
||||
/**
|
||||
* Returns true if the module has already been requested or is in the process of loading and should be available at some point.
|
||||
* @param module Module to check
|
||||
**/
|
||||
specified(module: string): boolean;
|
||||
|
||||
/**
|
||||
* On Error override
|
||||
* @param err
|
||||
**/
|
||||
onError(err: RequireError, errback?: (err: RequireError) => void): void;
|
||||
|
||||
/**
|
||||
* Undefine a module
|
||||
* @param module Module to undefine.
|
||||
**/
|
||||
undef(module: string): void;
|
||||
|
||||
/**
|
||||
* Semi-private function, overload in special instance of undef()
|
||||
**/
|
||||
onResourceLoad(context: Object, map: RequireMap, depArray: RequireMap[]): void;
|
||||
}
|
||||
|
||||
interface RequireDefine {
|
||||
|
||||
/**
|
||||
* Define Simple Name/Value Pairs
|
||||
* @param config Dictionary of Named/Value pairs for the config.
|
||||
**/
|
||||
(config: { [key: string]: any; }): void;
|
||||
|
||||
/**
|
||||
* Define function.
|
||||
* @param func: The function module.
|
||||
**/
|
||||
(func: () => any): void;
|
||||
|
||||
/**
|
||||
* Define function with dependencies.
|
||||
* @param deps List of dependencies module IDs.
|
||||
* @param ready Callback function when the dependencies are loaded.
|
||||
* callback param deps module dependencies
|
||||
* callback return module definition
|
||||
**/
|
||||
(deps: string[], ready: Function): void;
|
||||
|
||||
/**
|
||||
* Define module with simplified CommonJS wrapper.
|
||||
* @param ready
|
||||
* callback require requirejs instance
|
||||
* callback exports exports object
|
||||
* callback module module
|
||||
* callback return module definition
|
||||
**/
|
||||
(ready: (require: Require, exports: { [key: string]: any; }, module: RequireModule) => any): void;
|
||||
|
||||
/**
|
||||
* Define a module with a name and dependencies.
|
||||
* @param name The name of the module.
|
||||
* @param deps List of dependencies module IDs.
|
||||
* @param ready Callback function when the dependencies are loaded.
|
||||
* callback deps module dependencies
|
||||
* callback return module definition
|
||||
**/
|
||||
(name: string, deps: string[], ready: Function): void;
|
||||
|
||||
/**
|
||||
* Define a module with a name.
|
||||
* @param name The name of the module.
|
||||
* @param ready Callback function when the dependencies are loaded.
|
||||
* callback return module definition
|
||||
**/
|
||||
(name: string, ready: Function): void;
|
||||
|
||||
/**
|
||||
* Used to allow a clear indicator that a global define function (as needed for script src browser loading) conforms
|
||||
* to the AMD API, any global define function SHOULD have a property called "amd" whose value is an object.
|
||||
* This helps avoid conflict with any other existing JavaScript code that could have defined a define() function
|
||||
* that does not conform to the AMD API.
|
||||
* define.amd.jQuery is specific to jQuery and indicates that the loader is able to account for multiple version
|
||||
* of jQuery being loaded simultaneously.
|
||||
*/
|
||||
amd: Object;
|
||||
}
|
||||
|
||||
// Ambient declarations for 'require' and 'define'
|
||||
declare var requirejs: Require;
|
||||
declare var require: Require;
|
||||
declare var define: RequireDefine;
|
@ -90,7 +90,7 @@
|
||||
</div>
|
||||
|
||||
<div class="login-submit-button-row">
|
||||
<button type="submit" class="btn" ng-click="submit();" ng-class="{'btn-inverse': !signUpForm.$valid, 'btn-primary': signUpForm.$valid}">
|
||||
<button type="submit" class="btn" ng-click="ctrl.submit();" ng-class="{'btn-inverse': !signUpForm.$valid, 'btn-primary': signUpForm.$valid}">
|
||||
Continue
|
||||
</button>
|
||||
</div>
|
||||
|
@ -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',
|
||||
|
@ -9,10 +9,7 @@ module.exports = function(config) {
|
||||
// list of files / patterns to load in the browser
|
||||
files: [
|
||||
'public/test/test-main.js',
|
||||
{pattern: 'public/app/**/*.js', included: false},
|
||||
{pattern: 'public/vendor/**/*.js', included: false},
|
||||
{pattern: 'public/test/**/*.js', included: false},
|
||||
{pattern: 'public/**/*.js', included: false}
|
||||
{pattern: 'public_gen/**/*.js', included: false}
|
||||
],
|
||||
|
||||
// list of files to exclude
|
||||
@ -28,4 +25,5 @@ module.exports = function(config) {
|
||||
singleRun: true,
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
require.config({
|
||||
baseUrl: 'http://localhost:9876/base/public/app',
|
||||
baseUrl: 'http://localhost:9876/base/public_gen/app',
|
||||
|
||||
paths: {
|
||||
specs: '../test/specs',
|
||||
|
@ -6,35 +6,33 @@ module.exports = function(grunt) {
|
||||
'jshint:source',
|
||||
'jshint:tests',
|
||||
'jscs',
|
||||
'clean:release',
|
||||
'copy:public_to_gen',
|
||||
'typescript:build',
|
||||
'karma:test',
|
||||
'clean:on_start',
|
||||
'less:src',
|
||||
'concat:cssDark',
|
||||
'concat:cssLight',
|
||||
'copy:everything_but_less_to_temp',
|
||||
'css',
|
||||
'htmlmin:build',
|
||||
'ngtemplates',
|
||||
'cssmin:build',
|
||||
'ngAnnotate:build',
|
||||
'requirejs:build',
|
||||
'concat:js',
|
||||
'clean:temp',
|
||||
'filerev',
|
||||
'remapFilerev',
|
||||
'usemin',
|
||||
'clean:temp',
|
||||
'uglify:dest'
|
||||
'uglify:genDir'
|
||||
]);
|
||||
|
||||
|
||||
// task to add [[.AppSubUrl]] to reved path
|
||||
grunt.registerTask('remapFilerev', function(){
|
||||
var root = grunt.config().destDir;
|
||||
grunt.registerTask('remapFilerev', function() {
|
||||
var root = grunt.config().genDir;
|
||||
var summary = grunt.filerev.summary;
|
||||
var fixed = {};
|
||||
|
||||
for(var key in summary){
|
||||
if(summary.hasOwnProperty(key)){
|
||||
|
||||
var orig = key.replace(root, root+'/[[.AppSubUrl]]');
|
||||
var revved = summary[key].replace(root, root+'/[[.AppSubUrl]]');
|
||||
fixed[orig] = revved;
|
||||
@ -45,13 +43,12 @@ module.exports = function(grunt) {
|
||||
});
|
||||
|
||||
grunt.registerTask('build-post-process', function() {
|
||||
grunt.config('copy.dist_to_tmp', {
|
||||
grunt.config('copy.public_gen_to_temp', {
|
||||
expand: true,
|
||||
cwd: '<%= destDir %>',
|
||||
cwd: '<%= genDir %>',
|
||||
src: '**/*',
|
||||
dest: '<%= tempDir %>/public/',
|
||||
});
|
||||
grunt.config('clean.dest_dir', ['<%= destDir %>']);
|
||||
grunt.config('copy.backend_bin', {
|
||||
cwd: 'bin',
|
||||
expand: true,
|
||||
@ -66,8 +63,7 @@ module.exports = function(grunt) {
|
||||
dest: '<%= tempDir %>'
|
||||
});
|
||||
|
||||
grunt.task.run('copy:dist_to_tmp');
|
||||
grunt.task.run('clean:dest_dir');
|
||||
grunt.task.run('copy:public_gen_to_temp');
|
||||
grunt.task.run('copy:backend_bin');
|
||||
grunt.task.run('copy:backend_files');
|
||||
});
|
||||
|
@ -1,6 +1,17 @@
|
||||
// Lint and build CSS
|
||||
module.exports = function(grunt) {
|
||||
grunt.registerTask('css', ['less:src', 'concat:cssDark', 'concat:cssLight']);
|
||||
grunt.registerTask('default', ['jscs', 'jshint', 'css']);
|
||||
'use strict';
|
||||
|
||||
grunt.registerTask('css', ['less', 'concat:cssDark', 'concat:cssLight']);
|
||||
grunt.registerTask('default', [
|
||||
'jscs',
|
||||
'jshint',
|
||||
'tslint',
|
||||
'clean:gen',
|
||||
'copy:public_to_gen',
|
||||
'css',
|
||||
'typescript:build'
|
||||
]);
|
||||
|
||||
grunt.registerTask('test', ['default', 'karma:test']);
|
||||
};
|
||||
|
@ -1,6 +1,9 @@
|
||||
module.exports = function(config) {
|
||||
'use strict';
|
||||
|
||||
return {
|
||||
on_start: ['<%= destDir %>', '<%= tempDir %>'],
|
||||
release: ['<%= destDir %>', '<%= tempDir %>', '<%= genDir %>'],
|
||||
gen: ['<%= genDir %>'],
|
||||
temp: ['<%= tempDir %>']
|
||||
};
|
||||
};
|
||||
|
@ -4,34 +4,34 @@ module.exports = function(config) {
|
||||
return {
|
||||
cssDark: {
|
||||
src: [
|
||||
'<%= srcDir %>/vendor/css/normalize.min.css',
|
||||
'<%= srcDir %>/vendor/css/timepicker.css',
|
||||
'<%= srcDir %>/vendor/css/spectrum.css',
|
||||
'<%= srcDir %>/css/bootstrap.dark.min.css',
|
||||
'<%= srcDir %>/css/bootstrap-responsive.min.css',
|
||||
'<%= srcDir %>/vendor/css/font-awesome.min.css'
|
||||
'<%= genDir %>/vendor/css/normalize.min.css',
|
||||
'<%= genDir %>/vendor/css/timepicker.css',
|
||||
'<%= genDir %>/vendor/css/spectrum.css',
|
||||
'<%= genDir %>/css/bootstrap.dark.min.css',
|
||||
'<%= genDir %>/css/bootstrap-responsive.min.css',
|
||||
'<%= genDir %>/vendor/css/font-awesome.min.css'
|
||||
],
|
||||
dest: '<%= srcDir %>/css/grafana.dark.min.css'
|
||||
dest: '<%= genDir %>/css/grafana.dark.min.css'
|
||||
},
|
||||
cssLight: {
|
||||
src: [
|
||||
'<%= srcDir %>/vendor/css/normalize.min.css',
|
||||
'<%= srcDir %>/vendor/css/timepicker.css',
|
||||
'<%= srcDir %>/vendor/css/spectrum.css',
|
||||
'<%= srcDir %>/css/bootstrap.light.min.css',
|
||||
'<%= srcDir %>/css/bootstrap-responsive.min.css',
|
||||
'<%= srcDir %>/vendor/css/font-awesome.min.css'
|
||||
'<%= genDir %>/vendor/css/normalize.min.css',
|
||||
'<%= genDir %>/vendor/css/timepicker.css',
|
||||
'<%= genDir %>/vendor/css/spectrum.css',
|
||||
'<%= genDir %>/css/bootstrap.light.min.css',
|
||||
'<%= genDir %>/css/bootstrap-responsive.min.css',
|
||||
'<%= genDir %>/vendor/css/font-awesome.min.css'
|
||||
],
|
||||
dest: '<%= srcDir %>/css/grafana.light.min.css'
|
||||
dest: '<%= genDir %>/css/grafana.light.min.css'
|
||||
},
|
||||
|
||||
js: {
|
||||
src: [
|
||||
'<%= destDir %>/vendor/requirejs/require.js',
|
||||
'<%= destDir %>/app/components/require.config.js',
|
||||
'<%= destDir %>/app/app.js',
|
||||
'<%= tempDir %>/vendor/requirejs/require.js',
|
||||
'<%= tempDir %>/app/components/require.config.js',
|
||||
'<%= tempDir %>/app/app.js',
|
||||
],
|
||||
dest: '<%= destDir %>/app/app.js'
|
||||
dest: '<%= genDir %>/app/app.js'
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -4,8 +4,16 @@ module.exports = function(config) {
|
||||
everything_but_less_to_temp: {
|
||||
cwd: '<%= srcDir %>',
|
||||
expand: true,
|
||||
src: ['**/*', '!**/*.less', '!config.js'],
|
||||
src: ['**/*', '!**/*.less'],
|
||||
dest: '<%= tempDir %>'
|
||||
},
|
||||
|
||||
public_to_gen: {
|
||||
cwd: '<%= srcDir %>',
|
||||
expand: true,
|
||||
src: ['**/*', '!**/*.less'],
|
||||
dest: '<%= genDir %>'
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
@ -2,9 +2,9 @@ module.exports = function(config) {
|
||||
return {
|
||||
build: {
|
||||
expand: true,
|
||||
cwd: '<%= tempDir %>',
|
||||
cwd: '<%= genDir %>',
|
||||
src: '**/*.css',
|
||||
dest: '<%= tempDir %>'
|
||||
dest: '<%= genDir %>'
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -6,16 +6,16 @@ module.exports = function(config) {
|
||||
length: 8,
|
||||
},
|
||||
cssDark: {
|
||||
src: '<%= destDir %>/css/grafana.dark.min.css',
|
||||
dest: '<%= destDir %>/css'
|
||||
src: '<%= genDir %>/css/grafana.dark.min.css',
|
||||
dest: '<%= genDir %>/css'
|
||||
},
|
||||
cssLight: {
|
||||
src: '<%= destDir %>/css/grafana.light.min.css',
|
||||
dest: '<%= destDir %>/css'
|
||||
src: '<%= genDir %>/css/grafana.light.min.css',
|
||||
dest: '<%= genDir %>/css'
|
||||
},
|
||||
js: {
|
||||
src: '<%= destDir %>/app/app.js',
|
||||
dest: '<%= destDir %>/app'
|
||||
src: '<%= genDir %>/app/app.js',
|
||||
dest: '<%= genDir %>/app'
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -6,13 +6,13 @@ module.exports = function(config) {
|
||||
collapseWhitespace: true
|
||||
},
|
||||
expand: true,
|
||||
cwd: '<%= tempDir %>',
|
||||
cwd: '<%= genDir %>',
|
||||
src: [
|
||||
//'index.html',
|
||||
'app/panels/**/*.html',
|
||||
'app/partials/**/*.html'
|
||||
],
|
||||
dest: '<%= tempDir %>'
|
||||
dest: '<%= genDir %>'
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -1,25 +1,16 @@
|
||||
module.exports = function(config) {
|
||||
|
||||
return {
|
||||
// this is the only task, other than copy, that runs on the src directory, since we don't really need
|
||||
// the less files in the dist. Everything else runs from on temp, and require copys everything
|
||||
// from temp -> dist
|
||||
dist:{
|
||||
expand: true,
|
||||
cwd:'<%= srcDir %>/vendor/bootstrap/less/',
|
||||
src: ['bootstrap.dark.less', 'bootstrap.light.less'],
|
||||
dest: '<%= tempDir %>/css/',
|
||||
},
|
||||
// Compile in place when not building
|
||||
src:{
|
||||
options: {
|
||||
paths: ["<%= srcDir %>/vendor/bootstrap/less", "<%= srcDir %>/css/less"],
|
||||
yuicompress:true
|
||||
paths: ["<%= srcDir %>/vendor/bootstrap/less", "<%= srcDir %>/less"],
|
||||
yuicompress: true
|
||||
},
|
||||
files: {
|
||||
"<%= srcDir %>/css/bootstrap.dark.min.css": "<%= srcDir %>/css/less/bootstrap.dark.less",
|
||||
"<%= srcDir %>/css/bootstrap.light.min.css": "<%= srcDir %>/css/less/bootstrap.light.less",
|
||||
"<%= srcDir %>/css/bootstrap-responsive.min.css": "<%= srcDir %>/css/less/grafana-responsive.less"
|
||||
"<%= genDir %>/css/bootstrap.dark.min.css": "<%= srcDir %>/less/bootstrap.dark.less",
|
||||
"<%= genDir %>/css/bootstrap.light.min.css": "<%= srcDir %>/less/bootstrap.light.less",
|
||||
"<%= genDir %>/css/bootstrap-responsive.min.css": "<%= srcDir %>/less/grafana-responsive.less"
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -2,7 +2,7 @@ module.exports = function(config) {
|
||||
return {
|
||||
build: {
|
||||
expand: true,
|
||||
cwd:'<%= tempDir %>',
|
||||
cwd:'<%= genDir %>',
|
||||
src: [
|
||||
'app/controllers/**/*.js',
|
||||
'app/plugins/**/*.js',
|
||||
@ -15,7 +15,7 @@ module.exports = function(config) {
|
||||
'app/app.js',
|
||||
'vendor/angular/**/*.js',
|
||||
],
|
||||
dest: '<%= tempDir %>'
|
||||
dest: '<%= genDir %>'
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -1,9 +1,9 @@
|
||||
module.exports = function(config) {
|
||||
return {
|
||||
grafana: {
|
||||
cwd: '<%= tempDir %>',
|
||||
cwd: '<%= genDir %>',
|
||||
src: ['app/**/*.html'],
|
||||
dest: '<%= tempDir %>/app/components/partials.js',
|
||||
dest: '<%= genDir %>/app/components/partials.js',
|
||||
options: {
|
||||
bootstrap: function(module, script) {
|
||||
return "define('components/partials', ['angular'], function(angular) { \n" +
|
||||
|
@ -4,10 +4,10 @@ module.exports = function(config,grunt) {
|
||||
function buildRequireJsOptions() {
|
||||
|
||||
var options = {
|
||||
appDir: '<%= tempDir %>',
|
||||
dir: '<%= destDir %>',
|
||||
mainConfigFile: '<%= tempDir %>/app/components/require.config.js',
|
||||
baseUrl: './app',
|
||||
appDir: '<%= genDir %>',
|
||||
dir: '<%= tempDir %>',
|
||||
mainConfigFile: '<%= genDir %>/app/components/require.config.js',
|
||||
baseUrl: 'app',
|
||||
waitSeconds: 0,
|
||||
|
||||
modules: [], // populated below,
|
||||
@ -37,9 +37,9 @@ module.exports = function(config,grunt) {
|
||||
|
||||
// setup the modules require will build
|
||||
var requireModules = options.modules = [
|
||||
{
|
||||
// main/common module
|
||||
name: 'app',
|
||||
{
|
||||
// main/common module
|
||||
name: 'app',
|
||||
include: [
|
||||
'kbn',
|
||||
'text',
|
||||
@ -54,10 +54,10 @@ module.exports = function(config,grunt) {
|
||||
'jquery.flot',
|
||||
'angular-strap',
|
||||
'angular-dragdrop',
|
||||
'core/core',
|
||||
'services/all',
|
||||
'features/all',
|
||||
'directives/all',
|
||||
'filters/all',
|
||||
'controllers/all',
|
||||
'routes/all',
|
||||
'components/partials',
|
||||
@ -66,11 +66,15 @@ module.exports = function(config,grunt) {
|
||||
'plugins/datasource/graphite/datasource',
|
||||
'plugins/datasource/influxdb_08/datasource',
|
||||
]
|
||||
}
|
||||
},
|
||||
// {
|
||||
// name: 'features/org/all',
|
||||
// exclude: ['app'],
|
||||
// }
|
||||
];
|
||||
|
||||
var fs = require('fs');
|
||||
var panelPath = config.srcDir+'/app/panels';
|
||||
var panelPath = config.srcDir + '/app/panels';
|
||||
|
||||
// create a module for each directory in public/app/panels/
|
||||
fs.readdirSync(panelPath).forEach(function (panelName) {
|
||||
|
23
tasks/options/tslint.js
Normal file
23
tasks/options/tslint.js
Normal file
@ -0,0 +1,23 @@
|
||||
module.exports = function(config) {
|
||||
return {
|
||||
source: {
|
||||
files: {
|
||||
src: ['<%= srcDir %>/app/**/*.ts', '!<%= srcDir %>/app/**/*.d.ts'],
|
||||
}
|
||||
},
|
||||
options: {
|
||||
configuration: {
|
||||
rules: {
|
||||
curly: true,
|
||||
align: [true, "parameters", "arguments", "statements"],
|
||||
indent: [true, "spaces"],
|
||||
"class-name": true,
|
||||
"interface-name": true,
|
||||
"semicolon": true,
|
||||
"use-strict": [true, "check-module", "check-function" ],
|
||||
"whitespace": [true, "check-branch", "check-decl", "check-operator", "check-separator", "check-type"],
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
43
tasks/options/typescript.js
Normal file
43
tasks/options/typescript.js
Normal file
@ -0,0 +1,43 @@
|
||||
module.exports = function() {
|
||||
'use strict';
|
||||
|
||||
return {
|
||||
build: {
|
||||
src: ['public/app/**/*.ts'],
|
||||
dest: 'public_gen/app',
|
||||
options: {
|
||||
module: 'amd', //or commonjs
|
||||
target: 'es5', //or es3
|
||||
rootDir: 'public/app',
|
||||
declaration: true,
|
||||
sourceMap: true,
|
||||
generateTsConfig: true,
|
||||
}
|
||||
},
|
||||
|
||||
// build2: {
|
||||
// src: ['public/app/alerting#<{(||)}>#*.ts'],
|
||||
// dest: 'public/.app_gen/alerting/all.js',
|
||||
// options: {
|
||||
// target: 'es5', //or es3
|
||||
// declaration: true,
|
||||
// sourceMap: true,
|
||||
// }
|
||||
// },
|
||||
|
||||
watch: {
|
||||
src: ['public/app/**/*.ts'],
|
||||
dest: 'public/app_gen',
|
||||
options: {
|
||||
module: 'amd', //or commonjs
|
||||
target: 'es5', //or es3
|
||||
rootDir: 'public/app',
|
||||
declaration: true,
|
||||
sourceMap: true,
|
||||
watch: true,
|
||||
generateTsConfig: true,
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
};
|
@ -1,10 +1,10 @@
|
||||
module.exports = function(config) {
|
||||
return {
|
||||
dest: {
|
||||
genDir: {
|
||||
expand: true,
|
||||
src: ['**/*.js', '!dashboards/*.js', '!vendor/jquery/**/*.js'],
|
||||
dest: '<%= destDir %>',
|
||||
cwd: '<%= destDir %>',
|
||||
src: ['**/*.js', '!dashboards/*.js', '!vendor/**/*.js'],
|
||||
dest: '<%= genDir %>',
|
||||
cwd: '<%= genDir %>',
|
||||
options: {
|
||||
quite: true,
|
||||
compress: {},
|
||||
|
@ -3,10 +3,11 @@ module.exports = function() {
|
||||
|
||||
return {
|
||||
html: [
|
||||
'<%= destDir %>/views/index.html',
|
||||
'<%= genDir %>/views/index.html',
|
||||
'<%= genDir %>/views/500.html',
|
||||
],
|
||||
options: {
|
||||
assetsDirs: ['<%= destDir %>'],
|
||||
assetsDirs: ['<%= genDir %>'],
|
||||
patterns: {
|
||||
css: [
|
||||
[/(\.css)/, 'Replacing reference to image.png']
|
||||
|
@ -1,7 +0,0 @@
|
||||
module.exports = function(config) {
|
||||
return {
|
||||
html: [
|
||||
'tmp/index.html',
|
||||
]
|
||||
};
|
||||
};
|
@ -1,11 +1,28 @@
|
||||
module.exports = function(config) {
|
||||
return {
|
||||
css: {
|
||||
files: [ '<%= srcDir %>/css/**/*.less' ],
|
||||
files: [ '<%= srcDir %>/less/**/*.less' ],
|
||||
tasks: ['css'],
|
||||
options: {
|
||||
spawn: false
|
||||
}
|
||||
},
|
||||
|
||||
copy_to_gen: {
|
||||
files: ['<%= srcDir %>/**/*', '!<%= srcDir %>/**/*.less'],
|
||||
tasks: ['copy:public_to_gen'],
|
||||
options: {
|
||||
spawn: false
|
||||
}
|
||||
},
|
||||
|
||||
typescript: {
|
||||
files: ['<%= srcDir %>/app/**/*.ts'],
|
||||
tasks: ['typescript:build'],
|
||||
options: {
|
||||
spawn: false
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user