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
ae0b027d
Commit
ae0b027d
authored
Feb 05, 2019
by
Johannes Schill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: Replace sizeMe with AutoSizer in DashboardGrid
parent
310ee567
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
public/app/features/dashboard/dashgrid/DashboardGrid.tsx
+18
-6
No files found.
public/app/features/dashboard/dashgrid/DashboardGrid.tsx
View file @
ae0b027d
...
@@ -5,13 +5,12 @@ import { GRID_CELL_HEIGHT, GRID_CELL_VMARGIN, GRID_COLUMN_COUNT } from 'app/core
...
@@ -5,13 +5,12 @@ import { GRID_CELL_HEIGHT, GRID_CELL_VMARGIN, GRID_COLUMN_COUNT } from 'app/core
import
{
DashboardPanel
}
from
'./DashboardPanel'
;
import
{
DashboardPanel
}
from
'./DashboardPanel'
;
import
{
DashboardModel
,
PanelModel
}
from
'../state'
;
import
{
DashboardModel
,
PanelModel
}
from
'../state'
;
import
classNames
from
'classnames'
;
import
classNames
from
'classnames'
;
import
sizeMe
from
'react-sizeme
'
;
import
{
AutoSizer
}
from
'react-virtualized
'
;
let
lastGridWidth
=
1200
;
let
lastGridWidth
=
1200
;
let
ignoreNextWidthChange
=
false
;
let
ignoreNextWidthChange
=
false
;
interface
GridWrapperProps
{
interface
SizedReactLayoutGridProps
{
size
:
{
width
:
number
;
};
layout
:
ReactGridLayout
.
Layout
[];
layout
:
ReactGridLayout
.
Layout
[];
onLayoutChange
:
(
layout
:
ReactGridLayout
.
Layout
[])
=>
void
;
onLayoutChange
:
(
layout
:
ReactGridLayout
.
Layout
[])
=>
void
;
children
:
JSX
.
Element
|
JSX
.
Element
[];
children
:
JSX
.
Element
|
JSX
.
Element
[];
...
@@ -25,8 +24,12 @@ interface GridWrapperProps {
...
@@ -25,8 +24,12 @@ interface GridWrapperProps {
isFullscreen
?:
boolean
;
isFullscreen
?:
boolean
;
}
}
interface
GridWrapperProps
extends
SizedReactLayoutGridProps
{
sizedWidth
:
number
;
}
function
GridWrapper
({
function
GridWrapper
({
size
,
size
dWidth
,
layout
,
layout
,
onLayoutChange
,
onLayoutChange
,
children
,
children
,
...
@@ -39,7 +42,7 @@ function GridWrapper({
...
@@ -39,7 +42,7 @@ function GridWrapper({
isDraggable
,
isDraggable
,
isFullscreen
,
isFullscreen
,
}:
GridWrapperProps
)
{
}:
GridWrapperProps
)
{
const
width
=
size
.
width
>
0
?
size
.
w
idth
:
lastGridWidth
;
const
width
=
size
dWidth
>
0
?
sizedW
idth
:
lastGridWidth
;
// logic to ignore width changes (optimization)
// logic to ignore width changes (optimization)
if
(
width
!==
lastGridWidth
)
{
if
(
width
!==
lastGridWidth
)
{
...
@@ -74,7 +77,16 @@ function GridWrapper({
...
@@ -74,7 +77,16 @@ function GridWrapper({
);
);
}
}
const
SizedReactLayoutGrid
=
sizeMe
({
monitorWidth
:
true
})(
GridWrapper
);
const
SizedReactLayoutGrid
=
(
props
:
SizedReactLayoutGridProps
)
=>
(
<
AutoSizer
disableHeight
>
{
({
width
})
=>
(
<
GridWrapper
sizedWidth=
{
width
}
{
...
props
}
/>
)
}
</
AutoSizer
>
);
export
interface
DashboardGridProps
{
export
interface
DashboardGridProps
{
dashboard
:
DashboardModel
;
dashboard
:
DashboardModel
;
...
...
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