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
a03900e6
Commit
a03900e6
authored
Nov 27, 2018
by
Johannes Schill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
react-panel: Remove comments and improve readability in render()
parent
3908e64e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
30 deletions
+19
-30
public/app/features/dashboard/dashgrid/QueryInspector.tsx
+19
-30
No files found.
public/app/features/dashboard/dashgrid/QueryInspector.tsx
View file @
a03900e6
...
...
@@ -74,19 +74,12 @@ export class QueryInspector extends PureComponent<Props, State> {
};
onDataSourceResponse
=
(
response
:
any
=
{})
=>
{
// ignore if closed
// if (!this.isOpen) {
// return;
// }
if
(
this
.
state
.
isMocking
)
{
this
.
handleMocking
(
response
);
return
;
}
// this.isLoading = false;
// data = _.cloneDeep(data);
response
=
{
...
response
};
// clone
response
=
{
...
response
};
// clone - dont modify the response
if
(
response
.
headers
)
{
delete
response
.
headers
;
...
...
@@ -109,15 +102,6 @@ export class QueryInspector extends PureComponent<Props, State> {
if
(
response
.
data
)
{
response
.
response
=
response
.
data
;
// if (response.status === 200) {
// // if we are in error state, assume we automatically opened
// // and auto close it again
// if (this.hasError) {
// this.hasError = false;
// this.isOpen = false;
// }
// }
delete
response
.
data
;
delete
response
.
status
;
delete
response
.
statusText
;
...
...
@@ -175,10 +159,26 @@ export class QueryInspector extends PureComponent<Props, State> {
}));
};
renderExpandCollapse
=
()
=>
{
const
{
allNodesExpanded
}
=
this
.
state
;
const
collapse
=
(
<>
<
i
className=
"fa fa-minus-square-o"
/>
Collapse All
</>
);
const
expand
=
(
<>
<
i
className=
"fa fa-plus-square-o"
/>
Expand All
</>
);
return
allNodesExpanded
?
collapse
:
expand
;
};
render
()
{
const
{
response
,
isLoading
}
=
this
.
state
.
dsQuery
;
const
{
LoadingPlaceholder
}
=
this
.
props
;
const
{
allNodesExpanded
,
isMocking
}
=
this
.
state
;
const
{
isMocking
}
=
this
.
state
;
const
openNodes
=
this
.
getNrOfOpenNodes
();
if
(
isLoading
)
{
...
...
@@ -187,23 +187,12 @@ export class QueryInspector extends PureComponent<Props, State> {
return
(
<>
{
/* <div className="query-troubleshooter__header">
<a className="pointer" ng-click="ctrl.toggleMocking()">Mock Response</a>
*/
}
<
div
>
<
button
className=
"btn btn-transparent btn-p-x-0 m-r-1"
onClick=
{
this
.
onToggleMocking
}
>
Mock response
</
button
>
<
button
className=
"btn btn-transparent btn-p-x-0 m-r-1"
onClick=
{
this
.
onToggleExpand
}
>
{
allNodesExpanded
?
(
<>
<
i
className=
"fa fa-minus-square-o"
/>
Collapse All
</>
)
:
(
<>
<
i
className=
"fa fa-plus-square-o"
/>
Expand All
</>
)
}
{
this
.
renderExpandCollapse
()
}
</
button
>
<
CopyToClipboard
...
...
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