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
dc7f98de
Commit
dc7f98de
authored
Jan 08, 2019
by
Erik Sundell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use correct event handler name convention. register directive on startup
parent
f9f51d68
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
53 additions
and
57 deletions
+53
-57
public/app/core/angular_wrappers.ts
+8
-0
public/app/plugins/datasource/stackdriver/annotations_query_ctrl.ts
+2
-2
public/app/plugins/datasource/stackdriver/components/Aggregations.tsx
+2
-2
public/app/plugins/datasource/stackdriver/components/AliasBy.tsx
+7
-8
public/app/plugins/datasource/stackdriver/components/AnnotationQueryEditor.tsx
+6
-6
public/app/plugins/datasource/stackdriver/components/Help.tsx
+4
-4
public/app/plugins/datasource/stackdriver/components/Metrics.tsx
+5
-5
public/app/plugins/datasource/stackdriver/components/QueryEditor.tsx
+9
-9
public/app/plugins/datasource/stackdriver/components/VariableQueryEditor.tsx
+2
-2
public/app/plugins/datasource/stackdriver/partials/annotations.editor.html
+1
-1
public/app/plugins/datasource/stackdriver/partials/query.editor.html
+3
-4
public/app/plugins/datasource/stackdriver/query_ctrl.ts
+4
-14
No files found.
public/app/core/angular_wrappers.ts
View file @
dc7f98de
import
{
react2AngularDirective
}
from
'app/core/utils/react2angular'
;
import
{
QueryEditor
}
from
'app/plugins/datasource/stackdriver/components/QueryEditor'
;
import
{
PasswordStrength
}
from
'./components/PasswordStrength'
;
import
PageHeader
from
'./components/PageHeader/PageHeader'
;
import
EmptyListCTA
from
'./components/EmptyListCTA/EmptyListCTA'
;
...
...
@@ -29,4 +30,11 @@ export function registerAngularDirectives() {
'placeholder'
,
[
'variables'
,
{
watchDepth
:
'reference'
}],
]);
react2AngularDirective
(
'queryEditor'
,
QueryEditor
,
[
'target'
,
'onQueryChange'
,
'onExecuteQuery'
,
[
'events'
,
{
watchDepth
:
'reference'
}],
[
'datasource'
,
{
watchDepth
:
'reference'
}],
]);
}
public/app/plugins/datasource/stackdriver/annotations_query_ctrl.ts
View file @
dc7f98de
...
...
@@ -7,7 +7,7 @@ export class StackdriverAnnotationsQueryCtrl {
constructor
()
{
this
.
annotation
.
target
=
this
.
annotation
.
target
||
{};
this
.
handleQueryChange
=
this
.
handle
QueryChange
.
bind
(
this
);
this
.
onQueryChange
=
this
.
on
QueryChange
.
bind
(
this
);
react2AngularDirective
(
'annotationQueryEditor'
,
AnnotationQueryEditor
,
[
'target'
,
...
...
@@ -17,7 +17,7 @@ export class StackdriverAnnotationsQueryCtrl {
]);
}
handle
QueryChange
(
target
)
{
on
QueryChange
(
target
)
{
Object
.
assign
(
this
.
annotation
.
target
,
target
);
}
}
public/app/plugins/datasource/stackdriver/components/Aggregations.tsx
View file @
dc7f98de
...
...
@@ -52,7 +52,7 @@ export class Aggregations extends React.Component<Props, State> {
this
.
setState
({
aggOptions
});
}
handle
ToggleDisplayAdvanced
()
{
on
ToggleDisplayAdvanced
()
{
this
.
setState
(
state
=>
({
displayAdvancedOptions
:
!
state
.
displayAdvancedOptions
,
}));
...
...
@@ -78,7 +78,7 @@ export class Aggregations extends React.Component<Props, State> {
</
div
>
<
div
className=
"gf-form gf-form--grow"
>
<
label
className=
"gf-form-label gf-form-label--grow"
>
<
a
onClick=
{
()
=>
this
.
handle
ToggleDisplayAdvanced
()
}
>
<
a
onClick=
{
()
=>
this
.
on
ToggleDisplayAdvanced
()
}
>
<>
<
i
className=
{
`fa fa-caret-${displayAdvancedOptions ? 'down' : 'right'}`
}
/>
Advanced Options
</>
...
...
public/app/plugins/datasource/stackdriver/components/AliasBy.tsx
View file @
dc7f98de
...
...
@@ -13,8 +13,7 @@ export interface State {
export
class
AliasBy
extends
Component
<
Props
,
State
>
{
constructor
(
props
)
{
super
(
props
);
this
.
handleChange
=
this
.
handleChange
.
bind
(
this
);
this
.
onChange
=
debounce
(
this
.
onChange
.
bind
(
this
),
500
);
this
.
updateQuery
=
debounce
(
this
.
updateQuery
.
bind
(
this
),
500
);
this
.
state
=
{
value
:
''
};
}
...
...
@@ -28,18 +27,18 @@ export class AliasBy extends Component<Props, State> {
}
}
handle
Change
(
e
)
{
on
Change
(
e
)
{
this
.
setState
({
value
:
e
.
target
.
value
});
this
.
onChange
(
e
.
target
.
value
);
this
.
updateQuery
(
e
.
target
.
value
);
}
onChange
(
value
)
{
updateQuery
(
value
)
{
this
.
props
.
onChange
(
value
);
}
render
()
{
return
(
<>
<
React
.
Fragment
>
<
div
className=
"gf-form-inline"
>
<
div
className=
"gf-form"
>
<
label
className=
"gf-form-label query-keyword width-9"
>
Alias By
</
label
>
...
...
@@ -47,14 +46,14 @@ export class AliasBy extends Component<Props, State> {
type=
"text"
className=
"gf-form-input width-24"
value=
{
this
.
state
.
value
}
onChange=
{
this
.
handleChange
}
onChange=
{
e
=>
this
.
onChange
(
e
)
}
/>
</
div
>
<
div
className=
"gf-form gf-form--grow"
>
<
div
className=
"gf-form-label gf-form-label--grow"
/>
</
div
>
</
div
>
</>
</
React
.
Fragment
>
);
}
}
public/app/plugins/datasource/stackdriver/components/AnnotationQueryEditor.tsx
View file @
dc7f98de
...
...
@@ -36,7 +36,7 @@ export class AnnotationQueryEditor extends React.Component<Props, State> {
});
}
handle
MetricTypeChange
({
valueType
,
metricKind
,
type
,
unit
})
{
on
MetricTypeChange
({
valueType
,
metricKind
,
type
,
unit
})
{
const
{
onQueryChange
}
=
this
.
props
;
this
.
setState
(
{
...
...
@@ -51,7 +51,7 @@ export class AnnotationQueryEditor extends React.Component<Props, State> {
);
}
handle
Change
(
prop
,
value
)
{
on
Change
(
prop
,
value
)
{
this
.
setState
({
[
prop
]:
value
},
()
=>
{
this
.
props
.
onQueryChange
(
this
.
state
);
});
...
...
@@ -68,12 +68,12 @@ export class AnnotationQueryEditor extends React.Component<Props, State> {
metricType=
{
metricType
}
templateSrv=
{
datasource
.
templateSrv
}
datasource=
{
datasource
}
onChange=
{
value
=>
this
.
handle
MetricTypeChange
(
value
)
}
onChange=
{
value
=>
this
.
on
MetricTypeChange
(
value
)
}
>
{
metric
=>
(
<>
<
Filter
filtersChanged=
{
value
=>
this
.
handle
Change
(
'filters'
,
value
)
}
filtersChanged=
{
value
=>
this
.
on
Change
(
'filters'
,
value
)
}
filters=
{
filters
}
refId=
{
refId
}
hideGroupBys=
{
true
}
...
...
@@ -91,7 +91,7 @@ export class AnnotationQueryEditor extends React.Component<Props, State> {
type=
"text"
className=
"gf-form-input width-20"
value=
{
title
}
onChange=
{
e
=>
this
.
handle
Change
(
'title'
,
e
.
target
.
value
)
}
onChange=
{
e
=>
this
.
on
Change
(
'title'
,
e
.
target
.
value
)
}
/>
</
div
>
<
div
className=
"gf-form"
>
...
...
@@ -100,7 +100,7 @@ export class AnnotationQueryEditor extends React.Component<Props, State> {
type=
"text"
className=
"gf-form-input width-20"
value=
{
text
}
onChange=
{
e
=>
this
.
handle
Change
(
'text'
,
e
.
target
.
value
)
}
onChange=
{
e
=>
this
.
on
Change
(
'text'
,
e
.
target
.
value
)
}
/>
</
div
>
<
div
className=
"gf-form gf-form--grow"
>
...
...
public/app/plugins/datasource/stackdriver/components/Help.tsx
View file @
dc7f98de
...
...
@@ -18,11 +18,11 @@ export class Help extends React.Component<Props, State> {
displaRawQuery
:
false
,
};
handle
HelpClicked
()
{
on
HelpClicked
()
{
this
.
setState
({
displayHelp
:
!
this
.
state
.
displayHelp
});
}
handle
RawQueryClicked
()
{
on
RawQueryClicked
()
{
this
.
setState
({
displaRawQuery
:
!
this
.
state
.
displaRawQuery
});
}
...
...
@@ -38,7 +38,7 @@ export class Help extends React.Component<Props, State> {
<>
<
div
className=
"gf-form-inline"
>
<
Project
datasource=
{
datasource
}
/>
<
div
className=
"gf-form"
onClick=
{
()
=>
this
.
handle
HelpClicked
()
}
>
<
div
className=
"gf-form"
onClick=
{
()
=>
this
.
on
HelpClicked
()
}
>
<
label
className=
"gf-form-label query-keyword"
>
Show Help
<
i
className=
{
`fa fa-caret-${displayHelp ? 'down' : 'right'}`
}
/>
...
...
@@ -46,7 +46,7 @@ export class Help extends React.Component<Props, State> {
</
div
>
{
rawQuery
&&
(
<
div
className=
"gf-form"
onClick=
{
()
=>
this
.
handle
RawQueryClicked
()
}
>
<
div
className=
"gf-form"
onClick=
{
()
=>
this
.
on
RawQueryClicked
()
}
>
<
label
className=
"gf-form-label query-keyword"
>
Raw Query
<
i
className=
{
`fa fa-caret-${displaRawQuery ? 'down' : 'right'}`
}
ng
-
show=
"ctrl.showHelp"
/>
...
...
public/app/plugins/datasource/stackdriver/components/Metrics.tsx
View file @
dc7f98de
...
...
@@ -98,7 +98,7 @@ export class Metrics extends React.Component<Props, State> {
return
metricsByService
;
}
handle
ServiceChange
(
service
)
{
on
ServiceChange
(
service
)
{
const
{
metricDescriptors
}
=
this
.
state
;
const
{
templateSrv
,
metricType
}
=
this
.
props
;
...
...
@@ -112,11 +112,11 @@ export class Metrics extends React.Component<Props, State> {
this
.
setState
({
service
,
metrics
});
if
(
metrics
.
length
>
0
&&
!
metrics
.
some
(
m
=>
m
.
value
===
templateSrv
.
replace
(
metricType
)))
{
this
.
handle
MetricTypeChange
(
metrics
[
0
].
value
);
this
.
on
MetricTypeChange
(
metrics
[
0
].
value
);
}
}
handle
MetricTypeChange
(
value
)
{
on
MetricTypeChange
(
value
)
{
const
metricDescriptor
=
this
.
getSelectedMetricDescriptor
(
value
);
this
.
setState
({
metricDescriptor
});
this
.
props
.
onChange
({
...
metricDescriptor
,
type
:
value
});
...
...
@@ -151,7 +151,7 @@ export class Metrics extends React.Component<Props, State> {
<
div
className=
"gf-form"
>
<
span
className=
"gf-form-label width-9 query-keyword"
>
Service
</
span
>
<
MetricSelect
onChange=
{
value
=>
this
.
handle
ServiceChange
(
value
)
}
onChange=
{
value
=>
this
.
on
ServiceChange
(
value
)
}
value=
{
service
}
options=
{
services
}
isSearchable=
{
false
}
...
...
@@ -167,7 +167,7 @@ export class Metrics extends React.Component<Props, State> {
<
div
className=
"gf-form"
>
<
span
className=
"gf-form-label width-9 query-keyword"
>
Metric
</
span
>
<
MetricSelect
onChange=
{
value
=>
this
.
handle
MetricTypeChange
(
value
)
}
onChange=
{
value
=>
this
.
on
MetricTypeChange
(
value
)
}
value=
{
metricType
}
variables=
{
templateSrv
.
variables
}
options=
{
[
...
...
public/app/plugins/datasource/stackdriver/components/QueryEditor.tsx
View file @
dc7f98de
...
...
@@ -91,7 +91,7 @@ export class QueryEditor extends React.Component<Props, State> {
this
.
setState
({
lastQuery
,
lastQueryError
});
}
handle
MetricTypeChange
({
valueType
,
metricKind
,
type
,
unit
})
{
on
MetricTypeChange
({
valueType
,
metricKind
,
type
,
unit
})
{
const
{
datasource
,
onQueryChange
,
onExecuteQuery
}
=
this
.
props
;
const
{
perSeriesAligner
,
alignOptions
}
=
getAlignmentPickerData
(
{
valueType
,
metricKind
,
perSeriesAligner
:
this
.
state
.
perSeriesAligner
},
...
...
@@ -113,7 +113,7 @@ export class QueryEditor extends React.Component<Props, State> {
);
}
handle
Change
(
prop
,
value
)
{
onProperty
Change
(
prop
,
value
)
{
this
.
setState
({
[
prop
]:
value
},
()
=>
{
this
.
props
.
onQueryChange
(
this
.
state
);
this
.
props
.
onExecuteQuery
();
...
...
@@ -144,13 +144,13 @@ export class QueryEditor extends React.Component<Props, State> {
metricType=
{
metricType
}
templateSrv=
{
datasource
.
templateSrv
}
datasource=
{
datasource
}
onChange=
{
value
=>
this
.
handle
MetricTypeChange
(
value
)
}
onChange=
{
value
=>
this
.
on
MetricTypeChange
(
value
)
}
>
{
metric
=>
(
<>
<
Filter
filtersChanged=
{
value
=>
this
.
handle
Change
(
'filters'
,
value
)
}
groupBysChanged=
{
value
=>
this
.
handle
Change
(
'groupBys'
,
value
)
}
filtersChanged=
{
value
=>
this
.
onProperty
Change
(
'filters'
,
value
)
}
groupBysChanged=
{
value
=>
this
.
onProperty
Change
(
'groupBys'
,
value
)
}
filters=
{
filters
}
groupBys=
{
groupBys
}
refId=
{
refId
}
...
...
@@ -164,7 +164,7 @@ export class QueryEditor extends React.Component<Props, State> {
templateSrv=
{
datasource
.
templateSrv
}
crossSeriesReducer=
{
crossSeriesReducer
}
groupBys=
{
groupBys
}
onChange=
{
value
=>
this
.
handle
Change
(
'crossSeriesReducer'
,
value
)
}
onChange=
{
value
=>
this
.
onProperty
Change
(
'crossSeriesReducer'
,
value
)
}
>
{
displayAdvancedOptions
=>
displayAdvancedOptions
&&
(
...
...
@@ -172,16 +172,16 @@ export class QueryEditor extends React.Component<Props, State> {
alignOptions=
{
alignOptions
}
templateSrv=
{
datasource
.
templateSrv
}
perSeriesAligner=
{
perSeriesAligner
}
onChange=
{
value
=>
this
.
handle
Change
(
'perSeriesAligner'
,
value
)
}
onChange=
{
value
=>
this
.
onProperty
Change
(
'perSeriesAligner'
,
value
)
}
/>
)
}
</
Aggregations
>
<
AliasBy
value=
{
aliasBy
}
onChange=
{
value
=>
this
.
handle
Change
(
'aliasBy'
,
value
)
}
/>
<
AliasBy
value=
{
aliasBy
}
onChange=
{
value
=>
this
.
onProperty
Change
(
'aliasBy'
,
value
)
}
/>
<
AlignmentPeriods
templateSrv=
{
datasource
.
templateSrv
}
alignmentPeriod=
{
alignmentPeriod
}
onChange=
{
value
=>
this
.
handle
Change
(
'alignmentPeriod'
,
value
)
}
onChange=
{
value
=>
this
.
onProperty
Change
(
'alignmentPeriod'
,
value
)
}
/>
<
Help
datasource=
{
datasource
}
rawQuery=
{
lastQuery
}
lastQueryError=
{
lastQueryError
}
/>
</>
...
...
public/app/plugins/datasource/stackdriver/components/VariableQueryEditor.tsx
View file @
dc7f98de
...
...
@@ -63,7 +63,7 @@ export class StackdriverVariableQueryEditor extends PureComponent<VariableQueryP
this
.
setState
(
state
);
}
async
handle
QueryTypeChange
(
event
)
{
async
on
QueryTypeChange
(
event
)
{
const
state
:
any
=
{
selectedQueryType
:
event
.
target
.
value
,
...
await
this
.
getLabels
(
this
.
state
.
selectedMetricType
,
event
.
target
.
value
),
...
...
@@ -186,7 +186,7 @@ export class StackdriverVariableQueryEditor extends PureComponent<VariableQueryP
<
SimpleSelect
value=
{
this
.
state
.
selectedQueryType
}
options=
{
this
.
queryTypes
}
onValueChange=
{
e
=>
this
.
handle
QueryTypeChange
(
e
)
}
onValueChange=
{
e
=>
this
.
on
QueryTypeChange
(
e
)
}
label=
"Query Type"
/>
{
this
.
renderQueryTypeSwitch
(
this
.
state
.
selectedQueryType
)
}
...
...
public/app/plugins/datasource/stackdriver/partials/annotations.editor.html
View file @
dc7f98de
<annotation-query-editor
target=
"ctrl.annotation.target"
on-query-change=
"(ctrl.
handle
QueryChange)"
on-query-change=
"(ctrl.
on
QueryChange)"
datasource=
"ctrl.datasource"
></annotation-query-editor>
public/app/plugins/datasource/stackdriver/partials/query.editor.html
View file @
dc7f98de
...
...
@@ -3,7 +3,7 @@
target=
"ctrl.target"
events=
"ctrl.panelCtrl.events"
datasource=
"ctrl.datasource"
on-query-change=
"(ctrl.
handle
QueryChange)"
on-execute-query=
"(ctrl.
handle
ExecuteQuery)"
on-query-change=
"(ctrl.
on
QueryChange)"
on-execute-query=
"(ctrl.
on
ExecuteQuery)"
></query-editor>
</query-editor-row>
\ No newline at end of file
</query-editor-row>
public/app/plugins/datasource/stackdriver/query_ctrl.ts
View file @
dc7f98de
import
_
from
'lodash'
;
import
{
QueryCtrl
}
from
'app/plugins/sdk'
;
import
{
react2AngularDirective
}
from
'app/core/utils/react2angular'
;
import
{
QueryEditor
}
from
'./components/QueryEditor'
;
import
{
Target
}
from
'./types'
;
export
class
StackdriverQueryCtrl
extends
QueryCtrl
{
...
...
@@ -12,22 +9,15 @@ export class StackdriverQueryCtrl extends QueryCtrl {
/** @ngInject */
constructor
(
$scope
,
$injector
)
{
super
(
$scope
,
$injector
);
this
.
handleQueryChange
=
this
.
handleQueryChange
.
bind
(
this
);
this
.
handleExecuteQuery
=
this
.
handleExecuteQuery
.
bind
(
this
);
react2AngularDirective
(
'queryEditor'
,
QueryEditor
,
[
'target'
,
'onQueryChange'
,
'onExecuteQuery'
,
[
'events'
,
{
watchDepth
:
'reference'
}],
[
'datasource'
,
{
watchDepth
:
'reference'
}],
]);
this
.
onQueryChange
=
this
.
onQueryChange
.
bind
(
this
);
this
.
onExecuteQuery
=
this
.
onExecuteQuery
.
bind
(
this
);
}
handle
QueryChange
(
target
:
Target
)
{
on
QueryChange
(
target
:
Target
)
{
Object
.
assign
(
this
.
target
,
target
);
}
handle
ExecuteQuery
()
{
on
ExecuteQuery
()
{
this
.
$scope
.
ctrl
.
refresh
();
}
}
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