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
2b95cd50
Commit
2b95cd50
authored
Sep 15, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: moving routes into core, improved bundle loader
parent
8f45324b
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
45 additions
and
47 deletions
+45
-47
public/app/app.js
+0
-1
public/app/core/core.ts
+2
-1
public/app/core/core_module.ts
+1
-1
public/app/core/routes/all.js
+14
-13
public/app/core/routes/bundle_loader.ts
+23
-0
public/app/core/routes/dashboard_loaders.js
+5
-11
public/app/core/routes/module_loader.ts
+0
-19
tasks/options/requirejs.js
+0
-1
No files found.
public/app/app.js
View file @
2b95cd50
...
...
@@ -74,7 +74,6 @@ function (angular, $, _, appLevelRequire) {
'features/all'
,
'controllers/all'
,
'components/partials'
,
'routes/all'
,
];
app
.
boot
=
function
()
{
...
...
public/app/core/core.ts
View file @
2b95cd50
...
...
@@ -14,11 +14,12 @@
///<amd-dependency path="./directives/tags" />
///<amd-dependency path="./directives/topnav" />
///<amd-dependency path="./directives/value_select_dropdown" />
///<amd-dependency path="./routes/all" />
export
*
from
'./directives/array_join'
export
*
from
'./directives/give_focus'
export
*
from
'./routes/
modu
le_loader'
export
*
from
'./routes/
bund
le_loader'
export
*
from
'./filters/filters'
public/app/core/core_module.ts
View file @
2b95cd50
...
...
@@ -2,4 +2,4 @@
import
angular
=
require
(
'angular'
);
export
=
angular
.
module
(
'grafana.core'
,
[]);
export
=
angular
.
module
(
'grafana.core'
,
[
'ngRoute'
]);
public/app/routes/all.js
→
public/app/
core/
routes/all.js
View file @
2b95cd50
define
([
'angular'
,
'../core/core'
,
'./dashLoadControllers'
,
],
function
(
angular
,
core
)
{
'../core_module'
,
'./bundle_loader'
,
'./dashboard_loaders'
,
],
function
(
angular
,
coreModule
,
BundleLoader
)
{
"use strict"
;
var
module
=
angular
.
module
(
'grafana.routes'
);
module
.
config
(
function
(
$routeProvider
,
$locationProvider
)
{
coreModule
.
config
(
function
(
$routeProvider
,
$locationProvider
)
{
$locationProvider
.
html5Mode
(
true
);
var
loadOrgBundle
=
new
BundleLoader
.
BundleLoader
(
'features/org/all'
);
$routeProvider
.
when
(
'/'
,
{
templateUrl
:
'app/partials/dashboard.html'
,
...
...
@@ -42,37 +43,37 @@ define([
.
when
(
'/datasources'
,
{
templateUrl
:
'app/features/org/partials/datasources.html'
,
controller
:
'DataSourcesCtrl'
,
resolve
:
new
core
.
ModuleLoader
(
"features/org/all"
)
,
resolve
:
loadOrgBundle
,
})
.
when
(
'/datasources/edit/:id'
,
{
templateUrl
:
'app/features/org/partials/datasourceEdit.html'
,
controller
:
'DataSourceEditCtrl'
,
resolve
:
new
core
.
ModuleLoader
(
"features/org/all"
)
,
resolve
:
loadOrgBundle
,
})
.
when
(
'/datasources/new'
,
{
templateUrl
:
'app/features/org/partials/datasourceEdit.html'
,
controller
:
'DataSourceEditCtrl'
,
resolve
:
new
core
.
ModuleLoader
(
"features/org/all"
)
,
resolve
:
loadOrgBundle
,
})
.
when
(
'/org'
,
{
templateUrl
:
'app/features/org/partials/orgDetails.html'
,
controller
:
'OrgDetailsCtrl'
,
resolve
:
new
core
.
ModuleLoader
(
"features/org/all"
)
,
resolve
:
loadOrgBundle
,
})
.
when
(
'/org/new'
,
{
templateUrl
:
'app/features/org/partials/newOrg.html'
,
controller
:
'NewOrgCtrl'
,
resolve
:
new
core
.
ModuleLoader
(
"features/org/all"
)
,
resolve
:
loadOrgBundle
,
})
.
when
(
'/org/users'
,
{
templateUrl
:
'app/features/org/partials/orgUsers.html'
,
controller
:
'OrgUsersCtrl'
,
resolve
:
new
core
.
ModuleLoader
(
"features/org/all"
)
,
resolve
:
loadOrgBundle
,
})
.
when
(
'/org/apikeys'
,
{
templateUrl
:
'app/features/org/partials/orgApiKeys.html'
,
controller
:
'OrgApiKeysCtrl'
,
resolve
:
new
core
.
ModuleLoader
(
"features/org/all"
)
,
resolve
:
loadOrgBundle
,
})
.
when
(
'/profile'
,
{
templateUrl
:
'app/features/profile/partials/profile.html'
,
...
...
public/app/core/routes/bundle_loader.ts
0 → 100644
View file @
2b95cd50
///<reference path="../../headers/require/require.d.ts" />
export
class
BundleLoader
{
lazy
:
any
;
loadingDefer
:
any
;
constructor
(
bundleName
)
{
this
.
lazy
=
[
"$q"
,
"$route"
,
"$rootScope"
,
(
$q
,
$route
,
$rootScope
)
=>
{
if
(
this
.
loadingDefer
)
{
return
this
.
loadingDefer
.
promise
;
}
this
.
loadingDefer
=
$q
.
defer
();
require
([
bundleName
],
()
=>
{
this
.
loadingDefer
.
resolve
();
});
return
this
.
loadingDefer
.
promise
;
}];
}
}
public/app/
routes/dashLoadControll
ers.js
→
public/app/
core/routes/dashboard_load
ers.js
View file @
2b95cd50
define
([
'angular'
,
'lodash'
,
'kbn'
,
'moment'
,
'jquery'
,
'../core_module'
,
],
function
(
angular
)
{
function
(
coreModule
)
{
"use strict"
;
var
module
=
angular
.
module
(
'grafana.routes'
);
module
.
controller
(
'LoadDashboardCtrl'
,
function
(
$scope
,
$routeParams
,
dashboardLoaderSrv
,
backendSrv
)
{
coreModule
.
controller
(
'LoadDashboardCtrl'
,
function
(
$scope
,
$routeParams
,
dashboardLoaderSrv
,
backendSrv
)
{
if
(
!
$routeParams
.
slug
)
{
backendSrv
.
get
(
'/api/dashboards/home'
).
then
(
function
(
result
)
{
...
...
@@ -27,7 +21,7 @@ function (angular) {
});
m
odule
.
controller
(
'DashFromImportCtrl'
,
function
(
$scope
,
$location
,
alertSrv
)
{
coreM
odule
.
controller
(
'DashFromImportCtrl'
,
function
(
$scope
,
$location
,
alertSrv
)
{
if
(
!
window
.
grafanaImportDashboard
)
{
alertSrv
.
set
(
'Not found'
,
'Cannot reload page with unsaved imported dashboard'
,
'warning'
,
7000
);
$location
.
path
(
''
);
...
...
@@ -39,7 +33,7 @@ function (angular) {
},
$scope
);
});
m
odule
.
controller
(
'NewDashboardCtrl'
,
function
(
$scope
)
{
coreM
odule
.
controller
(
'NewDashboardCtrl'
,
function
(
$scope
)
{
$scope
.
initDashboard
({
meta
:
{
canStar
:
false
,
canShare
:
false
},
dashboard
:
{
...
...
public/app/core/routes/module_loader.ts
deleted
100644 → 0
View file @
8f45324b
///<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
;
}];
}
}
tasks/options/requirejs.js
View file @
2b95cd50
...
...
@@ -58,7 +58,6 @@ module.exports = function(config,grunt) {
'services/all'
,
'features/all'
,
'controllers/all'
,
'routes/all'
,
'components/partials'
,
// bundle the datasources
'plugins/datasource/grafana/datasource'
,
...
...
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