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
d7151e5c
Commit
d7151e5c
authored
Feb 03, 2019
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improving dash nav react comp
parent
4a8effdd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
18 deletions
+53
-18
public/app/features/dashboard/components/DashNav/DashNav.tsx
+30
-17
public/app/features/dashboard/components/DashNav/DashNavButton.tsx
+22
-0
public/app/features/dashboard/state/initDashboard.ts
+1
-1
No files found.
public/app/features/dashboard/components/DashNav/DashNav.tsx
View file @
d7151e5c
...
...
@@ -5,6 +5,9 @@ import { connect } from 'react-redux';
// Utils & Services
import
{
appEvents
}
from
'app/core/app_events'
;
// Components
import
{
DashNavButton
}
from
'./DashNavButton'
;
// State
import
{
updateLocation
}
from
'app/core/actions'
;
...
...
@@ -41,10 +44,17 @@ export class DashNav extends PureComponent<Props> {
};
onClose
=
()
=>
{
this
.
props
.
updateLocation
({
query
:
{
editview
:
null
,
panelId
:
null
,
edit
:
null
,
fullscreen
:
null
},
partial
:
true
,
});
if
(
this
.
props
.
editview
)
{
this
.
props
.
updateLocation
({
query
:
{
editview
:
null
},
partial
:
true
,
});
}
else
{
this
.
props
.
updateLocation
({
query
:
{
panelId
:
null
,
edit
:
null
,
fullscreen
:
null
},
partial
:
true
,
});
}
};
onToggleTVMode
=
()
=>
{
...
...
@@ -116,19 +126,12 @@ export class DashNav extends PureComponent<Props> {
<
div
className=
"navbar-buttons navbar-buttons--actions"
>
{
canEdit
&&
(
<
button
className=
"btn navbar-button navbar-button--add-panel"
title=
"Add panel"
onClick=
{
this
.
onAddPanel
}
>
<
i
className=
"gicon gicon-add-panel"
/>
</
button
>
)
}
{
showSettings
&&
(
<
button
className=
"btn navbar-button navbar-button--settings"
onClick=
{
this
.
onOpenSettings
}
title=
"Dashboard Settings"
>
<
i
className=
"fa fa-cog"
/>
</
button
>
<
DashNavButton
tooltip=
"Add panel"
classSuffix=
"add-panel"
icon=
"gicon gicon-add-panel"
onClick=
{
this
.
onAddPanel
}
/>
)
}
{
canStar
&&
(
...
...
@@ -171,6 +174,16 @@ export class DashNav extends PureComponent<Props> {
<
i
className=
"fa fa-link"
/>
</
a
>
)
}
{
showSettings
&&
(
<
button
className=
"btn navbar-button navbar-button--settings"
onClick=
{
this
.
onOpenSettings
}
title=
"Dashboard Settings"
>
<
i
className=
"fa fa-cog"
/>
</
button
>
)
}
</
div
>
<
div
className=
"navbar-buttons navbar-buttons--tv"
>
...
...
public/app/features/dashboard/components/DashNav/DashNavButton.tsx
0 → 100644
View file @
d7151e5c
// Libraries
import
React
,
{
FunctionComponent
}
from
'react'
;
// Components
import
{
Tooltip
}
from
'@grafana/ui'
;
interface
Props
{
icon
:
string
;
tooltip
:
string
;
classSuffix
:
string
;
onClick
:
()
=>
void
;
}
export
const
DashNavButton
:
FunctionComponent
<
Props
>
=
({
icon
,
tooltip
,
classSuffix
,
onClick
})
=>
{
return
(
<
Tooltip
content=
{
tooltip
}
placement=
"bottom"
>
<
button
className=
{
`btn navbar-button navbar-button--${classSuffix}`
}
onClick=
{
onClick
}
>
<
i
className=
{
icon
}
/>
</
button
>
</
Tooltip
>
);
};
public/app/features/dashboard/state/initDashboard.ts
View file @
d7151e5c
...
...
@@ -33,7 +33,7 @@ async function redirectToNewUrl(slug: string, dispatch: any) {
export
function
initDashboard
({
$injector
,
$scope
,
urlUid
,
urlSlug
,
urlType
}:
InitDashboardArgs
):
ThunkResult
<
void
>
{
return
async
dispatch
=>
{
// handle old urls with no uid
if
(
!
urlUid
&&
urlSlug
)
{
if
(
!
urlUid
&&
urlSlug
&&
!
urlType
)
{
redirectToNewUrl
(
urlSlug
,
dispatch
);
return
;
}
...
...
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