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
6d60d125
Commit
6d60d125
authored
Aug 18, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Othyus-filter_orgs'
parents
998ed097
e3bbf96b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
13 deletions
+36
-13
public/app/core/components/sidemenu/sidemenu.html
+10
-0
public/app/core/components/sidemenu/sidemenu.ts
+26
-13
No files found.
public/app/core/components/sidemenu/sidemenu.html
View file @
6d60d125
...
...
@@ -22,6 +22,16 @@
{{::menuItem.text}}
</a>
</li>
<li
ng-show=
"ctrl.orgs.length > ctrl.maxShownOrgs"
style=
"margin-left: 10px;width: 90%"
>
<span
class=
"sidemenu-item-text"
>
Max shown : {{::ctrl.maxShownOrgs}}
</span>
<input
ng-model=
"::ctrl.orgFilter"
style=
"padding-left: 5px"
type=
"text"
ng-change=
"::ctrl.loadOrgsItems();"
class=
"gf-input-small width-12"
placeholder=
"Filter"
>
</li>
<li
ng-repeat=
"orgItem in ctrl.orgItems"
ng-class=
"::orgItem.cssClass"
>
<a
href=
"{{::orgItem.url}}"
ng-show=
"::orgItem.url"
target=
"{{::orgItem.target}}"
>
<i
class=
"{{::orgItem.icon}}"
ng-show=
"::orgItem.icon"
></i>
{{::orgItem.text}}
</a>
</li>
</ul>
</li>
...
...
public/app/core/components/sidemenu/sidemenu.ts
View file @
6d60d125
...
...
@@ -13,6 +13,10 @@ export class SideMenuCtrl {
orgMenu
:
any
;
appSubUrl
:
string
;
loginUrl
:
string
;
orgFilter
:
string
;
orgItems
:
any
;
orgs
:
any
;
maxShownOrgs
:
number
;
/** @ngInject */
constructor
(
private
$scope
,
private
$location
,
private
contextSrv
,
private
backendSrv
,
private
$element
)
{
...
...
@@ -20,6 +24,7 @@ export class SideMenuCtrl {
this
.
user
=
contextSrv
.
user
;
this
.
appSubUrl
=
config
.
appSubUrl
;
this
.
showSignout
=
this
.
contextSrv
.
isSignedIn
&&
!
config
[
'authProxyEnabled'
];
this
.
maxShownOrgs
=
10
;
this
.
mainLinks
=
config
.
bootData
.
mainNavLinks
;
this
.
openUserDropdown
();
...
...
@@ -31,6 +36,8 @@ export class SideMenuCtrl {
}
this
.
loginUrl
=
'login?redirect='
+
encodeURIComponent
(
this
.
$location
.
path
());
});
this
.
orgFilter
=
''
;
}
getUrl
(
url
)
{
...
...
@@ -51,38 +58,44 @@ export class SideMenuCtrl {
this
.
orgMenu
.
push
({
section
:
this
.
user
.
orgName
,
cssClass
:
'dropdown-menu-title'
});
this
.
orgMenu
.
push
({
text
:
"Preferences"
,
url
:
this
.
getUrl
(
"/org"
)
,
url
:
this
.
getUrl
(
"/org"
)
});
this
.
orgMenu
.
push
({
text
:
"Users"
,
url
:
this
.
getUrl
(
"/org/users"
)
,
url
:
this
.
getUrl
(
"/org/users"
)
});
this
.
orgMenu
.
push
({
text
:
"API Keys"
,
url
:
this
.
getUrl
(
"/org/apikeys"
)
,
url
:
this
.
getUrl
(
"/org/apikeys"
)
});
}
this
.
orgMenu
.
push
({
cssClass
:
"divider"
});
this
.
backendSrv
.
get
(
'/api/user/orgs'
).
then
(
orgs
=>
{
orgs
.
forEach
(
org
=>
{
if
(
org
.
orgId
===
this
.
contextSrv
.
user
.
orgId
)
{
return
;
}
this
.
orgs
=
orgs
;
this
.
loadOrgsItems
();
})
;
}
this
.
orgMenu
.
push
({
loadOrgsItems
(){
this
.
orgItems
=
[];
this
.
orgs
.
forEach
(
org
=>
{
if
(
org
.
orgId
===
this
.
contextSrv
.
user
.
orgId
)
{
return
;
}
if
(
this
.
orgItems
.
length
<
this
.
maxShownOrgs
&&
(
this
.
orgFilter
===
''
||
org
.
name
.
indexOf
(
this
.
orgFilter
)
!==
-
1
)){
this
.
orgItems
.
push
({
text
:
"Switch to "
+
org
.
name
,
icon
:
"fa fa-fw fa-random"
,
url
:
this
.
getUrl
(
'/profile/switch-org/'
+
org
.
orgId
),
target
:
'_self'
});
});
if
(
config
.
allowOrgCreate
)
{
this
.
orgMenu
.
push
({
text
:
"New organization"
,
icon
:
"fa fa-fw fa-plus"
,
url
:
this
.
getUrl
(
'/org/new'
)});
}
});
if
(
config
.
allowOrgCreate
)
{
this
.
orgItems
.
push
({
text
:
"New organization"
,
icon
:
"fa fa-fw fa-plus"
,
url
:
this
.
getUrl
(
'/org/new'
)});
}
}
}
...
...
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