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
f8326c29
Commit
f8326c29
authored
Sep 14, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mysql: fix query editor not showing issue, fixes #9247
parent
491e6897
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
107 additions
and
1 deletions
+107
-1
public/app/plugins/datasource/mysql/mode-sql.js
+106
-0
public/app/plugins/datasource/mysql/partials/query.editor.html
+1
-1
No files found.
public/app/plugins/datasource/mysql/mode-sql.js
0 → 100644
View file @
f8326c29
// jshint ignore: start
// jscs: disable
ace
.
define
(
"ace/mode/sql_highlight_rules"
,[
"require"
,
"exports"
,
"module"
,
"ace/lib/oop"
,
"ace/mode/text_highlight_rules"
],
function
(
require
,
exports
,
module
)
{
"use strict"
;
var
oop
=
require
(
"../lib/oop"
);
var
TextHighlightRules
=
require
(
"./text_highlight_rules"
).
TextHighlightRules
;
var
SqlHighlightRules
=
function
()
{
var
keywords
=
(
"select|insert|update|delete|from|where|and|or|group|by|order|limit|offset|having|as|case|"
+
"when|else|end|type|left|right|join|on|outer|desc|asc|union|create|table|primary|key|if|"
+
"foreign|not|references|default|null|inner|cross|natural|database|drop|grant"
);
var
builtinConstants
=
(
"true|false"
);
var
builtinFunctions
=
(
"avg|count|first|last|max|min|sum|ucase|lcase|mid|len|round|rank|now|format|"
+
"coalesce|ifnull|isnull|nvl"
);
var
dataTypes
=
(
"int|numeric|decimal|date|varchar|char|bigint|float|double|bit|binary|text|set|timestamp|"
+
"money|real|number|integer"
);
var
keywordMapper
=
this
.
createKeywordMapper
({
"support.function"
:
builtinFunctions
,
"keyword"
:
keywords
,
"constant.language"
:
builtinConstants
,
"storage.type"
:
dataTypes
},
"identifier"
,
true
);
this
.
$rules
=
{
"start"
:
[
{
token
:
"comment"
,
regex
:
"--.*$"
},
{
token
:
"comment"
,
start
:
"/
\\
*"
,
end
:
"
\\
*/"
},
{
token
:
"string"
,
// " string
regex
:
'".*?"'
},
{
token
:
"string"
,
// ' string
regex
:
"'.*?'"
},
{
token
:
"string"
,
// ` string (apache drill)
regex
:
"`.*?`"
},
{
token
:
"constant.numeric"
,
// float
regex
:
"[+-]?
\\
d+(?:(?:
\\
.
\\
d*)?(?:[eE][+-]?
\\
d+)?)?
\\
b"
},
{
token
:
keywordMapper
,
regex
:
"[a-zA-Z_$][a-zA-Z0-9_$]*
\\
b"
},
{
token
:
"keyword.operator"
,
regex
:
"
\\
+|
\\
-|
\\
/|
\\
/
\\
/|%|<@>|@>|<@|&|
\\
^|~|<|>|<=|=>|==|!=|<>|="
},
{
token
:
"paren.lparen"
,
regex
:
"[
\\
(]"
},
{
token
:
"paren.rparen"
,
regex
:
"[
\\
)]"
},
{
token
:
"text"
,
regex
:
"
\\
s+"
}
]
};
this
.
normalizeRules
();
};
oop
.
inherits
(
SqlHighlightRules
,
TextHighlightRules
);
exports
.
SqlHighlightRules
=
SqlHighlightRules
;
});
ace
.
define
(
"ace/mode/sql"
,[
"require"
,
"exports"
,
"module"
,
"ace/lib/oop"
,
"ace/mode/text"
,
"ace/mode/sql_highlight_rules"
],
function
(
require
,
exports
,
module
)
{
"use strict"
;
var
oop
=
require
(
"../lib/oop"
);
var
TextMode
=
require
(
"./text"
).
Mode
;
var
SqlHighlightRules
=
require
(
"./sql_highlight_rules"
).
SqlHighlightRules
;
var
Mode
=
function
()
{
this
.
HighlightRules
=
SqlHighlightRules
;
this
.
$behaviour
=
this
.
$defaultBehaviour
;
};
oop
.
inherits
(
Mode
,
TextMode
);
(
function
()
{
this
.
lineCommentStart
=
"--"
;
this
.
$id
=
"ace/mode/sql"
;
}).
call
(
Mode
.
prototype
);
exports
.
Mode
=
Mode
;
});
public/app/plugins/datasource/mysql/partials/query.editor.html
View file @
f8326c29
<query-editor-row
query-ctrl=
"ctrl"
can-collapse=
"false"
>
<query-editor-row
query-ctrl=
"ctrl"
can-collapse=
"false"
>
<div
class=
"gf-form-inline"
>
<div
class=
"gf-form-inline"
>
<div
class=
"gf-form gf-form--grow"
>
<div
class=
"gf-form gf-form--grow"
>
<code-editor
content=
"ctrl.target.rawSql"
on-change=
"ctrl.panelCtrl.refresh()"
data-mode=
"sql"
>
<code-editor
content=
"ctrl.target.rawSql"
datasource=
"ctrl.datasource"
on-change=
"ctrl.panelCtrl.refresh()"
data-mode=
"sql"
>
</code-editor>
</code-editor>
</div>
</div>
</div>
</div>
...
...
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