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
9962f696
Unverified
Commit
9962f696
authored
May 05, 2020
by
Andrej Ocenas
Committed by
GitHub
May 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tracing: Remove collapsing of header (#24153)
parent
224aa4dd
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
7 deletions
+43
-7
packages/grafana-ui/src/themes/ThemeContext.tsx
+1
-1
packages/jaeger-ui-components/src/Theme.tsx
+21
-0
packages/jaeger-ui-components/src/common/TraceName.tsx
+10
-4
public/app/features/explore/TraceView/TraceView.tsx
+11
-2
No files found.
packages/grafana-ui/src/themes/ThemeContext.tsx
View file @
9962f696
...
@@ -35,7 +35,7 @@ export const withTheme = <P extends Themeable, S extends {} = {}>(Component: Rea
...
@@ -35,7 +35,7 @@ export const withTheme = <P extends Themeable, S extends {} = {}>(Component: Rea
return
WithTheme
as
Hoisted
;
return
WithTheme
as
Hoisted
;
}
;
}
;
export function useTheme()
{
export function useTheme()
: GrafanaTheme
{
return
useContext
(
ThemeContextMock
||
ThemeContext
);
return
useContext
(
ThemeContextMock
||
ThemeContext
);
}
}
/** Hook for using memoized styles with access to the theme. */
/** Hook for using memoized styles with access to the theme. */
...
...
packages/jaeger-ui-components/src/Theme.tsx
View file @
9962f696
...
@@ -72,6 +72,11 @@ export type Theme = {
...
@@ -72,6 +72,11 @@ export type Theme = {
type
:
ThemeType
;
type
:
ThemeType
;
servicesColorPalette
:
string
[];
servicesColorPalette
:
string
[];
borderStyle
:
string
;
borderStyle
:
string
;
components
?:
{
TraceName
?:
{
fontSize
?:
number
|
string
;
};
};
};
};
export
const
defaultTheme
:
Theme
=
{
export
const
defaultTheme
:
Theme
=
{
...
@@ -199,3 +204,19 @@ export function autoColor(theme: Theme, hex: string, base?: string) {
...
@@ -199,3 +204,19 @@ export function autoColor(theme: Theme, hex: string, base?: string) {
return
newColor
.
isLight
()
?
newColor
.
darken
(
5
).
toHex8String
()
:
newColor
.
lighten
(
5
).
toHex8String
();
return
newColor
.
isLight
()
?
newColor
.
darken
(
5
).
toHex8String
()
:
newColor
.
lighten
(
5
).
toHex8String
();
}
}
}
}
/**
* With theme overrides you can use both number or string (for things like rem units) so this makes sure we convert
* the value accordingly or use fallback if not set
*/
export function safeSize(size: number | string | undefined, fallback: string): string
{
if
(
!
size
)
{
return
fallback
;
}
if
(
typeof
size
===
'string'
)
{
return
size
;
}
else
{
return
`${size}px`
;
}
}
packages/jaeger-ui-components/src/common/TraceName.tsx
View file @
9962f696
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
import
*
as
React
from
'react'
;
import
*
as
React
from
'react'
;
import
{
css
}
from
'emotion'
;
import
{
css
}
from
'emotion'
;
import
cx
from
'classnames'
;
import
BreakableText
from
'./BreakableText'
;
import
BreakableText
from
'./BreakableText'
;
import
LoadingIndicator
from
'./LoadingIndicator'
;
import
LoadingIndicator
from
'./LoadingIndicator'
;
...
@@ -21,11 +22,16 @@ import { fetchedState, FALLBACK_TRACE_NAME } from '../constants';
...
@@ -21,11 +22,16 @@ import { fetchedState, FALLBACK_TRACE_NAME } from '../constants';
import
{
FetchedState
,
TNil
}
from
'../types'
;
import
{
FetchedState
,
TNil
}
from
'../types'
;
import
{
ApiError
}
from
'../types/api-error'
;
import
{
ApiError
}
from
'../types/api-error'
;
import
{
createStyle
}
from
'../Theme'
;
import
{
createStyle
,
safeSize
,
Theme
,
useTheme
}
from
'../Theme'
;
const
getStyles
=
createStyle
(()
=>
{
const
getStyles
=
createStyle
((
theme
:
Theme
)
=>
{
return
{
return
{
TraceName
:
css
`
label: TraceName;
font-size:
${
safeSize
(
theme
.
components
?.
TraceName
?.
fontSize
,
'unset'
)};
`,
TraceNameError: css`
TraceNameError: css`
label
:
TraceNameError
;
color
:
#
c00
;
color
:
#
c00
;
`,
`,
};
};
...
@@ -42,7 +48,7 @@ export default function TraceName(props: Props) {
...
@@ -42,7 +48,7 @@ export default function TraceName(props: Props) {
const { className, error, state, traceName } = props;
const { className, error, state, traceName } = props;
const isErred = state === fetchedState.ERROR;
const isErred = state === fetchedState.ERROR;
let title: string | React.ReactNode = traceName || FALLBACK_TRACE_NAME;
let title: string | React.ReactNode = traceName || FALLBACK_TRACE_NAME;
const
styles
=
getStyles
();
const styles = getStyles(
useTheme()
);
let errorCssClass = '';
let errorCssClass = '';
if (isErred) {
if (isErred) {
errorCssClass = styles.TraceNameError;
errorCssClass = styles.TraceNameError;
...
@@ -61,5 +67,5 @@ export default function TraceName(props: Props) {
...
@@ -61,5 +67,5 @@ export default function TraceName(props: Props) {
const text = String(traceName || FALLBACK_TRACE_NAME);
const text = String(traceName || FALLBACK_TRACE_NAME);
title = <BreakableText text={text} />;
title = <BreakableText text={text} />;
}
}
return
<
span
className=
{
`TraceName ${errorCssClass} ${className || ''}`
}
>
{
title
}
</
span
>;
return <span className={
cx(styles.TraceName, errorCssClass, className)
}>{title}</span>;
}
}
public/app/features/explore/TraceView/TraceView.tsx
View file @
9962f696
...
@@ -56,7 +56,16 @@ export function TraceView(props: Props) {
...
@@ -56,7 +56,16 @@ export function TraceView(props: Props) {
const
theme
=
useTheme
();
const
theme
=
useTheme
();
const
traceTheme
=
useMemo
(
const
traceTheme
=
useMemo
(
()
=>
({
type
:
theme
.
isDark
?
ThemeType
.
Dark
:
ThemeType
.
Light
,
servicesColorPalette
:
colors
}
as
ThemeOptions
),
()
=>
({
type
:
theme
.
isDark
?
ThemeType
.
Dark
:
ThemeType
.
Light
,
servicesColorPalette
:
colors
,
components
:
{
TraceName
:
{
fontSize
:
theme
.
typography
.
size
.
lg
,
},
},
}
as
ThemeOptions
),
[
theme
]
[
theme
]
);
);
const
traceTimeline
:
TTraceTimeline
=
useMemo
(
const
traceTimeline
:
TTraceTimeline
=
useMemo
(
...
@@ -75,7 +84,7 @@ export function TraceView(props: Props) {
...
@@ -75,7 +84,7 @@ export function TraceView(props: Props) {
<
ThemeProvider
value=
{
traceTheme
}
>
<
ThemeProvider
value=
{
traceTheme
}
>
<
UIElementsContext
.
Provider
value=
{
UIElements
}
>
<
UIElementsContext
.
Provider
value=
{
UIElements
}
>
<
TracePageHeader
<
TracePageHeader
canCollapse=
{
tru
e
}
canCollapse=
{
fals
e
}
clearSearch=
{
useCallback
(()
=>
{},
[])
}
clearSearch=
{
useCallback
(()
=>
{},
[])
}
focusUiFindMatches=
{
useCallback
(()
=>
{},
[])
}
focusUiFindMatches=
{
useCallback
(()
=>
{},
[])
}
hideMap=
{
false
}
hideMap=
{
false
}
...
...
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