Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
74d7a946
Commit
74d7a946
authored
Dec 15, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tech(systemjs): work on moving to systemjs
parent
7ee290cc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
127 deletions
+28
-127
public/app/_old_app.js
+0
-112
public/app/app.ts
+28
-15
No files found.
public/app/_old_app.js
deleted
100644 → 0
View file @
7ee290cc
define
([
'angular'
,
'jquery'
,
'lodash'
,
'app/core/config'
,
'require'
,
'bootstrap'
,
'angular-route'
,
'angular-sanitize'
,
'angular-strap'
,
'angular-dragdrop'
,
'angular-ui'
,
'bindonce'
,
'app/core/core'
,
],
function
(
angular
,
$
,
_
,
config
,
appLevelRequire
)
{
"use strict"
;
var
app
=
angular
.
module
(
'grafana'
,
[]);
var
register_fns
=
{};
var
preBootModules
=
[];
// This stores the grafana version number
app
.
constant
(
'grafanaVersion'
,
"@grafanaVersion@"
);
/**
* Tells the application to watch the module, once bootstraping has completed
* the modules controller, service, etc. functions will be overwritten to register directly
* with this application.
* @param {[type]} module [description]
* @return {[type]} [description]
*/
app
.
useModule
=
function
(
module
)
{
if
(
preBootModules
)
{
preBootModules
.
push
(
module
);
}
else
{
_
.
extend
(
module
,
register_fns
);
}
// push it into the apps dependencies
apps_deps
.
push
(
module
.
name
);
return
module
;
};
app
.
config
(
function
(
$locationProvider
,
$controllerProvider
,
$compileProvider
,
$filterProvider
,
$provide
)
{
register_fns
.
controller
=
$controllerProvider
.
register
;
register_fns
.
directive
=
$compileProvider
.
directive
;
register_fns
.
factory
=
$provide
.
factory
;
register_fns
.
service
=
$provide
.
service
;
register_fns
.
filter
=
$filterProvider
.
register
;
});
var
apps_deps
=
[
'grafana.core'
,
'ngRoute'
,
'ngSanitize'
,
'$strap.directives'
,
'ang-drag-drop'
,
'grafana'
,
'pasvaz.bindonce'
,
'ui.bootstrap'
,
'ui.bootstrap.tpls'
,
];
var
module_types
=
[
'controllers'
,
'directives'
,
'factories'
,
'services'
,
'filters'
,
'routes'
];
_
.
each
(
module_types
,
function
(
type
)
{
var
module_name
=
'grafana.'
+
type
;
// create the module
app
.
useModule
(
angular
.
module
(
module_name
,
[]));
});
var
preBootRequires
=
[
'app/features/all'
];
var
pluginModules
=
config
.
bootData
.
pluginModules
||
[];
// add plugin modules
for
(
var
i
=
0
;
i
<
pluginModules
.
length
;
i
++
)
{
preBootRequires
.
push
(
pluginModules
[
i
]);
}
app
.
boot
=
function
()
{
require
(
preBootRequires
,
function
()
{
// disable tool tip animation
$
.
fn
.
tooltip
.
defaults
.
animation
=
false
;
// bootstrap the app
angular
.
element
(
document
)
.
ready
(
function
()
{
angular
.
bootstrap
(
document
,
apps_deps
)
.
invoke
([
'$rootScope'
,
function
(
$rootScope
)
{
_
.
each
(
preBootModules
,
function
(
module
)
{
_
.
extend
(
module
,
register_fns
);
});
preBootModules
=
null
;
$rootScope
.
requireContext
=
appLevelRequire
;
$rootScope
.
require
=
function
(
deps
,
fn
)
{
var
$scope
=
this
;
$scope
.
requireContext
(
deps
,
function
()
{
var
deps
=
_
.
toArray
(
arguments
);
fn
.
apply
(
$scope
,
deps
);
});
};
}]);
});
});
};
return
app
;
});
public/app/app.ts
View file @
74d7a946
...
...
@@ -20,27 +20,37 @@ import angular = require('angular');
import
config
=
require
(
'app/core/config'
);
class
GrafanaApp
{
register_fns
:
any
=
{};
registerFunctions
:
any
;
ngModuleDependencies
:
any
[];
preBootModules
:
any
[];
useModule
(
module
)
{
_
.
extend
(
module
,
this
.
register_fns
);
if
(
this
.
preBootModules
)
{
this
.
preBootModules
.
push
(
module
);
}
else
{
_
.
extend
(
module
,
this
.
registerFunctions
);
}
this
.
ngModuleDependencies
.
push
(
module
.
name
);
return
module
;
}
init
()
{
this
.
registerFunctions
=
{};
this
.
preBootModules
=
[];
var
app
=
angular
.
module
(
'grafana'
,
[]);
app
.
constant
(
'grafanaVersion'
,
"@grafanaVersion@"
);
app
.
config
((
$locationProvider
,
$controllerProvider
,
$compileProvider
,
$filterProvider
,
$provide
)
=>
{
console
.
log
(
'app config'
);
this
.
register
_f
ns
.
controller
=
$controllerProvider
.
register
;
this
.
register
_f
ns
.
directive
=
$compileProvider
.
directive
;
this
.
register
_f
ns
.
factory
=
$provide
.
factory
;
this
.
register
_f
ns
.
service
=
$provide
.
service
;
this
.
register
_f
ns
.
filter
=
$filterProvider
.
register
;
this
.
register
Functio
ns
.
controller
=
$controllerProvider
.
register
;
this
.
register
Functio
ns
.
directive
=
$compileProvider
.
directive
;
this
.
register
Functio
ns
.
factory
=
$provide
.
factory
;
this
.
register
Functio
ns
.
service
=
$provide
.
service
;
this
.
register
Functio
ns
.
filter
=
$filterProvider
.
register
;
});
var
apps_dep
s
=
[
this
.
ngModuleDependencie
s
=
[
'grafana.core'
,
'ngRoute'
,
'ngSanitize'
,
...
...
@@ -54,9 +64,8 @@ class GrafanaApp {
var
module_types
=
[
'controllers'
,
'directives'
,
'factories'
,
'services'
,
'filters'
,
'routes'
];
_
.
each
(
module_types
,
type
=>
{
var
module_name
=
'grafana.'
+
type
;
this
.
useModule
(
angular
.
module
(
module_name
,
[]));
apps_deps
.
push
(
module_name
);
var
moduleName
=
'grafana.'
+
type
;
this
.
useModule
(
angular
.
module
(
moduleName
,
[]));
});
var
preBootRequires
=
[
System
.
import
(
'app/features/all'
)];
...
...
@@ -67,13 +76,17 @@ class GrafanaApp {
preBootRequires
.
push
(
System
.
import
(
pluginModules
[
i
]));
}
Promise
.
all
(
preBootRequires
).
then
(
function
()
{
Promise
.
all
(
preBootRequires
).
then
(
()
=>
{
// disable tool tip animation
$
.
fn
.
tooltip
.
defaults
.
animation
=
false
;
// bootstrap the app
var
asd
=
angular
.
bootstrap
(
document
,
apps_deps
).
invoke
([
'$rootScope'
,
function
(
$rootScope
)
{
console
.
log
(
'bootstrap'
);
}]);
angular
.
bootstrap
(
document
,
this
.
ngModuleDependencies
).
invoke
(()
=>
{
_
.
each
(
this
.
preBootModules
,
module
=>
{
_
.
extend
(
module
,
this
.
registerFunctions
);
});
this
.
preBootModules
=
null
;
});
}).
catch
(
function
(
err
)
{
console
.
log
(
'Application boot failed: '
+
err
);
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment