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
4ca39670
Unverified
Commit
4ca39670
authored
Feb 17, 2020
by
Torkel Ödegaard
Committed by
GitHub
Feb 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Chore: Fixed strict null errors (#22238)
parent
f1ecaa5d
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
30 additions
and
41 deletions
+30
-41
public/app/features/dashboard/containers/DashboardPage.test.tsx
+2
-2
public/app/features/dashboard/containers/SoloPanelPage.tsx
+1
-1
public/app/features/dashboard/dashgrid/DashboardGrid.test.tsx
+2
-2
public/app/features/dashboard/dashgrid/DashboardGrid.tsx
+5
-12
public/app/features/dashboard/dashgrid/DashboardPanel.tsx
+3
-3
public/app/features/dashboard/dashgrid/PanelChrome.tsx
+7
-11
public/app/features/dashboard/dashgrid/PanelChromeAngular.tsx
+3
-4
public/app/features/dashboard/dashgrid/PanelHeader/PanelHeader.tsx
+1
-1
public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderCorner.tsx
+3
-2
public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderMenuItem.tsx
+1
-1
public/app/features/templating/template_srv.ts
+1
-1
scripts/ci-frontend-metrics.sh
+1
-1
No files found.
public/app/features/dashboard/containers/DashboardPage.test.tsx
View file @
4ca39670
...
...
@@ -273,7 +273,7 @@ describe('DashboardPage', () => {
},
panelEditorNew
:
{},
dashboard
:
{
getModel
:
()
=>
null
as
DashboardModel
,
getModel
:
()
=>
({}
as
DashboardModel
)
,
},
}
as
any
);
...
...
@@ -292,7 +292,7 @@ describe('DashboardPage', () => {
},
panelEditorNew
:
{},
dashboard
:
{
getModel
:
()
=>
null
as
DashboardModel
,
getModel
:
()
=>
({}
as
DashboardModel
)
,
},
}
as
any
);
...
...
public/app/features/dashboard/containers/SoloPanelPage.tsx
View file @
4ca39670
...
...
@@ -83,7 +83,7 @@ export class SoloPanelPage extends Component<Props, State> {
return
<
div
className=
"alert alert-error"
>
Panel with id
{
urlPanelId
}
not found
</
div
>;
}
if
(
!
panel
)
{
if
(
!
panel
||
!
dashboard
)
{
return
<
div
>
Loading
&
initializing dashboard
</
div
>;
}
...
...
public/app/features/dashboard/dashgrid/DashboardGrid.test.tsx
View file @
4ca39670
...
...
@@ -6,7 +6,7 @@ import { DashboardModel } from '../state';
interface
ScenarioContext
{
props
:
Props
;
wrapper
?:
ShallowWrapper
<
Props
,
any
,
DashboardGrid
>
;
setup
?
:
(
fn
:
()
=>
void
)
=>
void
;
setup
:
(
fn
:
()
=>
void
)
=>
void
;
setProps
:
(
props
:
Partial
<
Props
>
)
=>
void
;
}
...
...
@@ -59,7 +59,7 @@ function dashboardGridScenario(description: string, scenarioFn: (ctx: ScenarioCo
props
:
{
isEditing
:
false
,
isFullscreen
:
false
,
scrollTop
:
null
,
scrollTop
:
0
,
dashboard
:
getTestDashboard
(),
},
setProps
:
(
props
:
Partial
<
Props
>
)
=>
{
...
...
public/app/features/dashboard/dashgrid/DashboardGrid.tsx
View file @
4ca39670
...
...
@@ -162,7 +162,7 @@ export class DashboardGrid extends PureComponent<Props> {
onLayoutChange
=
(
newLayout
:
ReactGridLayout
.
Layout
[])
=>
{
for
(
const
newPos
of
newLayout
)
{
this
.
panelMap
[
newPos
.
i
].
updateGridPos
(
newPos
);
this
.
panelMap
[
newPos
.
i
!
].
updateGridPos
(
newPos
);
}
this
.
props
.
dashboard
.
sortPanelsByGridPos
();
...
...
@@ -186,7 +186,7 @@ export class DashboardGrid extends PureComponent<Props> {
};
updateGridPos
=
(
item
:
ReactGridLayout
.
Layout
,
layout
:
ReactGridLayout
.
Layout
[])
=>
{
this
.
panelMap
[
item
.
i
].
updateGridPos
(
item
);
this
.
panelMap
[
item
.
i
!
].
updateGridPos
(
item
);
// react-grid-layout has a bug (#670), and onLayoutChange() is only called when the component is mounted.
// So it's required to call it explicitly when panel resized or moved to save layout changes.
...
...
@@ -194,12 +194,12 @@ export class DashboardGrid extends PureComponent<Props> {
};
onResize
:
ItemCallback
=
(
layout
,
oldItem
,
newItem
)
=>
{
this
.
panelMap
[
newItem
.
i
].
updateGridPos
(
newItem
);
this
.
panelMap
[
newItem
.
i
!
].
updateGridPos
(
newItem
);
};
onResizeStop
:
ItemCallback
=
(
layout
,
oldItem
,
newItem
)
=>
{
this
.
updateGridPos
(
newItem
,
layout
);
this
.
panelMap
[
newItem
.
i
].
resizeDone
();
this
.
panelMap
[
newItem
.
i
!
].
resizeDone
();
};
onDragStop
:
ItemCallback
=
(
layout
,
oldItem
,
newItem
)
=>
{
...
...
@@ -253,14 +253,7 @@ export class DashboardGrid extends PureComponent<Props> {
panel
.
isInView
=
this
.
isInView
(
panel
);
panelElements
.
push
(
<
div
key=
{
id
}
className=
{
panelClasses
}
id=
{
'panel-'
+
id
}
ref=
{
elem
=>
{
this
.
panelRef
[
id
]
=
elem
;
}
}
>
<
div
key=
{
id
}
className=
{
panelClasses
}
id=
{
'panel-'
+
id
}
ref=
{
elem
=>
elem
&&
(
this
.
panelRef
[
id
]
=
elem
)
}
>
{
this
.
renderPanel
(
panel
)
}
</
div
>
);
...
...
public/app/features/dashboard/dashgrid/DashboardPanel.tsx
View file @
4ca39670
...
...
@@ -71,8 +71,8 @@ export class DashboardPanelUnconnected extends PureComponent<Props, State> {
this
.
props
.
dashboard
.
setPanelFocus
(
0
);
};
renderPanel
()
{
const
{
dashboard
,
panel
,
isFullscreen
,
isInView
,
isInEditMode
,
plugin
}
=
this
.
props
;
renderPanel
(
plugin
:
PanelPlugin
)
{
const
{
dashboard
,
panel
,
isFullscreen
,
isInView
,
isInEditMode
}
=
this
.
props
;
return
(
<
AutoSizer
>
...
...
@@ -149,7 +149,7 @@ export class DashboardPanelUnconnected extends PureComponent<Props, State> {
onMouseLeave=
{
this
.
onMouseLeave
}
style=
{
styles
}
>
{
this
.
renderPanel
()
}
{
this
.
renderPanel
(
plugin
)
}
</
div
>
)
}
/>
...
...
public/app/features/dashboard/dashgrid/PanelChrome.tsx
View file @
4ca39670
...
...
@@ -43,7 +43,7 @@ export interface Props {
export
interface
State
{
isFirstLoad
:
boolean
;
renderCounter
:
number
;
errorMessage
:
string
|
null
;
errorMessage
?:
string
;
refreshWhenInView
:
boolean
;
// Current state of all events
...
...
@@ -56,10 +56,10 @@ export class PanelChrome extends PureComponent<Props, State> {
constructor
(
props
:
Props
)
{
super
(
props
);
this
.
state
=
{
isFirstLoad
:
true
,
renderCounter
:
0
,
errorMessage
:
null
,
refreshWhenInView
:
false
,
data
:
{
state
:
LoadingState
.
NotStarted
,
...
...
@@ -107,7 +107,6 @@ export class PanelChrome extends PureComponent<Props, State> {
if
(
this
.
querySubscription
)
{
this
.
querySubscription
.
unsubscribe
();
this
.
querySubscription
=
null
;
}
}
...
...
@@ -121,9 +120,6 @@ export class PanelChrome extends PureComponent<Props, State> {
if
(
this
.
state
.
refreshWhenInView
)
{
this
.
onRefresh
();
}
}
else
if
(
this
.
querySubscription
)
{
this
.
querySubscription
.
unsubscribe
();
this
.
querySubscription
=
null
;
}
}
}
...
...
@@ -139,7 +135,7 @@ export class PanelChrome extends PureComponent<Props, State> {
}
let
{
isFirstLoad
}
=
this
.
state
;
let
errorMessage
:
string
|
null
=
null
;
let
errorMessage
:
string
|
undefined
;
switch
(
data
.
state
)
{
case
LoadingState
.
Loading
:
...
...
@@ -258,7 +254,7 @@ export class PanelChrome extends PureComponent<Props, State> {
});
};
renderPanel
(
width
:
number
,
height
:
number
)
:
JSX
.
Element
{
renderPanel
(
width
:
number
,
height
:
number
)
{
const
{
panel
,
plugin
}
=
this
.
props
;
const
{
renderCounter
,
data
,
isFirstLoad
}
=
this
.
state
;
const
{
theme
}
=
config
;
...
...
@@ -344,7 +340,7 @@ export class PanelChrome extends PureComponent<Props, State> {
<
PanelHeader
panel=
{
panel
}
dashboard=
{
dashboard
}
timeInfo=
{
data
.
request
?
data
.
request
.
timeInfo
:
null
}
timeInfo=
{
data
.
request
?
data
.
request
.
timeInfo
:
undefined
}
title=
{
panel
.
title
}
description=
{
panel
.
description
}
scopedVars=
{
panel
.
scopedVars
}
...
...
@@ -354,8 +350,8 @@ export class PanelChrome extends PureComponent<Props, State> {
isLoading=
{
data
.
state
===
LoadingState
.
Loading
}
/>
<
ErrorBoundary
>
{
({
error
,
errorInfo
})
=>
{
if
(
error
Info
)
{
{
({
error
})
=>
{
if
(
error
)
{
this
.
onPanelError
(
error
.
message
||
DEFAULT_PLUGIN_ERROR
);
return
null
;
}
...
...
public/app/features/dashboard/dashgrid/PanelChromeAngular.tsx
View file @
4ca39670
...
...
@@ -37,7 +37,7 @@ interface AngularScopeProps {
}
export
class
PanelChromeAngular
extends
PureComponent
<
Props
,
State
>
{
element
?:
HTMLElement
;
element
:
HTMLElement
|
null
=
null
;
timeSrv
:
TimeSrv
=
getTimeSrv
();
scopeProps
?:
AngularScopeProps
;
querySubscription
:
Unsubscribable
;
...
...
@@ -85,7 +85,7 @@ export class PanelChromeAngular extends PureComponent<Props, State> {
};
onPanelDataUpdate
(
data
:
PanelData
)
{
let
errorMessage
:
string
|
null
=
null
;
let
errorMessage
:
string
|
undefined
;
if
(
data
.
state
===
LoadingState
.
Error
)
{
const
{
error
}
=
data
;
...
...
@@ -104,7 +104,6 @@ export class PanelChromeAngular extends PureComponent<Props, State> {
if
(
this
.
querySubscription
)
{
this
.
querySubscription
.
unsubscribe
();
this
.
querySubscription
=
null
;
}
this
.
props
.
panel
.
events
.
off
(
PanelEvents
.
render
,
this
.
onPanelRenderEvent
);
...
...
@@ -192,7 +191,7 @@ export class PanelChromeAngular extends PureComponent<Props, State> {
<
PanelHeader
panel=
{
panel
}
dashboard=
{
dashboard
}
timeInfo=
{
data
.
request
?
data
.
request
.
timeInfo
:
null
}
timeInfo=
{
data
.
request
?
data
.
request
.
timeInfo
:
undefined
}
title=
{
panel
.
title
}
description=
{
panel
.
description
}
scopedVars=
{
panel
.
scopedVars
}
...
...
public/app/features/dashboard/dashgrid/PanelHeader/PanelHeader.tsx
View file @
4ca39670
...
...
@@ -17,7 +17,7 @@ import { getPanelMenu } from 'app/features/dashboard/utils/getPanelMenu';
export
interface
Props
{
panel
:
PanelModel
;
dashboard
:
DashboardModel
;
timeInfo
:
string
;
timeInfo
?
:
string
;
title
?:
string
;
description
?:
string
;
scopedVars
?:
ScopedVars
;
...
...
public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderCorner.tsx
View file @
4ca39670
...
...
@@ -90,14 +90,15 @@ export class PanelHeaderCorner extends Component<Props> {
}
render
()
{
const
{
error
}
=
this
.
props
;
const
infoMode
:
InfoMode
|
undefined
=
this
.
getInfoMode
();
if
(
!
infoMode
)
{
return
null
;
}
if
(
infoMode
===
InfoMode
.
Error
)
{
return
this
.
renderCornerType
(
infoMode
,
this
.
props
.
error
,
this
.
onClickError
);
if
(
infoMode
===
InfoMode
.
Error
&&
error
)
{
return
this
.
renderCornerType
(
infoMode
,
error
,
this
.
onClickError
);
}
if
(
infoMode
===
InfoMode
.
Info
||
infoMode
===
InfoMode
.
Links
)
{
...
...
public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderMenuItem.tsx
View file @
4ca39670
...
...
@@ -12,7 +12,7 @@ export const PanelHeaderMenuItem: FC<Props & PanelMenuItem> = props => {
return
isDivider
?
(
<
li
className=
"divider"
/>
)
:
(
<
li
className=
{
isSubMenu
?
'dropdown-submenu'
:
null
}
>
<
li
className=
{
isSubMenu
?
'dropdown-submenu'
:
undefined
}
>
<
a
onClick=
{
props
.
onClick
}
href=
{
props
.
href
}
>
{
props
.
iconClassName
&&
<
i
className=
{
props
.
iconClassName
}
/>
}
<
span
...
...
public/app/features/templating/template_srv.ts
View file @
4ca39670
...
...
@@ -322,7 +322,7 @@ export class TemplateSrv {
return
value
===
'$__all'
||
(
Array
.
isArray
(
value
)
&&
value
[
0
]
===
'$__all'
);
}
replaceWithText
(
target
:
string
,
scopedVars
:
ScopedVars
)
{
replaceWithText
(
target
:
string
,
scopedVars
?
:
ScopedVars
)
{
if
(
!
target
)
{
return
target
;
}
...
...
scripts/ci-frontend-metrics.sh
View file @
4ca39670
...
...
@@ -3,7 +3,7 @@
echo
-e
"Collecting code stats (typescript errors & more)"
ERROR_COUNT_LIMIT
=
1005
ERROR_COUNT_LIMIT
=
958
DIRECTIVES_LIMIT
=
172
CONTROLLERS_LIMIT
=
139
...
...
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