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
181b4f9e
Unverified
Commit
181b4f9e
authored
Feb 05, 2019
by
Alexander Zobnin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
azuremonitor: improve autocomplete experence
parent
4b5bfd3d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
14 deletions
+16
-14
public/app/plugins/datasource/grafana-azure-monitor-datasource/editor/KustoQueryField.tsx
+13
-11
public/app/plugins/datasource/grafana-azure-monitor-datasource/editor/query_field.tsx
+3
-3
No files found.
public/app/plugins/datasource/grafana-azure-monitor-datasource/editor/KustoQueryField.tsx
View file @
181b4f9e
...
@@ -65,7 +65,7 @@ export default class KustoQueryField extends QueryField {
...
@@ -65,7 +65,7 @@ export default class KustoQueryField extends QueryField {
this
.
fetchSchema
();
this
.
fetchSchema
();
}
}
onTypeahead
=
()
=>
{
onTypeahead
=
(
force
=
false
)
=>
{
const
selection
=
window
.
getSelection
();
const
selection
=
window
.
getSelection
();
if
(
selection
.
anchorNode
)
{
if
(
selection
.
anchorNode
)
{
const
wrapperNode
=
selection
.
anchorNode
.
parentElement
;
const
wrapperNode
=
selection
.
anchorNode
.
parentElement
;
...
@@ -140,14 +140,8 @@ export default class KustoQueryField extends QueryField {
...
@@ -140,14 +140,8 @@ export default class KustoQueryField extends QueryField {
suggestionGroups
=
this
.
getTableSuggestions
(
db
);
suggestionGroups
=
this
.
getTableSuggestions
(
db
);
prefix
=
prefix
.
replace
(
'.'
,
''
);
prefix
=
prefix
.
replace
(
'.'
,
''
);
// built-in
// new
}
else
if
(
prefix
&&
!
wrapperClasses
.
contains
(
'argument'
))
{
}
else
if
(
normalizeQuery
(
Plain
.
serialize
(
this
.
state
.
value
)).
match
(
/^
\s
*
\w
*$/i
))
{
if
(
modelPrefix
.
match
(
/
\s
$/i
))
{
prefix
=
''
;
}
typeaheadContext
=
'context-builtin'
;
suggestionGroups
=
this
.
getKeywordSuggestions
();
}
else
if
(
Plain
.
serialize
(
this
.
state
.
value
)
===
''
)
{
typeaheadContext
=
'context-new'
;
typeaheadContext
=
'context-new'
;
if
(
this
.
schema
)
{
if
(
this
.
schema
)
{
suggestionGroups
=
this
.
getInitialSuggestions
();
suggestionGroups
=
this
.
getInitialSuggestions
();
...
@@ -156,7 +150,15 @@ export default class KustoQueryField extends QueryField {
...
@@ -156,7 +150,15 @@ export default class KustoQueryField extends QueryField {
setTimeout
(
this
.
onTypeahead
,
0
);
setTimeout
(
this
.
onTypeahead
,
0
);
return
;
return
;
}
}
}
else
{
// built-in
}
else
if
(
prefix
&&
!
wrapperClasses
.
contains
(
'argument'
))
{
if
(
modelPrefix
.
match
(
/
\s
$/i
))
{
prefix
=
''
;
}
typeaheadContext
=
'context-builtin'
;
suggestionGroups
=
this
.
getKeywordSuggestions
();
}
else
if
(
force
===
true
)
{
typeaheadContext
=
'context-builtin'
;
typeaheadContext
=
'context-builtin'
;
if
(
modelPrefix
.
match
(
/
\s
$/i
))
{
if
(
modelPrefix
.
match
(
/
\s
$/i
))
{
prefix
=
''
;
prefix
=
''
;
...
@@ -181,7 +183,7 @@ export default class KustoQueryField extends QueryField {
...
@@ -181,7 +183,7 @@ export default class KustoQueryField extends QueryField {
.
filter
(
group
=>
group
.
items
.
length
>
0
);
.
filter
(
group
=>
group
.
items
.
length
>
0
);
// console.log('onTypeahead', selection.anchorNode, wrapperClasses, text, offset, prefix, typeaheadContext);
// console.log('onTypeahead', selection.anchorNode, wrapperClasses, text, offset, prefix, typeaheadContext);
console
.
log
(
'onTypeahead'
,
modelPrefix
,
prefix
,
typeaheadContext
);
// console.log('onTypeahead'
, prefix, typeaheadContext);
this
.
setState
({
this
.
setState
({
typeaheadPrefix
:
prefix
,
typeaheadPrefix
:
prefix
,
...
...
public/app/plugins/datasource/grafana-azure-monitor-datasource/editor/query_field.tsx
View file @
181b4f9e
...
@@ -104,11 +104,11 @@ class QueryField extends React.Component<any, any> {
...
@@ -104,11 +104,11 @@ class QueryField extends React.Component<any, any> {
const
changed
=
value
.
document
!==
this
.
state
.
value
.
document
;
const
changed
=
value
.
document
!==
this
.
state
.
value
.
document
;
this
.
setState
({
value
},
()
=>
{
this
.
setState
({
value
},
()
=>
{
if
(
changed
)
{
if
(
changed
)
{
// call typeahead only if query changed
window
.
requestAnimationFrame
(
this
.
onTypeahead
);
this
.
onChangeQuery
();
this
.
onChangeQuery
();
}
}
});
});
window
.
requestAnimationFrame
(
this
.
onTypeahead
);
};
};
request
=
(
url
?)
=>
{
request
=
(
url
?)
=>
{
...
@@ -143,7 +143,7 @@ class QueryField extends React.Component<any, any> {
...
@@ -143,7 +143,7 @@ class QueryField extends React.Component<any, any> {
case
' '
:
{
case
' '
:
{
if
(
event
.
ctrlKey
)
{
if
(
event
.
ctrlKey
)
{
event
.
preventDefault
();
event
.
preventDefault
();
this
.
onTypeahead
();
this
.
onTypeahead
(
true
);
return
true
;
return
true
;
}
}
break
;
break
;
...
...
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