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
2feab76a
Commit
2feab76a
authored
Jan 29, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'pro' into temp_test
parents
c6e11010
3b5c813b
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
160 additions
and
74 deletions
+160
-74
src/app/components/settings.js
+1
-6
src/app/controllers/grafanaCtrl.js
+8
-18
src/app/controllers/loginCtrl.js
+4
-0
src/app/controllers/search.js
+2
-1
src/app/controllers/sidemenuCtrl.js
+44
-24
src/app/directives/dashEditLink.js
+1
-0
src/app/features/admin/adminSettingsCtrl.js
+18
-0
src/app/features/admin/partials/settings.html
+11
-0
src/app/features/all.js
+1
-0
src/app/features/dashboard/dashboardCtrl.js
+1
-1
src/app/features/grafanaDatasource/datasource.js
+6
-6
src/app/features/graphite/datasource.js
+0
-1
src/app/panels/graph/axisEditor.html
+1
-1
src/app/partials/dasheditor.html
+1
-1
src/app/partials/login.html
+2
-2
src/app/partials/sidemenu.html
+4
-1
src/app/routes/backend/all.js
+8
-4
src/app/routes/backend/dashboard.js
+8
-5
src/app/routes/standalone/fromFile.js
+14
-3
src/app/services/all.js
+1
-0
src/app/services/userSrv.js
+24
-0
No files found.
src/app/components/settings.js
View file @
2feab76a
...
...
@@ -34,12 +34,7 @@ function (_, crypto) {
}
};
// This initializes a new hash on purpose, to avoid adding parameters to
// config.js without providing sane defaults
var
settings
=
{};
_
.
each
(
defaults
,
function
(
value
,
key
)
{
settings
[
key
]
=
typeof
options
[
key
]
!==
'undefined'
?
options
[
key
]
:
defaults
[
key
];
});
var
settings
=
_
.
extend
({},
defaults
,
options
);
var
parseBasicAuth
=
function
(
datasource
)
{
var
passwordEnd
=
datasource
.
url
.
indexOf
(
'@'
);
...
...
src/app/controllers/grafanaCtrl.js
View file @
2feab76a
...
...
@@ -10,17 +10,17 @@ function (angular, config, _, $, store) {
var
module
=
angular
.
module
(
'grafana.controllers'
);
module
.
controller
(
'GrafanaCtrl'
,
function
(
$scope
,
alertSrv
,
utilSrv
,
grafanaVersion
,
$rootScope
,
$controller
)
{
$scope
.
grafanaVersion
=
grafanaVersion
[
0
]
===
'@'
?
'master'
:
grafanaVersion
;
$scope
.
grafana
=
{};
$rootScope
.
profilingEnabled
=
store
.
getBool
(
'profilingEnabled'
);
$rootScope
.
performance
=
{
loadStart
:
new
Date
().
getTime
()
};
$rootScope
.
appSubUrl
=
config
.
appSubUrl
;
module
.
controller
(
'GrafanaCtrl'
,
function
(
$scope
,
alertSrv
,
utilSrv
,
grafanaVersion
,
$rootScope
,
$controller
,
userSrv
)
{
$scope
.
init
=
function
()
{
$scope
.
grafana
=
{};
$scope
.
grafana
.
version
=
grafanaVersion
;
$scope
.
_
=
_
;
$rootScope
.
profilingEnabled
=
store
.
getBool
(
'profilingEnabled'
);
$rootScope
.
performance
=
{
loadStart
:
new
Date
().
getTime
()
};
$rootScope
.
appSubUrl
=
config
.
appSubUrl
;
if
(
$rootScope
.
profilingEnabled
)
{
$scope
.
initProfiling
();
}
alertSrv
.
init
();
...
...
@@ -28,19 +28,9 @@ function (angular, config, _, $, store) {
$scope
.
dashAlerts
=
alertSrv
;
$scope
.
grafana
.
style
=
'dark'
;
if
(
window
.
grafanaBackend
)
{
$scope
.
initBackendFeatures
();
}
};
$scope
.
initBackendFeatures
=
function
()
{
$scope
.
grafana
.
user
=
userSrv
.
getSignedInUser
();
$scope
.
grafana
.
sidemenu
=
store
.
getBool
(
'grafana.sidemenu'
);
if
(
window
.
grafanaBootData
.
user
.
login
)
{
$scope
.
grafana
.
user
=
window
.
grafanaBootData
.
user
;
}
$scope
.
onAppEvent
(
'logged-out'
,
function
()
{
$scope
.
grafana
.
sidemenu
=
false
;
$scope
.
grafana
.
user
=
{};
...
...
src/app/controllers/loginCtrl.js
View file @
2feab76a
...
...
@@ -16,6 +16,10 @@ function (angular, config) {
};
$scope
.
grafana
.
sidemenu
=
false
;
$scope
.
googleAuthEnabled
=
config
.
googleAuthEnabled
;
$scope
.
githubAuthEnabled
=
config
.
githubAuthEnabled
;
$scope
.
loginMode
=
true
;
$scope
.
submitBtnClass
=
'btn-inverse'
;
$scope
.
submitBtnText
=
'Log in'
;
...
...
src/app/controllers/search.js
View file @
2feab76a
...
...
@@ -154,7 +154,8 @@ function (angular, _, config, $) {
};
$scope
.
newDashboard
=
function
()
{
$location
.
url
(
'/dashboard/file/empty.json'
);
//$location.path('/dashboard/file/empty.json');
$location
.
url
(
'dashboard/new'
);
};
});
...
...
src/app/controllers/sidemenuCtrl.js
View file @
2feab76a
...
...
@@ -15,39 +15,59 @@ function (angular, _, $, config) {
return
config
.
appSubUrl
+
url
;
};
$scope
.
menu
=
[
{
text
:
"Dashbord"
,
href
:
$scope
.
getUrl
(
"/"
),
startsWith
:
config
.
appSubUrl
+
'/dashboard/'
,
icon
:
"fa fa-th-large"
,
links
:
[
{
text
:
'Settings'
,
editview
:
'settings'
,
icon
:
"fa fa-cogs"
},
{
text
:
'Templating'
,
editview
:
'templating'
,
icon
:
"fa fa-cogs"
},
{
text
:
'Annotations'
,
editview
:
'annotations'
,
icon
:
"fa fa-bolt"
},
{
text
:
'Export'
,
href
:
""
,
icon
:
"fa fa-bolt"
},
{
text
:
'JSON'
,
href
:
""
,
icon
:
"fa fa-bolt"
},
]
},
{
$scope
.
menu
=
[];
$scope
.
menu
.
push
({
text
:
"Dashbord"
,
href
:
$scope
.
getUrl
(
"/"
),
startsWith
:
config
.
appSubUrl
+
'/dashboard/'
,
icon
:
"fa fa-th-large"
,
links
:
[
{
text
:
'Settings'
,
editview
:
'settings'
},
{
text
:
'Templating'
,
editview
:
'templating'
},
{
text
:
'Annotations'
,
editview
:
'annotations'
},
{
text
:
'Export'
,
href
:
""
},
{
text
:
'JSON'
,
href
:
""
},
]
});
if
(
$scope
.
grafana
.
user
.
accountRole
===
'Admin'
)
{
$scope
.
menu
.
push
({
text
:
"Account"
,
href
:
$scope
.
getUrl
(
"/account"
),
requireRole
:
"Admin"
,
icon
:
"fa fa-shield"
,
links
:
[
{
text
:
'Info'
,
href
:
$scope
.
getUrl
(
"/account"
),
icon
:
"fa fa-sitemap"
},
{
text
:
'Data sources'
,
href
:
$scope
.
getUrl
(
"/account/datasources"
)
,
icon
:
"fa fa-sitemap"
},
{
text
:
'Users'
,
href
:
$scope
.
getUrl
(
"/account/users"
),
icon
:
"fa fa-users"
},
{
text
:
'API Keys'
,
href
:
$scope
.
getUrl
(
"/account/apikeys"
),
icon
:
"fa fa-key"
},
{
text
:
'Info'
,
href
:
$scope
.
getUrl
(
"/account"
)
},
{
text
:
'Data sources'
,
href
:
$scope
.
getUrl
(
"/account/datasources"
)},
{
text
:
'Users'
,
href
:
$scope
.
getUrl
(
"/account/users"
)
},
{
text
:
'API Keys'
,
href
:
$scope
.
getUrl
(
"/account/apikeys"
)
},
]
},
{
});
}
if
(
$scope
.
grafana
.
user
.
isSignedIn
)
{
$scope
.
menu
.
push
({
text
:
"Profile"
,
href
:
$scope
.
getUrl
(
"/profile"
),
icon
:
"fa fa-user"
,
requireSignedIn
:
true
,
links
:
[
{
text
:
'Info'
,
href
:
$scope
.
getUrl
(
"/profile"
),
icon
:
"fa fa-sitemap"
},
{
text
:
'Info'
,
href
:
$scope
.
getUrl
(
"/profile"
),
icon
:
"fa fa-sitemap"
},
{
text
:
'Password'
,
href
:
""
,
icon
:
"fa fa-lock"
},
]
}
];
});
}
if
(
$scope
.
grafana
.
user
.
isGrafanaAdmin
)
{
$scope
.
menu
.
push
({
text
:
"Admin"
,
href
:
$scope
.
getUrl
(
"/admin/users"
),
icon
:
"fa fa-cube"
,
requireSignedIn
:
true
,
links
:
[
{
text
:
'Settings'
,
href
:
$scope
.
getUrl
(
"/admin/settings"
)},
{
text
:
'Users'
,
href
:
$scope
.
getUrl
(
"/admin/users"
),
icon
:
"fa fa-lock"
},
{
text
:
'Log'
,
href
:
""
,
icon
:
"fa fa-lock"
},
]
});
}
$scope
.
onAppEvent
(
'$routeUpdate'
,
function
()
{
$scope
.
updateState
();
...
...
src/app/directives/dashEditLink.js
View file @
2feab76a
...
...
@@ -102,6 +102,7 @@ function (angular, $) {
}
});
scope
.
$on
(
"$destroy"
,
hideEditorPane
);
scope
.
onAppEvent
(
'hide-dash-editor'
,
hideEditorPane
);
scope
.
onAppEvent
(
'show-dash-editor'
,
showEditorPane
);
}
...
...
src/app/features/admin/adminSettingsCtrl.js
0 → 100644
View file @
2feab76a
define
([
'angular'
,
],
function
(
angular
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.controllers'
);
module
.
controller
(
'AdminSettingsCtrl'
,
function
(
$scope
)
{
$scope
.
init
=
function
()
{
};
$scope
.
init
();
});
});
src/app/features/admin/partials/settings.html
0 → 100644
View file @
2feab76a
<div
ng-include=
"'app/partials/navbar.html'"
ng-init=
"pageTitle='Admin > Settings'"
></div>
<div
class=
"dashboard-edit-view"
style=
"min-height: 500px"
>
<div
class=
"dashboard-editor-body"
>
<div
class=
"editor-row row"
>
<div
class=
"section span6"
>
</div>
</div>
</div>
</div>
src/app/features/all.js
View file @
2feab76a
...
...
@@ -14,5 +14,6 @@ define([
'./account/importCtrl'
,
'./account/accountCtrl'
,
'./admin/adminUsersCtrl'
,
'./admin/adminSettingsCtrl'
,
'./grafanaDatasource/datasource'
,
],
function
()
{});
src/app/features/dashboard/dashboardCtrl.js
View file @
2feab76a
...
...
@@ -105,7 +105,7 @@ function (angular, $, config, _) {
};
$scope
.
checkFeatureToggles
=
function
()
{
$scope
.
submenuEnabled
=
$scope
.
dashboard
.
templating
.
enable
||
$scope
.
dashboard
.
annotations
.
enable
;
$scope
.
submenuEnabled
=
$scope
.
dashboard
.
templating
.
enable
||
$scope
.
dashboard
.
annotations
.
enable
||
false
;
};
$scope
.
onDrop
=
function
(
panelId
,
row
,
dropTarget
)
{
...
...
src/app/features/grafanaDatasource/datasource.js
View file @
2feab76a
...
...
@@ -18,17 +18,17 @@ function (angular, _, kbn) {
this
.
editorSrc
=
'app/features/grafanaDatasource/partials/query.editor.html'
;
}
GrafanaDatasource
.
prototype
.
getDashboard
=
function
(
id
,
isTemp
)
{
var
url
=
'/dashboard/'
+
id
;
GrafanaDatasource
.
prototype
.
getDashboard
=
function
(
slug
,
isTemp
)
{
var
url
=
'/dashboard/'
+
slug
;
if
(
isTemp
)
{
url
=
'/temp/'
+
id
;
url
=
'/temp/'
+
slug
;
}
return
backendSrv
.
get
(
'/api/dashboard/'
+
id
)
return
backendSrv
.
get
(
'/api/dashboard/'
+
slug
)
.
then
(
function
(
data
)
{
if
(
data
)
{
return
angular
.
fromJson
(
data
)
;
if
(
data
&&
data
.
dashboard
)
{
return
data
.
dashboard
;
}
else
{
return
false
;
}
...
...
src/app/features/graphite/datasource.js
View file @
2feab76a
...
...
@@ -158,7 +158,6 @@ function (angular, _, $, config, kbn, moment) {
date
=
date
.
replace
(
'M'
,
'mon'
);
return
date
;
}
date
=
kbn
.
parseDate
(
date
);
}
...
...
src/app/panels/graph/axisEditor.html
View file @
2feab76a
...
...
@@ -150,7 +150,7 @@
<li
class=
"tight-form-item"
>
Show
<input
class=
"cr1"
id=
"panel.legend.show"
type=
"checkbox"
ng-model=
"panel.legend.show"
ng-checked=
"panel.legend.show"
ng-change=
"
render
()"
>
ng-model=
"panel.legend.show"
ng-checked=
"panel.legend.show"
ng-change=
"
get_data
()"
>
<label
for=
"panel.legend.show"
class=
"cr1"
></label>
</li>
<li
class=
"tight-form-item"
>
...
...
src/app/partials/dasheditor.html
View file @
2feab76a
...
...
@@ -96,7 +96,7 @@
<div
class=
"dashboard-editor-footer"
>
<div
class=
"grafana-version-info"
ng-show=
"editor.index === 0"
>
<span
class=
"editor-option small"
>
Grafana version: {{grafana
V
ersion}}
Grafana version: {{grafana
.v
ersion}}
</span>
<span
grafana-version-check
>
</span>
...
...
src/app/partials/login.html
View file @
2feab76a
...
...
@@ -80,11 +80,11 @@
<div
class=
"clearfix"
></div>
<div
class=
"login-oauth text-center"
>
<a
class=
"btn btn-google"
href=
"login/google"
target=
"_self"
>
<a
class=
"btn btn-google"
href=
"login/google"
target=
"_self"
ng-if=
"googleAuthEnabled"
>
<i
class=
"fa fa-google"
></i>
with Google
</a>
<a
class=
"btn btn-github"
href=
"login/github"
target=
"_self"
>
<a
class=
"btn btn-github"
href=
"login/github"
target=
"_self"
ng-if=
"githubAuthEnabled"
>
<i
class=
"fa fa-github"
></i>
with Github
</a>
...
...
src/app/partials/sidemenu.html
View file @
2feab76a
<div
ng-controller=
"SideMenuCtrl"
ng-init=
"init()"
>
<ul
class=
"sidemenu"
>
<li
class=
"dropdown"
>
<li
class=
"dropdown"
ng-if=
"grafana.user.isSignedIn"
>
<a
class=
"sidemenu-user pointer"
data-toggle=
"dropdown"
title=
"{{grafana.user.email}}"
>
<span
class=
"gravatar-missing"
>
f
</span>
<img
ng-src=
"{{grafana.user.gravatarUrl}}"
width=
"35"
>
...
...
@@ -10,6 +10,9 @@
<li><a
href=
"{{appSubUrl}}/login?logout"
>
Logout
</a></li>
</ul>
</li>
<li
ng-if=
"!grafana.user.isSignedIn"
>
<a
href=
"login"
class=
"sidemenu-item"
><i
class=
"fa fa-sign-in"
></i>
Sign in
</a>
</li>
<li
ng-repeat-start=
"item in menu"
ng-class=
"{'active': item.active}"
>
<a
href=
"{{item.href}}"
class=
"sidemenu-item"
><i
class=
"{{item.icon}}"
></i>
{{item.text}}
</a>
</li>
...
...
src/app/routes/backend/all.js
View file @
2feab76a
...
...
@@ -20,14 +20,14 @@ define([
controller
:
'DashFromDBProvider'
,
reloadOnSearch
:
false
,
})
.
when
(
'/dashboard/
temp
/:id'
,
{
.
when
(
'/dashboard/
import
/:id'
,
{
templateUrl
:
'app/partials/dashboard.html'
,
controller
:
'DashFrom
DBProvider
'
,
controller
:
'DashFrom
ImportCtrl
'
,
reloadOnSearch
:
false
,
})
.
when
(
'/dashboard/
import/:id
'
,
{
.
when
(
'/dashboard/
new
'
,
{
templateUrl
:
'app/partials/dashboard.html'
,
controller
:
'
DashFromImport
Ctrl'
,
controller
:
'
NewDashboard
Ctrl'
,
reloadOnSearch
:
false
,
})
.
when
(
'/account'
,
{
...
...
@@ -54,6 +54,10 @@ define([
templateUrl
:
'app/features/profile/partials/profile.html'
,
controller
:
'ProfileCtrl'
,
})
.
when
(
'/admin/settings'
,
{
templateUrl
:
'app/features/admin/partials/settings.html'
,
controller
:
'AdminSettingsCtrl'
,
})
.
when
(
'/admin/users'
,
{
templateUrl
:
'app/features/admin/partials/users.html'
,
controller
:
'AdminUsersCtrl'
,
...
...
src/app/routes/backend/dashboard.js
View file @
2feab76a
...
...
@@ -45,22 +45,25 @@ function (angular, store) {
.
then
(
function
(
dashboard
)
{
prevDashPath
=
$location
.
path
();
$scope
.
initDashboard
(
dashboard
,
$scope
);
}).
then
(
null
,
function
(
err
)
{
$scope
.
appEvent
(
'alert-error'
,
[
'Load dashboard failed'
,
err
]);
}).
then
(
null
,
function
()
{
$scope
.
initDashboard
({},
$scope
);
});
});
module
.
controller
(
'DashFromImportCtrl'
,
function
(
$scope
,
$location
,
alertSrv
)
{
if
(
!
window
.
grafanaImportDashboard
)
{
alertSrv
.
set
(
'Not found'
,
'Cannot reload page with unsaved imported dashboard'
,
'warning'
,
7000
);
$location
.
path
(
''
);
return
;
}
$scope
.
initDashboard
(
window
.
grafanaImportDashboard
,
$scope
);
});
module
.
controller
(
'NewDashboardCtrl'
,
function
(
$scope
)
{
$scope
.
initDashboard
({
title
:
"New dashboard"
,
rows
:
[{
height
:
'250px'
,
panels
:[]
}]
},
$scope
);
});
});
src/app/routes/standalone/fromFile.js
View file @
2feab76a
...
...
@@ -15,10 +15,16 @@ function (angular, $, config, _) {
templateUrl
:
'app/partials/dashboard.html'
,
controller
:
'DashFromFileProvider'
,
reloadOnSearch
:
false
,
})
.
when
(
'/dashboard/new'
,
{
templateUrl
:
'app/partials/dashboard.html'
,
controller
:
'DashFromFileProvider'
,
reloadOnSearch
:
false
,
newDashboard
:
true
,
});
});
module
.
controller
(
'DashFromFileProvider'
,
function
(
$scope
,
$rootScope
,
$http
,
$routeParams
,
alertSrv
)
{
module
.
controller
(
'DashFromFileProvider'
,
function
(
$scope
,
$rootScope
,
$http
,
$routeParams
,
$route
)
{
var
renderTemplate
=
function
(
json
,
params
)
{
var
_r
;
...
...
@@ -46,12 +52,17 @@ function (angular, $, config, _) {
}
return
result
.
data
;
},
function
()
{
alertSrv
.
set
(
'Error'
,
"Could not load <i>dashboards/"
+
file
+
"</i>. Please make sure it exists"
,
'error'
);
$scope
.
appEvent
(
'alert-error'
,
[
"Dashboard load failed"
,
"Could not load <i>dashboards/"
+
file
+
"</i>. Please make sure it exists"
]
);
return
false
;
});
};
file_load
(
$routeParams
.
jsonFile
).
then
(
function
(
result
)
{
var
fileToLoad
=
$routeParams
.
jsonFile
;
if
(
$route
.
current
.
newDashboard
)
{
fileToLoad
=
'empty.json'
;
}
file_load
(
fileToLoad
).
then
(
function
(
result
)
{
$scope
.
initDashboard
(
result
,
$scope
);
});
...
...
src/app/services/all.js
View file @
2feab76a
...
...
@@ -2,6 +2,7 @@ define([
'./alertSrv'
,
'./utilSrv'
,
'./datasourceSrv'
,
'./userSrv'
,
'./timer'
,
'./keyboardManager'
,
'./popoverSrv'
,
...
...
src/app/services/userSrv.js
0 → 100644
View file @
2feab76a
define
([
'angular'
,
'lodash'
,
],
function
(
angular
,
_
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.services'
);
module
.
service
(
'userSrv'
,
function
()
{
function
User
()
{
if
(
window
.
grafanaBootData
.
user
)
{
_
.
extend
(
this
,
window
.
grafanaBootData
.
user
);
}
}
this
.
getSignedInUser
=
function
()
{
return
new
User
();
};
});
});
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