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
0c855fb9
Unverified
Commit
0c855fb9
authored
Dec 04, 2018
by
Torkel Ödegaard
Committed by
GitHub
Dec 04, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14308 from grafana/davkal/explore-dedup-number
Explore: Display duplicate row count as number
parents
c4a89eb3
6980d2e1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
27 deletions
+25
-27
public/app/features/explore/Logs.tsx
+23
-10
public/sass/pages/_explore.scss
+2
-17
No files found.
public/app/features/explore/Logs.tsx
View file @
0c855fb9
...
@@ -40,13 +40,23 @@ interface RowProps {
...
@@ -40,13 +40,23 @@ interface RowProps {
allRows
:
LogRow
[];
allRows
:
LogRow
[];
highlighterExpressions
?:
string
[];
highlighterExpressions
?:
string
[];
row
:
LogRow
;
row
:
LogRow
;
showDuplicates
:
boolean
;
showLabels
:
boolean
|
null
;
// Tristate: null means auto
showLabels
:
boolean
|
null
;
// Tristate: null means auto
showLocalTime
:
boolean
;
showLocalTime
:
boolean
;
showUtc
:
boolean
;
showUtc
:
boolean
;
onClickLabel
?:
(
label
:
string
,
value
:
string
)
=>
void
;
onClickLabel
?:
(
label
:
string
,
value
:
string
)
=>
void
;
}
}
function
Row
({
allRows
,
highlighterExpressions
,
onClickLabel
,
row
,
showLabels
,
showLocalTime
,
showUtc
}:
RowProps
)
{
function
Row
({
allRows
,
highlighterExpressions
,
onClickLabel
,
row
,
showDuplicates
,
showLabels
,
showLocalTime
,
showUtc
,
}:
RowProps
)
{
const
previewHighlights
=
highlighterExpressions
&&
!
_
.
isEqual
(
highlighterExpressions
,
row
.
searchWords
);
const
previewHighlights
=
highlighterExpressions
&&
!
_
.
isEqual
(
highlighterExpressions
,
row
.
searchWords
);
const
highlights
=
previewHighlights
?
highlighterExpressions
:
row
.
searchWords
;
const
highlights
=
previewHighlights
?
highlighterExpressions
:
row
.
searchWords
;
const
needsHighlighter
=
highlights
&&
highlights
.
length
>
0
;
const
needsHighlighter
=
highlights
&&
highlights
.
length
>
0
;
...
@@ -55,15 +65,10 @@ function Row({ allRows, highlighterExpressions, onClickLabel, row, showLabels, s
...
@@ -55,15 +65,10 @@ function Row({ allRows, highlighterExpressions, onClickLabel, row, showLabels, s
});
});
return
(
return
(
<>
<>
<
div
className=
{
row
.
logLevel
?
`logs-row-level logs-row-level-${row.logLevel}`
:
''
}
>
{
showDuplicates
&&
(
{
row
.
duplicates
>
0
&&
(
<
div
className=
"logs-row-duplicates"
>
{
row
.
duplicates
>
0
?
`${row.duplicates + 1}x`
:
null
}
</
div
>
<
div
className=
"logs-row-level__duplicates"
title=
{
`${row.duplicates} duplicates`
}
>
{
Array
.
apply
(
null
,
{
length
:
row
.
duplicates
}).
map
((
bogus
,
index
)
=>
(
<
div
className=
"logs-row-level__duplicate"
key=
{
`${index}`
}
/>
))
}
</
div
>
)
}
)
}
<
/
div
>
<
div
className=
{
row
.
logLevel
?
`logs-row-level logs-row-level-${row.logLevel}`
:
''
}
/
>
{
showUtc
&&
(
{
showUtc
&&
(
<
div
className=
"logs-row-time"
title=
{
`Local: ${row.timeLocal} (${row.timeFromNow})`
}
>
<
div
className=
"logs-row-time"
title=
{
`Local: ${row.timeLocal} (${row.timeFromNow})`
}
>
{
row
.
timestamp
}
{
row
.
timestamp
}
...
@@ -228,6 +233,7 @@ export default class Logs extends PureComponent<LogsProps, LogsState> {
...
@@ -228,6 +233,7 @@ export default class Logs extends PureComponent<LogsProps, LogsState> {
const
{
dedup
,
deferLogs
,
hiddenLogLevels
,
renderAll
,
showLocalTime
,
showUtc
}
=
this
.
state
;
const
{
dedup
,
deferLogs
,
hiddenLogLevels
,
renderAll
,
showLocalTime
,
showUtc
}
=
this
.
state
;
let
{
showLabels
}
=
this
.
state
;
let
{
showLabels
}
=
this
.
state
;
const
hasData
=
data
&&
data
.
rows
&&
data
.
rows
.
length
>
0
;
const
hasData
=
data
&&
data
.
rows
&&
data
.
rows
.
length
>
0
;
const
showDuplicates
=
dedup
!==
LogsDedupStrategy
.
none
;
// Filtering
// Filtering
const
filteredData
=
filterLogLevels
(
data
,
hiddenLogLevels
);
const
filteredData
=
filterLogLevels
(
data
,
hiddenLogLevels
);
...
@@ -257,7 +263,12 @@ export default class Logs extends PureComponent<LogsProps, LogsState> {
...
@@ -257,7 +263,12 @@ export default class Logs extends PureComponent<LogsProps, LogsState> {
}
}
// Grid options
// Grid options
const
cssColumnSizes
=
[
'3px'
];
// Log-level indicator line
const
cssColumnSizes
=
[];
if
(
showDuplicates
)
{
cssColumnSizes
.
push
(
'max-content'
);
}
// Log-level indicator line
cssColumnSizes
.
push
(
'3px'
);
if
(
showUtc
)
{
if
(
showUtc
)
{
cssColumnSizes
.
push
(
'minmax(100px, max-content)'
);
cssColumnSizes
.
push
(
'minmax(100px, max-content)'
);
}
}
...
@@ -341,6 +352,7 @@ export default class Logs extends PureComponent<LogsProps, LogsState> {
...
@@ -341,6 +352,7 @@ export default class Logs extends PureComponent<LogsProps, LogsState> {
allRows=
{
processedRows
}
allRows=
{
processedRows
}
highlighterExpressions=
{
highlighterExpressions
}
highlighterExpressions=
{
highlighterExpressions
}
row=
{
row
}
row=
{
row
}
showDuplicates=
{
showDuplicates
}
showLabels=
{
showLabels
}
showLabels=
{
showLabels
}
showLocalTime=
{
showLocalTime
}
showLocalTime=
{
showLocalTime
}
showUtc=
{
showUtc
}
showUtc=
{
showUtc
}
...
@@ -355,6 +367,7 @@ export default class Logs extends PureComponent<LogsProps, LogsState> {
...
@@ -355,6 +367,7 @@ export default class Logs extends PureComponent<LogsProps, LogsState> {
key=
{
row
.
key
+
row
.
duplicates
}
key=
{
row
.
key
+
row
.
duplicates
}
allRows=
{
processedRows
}
allRows=
{
processedRows
}
row=
{
row
}
row=
{
row
}
showDuplicates=
{
showDuplicates
}
showLabels=
{
showLabels
}
showLabels=
{
showLabels
}
showLocalTime=
{
showLocalTime
}
showLocalTime=
{
showLocalTime
}
showUtc=
{
showUtc
}
showUtc=
{
showUtc
}
...
...
public/sass/pages/_explore.scss
View file @
0c855fb9
...
@@ -346,23 +346,8 @@
...
@@ -346,23 +346,8 @@
background-color
:
#6ed0e0
;
background-color
:
#6ed0e0
;
}
}
.logs-row-level__duplicates
{
.logs-row-duplicates
{
position
:
absolute
;
text-align
:
right
;
width
:
9px
;
height
:
100%
;
top
:
0
;
left
:
5px
;
display
:
flex
;
flex-wrap
:
wrap
;
align-items
:
flex-start
;
align-content
:
flex-start
;
}
.logs-row-level__duplicate
{
width
:
2px
;
height
:
3px
;
background-color
:
#1f78c1
;
margin
:
0
1px
1px
0
;
}
}
.logs-label
{
.logs-label
{
...
...
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