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
cd4fc78a
Commit
cd4fc78a
authored
Jan 21, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trying to get dashboard settings, annotations and templating views be opened via url parameters
parent
4e6a0492
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
59 additions
and
38 deletions
+59
-38
src/app/controllers/sidemenuCtrl.js
+30
-6
src/app/directives/dashEditLink.js
+19
-2
src/app/features/account/partials/apikeys.html
+1
-1
src/app/features/account/partials/datasources.html
+1
-1
src/app/features/account/partials/users.html
+1
-1
src/app/features/dashboard/viewStateSrv.js
+5
-0
src/app/partials/sidemenu.html
+2
-27
No files found.
src/app/controllers/sidemenuCtrl.js
View file @
cd4fc78a
define
([
'angular'
,
'lodash'
,
'jquery'
,
],
function
(
angular
,
_
)
{
function
(
angular
,
_
,
$
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.controllers'
);
...
...
@@ -13,11 +14,12 @@ function (angular, _) {
{
text
:
"Dashbord"
,
href
:
"/"
,
startsWith
:
'/dashboard/'
,
icon
:
"fa fa-th-large"
,
links
:
[
{
text
:
'Settings'
,
href
:
"asd"
,
icon
:
"fa fa-cogs"
},
{
text
:
'Templating'
,
href
:
"asd"
,
icon
:
"fa fa-cogs"
},
{
text
:
'Annotations'
,
href
:
"asd"
,
icon
:
"fa fa-bolt"
},
{
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
:
'More'
,
href
:
"asd"
,
icon
:
"fa fa-bolt"
},
]
},
...
...
@@ -26,8 +28,8 @@ function (angular, _) {
icon
:
"fa fa-shield"
,
links
:
[
{
text
:
'Data sources'
,
href
:
"/account/datasources"
,
icon
:
"fa fa-sitemap"
},
{
text
:
'Users'
,
href
:
"/account/
datasource
s"
,
icon
:
"fa fa-users"
},
{
text
:
'API Keys'
,
href
:
"/account/
datasource
s"
,
icon
:
"fa fa-key"
},
{
text
:
'Users'
,
href
:
"/account/
user
s"
,
icon
:
"fa fa-users"
},
{
text
:
'API Keys'
,
href
:
"/account/
apikey
s"
,
icon
:
"fa fa-key"
},
]
},
{
...
...
@@ -39,12 +41,18 @@ function (angular, _) {
}
];
$scope
.
onAppEvent
(
'$routeUpdate'
,
function
()
{
$scope
.
updateState
();
});
$scope
.
onAppEvent
(
'$routeChangeSuccess'
,
function
()
{
$scope
.
updateState
();
});
$scope
.
updateState
=
function
()
{
var
currentPath
=
$location
.
path
();
var
search
=
$location
.
search
();
_
.
each
(
$scope
.
menu
,
function
(
item
)
{
item
.
active
=
false
;
...
...
@@ -52,9 +60,25 @@ function (angular, _) {
item
.
active
=
true
;
}
if
(
item
.
startsWith
)
{
if
(
currentPath
.
indexOf
(
item
.
startsWith
)
===
0
)
{
item
.
active
=
true
;
}
}
_
.
each
(
item
.
links
,
function
(
link
)
{
link
.
active
=
false
;
if
(
link
.
editview
)
{
var
params
=
{};
_
.
each
(
search
,
function
(
value
,
key
)
{
if
(
value
!==
null
)
{
params
[
key
]
=
value
;
}
});
params
.
editview
=
link
.
editview
;
link
.
href
=
currentPath
+
'?'
+
$
.
param
(
params
);
}
if
(
link
.
href
===
currentPath
)
{
item
.
active
=
true
;
link
.
active
=
true
;
...
...
src/app/directives/dashEditLink.js
View file @
cd4fc78a
...
...
@@ -5,6 +5,12 @@ define([
function
(
angular
,
$
)
{
'use strict'
;
var
editViewMap
=
{
'settings'
:
'app/partials/dasheditor.html'
,
'annotations'
:
'app/features/annotations/partials/editor.html'
,
'templating'
:
'app/partials/templating_editor.html'
,
};
angular
.
module
(
'grafana.directives'
)
.
directive
(
'dashEditorLink'
,
function
(
$timeout
)
{
...
...
@@ -25,7 +31,7 @@ function (angular, $) {
angular
.
module
(
'grafana.directives'
)
.
directive
(
'dashEditorView'
,
function
(
$compile
)
{
.
directive
(
'dashEditorView'
,
function
(
$compile
,
$location
)
{
return
{
restrict
:
'A'
,
link
:
function
(
scope
,
elem
)
{
...
...
@@ -48,10 +54,13 @@ function (angular, $) {
if
(
editorScope
)
{
editorScope
.
dismiss
();
}
}
scope
.
onAppEvent
(
"dashboard-loaded"
,
hideEditorPane
);
scope
.
onAppEvent
(
'hide-dash-editor'
,
hideEditorPane
);
scope
.
onAppEvent
(
'show-dash-editor'
,
function
(
evt
,
payload
)
{
if
(
payload
.
editview
)
{
payload
.
src
=
editViewMap
[
payload
.
editview
];
}
if
(
lastEditor
===
payload
.
src
)
{
hideEditorPane
();
return
;
...
...
@@ -70,6 +79,14 @@ function (angular, $) {
lastEditor
=
null
;
editorScope
=
null
;
hideScrollbars
(
false
);
if
(
payload
.
editview
)
{
var
urlParams
=
$location
.
search
();
if
(
payload
.
editview
===
urlParams
.
editview
)
{
delete
urlParams
.
editview
;
$location
.
search
(
urlParams
);
}
}
};
// hide page scrollbars while edit pane is visible
...
...
src/app/features/account/partials/apikeys.html
View file @
cd4fc78a
<div
ng-include=
"'app/partials/navbar.html'"
ng-init=
"pageTitle='Account
> API Keys
'"
></div>
<div
ng-include=
"'app/partials/navbar.html'"
ng-init=
"pageTitle='Account'"
></div>
<div
class=
"dashboard-edit-view"
style=
"min-height: 500px"
>
...
...
src/app/features/account/partials/datasources.html
View file @
cd4fc78a
<div
ng-include=
"'app/partials/navbar.html'"
ng-init=
"pageTitle='A
dmin
'"
></div>
<div
ng-include=
"'app/partials/navbar.html'"
ng-init=
"pageTitle='A
ccount
'"
></div>
<div
class=
"dashboard-edit-view"
style=
"min-height: 500px"
>
<div
class=
"editor-row"
>
...
...
src/app/features/account/partials/users.html
View file @
cd4fc78a
<div
ng-include=
"'app/partials/navbar.html'"
ng-init=
"pageTitle='Account
> Users
'"
></div>
<div
ng-include=
"'app/partials/navbar.html'"
ng-init=
"pageTitle='Account'"
></div>
<div
class=
"dashboard-edit-view"
style=
"min-height: 500px"
>
...
...
src/app/features/dashboard/viewStateSrv.js
View file @
cd4fc78a
...
...
@@ -81,6 +81,11 @@ function (angular, _, $) {
};
DashboardViewState
.
prototype
.
syncState
=
function
()
{
if
(
this
.
state
.
editview
)
{
this
.
$scope
.
appEvent
(
'show-dash-editor'
,
{
scope
:
this
.
$scope
,
editview
:
this
.
state
.
editview
});
return
;
}
if
(
this
.
panelScopes
.
length
===
0
)
{
return
;
}
if
(
this
.
fullscreen
)
{
...
...
src/app/partials/sidemenu.html
View file @
cd4fc78a
...
...
@@ -8,7 +8,7 @@
</div>
<ul
class=
"sidemenu"
>
<li
ng-repeat-start=
"item in menu"
>
<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>
<li
ng-repeat-end
ng-if=
"item.active"
>
...
...
@@ -21,31 +21,7 @@
</ul>
</div>
<section
class=
"pro-sidemenu-items"
>
<!-- <a class="pro-sidemenu-link" ng-href="{{appSubUrl}}/"> -->
<!-- <i class="fa fa-th-large"></i> -->
<!-- Dashboards -->
<!-- </a> -->
<!-- <a class="pro-sidemenu-link" href="account/datasources"> -->
<!-- <i class="fa fa-sitemap"></i> -->
<!-- Data -->
<!-- </a> -->
<!-- <a class="pro-sidemenu-link" href="account/users"> -->
<!-- <i class="fa fa-users"></i>Users -->
<!-- </a> -->
<!-- <a class="pro-sidemenu-link" href="account/apikeys"> -->
<!-- <i class="fa fa-key"></i>API Keys -->
<!-- </a> -->
<!-- <a class="pro-sidemenu-link" href="account/import"> -->
<!-- <i class="fa fa-download"></i> -->
<!-- Import -->
<!-- </a> -->
<!-- -->
<!-- <a class="pro-sidemenu-link" href="profile"> -->
<!-- <i class="fa fa-user"></i> -->
<!-- Profile -->
<!-- </a> -->
<!-- -->
<section
class=
"pro-sidemenu-items"
style=
"position: fixed; bottom: 0; width 200px; left: 0;"
>
<a
class=
"pro-sidemenu-link"
href=
"admin/users"
ng-if=
"grafana.user.isGrafanaAdmin"
>
<i
class=
"fa fa-institution"
></i>
Admin
</a>
...
...
@@ -62,7 +38,6 @@
<a
class=
"pro-sidemenu-link"
href=
"login?logout"
>
<i
class=
"fa fa-sign-out"
></i>
Sign out
</a>
</section>
</div>
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