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
0ecc9a57
Unverified
Commit
0ecc9a57
authored
Nov 01, 2019
by
Ivana Huckova
Committed by
GitHub
Nov 01, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explore: Add titles to query row action buttons (#20128)
parent
069d718b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
21 deletions
+29
-21
public/app/features/explore/QueryRow.tsx
+5
-5
public/app/features/explore/QueryRowActions.test.tsx
+5
-5
public/app/features/explore/QueryRowActions.tsx
+15
-10
public/app/features/explore/__snapshots__/QueryRowActions.test.tsx.snap
+4
-1
No files found.
public/app/features/explore/QueryRow.tsx
View file @
0ecc9a57
...
...
@@ -85,7 +85,7 @@ export class QueryRow extends PureComponent<QueryRowProps, QueryRowState> {
this
.
props
.
addQueryRow
(
exploreId
,
index
);
};
onClickToggle
HiddenQuery
=
()
=>
{
onClickToggle
Disabled
=
()
=>
{
const
{
exploreId
,
index
,
query
}
=
this
.
props
;
const
newQuery
=
{
...
query
,
...
...
@@ -136,7 +136,7 @@ export class QueryRow extends PureComponent<QueryRowProps, QueryRowState> {
const
canToggleEditorModes
=
mode
===
ExploreMode
.
Metrics
&&
has
(
datasourceInstance
,
'components.QueryCtrl.prototype.toggleEditorMode'
);
const
canHide
=
queryResponse
.
state
!
==
LoadingState
.
NotStarted
;
const
isNotStarted
=
queryResponse
.
state
=
==
LoadingState
.
NotStarted
;
const
queryErrors
=
queryResponse
.
error
&&
queryResponse
.
error
.
refId
===
query
.
refId
?
[
queryResponse
.
error
]
:
[];
let
QueryField
;
...
...
@@ -181,10 +181,10 @@ export class QueryRow extends PureComponent<QueryRowProps, QueryRowState> {
</
div
>
<
QueryRowActions
canToggleEditorModes=
{
canToggleEditorModes
}
hideQuery
=
{
query
.
hide
}
canHide=
{
canHide
}
isDisabled
=
{
query
.
hide
}
isNotStarted=
{
isNotStarted
}
onClickToggleEditorMode=
{
this
.
onClickToggleEditorMode
}
onClickToggle
HiddenQuery=
{
this
.
onClickToggleHiddenQuery
}
onClickToggle
Disabled=
{
this
.
onClickToggleDisabled
}
onClickAddButton=
{
this
.
onClickAddButton
}
onClickRemoveButton=
{
this
.
onClickRemoveButton
}
/>
...
...
public/app/features/explore/QueryRowActions.test.tsx
View file @
0ecc9a57
...
...
@@ -4,11 +4,11 @@ import { shallow } from 'enzyme';
const
setup
=
(
propOverrides
?:
object
)
=>
{
const
props
:
Props
=
{
hideQuery
:
false
,
canHide
:
true
,
isDisabled
:
false
,
isNotStarted
:
true
,
canToggleEditorModes
:
true
,
onClickToggleEditorMode
:
()
=>
{},
onClickToggle
HiddenQuery
:
()
=>
{},
onClickToggle
Disabled
:
()
=>
{},
onClickAddButton
:
()
=>
{},
onClickRemoveButton
:
()
=>
{},
};
...
...
@@ -29,11 +29,11 @@ describe('QueryRowActions', () => {
expect
(
wrapper
.
find
({
'aria-label'
:
'Edit mode button'
})).
toHaveLength
(
0
);
});
it
(
'should change icon to fa-eye-slash when query row result is hidden'
,
()
=>
{
const
wrapper
=
setup
({
hideQuery
:
true
});
const
wrapper
=
setup
({
isDisabled
:
true
});
expect
(
wrapper
.
find
(
'i.fa-eye-slash'
)).
toHaveLength
(
1
);
});
it
(
'should change icon to fa-eye when query row result is not hidden'
,
()
=>
{
const
wrapper
=
setup
({
hideQuery
:
false
});
const
wrapper
=
setup
({
isDisabled
:
false
});
expect
(
wrapper
.
find
(
'i.fa-eye'
)).
toHaveLength
(
1
);
});
});
public/app/features/explore/QueryRowActions.tsx
View file @
0ecc9a57
...
...
@@ -2,10 +2,10 @@ import React from 'react';
export
type
Props
=
{
canToggleEditorModes
:
boolean
;
hideQuery
:
boolean
;
canHide
:
boolean
;
isDisabled
:
boolean
;
isNotStarted
:
boolean
;
onClickToggleEditorMode
:
()
=>
void
;
onClickToggle
HiddenQuery
:
()
=>
void
;
onClickToggle
Disabled
:
()
=>
void
;
onClickAddButton
:
()
=>
void
;
onClickRemoveButton
:
()
=>
void
;
};
...
...
@@ -14,11 +14,11 @@ export function QueryRowActions(props: Props) {
const
{
canToggleEditorModes
,
onClickToggleEditorMode
,
onClickToggle
HiddenQuery
,
onClickToggle
Disabled
,
onClickAddButton
,
onClickRemoveButton
,
hideQuery
,
canHide
,
isDisabled
,
isNotStarted
,
}
=
props
;
return
(
...
...
@@ -35,17 +35,22 @@ export function QueryRowActions(props: Props) {
</
div
>
)
}
<
div
className=
"gf-form"
>
<
button
disabled=
{
!
canHide
}
className=
"gf-form-label gf-form-label--btn"
onClick=
{
onClickToggleHiddenQuery
}
>
<
i
className=
{
hideQuery
?
'fa fa-eye-slash'
:
'fa fa-eye'
}
/>
<
button
disabled=
{
isNotStarted
}
className=
"gf-form-label gf-form-label--btn"
onClick=
{
onClickToggleDisabled
}
title=
"Disable/enable query"
>
<
i
className=
{
isDisabled
?
'fa fa-eye-slash'
:
'fa fa-eye'
}
/>
</
button
>
</
div
>
<
div
className=
"gf-form"
>
<
button
className=
"gf-form-label gf-form-label--btn"
onClick=
{
onClickAddButton
}
>
<
button
className=
"gf-form-label gf-form-label--btn"
onClick=
{
onClickAddButton
}
title=
"Add query"
>
<
i
className=
"fa fa-plus"
/>
</
button
>
</
div
>
<
div
className=
"gf-form"
>
<
button
className=
"gf-form-label gf-form-label--btn"
onClick=
{
onClickRemoveButton
}
>
<
button
className=
"gf-form-label gf-form-label--btn"
onClick=
{
onClickRemoveButton
}
title=
"Remove query"
>
<
i
className=
"fa fa-minus"
/>
</
button
>
</
div
>
...
...
public/app/features/explore/__snapshots__/QueryRowActions.test.tsx.snap
View file @
0ecc9a57
...
...
@@ -22,8 +22,9 @@ exports[`QueryRowActions should render component 1`] = `
>
<button
className="gf-form-label gf-form-label--btn"
disabled={
fals
e}
disabled={
tru
e}
onClick={[Function]}
title="Disable/enable query"
>
<i
className="fa fa-eye"
...
...
@@ -36,6 +37,7 @@ exports[`QueryRowActions should render component 1`] = `
<button
className="gf-form-label gf-form-label--btn"
onClick={[Function]}
title="Add query"
>
<i
className="fa fa-plus"
...
...
@@ -48,6 +50,7 @@ exports[`QueryRowActions should render component 1`] = `
<button
className="gf-form-label gf-form-label--btn"
onClick={[Function]}
title="Remove query"
>
<i
className="fa fa-minus"
...
...
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