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
c58f818e
Unverified
Commit
c58f818e
authored
Dec 09, 2018
by
Torkel Ödegaard
Committed by
GitHub
Dec 09, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14411 from grafana/davkal/fix-14362
Explore: dont pass all rows to all rows, fixes profiler
parents
e5c547c5
61924e91
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
14 deletions
+19
-14
public/app/features/explore/LogLabels.tsx
+9
-8
public/app/features/explore/Logs.tsx
+10
-6
No files found.
public/app/features/explore/LogLabels.tsx
View file @
c58f818e
...
@@ -69,7 +69,7 @@ export class Stats extends PureComponent<{
...
@@ -69,7 +69,7 @@ export class Stats extends PureComponent<{
class
Label
extends
PureComponent
<
class
Label
extends
PureComponent
<
{
{
allRows
?:
LogRow
[];
getRows
?:
()
=>
LogRow
[];
label
:
string
;
label
:
string
;
plain
?:
boolean
;
plain
?:
boolean
;
value
:
string
;
value
:
string
;
...
@@ -98,13 +98,14 @@ class Label extends PureComponent<
...
@@ -98,13 +98,14 @@ class Label extends PureComponent<
if
(
state
.
showStats
)
{
if
(
state
.
showStats
)
{
return
{
showStats
:
false
,
stats
:
null
};
return
{
showStats
:
false
,
stats
:
null
};
}
}
const
stats
=
calculateLogsLabelStats
(
this
.
props
.
allRows
,
this
.
props
.
label
);
const
allRows
=
this
.
props
.
getRows
();
const
stats
=
calculateLogsLabelStats
(
allRows
,
this
.
props
.
label
);
return
{
showStats
:
true
,
stats
};
return
{
showStats
:
true
,
stats
};
});
});
};
};
render
()
{
render
()
{
const
{
all
Rows
,
label
,
plain
,
value
}
=
this
.
props
;
const
{
get
Rows
,
label
,
plain
,
value
}
=
this
.
props
;
const
{
showStats
,
stats
}
=
this
.
state
;
const
{
showStats
,
stats
}
=
this
.
state
;
const
tooltip
=
`
${
label
}
:
${
value
}
`
;
const
tooltip
=
`
${
label
}
:
${
value
}
`
;
return
(
return
(
...
@@ -115,12 +116,12 @@ class Label extends PureComponent<
...
@@ -115,12 +116,12 @@ class Label extends PureComponent<
{
!
plain
&&
(
{
!
plain
&&
(
<
span
title=
"Filter for label"
onClick=
{
this
.
onClickLabel
}
className=
"logs-label__icon fa fa-search-plus"
/>
<
span
title=
"Filter for label"
onClick=
{
this
.
onClickLabel
}
className=
"logs-label__icon fa fa-search-plus"
/>
)
}
)
}
{
!
plain
&&
all
Rows
&&
<
span
onClick=
{
this
.
onClickStats
}
className=
"logs-label__icon fa fa-signal"
/>
}
{
!
plain
&&
get
Rows
&&
<
span
onClick=
{
this
.
onClickStats
}
className=
"logs-label__icon fa fa-signal"
/>
}
{
showStats
&&
(
{
showStats
&&
(
<
span
className=
"logs-label__stats"
>
<
span
className=
"logs-label__stats"
>
<
Stats
<
Stats
stats=
{
stats
}
stats=
{
stats
}
rowCount=
{
allRows
.
length
}
rowCount=
{
getRows
()
.
length
}
label=
{
label
}
label=
{
label
}
value=
{
value
}
value=
{
value
}
onClickClose=
{
this
.
onClickClose
}
onClickClose=
{
this
.
onClickClose
}
...
@@ -133,15 +134,15 @@ class Label extends PureComponent<
...
@@ -133,15 +134,15 @@ class Label extends PureComponent<
}
}
export
default
class
LogLabels
extends
PureComponent
<
{
export
default
class
LogLabels
extends
PureComponent
<
{
allRows
?:
LogRow
[];
getRows
?:
()
=>
LogRow
[];
labels
:
LogsStreamLabels
;
labels
:
LogsStreamLabels
;
plain
?:
boolean
;
plain
?:
boolean
;
onClickLabel
?:
(
label
:
string
,
value
:
string
)
=>
void
;
onClickLabel
?:
(
label
:
string
,
value
:
string
)
=>
void
;
}
>
{
}
>
{
render
()
{
render
()
{
const
{
all
Rows
,
labels
,
onClickLabel
,
plain
}
=
this
.
props
;
const
{
get
Rows
,
labels
,
onClickLabel
,
plain
}
=
this
.
props
;
return
Object
.
keys
(
labels
).
map
(
key
=>
(
return
Object
.
keys
(
labels
).
map
(
key
=>
(
<
Label
key=
{
key
}
allRows=
{
all
Rows
}
label=
{
key
}
value=
{
labels
[
key
]
}
plain=
{
plain
}
onClickLabel=
{
onClickLabel
}
/>
<
Label
key=
{
key
}
getRows=
{
get
Rows
}
label=
{
key
}
value=
{
labels
[
key
]
}
plain=
{
plain
}
onClickLabel=
{
onClickLabel
}
/>
));
));
}
}
}
}
public/app/features/explore/Logs.tsx
View file @
c58f818e
...
@@ -56,13 +56,13 @@ const FieldHighlight = onClick => props => {
...
@@ -56,13 +56,13 @@ const FieldHighlight = onClick => props => {
};
};
interface
RowProps
{
interface
RowProps
{
allRows
:
LogRow
[];
highlighterExpressions
?:
string
[];
highlighterExpressions
?:
string
[];
row
:
LogRow
;
row
:
LogRow
;
showDuplicates
:
boolean
;
showDuplicates
:
boolean
;
showLabels
:
boolean
|
null
;
// Tristate: null means auto
showLabels
:
boolean
|
null
;
// Tristate: null means auto
showLocalTime
:
boolean
;
showLocalTime
:
boolean
;
showUtc
:
boolean
;
showUtc
:
boolean
;
getRows
:
()
=>
LogRow
[];
onClickLabel
?:
(
label
:
string
,
value
:
string
)
=>
void
;
onClickLabel
?:
(
label
:
string
,
value
:
string
)
=>
void
;
}
}
...
@@ -107,11 +107,12 @@ class Row extends PureComponent<RowProps, RowState> {
...
@@ -107,11 +107,12 @@ class Row extends PureComponent<RowProps, RowState> {
};
};
onClickHighlight
=
(
fieldText
:
string
)
=>
{
onClickHighlight
=
(
fieldText
:
string
)
=>
{
const
{
all
Rows
}
=
this
.
props
;
const
{
get
Rows
}
=
this
.
props
;
const
{
parser
}
=
this
.
state
;
const
{
parser
}
=
this
.
state
;
const
fieldMatch
=
fieldText
.
match
(
parser
.
fieldRegex
);
const
fieldMatch
=
fieldText
.
match
(
parser
.
fieldRegex
);
if
(
fieldMatch
)
{
if
(
fieldMatch
)
{
const
allRows
=
getRows
();
// Build value-agnostic row matcher based on the field label
// Build value-agnostic row matcher based on the field label
const
fieldLabel
=
fieldMatch
[
1
];
const
fieldLabel
=
fieldMatch
[
1
];
const
fieldValue
=
fieldMatch
[
2
];
const
fieldValue
=
fieldMatch
[
2
];
...
@@ -151,7 +152,7 @@ class Row extends PureComponent<RowProps, RowState> {
...
@@ -151,7 +152,7 @@ class Row extends PureComponent<RowProps, RowState> {
render
()
{
render
()
{
const
{
const
{
all
Rows
,
get
Rows
,
highlighterExpressions
,
highlighterExpressions
,
onClickLabel
,
onClickLabel
,
row
,
row
,
...
@@ -193,7 +194,7 @@ class Row extends PureComponent<RowProps, RowState> {
...
@@ -193,7 +194,7 @@ class Row extends PureComponent<RowProps, RowState> {
)
}
)
}
{
showLabels
&&
(
{
showLabels
&&
(
<
div
className=
"logs-row__labels"
>
<
div
className=
"logs-row__labels"
>
<
LogLabels
allRows=
{
all
Rows
}
labels=
{
row
.
uniqueLabels
}
onClickLabel=
{
onClickLabel
}
/>
<
LogLabels
getRows=
{
get
Rows
}
labels=
{
row
.
uniqueLabels
}
onClickLabel=
{
onClickLabel
}
/>
</
div
>
</
div
>
)
}
)
}
<
div
className=
"logs-row__message"
onMouseEnter=
{
this
.
onMouseOverMessage
}
onMouseLeave=
{
this
.
onMouseOutMessage
}
>
<
div
className=
"logs-row__message"
onMouseEnter=
{
this
.
onMouseOverMessage
}
onMouseLeave=
{
this
.
onMouseOutMessage
}
>
...
@@ -416,6 +417,9 @@ export default class Logs extends PureComponent<LogsProps, LogsState> {
...
@@ -416,6 +417,9 @@ export default class Logs extends PureComponent<LogsProps, LogsState> {
const
scanText
=
scanRange
?
`Scanning
${
rangeUtil
.
describeTimeRange
(
scanRange
)}
`
:
'Scanning...'
;
const
scanText
=
scanRange
?
`Scanning
${
rangeUtil
.
describeTimeRange
(
scanRange
)}
`
:
'Scanning...'
;
// React profiler becomes unusable if we pass all rows to all rows and their labels, using getter instead
const
getRows
=
()
=>
processedRows
;
return
(
return
(
<
div
className=
"logs-panel"
>
<
div
className=
"logs-panel"
>
<
div
className=
"logs-panel-graph"
>
<
div
className=
"logs-panel-graph"
>
...
@@ -473,7 +477,7 @@ export default class Logs extends PureComponent<LogsProps, LogsState> {
...
@@ -473,7 +477,7 @@ export default class Logs extends PureComponent<LogsProps, LogsState> {
firstRows
.
map
(
row
=>
(
firstRows
.
map
(
row
=>
(
<
Row
<
Row
key=
{
row
.
key
+
row
.
duplicates
}
key=
{
row
.
key
+
row
.
duplicates
}
allRows=
{
processed
Rows
}
getRows=
{
get
Rows
}
highlighterExpressions=
{
highlighterExpressions
}
highlighterExpressions=
{
highlighterExpressions
}
row=
{
row
}
row=
{
row
}
showDuplicates=
{
showDuplicates
}
showDuplicates=
{
showDuplicates
}
...
@@ -489,7 +493,7 @@ export default class Logs extends PureComponent<LogsProps, LogsState> {
...
@@ -489,7 +493,7 @@ export default class Logs extends PureComponent<LogsProps, LogsState> {
lastRows
.
map
(
row
=>
(
lastRows
.
map
(
row
=>
(
<
Row
<
Row
key=
{
row
.
key
+
row
.
duplicates
}
key=
{
row
.
key
+
row
.
duplicates
}
allRows=
{
processed
Rows
}
getRows=
{
get
Rows
}
row=
{
row
}
row=
{
row
}
showDuplicates=
{
showDuplicates
}
showDuplicates=
{
showDuplicates
}
showLabels=
{
showLabels
}
showLabels=
{
showLabels
}
...
...
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