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
06d8243a
Commit
06d8243a
authored
Jan 14, 2019
by
Johannes Schill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Possibility to change document title on pages using the Page component
parent
8237c22e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
public/app/core/components/Page/Page.tsx
+18
-6
No files found.
public/app/core/components/Page/Page.tsx
View file @
06d8243a
...
...
@@ -7,7 +7,7 @@ import PageContents from './PageContents';
import
{
CustomScrollbar
}
from
'@grafana/ui'
;
interface
Props
{
title
:
string
;
title
?
:
string
;
children
:
JSX
.
Element
[]
|
JSX
.
Element
;
}
...
...
@@ -23,12 +23,24 @@ class Page extends Component<Props> {
componentDidMount
()
{
this
.
body
.
classList
.
add
(
this
.
bodyClass
);
this
.
copyFooter
();
this
.
updateTitle
();
}
componentDidUpdate
(
prevProps
:
Props
)
{
if
(
prevProps
.
title
!==
this
.
props
.
title
)
{
this
.
updateTitle
();
}
}
componentWillUnmount
()
{
this
.
body
.
classList
.
remove
(
this
.
bodyClass
);
}
updateTitle
=
()
=>
{
const
{
title
}
=
this
.
props
;
document
.
title
=
title
?
title
+
' - Grafana'
:
'Grafana'
;
}
copyFooter
=
()
=>
{
const
c
=
this
.
scrollbarElementRef
.
current
;
c
.
append
(
this
.
footer
);
...
...
@@ -37,11 +49,11 @@ class Page extends Component<Props> {
render
()
{
return
(
<
div
className=
"page-scrollbar-wrapper"
>
<
CustomScrollbar
autoHeightMin=
{
'100%'
}
>
<
div
className=
"page-scrollbar-content"
ref=
{
this
.
scrollbarElementRef
}
>
{
this
.
props
.
children
}
</
div
>
</
CustomScrollbar
>
<
CustomScrollbar
autoHeightMin=
{
'100%'
}
>
<
div
className=
"page-scrollbar-content"
ref=
{
this
.
scrollbarElementRef
}
>
{
this
.
props
.
children
}
</
div
>
</
CustomScrollbar
>
</
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