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
6c6c3a50
Commit
6c6c3a50
authored
Jan 14, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(plugins): more work on how plugins expose directives
parent
d420cb38
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
87 additions
and
64 deletions
+87
-64
docs/sources/reference/keyboard_shortcuts.md
+1
-1
public/app/core/services/dynamic_directive_srv.ts
+25
-15
public/app/features/all.js
+1
-1
public/app/features/annotations/annotations_srv.js
+2
-1
public/app/features/annotations/editor_ctrl.js
+0
-0
public/app/features/annotations/partials/editor.html
+2
-4
public/app/features/annotations/query_editor.ts
+26
-0
public/app/features/apps/all.ts
+1
-1
public/app/features/dashboard/keybindings.js
+1
-1
public/app/features/panel/panel_directive.js
+0
-14
public/app/partials/help_modal.html
+4
-4
public/app/plugins/datasource/cloudwatch/module.js
+4
-3
public/app/plugins/datasource/elasticsearch/module.js
+12
-13
public/app/plugins/datasource/graphite/module.js
+6
-4
public/app/plugins/datasource/graphite/partials/annotations.editor.html
+2
-2
No files found.
docs/sources/reference/keyboard_shortcuts.md
View file @
6c6c3a50
...
@@ -18,10 +18,10 @@ Press `Shift`+`?` to open the keyboard shortcut dialog from anywhere within the
...
@@ -18,10 +18,10 @@ Press `Shift`+`?` to open the keyboard shortcut dialog from anywhere within the
|---|---|
|---|---|
|
`Esc`
|Exit fullscreen edit/view mode, close search or any editor view|
|
`Esc`
|Exit fullscreen edit/view mode, close search or any editor view|
|
`F`
|Open dashboard search view (also contains import/playlist controls)|
|
`F`
|Open dashboard search view (also contains import/playlist controls)|
|
`R`
|Refresh (Fetches new data and rerenders panels)|
|
`CTRL`
+
`S`
|Save dashboard|
|
`CTRL`
+
`S`
|Save dashboard|
|
`CTRL`
+
`H`
|Hide row controls|
|
`CTRL`
+
`H`
|Hide row controls|
|
`CTRL`
+
`Z`
|Zoom out|
|
`CTRL`
+
`Z`
|Zoom out|
|
`CTRL`
+
`R`
|Refresh (Fetches new data and rerenders panels)|
|
`CTRL`
+
`O`
|Enable/Disable shared graph crosshair|
|
`CTRL`
+
`O`
|Enable/Disable shared graph crosshair|
...
...
public/app/core/services/dynamic_directive_srv.ts
View file @
6c6c3a50
...
@@ -6,7 +6,7 @@ import coreModule from '../core_module';
...
@@ -6,7 +6,7 @@ import coreModule from '../core_module';
class
DynamicDirectiveSrv
{
class
DynamicDirectiveSrv
{
/** @ngInject */
/** @ngInject */
constructor
(
private
$compile
,
private
$parse
)
{}
constructor
(
private
$compile
,
private
$parse
,
private
$rootScope
)
{}
addDirective
(
element
,
name
,
scope
)
{
addDirective
(
element
,
name
,
scope
)
{
var
child
=
angular
.
element
(
document
.
createElement
(
name
));
var
child
=
angular
.
element
(
document
.
createElement
(
name
));
...
@@ -16,25 +16,35 @@ class DynamicDirectiveSrv {
...
@@ -16,25 +16,35 @@ class DynamicDirectiveSrv {
element
.
append
(
child
);
element
.
append
(
child
);
}
}
link
(
scope
,
elem
,
attrs
,
options
)
{
options
.
directive
(
scope
).
then
(
directiveInfo
=>
{
if
(
!
directiveInfo
||
!
directiveInfo
.
fn
)
{
elem
.
empty
();
return
;
}
if
(
!
directiveInfo
.
fn
.
registered
)
{
coreModule
.
directive
(
attrs
.
$normalize
(
directiveInfo
.
name
),
directiveInfo
.
fn
);
directiveInfo
.
fn
.
registered
=
true
;
}
this
.
addDirective
(
elem
,
directiveInfo
.
name
,
scope
);
}).
catch
(
err
=>
{
console
.
log
(
'Plugin load:'
,
err
);
this
.
$rootScope
.
appEvent
(
'alert-error'
,
[
'Plugin error'
,
err
.
toString
()]);
});
}
create
(
options
)
{
create
(
options
)
{
let
directiveDef
=
{
let
directiveDef
=
{
restrict
:
'E'
,
restrict
:
'E'
,
scope
:
options
.
scope
,
scope
:
options
.
scope
,
link
:
(
scope
,
elem
,
attrs
)
=>
{
link
:
(
scope
,
elem
,
attrs
)
=>
{
options
.
directive
(
scope
).
then
(
directiveInfo
=>
{
if
(
options
.
watch
)
{
if
(
!
directiveInfo
||
!
directiveInfo
.
fn
)
{
scope
.
$watch
(
options
.
watch
,()
=>
this
.
link
(
scope
,
elem
,
attrs
,
options
));
return
;
}
else
{
}
this
.
link
(
scope
,
elem
,
attrs
,
options
);
}
if
(
!
directiveInfo
.
fn
.
registered
)
{
coreModule
.
directive
(
attrs
.
$normalize
(
directiveInfo
.
name
),
directiveInfo
.
fn
);
directiveInfo
.
fn
.
registered
=
true
;
}
this
.
addDirective
(
elem
,
directiveInfo
.
name
,
scope
);
}).
catch
(
function
(
err
)
{
console
.
log
(
'Dynamic directive load error: '
,
err
);
});
}
}
};
};
...
...
public/app/features/all.js
View file @
6c6c3a50
define
([
define
([
'./panellinks/module'
,
'./panellinks/module'
,
'./dashlinks/module'
,
'./dashlinks/module'
,
'./annotations/annotations
S
rv'
,
'./annotations/annotations
_s
rv'
,
'./templating/templateSrv'
,
'./templating/templateSrv'
,
'./dashboard/all'
,
'./dashboard/all'
,
'./playlist/all'
,
'./playlist/all'
,
...
...
public/app/features/annotations/annotations
S
rv.js
→
public/app/features/annotations/annotations
_s
rv.js
View file @
6c6c3a50
define
([
define
([
'angular'
,
'angular'
,
'lodash'
,
'lodash'
,
'./editorCtrl'
'./editor_ctrl'
,
'./query_editor'
],
function
(
angular
,
_
)
{
],
function
(
angular
,
_
)
{
'use strict'
;
'use strict'
;
...
...
public/app/features/annotations/editor
C
trl.js
→
public/app/features/annotations/editor
_c
trl.js
View file @
6c6c3a50
File moved
public/app/features/annotations/partials/editor.html
View file @
6c6c3a50
...
@@ -91,10 +91,8 @@
...
@@ -91,10 +91,8 @@
</div>
</div>
</div>
</div>
<annnotations-ds-query-editor
<annotations-query-editor
datasource=
"currentDatasource"
annotation=
"currentAnnotation"
>
datasource=
"currentAnnotation.datasource"
</annotations-query-editor>
current-annotation=
"currentAnnotation"
></annotations-ds-query-editor>
<datasource-editor-view
datasource=
"currentAnnotation.datasource"
name=
"annotations-query-editor"
></datasource-editor-view>
<br>
<br>
<button
ng-show=
"mode === 'new'"
type=
"button"
class=
"btn btn-success"
ng-click=
"add()"
>
Add
</button>
<button
ng-show=
"mode === 'new'"
type=
"button"
class=
"btn btn-success"
ng-click=
"add()"
>
Add
</button>
...
...
public/app/features/annotations/query_editor.ts
0 → 100644
View file @
6c6c3a50
///<reference path="../../headers/common.d.ts" />
import
angular
from
'angular'
;
/** @ngInject */
function
annotationsQueryEditor
(
dynamicDirectiveSrv
)
{
return
dynamicDirectiveSrv
.
create
({
scope
:
{
annotation
:
"="
,
datasource
:
"="
},
watch
:
"datasource.type"
,
directive
:
scope
=>
{
console
.
log
(
scope
.
datasource
);
return
System
.
import
(
scope
.
datasource
.
meta
.
module
).
then
(
function
(
dsModule
)
{
return
{
name
:
'annotation-query-editor-'
+
scope
.
datasource
.
meta
.
id
,
fn
:
dsModule
.
annotationsQueryEditor
,
};
});
},
});
}
angular
.
module
(
'grafana.directives'
).
directive
(
'annotationsQueryEditor'
,
annotationsQueryEditor
);
public/app/features/apps/all.ts
View file @
6c6c3a50
import
'./edit_ctrl'
;
import
'./edit_ctrl'
;
import
'./list_ctrl'
;
import
'./list_ctrl'
;
import
'./config_
loader
'
;
import
'./config_
view
'
;
public/app/features/dashboard/keybindings.js
View file @
6c6c3a50
...
@@ -52,7 +52,7 @@ function(angular, $) {
...
@@ -52,7 +52,7 @@ function(angular, $) {
scope
.
appEvent
(
'save-dashboard'
,
evt
);
scope
.
appEvent
(
'save-dashboard'
,
evt
);
},
{
inputDisabled
:
true
});
},
{
inputDisabled
:
true
});
keyboardManager
.
bind
(
'
ctrl+
r'
,
function
()
{
keyboardManager
.
bind
(
'r'
,
function
()
{
scope
.
broadcastRefresh
();
scope
.
broadcastRefresh
();
},
{
inputDisabled
:
true
});
},
{
inputDisabled
:
true
});
...
...
public/app/features/panel/panel_directive.js
View file @
6c6c3a50
...
@@ -43,20 +43,6 @@ function (angular, $, config) {
...
@@ -43,20 +43,6 @@ function (angular, $, config) {
};
};
});
});
module
.
directive
(
'datasourceEditorView'
,
function
(
dynamicDirectiveSrv
)
{
return
{
restrict
:
'E'
,
link
:
function
(
scope
,
elem
,
attrs
)
{
dynamicDirectiveSrv
.
define
({
datasourceProperty
:
attrs
.
datasource
,
name
:
attrs
.
name
,
scope
:
scope
,
parentElem
:
elem
,
});
}
};
});
module
.
directive
(
'queryEditorLoader'
,
function
(
$compile
,
$parse
,
datasourceSrv
)
{
module
.
directive
(
'queryEditorLoader'
,
function
(
$compile
,
$parse
,
datasourceSrv
)
{
return
{
return
{
restrict
:
'E'
,
restrict
:
'E'
,
...
...
public/app/partials/help_modal.html
View file @
6c6c3a50
...
@@ -25,6 +25,10 @@
...
@@ -25,6 +25,10 @@
<td>
Open dashboard search view (also contains import/playlist controls)
</td>
<td>
Open dashboard search view (also contains import/playlist controls)
</td>
</tr>
</tr>
<tr>
<tr>
<td><span
class=
"label label-info"
>
R
</span></td>
<td>
Refresh (Fetches new data and rerenders panels)
</td>
</tr>
<tr>
<td><span
class=
"label label-info"
>
CTRL+S
</span></td>
<td><span
class=
"label label-info"
>
CTRL+S
</span></td>
<td>
Save dashboard
</td>
<td>
Save dashboard
</td>
</tr>
</tr>
...
@@ -37,10 +41,6 @@
...
@@ -37,10 +41,6 @@
<td>
Zoom out
</td>
<td>
Zoom out
</td>
</tr>
</tr>
<tr>
<tr>
<td><span
class=
"label label-info"
>
CTRL+R
</span></td>
<td>
Refresh (Fetches new data and rerenders panels)
</td>
</tr>
<tr>
<td><span
class=
"label label-info"
>
CTRL+O
</span></td>
<td><span
class=
"label label-info"
>
CTRL+O
</span></td>
<td>
Enable/Disable shared graph crosshair
</td>
<td>
Enable/Disable shared graph crosshair
</td>
</tr>
</tr>
...
...
public/app/plugins/datasource/cloudwatch/module.js
View file @
6c6c3a50
...
@@ -29,11 +29,12 @@ function (angular, CloudWatchDatasource) {
...
@@ -29,11 +29,12 @@ function (angular, CloudWatchDatasource) {
};
};
});
});
module
.
directive
(
'datasourceCustomSettingsViewCloudwatch'
,
function
()
{
function
configView
()
{
return
{
templateUrl
:
'app/plugins/datasource/cloudwatch/partials/edit_view.html'
};
return
{
templateUrl
:
'app/plugins/datasource/cloudwatch/partials/edit_view.html'
};
}
);
}
return
{
return
{
Datasource
:
CloudWatchDatasource
Datasource
:
CloudWatchDatasource
,
configView
:
configView
,
};
};
});
});
public/app/plugins/datasource/elasticsearch/module.js
View file @
6c6c3a50
...
@@ -10,18 +10,6 @@ function (angular, ElasticDatasource, editView) {
...
@@ -10,18 +10,6 @@ function (angular, ElasticDatasource, editView) {
var
module
=
angular
.
module
(
'grafana.directives'
);
var
module
=
angular
.
module
(
'grafana.directives'
);
module
.
directive
(
'metricQueryEditorElasticsearch'
,
function
()
{
return
{
controller
:
'ElasticQueryCtrl'
,
templateUrl
:
'app/plugins/datasource/elasticsearch/partials/query.editor.html'
};
});
module
.
directive
(
'metricQueryOptionsElasticsearch'
,
function
()
{
return
{
templateUrl
:
'app/plugins/datasource/elasticsearch/partials/query.options.html'
};
});
module
.
directive
(
'annotationsQueryEditorElasticsearch'
,
function
()
{
return
{
templateUrl
:
'app/plugins/datasource/elasticsearch/partials/annotations.editor.html'
};
});
module
.
directive
(
'elasticMetricAgg'
,
function
()
{
module
.
directive
(
'elasticMetricAgg'
,
function
()
{
return
{
return
{
templateUrl
:
'app/plugins/datasource/elasticsearch/partials/metric_agg.html'
,
templateUrl
:
'app/plugins/datasource/elasticsearch/partials/metric_agg.html'
,
...
@@ -51,11 +39,22 @@ function (angular, ElasticDatasource, editView) {
...
@@ -51,11 +39,22 @@ function (angular, ElasticDatasource, editView) {
};
};
});
});
module
.
directive
(
'datasourceCustomSettingsViewElasticsearch'
,
editView
.
default
);
module
.
directive
(
'metricQueryEditorElasticsearch'
,
function
()
{
return
{
controller
:
'ElasticQueryCtrl'
,
templateUrl
:
'app/plugins/datasource/elasticsearch/partials/query.editor.html'
};
});
module
.
directive
(
'metricQueryOptionsElasticsearch'
,
function
()
{
return
{
templateUrl
:
'app/plugins/datasource/elasticsearch/partials/query.options.html'
};
});
function
annotationsQueryEditor
()
{
return
{
templateUrl
:
'app/plugins/datasource/elasticsearch/partials/annotations.editor.html'
};
}
return
{
return
{
Datasource
:
ElasticDatasource
,
Datasource
:
ElasticDatasource
,
configView
:
editView
.
default
,
configView
:
editView
.
default
,
annotationsQueryEditor
:
annotationsQueryEditor
,
};
};
});
});
public/app/plugins/datasource/graphite/module.js
View file @
6c6c3a50
...
@@ -15,15 +15,17 @@ function (angular, GraphiteDatasource) {
...
@@ -15,15 +15,17 @@ function (angular, GraphiteDatasource) {
return
{
templateUrl
:
'app/plugins/datasource/graphite/partials/query.options.html'
};
return
{
templateUrl
:
'app/plugins/datasource/graphite/partials/query.options.html'
};
});
});
module
.
directive
(
'annotationsQueryEditorGraphite'
,
function
()
{
function
annotationsQueryEditor
()
{
return
{
templateUrl
:
'app/plugins/datasource/graphite/partials/annotations.editor.html'
};
return
{
templateUrl
:
'app/plugins/datasource/graphite/partials/annotations.editor.html'
};
}
);
}
module
.
directive
(
'datasourceCustomSettingsViewGraphite'
,
function
()
{
function
configView
()
{
return
{
templateUrl
:
'app/plugins/datasource/graphite/partials/config.html'
};
return
{
templateUrl
:
'app/plugins/datasource/graphite/partials/config.html'
};
}
);
}
return
{
return
{
Datasource
:
GraphiteDatasource
,
Datasource
:
GraphiteDatasource
,
configView
:
configView
,
annotationsQueryEditor
:
annotationsQueryEditor
,
};
};
});
});
public/app/plugins/datasource/graphite/partials/annotations.editor.html
View file @
6c6c3a50
<div
class=
"editor-row"
>
<div
class=
"editor-row"
>
<div
class=
"editor-option"
>
<div
class=
"editor-option"
>
<label
class=
"small"
>
Graphite target expression
</label>
<label
class=
"small"
>
Graphite target expression
</label>
<input
type=
"text"
class=
"span10"
ng-model=
'
currentA
nnotation.target'
placeholder=
""
></input>
<input
type=
"text"
class=
"span10"
ng-model=
'
a
nnotation.target'
placeholder=
""
></input>
</div>
</div>
</div>
</div>
<div
class=
"editor-row"
>
<div
class=
"editor-row"
>
<div
class=
"editor-option"
>
<div
class=
"editor-option"
>
<label
class=
"small"
>
Graphite event tags
</label>
<label
class=
"small"
>
Graphite event tags
</label>
<input
type=
"text"
ng-model=
'
currentA
nnotation.tags'
placeholder=
""
></input>
<input
type=
"text"
ng-model=
'
a
nnotation.tags'
placeholder=
""
></input>
</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