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
2f101d1d
Unverified
Commit
2f101d1d
authored
Nov 27, 2019
by
Andrej Ocenas
Committed by
GitHub
Nov 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DataLinks: Refactor title state (#20256)
parent
758201e8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
9 deletions
+3
-9
packages/grafana-ui/src/components/DataLinks/DataLinkEditor.tsx
+3
-9
No files found.
packages/grafana-ui/src/components/DataLinks/DataLinkEditor.tsx
View file @
2f101d1d
import
React
,
{
useState
,
ChangeEvent
,
useContext
}
from
'react'
;
import
React
,
{
ChangeEvent
,
useContext
}
from
'react'
;
import
{
DataLink
}
from
'@grafana/data'
;
import
{
FormField
,
Switch
}
from
'../index'
;
import
{
VariableSuggestion
}
from
'./DataLinkSuggestions'
;
...
...
@@ -31,17 +31,12 @@ export const DataLinkEditor: React.FC<DataLinkEditorProps> = React.memo(
({
index
,
value
,
onChange
,
onRemove
,
suggestions
,
isLast
})
=>
{
const
theme
=
useContext
(
ThemeContext
);
const
styles
=
getStyles
(
theme
);
const
[
title
,
setTitle
]
=
useState
(
value
.
title
);
const
onUrlChange
=
(
url
:
string
,
callback
?:
()
=>
void
)
=>
{
onChange
(
index
,
{
...
value
,
url
},
callback
);
};
const
onTitleChange
=
(
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
setTitle
(
event
.
target
.
value
);
};
const
onTitleBlur
=
()
=>
{
onChange
(
index
,
{
...
value
,
title
:
title
});
onChange
(
index
,
{
...
value
,
title
:
event
.
target
.
value
});
};
const
onRemoveClick
=
()
=>
{
...
...
@@ -58,9 +53,8 @@ export const DataLinkEditor: React.FC<DataLinkEditorProps> = React.memo(
<
FormField
className=
"gf-form--grow"
label=
"Title"
value=
{
title
}
value=
{
value
.
title
}
onChange=
{
onTitleChange
}
onBlur=
{
onTitleBlur
}
inputWidth=
{
0
}
labelWidth=
{
5
}
placeholder=
"Show details"
...
...
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