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
ae64dcf0
Unverified
Commit
ae64dcf0
authored
Feb 08, 2021
by
Erik Sundell
Committed by
GitHub
Feb 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make sure service and slo display name is passed to segment comp (#30900)
parent
d824dc8e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
7 deletions
+13
-7
public/app/plugins/datasource/cloud-monitoring/components/SLOQueryEditor.tsx
+9
-5
public/app/plugins/datasource/cloud-monitoring/datasource.ts
+2
-2
public/app/plugins/datasource/cloud-monitoring/types.ts
+2
-0
No files found.
public/app/plugins/datasource/cloud-monitoring/components/SLOQueryEditor.tsx
View file @
ae64dcf0
...
...
@@ -21,7 +21,9 @@ export const defaultQuery: (dataSource: CloudMonitoringDatasource) => SLOQuery =
aliasBy
:
''
,
selectorName
:
'select_slo_health'
,
serviceId
:
''
,
serviceName
:
''
,
sloId
:
''
,
sloName
:
''
,
});
export
function
SLOQueryEditor
({
...
...
@@ -42,7 +44,7 @@ export function SLOQueryEditor({
<
QueryInlineField
label=
"Service"
>
<
SegmentAsync
allowCustomValue
value=
{
query
?.
serviceId
}
value=
{
{
value
:
query
?.
serviceId
,
label
:
query
?.
serviceName
||
query
?.
serviceId
}
}
placeholder=
"Select service"
loadOptions=
{
()
=>
datasource
.
getSLOServices
(
query
.
projectName
).
then
((
services
)
=>
[
...
...
@@ -53,14 +55,16 @@ export function SLOQueryEditor({
...
services
,
])
}
onChange=
{
({
value
:
serviceId
=
''
})
=>
onChange
({
...
query
,
serviceId
,
sloId
:
''
})
}
onChange=
{
({
value
:
serviceId
=
''
,
label
:
serviceName
=
''
})
=>
onChange
({
...
query
,
serviceId
,
serviceName
,
sloId
:
''
})
}
/>
</
QueryInlineField
>
<
QueryInlineField
label=
"SLO"
>
<
SegmentAsync
allowCustomValue
value=
{
query
?.
sloId
}
value=
{
{
value
:
query
?.
sloId
,
label
:
query
?.
sloName
||
query
?.
sloId
}
}
placeholder=
"Select SLO"
loadOptions=
{
()
=>
datasource
.
getServiceLevelObjectives
(
query
.
projectName
,
query
.
serviceId
).
then
((
sloIds
)
=>
[
...
...
@@ -71,10 +75,10 @@ export function SLOQueryEditor({
...
sloIds
,
])
}
onChange=
{
async
({
value
:
sloId
=
''
})
=>
{
onChange=
{
async
({
value
:
sloId
=
''
,
label
:
sloName
=
''
})
=>
{
const
slos
=
await
datasource
.
getServiceLevelObjectives
(
query
.
projectName
,
query
.
serviceId
);
const
slo
=
slos
.
find
(({
value
})
=>
value
===
datasource
.
templateSrv
.
replace
(
sloId
));
onChange
({
...
query
,
sloId
,
goal
:
slo
?.
goal
});
onChange
({
...
query
,
sloId
,
sloName
,
goal
:
slo
?.
goal
});
}
}
/>
</
QueryInlineField
>
...
...
public/app/plugins/datasource/cloud-monitoring/datasource.ts
View file @
ae64dcf0
...
...
@@ -257,9 +257,9 @@ export default class CloudMonitoringDatasource extends DataSourceWithBackend<
async
getSLOServices
(
projectName
:
string
):
Promise
<
Array
<
SelectableValue
<
string
>>>
{
return
this
.
api
.
get
(
`
${
this
.
templateSrv
.
replace
(
projectName
)}
/services?pageSize=1000`
,
{
responseMap
:
({
name
}:
{
n
ame
:
string
})
=>
({
responseMap
:
({
name
,
displayName
}:
{
name
:
string
;
displayN
ame
:
string
})
=>
({
value
:
name
.
match
(
/
([^\/]
*
)\/
*$/
)
!
[
1
],
label
:
name
.
match
(
/
([^\/]
*
)\/
*$/
)
!
[
1
],
label
:
displayName
||
name
.
match
(
/
([^\/]
*
)\/
*$/
)
!
[
1
],
}),
});
}
...
...
public/app/plugins/datasource/cloud-monitoring/types.ts
View file @
ae64dcf0
...
...
@@ -92,7 +92,9 @@ export interface SLOQuery {
aliasBy
?:
string
;
selectorName
:
string
;
serviceId
:
string
;
serviceName
:
string
;
sloId
:
string
;
sloName
:
string
;
goal
?:
number
;
}
...
...
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