Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
qorus
prometheus
Commits
f2c5c230
Unverified
Commit
f2c5c230
authored
Feb 08, 2021
by
Julien Pivotto
Committed by
GitHub
Feb 08, 2021
Browse files
Merge pull request #8459 from prometheus/fix-labelname-style-bug
Fix label name leak into class name
parents
860f0853
b6544c90
Changes
2
Hide whitespace changes
Inline
Side-by-side
web/ui/react-app/src/pages/targets/EndpointLink.test.tsx
View file @
f2c5c230
...
...
@@ -24,10 +24,10 @@ describe('EndpointLink', () => {
expect
(
anchor
.
children
().
text
()).
toEqual
(
'
http://100.99.128.71:9115/probe
'
);
expect
(
endpointLink
.
find
(
'
br
'
)).
toHaveLength
(
1
);
expect
(
badges
).
toHaveLength
(
2
);
const
moduleLabel
=
badges
.
filterWhere
(
badge
=>
badge
.
hasClass
(
'
module
'
)
);
expect
(
moduleLabel
.
children
().
text
()).
toEqual
(
'
module="http_2xx"
'
);
const
targetLabel
=
badges
.
filterWhere
(
badge
=>
badge
.
hasClass
(
'
target
'
)
);
expect
(
targetLabel
.
children
().
text
()).
toEqual
(
'
target="http://some-service"
'
);
const
moduleLabel
=
badges
.
filterWhere
(
badge
=>
badge
.
children
().
text
()
===
'
module="http_2xx"
'
);
expect
(
moduleLabel
.
length
).
toEqual
(
1
);
const
targetLabel
=
badges
.
filterWhere
(
badge
=>
badge
.
children
().
text
()
===
'
target="http://some-service"
'
);
expect
(
targetLabel
.
length
).
toEqual
(
1
);
});
it
(
'
renders an alert if url is invalid
'
,
()
=>
{
...
...
@@ -37,7 +37,7 @@ describe('EndpointLink', () => {
});
it
(
'
handles params with multiple values correctly
'
,
()
=>
{
const
consoleSpy
=
jest
.
spyOn
(
console
,
"
warn
"
);
const
consoleSpy
=
jest
.
spyOn
(
console
,
'
warn
'
);
const
endpoint
=
`http://example.com/federate?match[]={__name__="name1"}&match[]={__name__="name2"}&match[]={__name__="name3"}`
;
const
globalURL
=
'
http://example.com/federate
'
;
const
endpointLink
=
mount
(<
EndpointLink
endpoint
=
{
endpoint
}
globalUrl
=
{
globalURL
}
/>);
...
...
web/ui/react-app/src/pages/targets/EndpointLink.tsx
View file @
f2c5c230
...
...
@@ -27,7 +27,7 @@ const EndpointLink: FC<EndpointLinkProps> = ({ endpoint, globalUrl }) => {
{
params
.
length
>
0
?
<
br
/>
:
null
}
{
params
.
map
(([
labelName
,
labelValue
]:
[
string
,
string
])
=>
{
return
(
<
Badge
color
=
"primary"
className
=
{
`
mr-1
${
labelName
}
`
}
key
=
{
`
${
labelName
}
/
${
labelValue
}
`
}
>
<
Badge
color
=
"primary"
className
=
"
mr-1
"
key
=
{
`
${
labelName
}
/
${
labelValue
}
`
}
>
{
`
${
labelName
}
="
${
labelValue
}
"`
}
</
Badge
>
);
...
...
Write
Preview
Supports
Markdown
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