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
b349b3ef
Commit
b349b3ef
authored
Sep 13, 2017
by
Mitsuhiro Tanda
Committed by
Torkel Ödegaard
Sep 13, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
provide ace editor for external datasource plugin (#9224)
parent
dd67c9d4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
5 deletions
+10
-5
public/app/core/components/code_editor/code_editor.ts
+9
-4
public/app/plugins/datasource/prometheus/mode-prometheus.js
+0
-0
public/app/plugins/datasource/prometheus/partials/query.editor.html
+1
-1
public/app/plugins/datasource/prometheus/snippets/prometheus.js
+0
-0
No files found.
public/app/core/components/code_editor/code_editor.ts
View file @
b349b3ef
...
@@ -40,11 +40,11 @@ const DEFAULT_MAX_LINES = 10;
...
@@ -40,11 +40,11 @@ const DEFAULT_MAX_LINES = 10;
const
DEFAULT_TAB_SIZE
=
2
;
const
DEFAULT_TAB_SIZE
=
2
;
const
DEFAULT_BEHAVIOURS
=
true
;
const
DEFAULT_BEHAVIOURS
=
true
;
const
GRAFANA_MODULES
=
[
'
mode-prometheus'
,
'snippets-prometheus'
,
'
theme-grafana-dark'
];
const
GRAFANA_MODULES
=
[
'theme-grafana-dark'
];
const
GRAFANA_MODULE_BASE
=
"public/app/core/components/code_editor/"
;
const
GRAFANA_MODULE_BASE
=
"public/app/core/components/code_editor/"
;
// Trick for loading additional modules
// Trick for loading additional modules
function
setModuleUrl
(
moduleType
,
name
)
{
function
setModuleUrl
(
moduleType
,
name
,
pluginBaseUrl
=
null
)
{
let
baseUrl
=
ACE_SRC_BASE
;
let
baseUrl
=
ACE_SRC_BASE
;
let
aceModeName
=
`ace/
${
moduleType
}
/
${
name
}
`
;
let
aceModeName
=
`ace/
${
moduleType
}
/
${
name
}
`
;
let
moduleName
=
`
${
moduleType
}
-
${
name
}
`
;
let
moduleName
=
`
${
moduleType
}
-
${
name
}
`
;
...
@@ -54,6 +54,10 @@ function setModuleUrl(moduleType, name) {
...
@@ -54,6 +54,10 @@ function setModuleUrl(moduleType, name) {
baseUrl
=
GRAFANA_MODULE_BASE
;
baseUrl
=
GRAFANA_MODULE_BASE
;
}
}
if
(
pluginBaseUrl
)
{
baseUrl
=
pluginBaseUrl
+
'/'
;
}
if
(
moduleType
===
'snippets'
)
{
if
(
moduleType
===
'snippets'
)
{
componentName
=
`
${
moduleType
}
/
${
name
}
.js`
;
componentName
=
`
${
moduleType
}
/
${
name
}
.js`
;
}
}
...
@@ -159,8 +163,8 @@ function link(scope, elem, attrs) {
...
@@ -159,8 +163,8 @@ function link(scope, elem, attrs) {
function
setLangMode
(
lang
)
{
function
setLangMode
(
lang
)
{
let
aceModeName
=
`ace/mode/
${
lang
}
`
;
let
aceModeName
=
`ace/mode/
${
lang
}
`
;
setModuleUrl
(
"mode"
,
lang
);
setModuleUrl
(
"mode"
,
lang
,
scope
.
datasource
.
meta
.
baseUrl
||
null
);
setModuleUrl
(
"snippets"
,
lang
);
setModuleUrl
(
"snippets"
,
lang
,
scope
.
datasource
.
meta
.
baseUrl
||
null
);
editorSession
.
setMode
(
aceModeName
);
editorSession
.
setMode
(
aceModeName
);
ace
.
config
.
loadModule
(
"ace/ext/language_tools"
,
(
language_tools
)
=>
{
ace
.
config
.
loadModule
(
"ace/ext/language_tools"
,
(
language_tools
)
=>
{
...
@@ -210,6 +214,7 @@ export function codeEditorDirective() {
...
@@ -210,6 +214,7 @@ export function codeEditorDirective() {
template
:
editorTemplate
,
template
:
editorTemplate
,
scope
:
{
scope
:
{
content
:
"="
,
content
:
"="
,
datasource
:
"="
,
codeEditorFocus
:
"<"
,
codeEditorFocus
:
"<"
,
onChange
:
"&"
,
onChange
:
"&"
,
getCompleter
:
"&"
getCompleter
:
"&"
...
...
public/app/
core/components/code_editor
/mode-prometheus.js
→
public/app/
plugins/datasource/prometheus
/mode-prometheus.js
View file @
b349b3ef
File moved
public/app/plugins/datasource/prometheus/partials/query.editor.html
View file @
b349b3ef
<query-editor-row
query-ctrl=
"ctrl"
can-collapse=
"true"
has-text-edit-mode=
"false"
>
<query-editor-row
query-ctrl=
"ctrl"
can-collapse=
"true"
has-text-edit-mode=
"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.expr"
on-change=
"ctrl.refreshMetricData()"
<code-editor
content=
"ctrl.target.expr"
datasource=
"ctrl.datasource"
on-change=
"ctrl.refreshMetricData()"
get-completer=
"ctrl.getCompleter()"
data-mode=
"prometheus"
code-editor-focus=
"ctrl.isLastQuery"
>
get-completer=
"ctrl.getCompleter()"
data-mode=
"prometheus"
code-editor-focus=
"ctrl.isLastQuery"
>
</code-editor>
</code-editor>
</div>
</div>
...
...
public/app/
core/components/code_editor
/snippets/prometheus.js
→
public/app/
plugins/datasource/prometheus
/snippets/prometheus.js
View file @
b349b3ef
File moved
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