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
import
{
DashboardPanel
}
from
'./DashboardPanel'
;
import
{
DashboardModel
,
PanelModel
}
from
'../state'
;
import
classNames
from
'classnames'
;
import
sizeMe
from
'react-sizeme
'
;
import
{
AutoSizer
}
from
'react-virtualized
'
;
let
lastGridWidth
=
1200
;
let
ignoreNextWidthChange
=
false
;
interface
GridWrapperProps
{
size
:
{
width
:
number
;
};
interface
SizedReactLayoutGridProps
{
layout
:
ReactGridLayout
.
Layout
[];
onLayoutChange
:
(
layout
:
ReactGridLayout
.
Layout
[])
=>
void
;
children
:
JSX
.
Element
|
JSX
.
Element
[];
...
...
@@ -25,8 +24,12 @@ interface GridWrapperProps {
isFullscreen
?:
boolean
;
}
interface
GridWrapperProps
extends
SizedReactLayoutGridProps
{
sizedWidth
:
number
;
}
function
GridWrapper
({
size
,
size
dWidth
,
layout
,
onLayoutChange
,
children
,
...
...
@@ -39,7 +42,7 @@ function GridWrapper({
isDraggable
,
isFullscreen
,
}:
GridWrapperProps
)
{
const
width
=
size
.
width
>
0
?
size
.
w
idth
:
lastGridWidth
;
const
width
=
size
dWidth
>
0
?
sizedW
idth
:
lastGridWidth
;
// logic to ignore width changes (optimization)
if
(
width
!==
lastGridWidth
)
{
...
...
@@ -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
{
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