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
5f399112
Commit
5f399112
authored
Jun 08, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring progress
parent
b995dc54
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
38 additions
and
71 deletions
+38
-71
src/app/app.js
+0
-24
src/app/controllers/all.js
+1
-0
src/app/controllers/dash.js
+3
-23
src/app/controllers/graphiteImport.js
+1
-1
src/app/controllers/search.js
+4
-3
src/app/partials/dashboard.html
+0
-0
src/app/routes/dashboard-loader.js
+13
-15
src/app/services/dashboard.js
+1
-1
src/app/services/dashboard/dashboardKeyBindings.js
+8
-0
src/app/services/panelMove.js
+1
-1
src/app/services/unsavedChangesSrv.js
+5
-2
src/index.html
+1
-1
No files found.
src/app/app.js
View file @
5f399112
...
...
@@ -49,23 +49,6 @@ function (angular, $, _, appLevelRequire, config) {
return
module
;
};
app
.
safeApply
=
function
(
$scope
,
fn
)
{
switch
(
$scope
.
$$phase
)
{
case
'$apply'
:
// $digest hasn't started, we should be good
$scope
.
$eval
(
fn
);
break
;
case
'$digest'
:
// waiting to $apply the changes
setTimeout
(
function
()
{
app
.
safeApply
(
$scope
,
fn
);
},
10
);
break
;
default
:
// clear to begin an $apply $$phase
$scope
.
$apply
(
fn
);
break
;
}
};
app
.
config
(
function
(
$routeProvider
,
$controllerProvider
,
$compileProvider
,
$filterProvider
,
$provide
)
{
$routeProvider
.
otherwise
({
redirectTo
:
config
.
default_route
});
...
...
@@ -97,12 +80,6 @@ function (angular, $, _, appLevelRequire, config) {
apps_deps
.
push
(
module_name
);
});
app
.
panel_helpers
=
{
partial
:
function
(
name
)
{
return
'app/partials/'
+
name
+
'.html'
;
}
};
// load the core components
require
([
'controllers/all'
,
...
...
@@ -116,7 +93,6 @@ function (angular, $, _, appLevelRequire, config) {
angular
.
element
(
document
)
.
ready
(
function
()
{
$
(
'body'
).
attr
(
'ng-controller'
,
'DashCtrl'
);
angular
.
bootstrap
(
document
,
apps_deps
)
.
invoke
([
'$rootScope'
,
function
(
$rootScope
)
{
_
.
each
(
pre_boot_modules
,
function
(
module
)
{
...
...
src/app/controllers/all.js
View file @
5f399112
define
([
'./grafanaCtrl'
,
'./dash'
,
'./dashLoader'
,
'./row'
,
...
...
src/app/controllers/dash.js
View file @
5f399112
...
...
@@ -30,35 +30,15 @@ function (angular, $, config, _) {
var
module
=
angular
.
module
(
'kibana.controllers'
);
module
.
controller
(
'DashCtrl'
,
function
(
$scope
,
$rootScope
,
$timeout
,
ejsResource
,
filterSrv
,
dashboardKeybindings
,
alertSrv
,
keyboardManager
,
grafanaVersion
)
{
module
.
controller
(
'DashCtrl'
,
function
(
$scope
,
$rootScope
,
dashboardKeybindings
)
{
$scope
.
editor
=
{
index
:
0
};
$scope
.
grafanaVersion
=
grafanaVersion
[
0
]
===
'@'
?
'master'
:
grafanaVersion
;
$scope
.
editor
=
{
index
:
0
};
$scope
.
init
=
function
()
{
$scope
.
config
=
config
;
// Make stuff, including underscore.js available to views
$scope
.
_
=
_
;
$scope
.
dashAlerts
=
alertSrv
;
// Clear existing alerts
alertSrv
.
clearAll
();
$scope
.
reset_row
();
$scope
.
ejs
=
ejsResource
(
config
.
elasticsearch
,
config
.
elasticsearchBasicAuth
);
$scope
.
bindKeyboardShortcuts
();
dashboardKeybindings
.
shortcuts
();
};
$scope
.
bindKeyboardShortcuts
=
dashboardKeybindings
.
shortcuts
;
$scope
.
isPanel
=
function
(
obj
)
{
if
(
!
_
.
isNull
(
obj
)
&&
!
_
.
isUndefined
(
obj
)
&&
!
_
.
isUndefined
(
obj
.
type
))
{
return
true
;
...
...
src/app/controllers/graphiteImport.js
View file @
5f399112
...
...
@@ -96,7 +96,7 @@ function (angular, app, _) {
currentRow
.
panels
.
push
(
panel
);
});
dashboard
.
dash_load
(
newDashboard
);
$scope
.
dashboard
.
dash_load
(
newDashboard
);
}
});
...
...
src/app/controllers/search.js
View file @
5f399112
...
...
@@ -9,14 +9,15 @@ function (angular, _, config, $) {
var
module
=
angular
.
module
(
'kibana.controllers'
);
module
.
controller
(
'SearchCtrl'
,
function
(
$scope
,
$rootScope
,
dashboard
,
$element
,
$location
)
{
module
.
controller
(
'SearchCtrl'
,
function
(
$scope
,
$rootScope
,
$element
,
$location
,
ejsResource
)
{
$scope
.
init
=
function
()
{
$scope
.
ejs
=
ejsResource
(
config
.
elasticsearch
,
config
.
elasticsearchBasicAuth
);
$scope
.
giveSearchFocus
=
0
;
$scope
.
selectedIndex
=
-
1
;
$scope
.
results
=
{
dashboards
:
[],
tags
:
[],
metrics
:
[]};
$scope
.
query
=
{
query
:
'title:'
};
$
rootScope
.
$on
(
'open-search'
,
$scope
.
openSearch
);
$
scope
.
$onRootScope
(
'open-search'
,
$scope
.
openSearch
,
$scope
);
};
$scope
.
keyDown
=
function
(
evt
)
{
...
...
@@ -153,7 +154,7 @@ function (angular, _, config, $) {
};
$scope
.
addMetricToCurrentDashboard
=
function
(
metricId
)
{
dashboard
.
rows
.
push
({
$scope
.
dashboard
.
rows
.
push
({
title
:
''
,
height
:
'250px'
,
editable
:
true
,
...
...
src/app/partials/dashboard.html
View file @
5f399112
This diff is collapsed.
Click to expand it.
src/app/routes/dashboard-loader.js
View file @
5f399112
...
...
@@ -21,24 +21,22 @@ function (angular, $, config, _) {
$scope
,
$rootScope
,
$http
,
$routeParams
,
alertSrv
,
dashboard
,
filterSrv
,
panelMoveSrv
)
{
$scope
.
init
=
function
()
{
console
.
log
(
'DashFromFileProvider->init()'
)
file_load
(
$routeParams
.
jsonFile
)
.
then
(
function
(
data
)
{
$scope
.
dashboard
=
dashboard
.
create
(
data
);
$scope
.
filter
=
filterSrv
;
$scope
.
filter
.
init
(
$scope
.
dashboard
);
file_load
(
$routeParams
.
jsonFile
).
then
(
function
(
data
)
{
$scope
.
dashboard
=
dashboard
.
create
(
data
);
$scope
.
filter
=
filterSrv
;
$scope
.
filter
.
init
(
$scope
.
dashboard
);
var
panelMove
=
panelMoveSrv
.
create
(
$scope
.
dashboard
);
// For moving stuff around the dashboard.
$scope
.
panelMoveDrop
=
panelMove
.
onDrop
;
$scope
.
panelMoveStart
=
panelMove
.
onStart
;
$scope
.
panelMoveStop
=
panelMove
.
onStop
;
$scope
.
panelMoveOver
=
panelMove
.
onOver
;
$scope
.
panelMoveOut
=
panelMove
.
onOut
;
var
panelMove
=
panelMoveSrv
.
create
(
$scope
.
dashboard
);
// For moving stuff around the dashboard.
$scope
.
panelMoveDrop
=
panelMove
.
onDrop
;
$scope
.
panelMoveStart
=
panelMove
.
onStart
;
$scope
.
panelMoveStop
=
panelMove
.
onStop
;
$scope
.
panelMoveOver
=
panelMove
.
onOver
;
$scope
.
panelMoveOut
=
panelMove
.
onOut
;
$rootScope
.
$emit
(
"dashboard-loaded"
,
$scope
.
dashboard
);
});
$rootScope
.
$emit
(
"dashboard-loaded"
,
$scope
.
dashboard
);
});
};
var
renderTemplate
=
function
(
json
,
params
)
{
...
...
src/app/services/dashboard.js
View file @
5f399112
...
...
@@ -13,7 +13,7 @@ function (angular, $, kbn, _) {
var
module
=
angular
.
module
(
'kibana.services'
);
module
.
service
(
'dashboard'
,
function
(
timer
,
$rootScope
)
{
module
.
service
(
'dashboard'
,
function
(
timer
,
$rootScope
,
$timeout
)
{
function
DashboardModel
(
data
)
{
this
.
title
=
data
.
title
;
...
...
src/app/services/dashboard/dashboardKeyBindings.js
View file @
5f399112
...
...
@@ -9,7 +9,15 @@ function(angular, $) {
var
module
=
angular
.
module
(
'kibana.services'
);
module
.
service
(
'dashboardKeybindings'
,
function
(
$rootScope
,
keyboardManager
,
dashboard
)
{
this
.
hasRegistered
=
false
;
this
.
shortcuts
=
function
()
{
if
(
this
.
hasRegistered
)
{
return
;
}
this
.
hasRegistered
=
true
;
$rootScope
.
$on
(
'panel-fullscreen-enter'
,
function
()
{
$rootScope
.
fullscreen
=
true
;
});
...
...
src/app/services/panelMove.js
View file @
5f399112
...
...
@@ -72,7 +72,7 @@ function (angular, _) {
create
:
function
(
dashboard
)
{
return
new
PanelMoveSrv
(
dashboard
);
}
}
}
;
});
...
...
src/app/services/unsavedChangesSrv.js
View file @
5f399112
...
...
@@ -12,16 +12,19 @@ function(angular, _, config) {
var
module
=
angular
.
module
(
'kibana.services'
);
module
.
service
(
'unsavedChangesSrv'
,
function
(
$rootScope
,
$modal
,
dashboard
,
$q
,
$location
,
$timeout
)
{
module
.
service
(
'unsavedChangesSrv'
,
function
(
$rootScope
,
$modal
,
$q
,
$location
,
$timeout
)
{
var
self
=
this
;
var
modalScope
=
$rootScope
.
$new
();
$rootScope
.
$on
(
"dashboard-loaded"
,
function
(
event
,
newDashboard
)
{
self
.
original
=
angular
.
copy
(
newDashboard
);
self
.
current
=
newDashboard
;
});
$rootScope
.
$on
(
"dashboard-saved"
,
function
(
event
,
savedDashboard
)
{
self
.
original
=
angular
.
copy
(
savedDashboard
);
self
.
current
=
savedDashboard
;
});
$rootScope
.
$on
(
"$routeChangeSuccess"
,
function
()
{
...
...
@@ -63,7 +66,7 @@ function(angular, _, config) {
return
false
;
}
var
current
=
angular
.
copy
(
dashboard
.
current
);
var
current
=
angular
.
copy
(
self
.
current
);
var
original
=
self
.
original
;
// ignore timespan changes
...
...
src/index.html
View file @
5f399112
...
...
@@ -18,7 +18,7 @@
</head>
<body
ng-cloak
body-class
>
<body
ng-cloak
body-class
ng-controller=
"GrafanaCtrl"
>
<link
rel=
"stylesheet"
href=
"css/bootstrap.light.min.css"
ng-if=
"dashboard.style === 'light'"
>
<link
rel=
"stylesheet"
href=
"css/bootstrap-responsive.min.css"
>
...
...
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