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
5fcb9662
Commit
5fcb9662
authored
May 19, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: query troubleshooter progress
parent
6ad1a396
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
30 deletions
+50
-30
public/app/core/components/collapse_box.ts
+7
-7
public/app/features/panel/query_troubleshooter.ts
+29
-19
public/app/plugins/datasource/influxdb/datasource.ts
+6
-4
public/sass/components/_collapse_box.scss
+8
-0
No files found.
public/app/core/components/collapse_box.ts
View file @
5fcb9662
...
...
@@ -10,7 +10,7 @@ const template = `
<span class="fa fa-fw fa-caret-down" ng-hide="!ctrl.isOpen"></span>
{{ctrl.title}}
</a>
<div class="collapse-box__header-actions" ng-transclude="actions"></div>
<div class="collapse-box__header-actions" ng-transclude="actions"
ng-if="ctrl.isOpen"
></div>
</div>
<div class="collapse-box__body" ng-transclude="body" ng-if="ctrl.isOpen">
</div>
...
...
@@ -19,18 +19,18 @@ const template = `
export
class
CollapseBoxCtrl
{
isOpen
:
boolean
;
onOpen
:
()
=>
void
;
stateChanged
:
()
=>
void
;
/** @ngInject **/
constructor
()
{
constructor
(
private
$timeout
)
{
this
.
isOpen
=
false
;
}
toggle
()
{
this
.
isOpen
=
!
this
.
isOpen
;
if
(
this
.
isOpen
)
{
this
.
onOpen
();
}
this
.
$timeout
(()
=>
{
this
.
stateChanged
();
}
);
}
}
...
...
@@ -44,7 +44,7 @@ export function collapseBox() {
scope
:
{
"title"
:
"@"
,
"isOpen"
:
"=?"
,
"
onOpen
"
:
"&"
"
stateChanged
"
:
"&"
},
transclude
:
{
'actions'
:
'?collapseBoxActions'
,
...
...
public/app/features/panel/query_troubleshooter.ts
View file @
5fcb9662
...
...
@@ -5,7 +5,8 @@ import appEvents from 'app/core/app_events';
import
{
coreModule
,
JsonExplorer
}
from
'app/core/core'
;
const
template
=
`
<collapse-box title="Query Troubleshooter" is-open="ctrl.showResponse" on-open="ctrl.onOpen()">
<collapse-box title="Query Troubleshooter" is-open="ctrl.isOpen" state-changed="ctrl.stateChanged()"
ng-class="{'collapse-box--error': ctrl.hasError}">
<collapse-box-actions>
<a class="pointer"><i class="fa fa-clipboard"></i> Copy to clipboard</a>
</collapse-box-actions>
...
...
@@ -16,38 +17,47 @@ const template = `
`
;
export
class
QueryTroubleshooterCtrl
{
responseData
:
any
;
isOpen
:
any
;
showResponse
:
boolean
;
panelCtrl
:
any
;
renderJsonExplorer
:
(
data
)
=>
void
;
onRequestErrorEventListener
:
any
;
onRequestResponseEventListener
:
any
;
hasError
:
boolean
;
/** @ngInject **/
constructor
(
$scope
,
private
$timeout
)
{
appEvents
.
on
(
'ds-request-response'
,
this
.
onRequestResponse
.
bind
(
this
),
$scope
);
appEvents
.
on
(
'ds-request-error'
,
this
.
onRequestError
.
bind
(
this
),
$scope
);
}
this
.
onRequestErrorEventListener
=
this
.
onRequestError
.
bind
(
this
);
this
.
onRequestResponseEventListener
=
this
.
onRequestResponse
.
bind
(
this
);
onRequestResponse
(
data
)
{
this
.
responseData
=
data
;
appEvents
.
on
(
'ds-request-error'
,
this
.
onRequestErrorEventListener
);
$scope
.
$on
(
'$destroy'
,
this
.
removeEventsListeners
.
bind
(
this
))
;
}
toggleShowResponse
()
{
this
.
showResponse
=
!
this
.
showResponse
;
removeEventsListeners
()
{
appEvents
.
off
(
'ds-request-response'
,
this
.
onRequestResponseEventListener
);
appEvents
.
off
(
'ds-request-error'
,
this
.
onRequestErrorEventListener
);
}
onRequestError
(
err
)
{
this
.
responseData
=
err
;
this
.
responseData
.
i
sError
=
true
;
this
.
showResponse
=
true
;
this
.
isOpen
=
true
;
this
.
ha
sError
=
true
;
this
.
onRequestResponse
(
err
)
;
}
onOpen
()
{
if
(
!
this
.
responseData
)
{
console
.
log
(
'no data'
);
return
;
stateChanged
()
{
console
.
log
(
this
.
isOpen
);
if
(
this
.
isOpen
)
{
appEvents
.
on
(
'ds-request-response'
,
this
.
onRequestResponseEventListener
);
this
.
panelCtrl
.
refresh
();
}
else
{
this
.
hasError
=
false
;
}
}
onRequestResponse
(
data
)
{
data
=
_
.
cloneDeep
(
data
);
var
data
=
this
.
responseData
;
if
(
data
.
headers
)
{
delete
data
.
headers
;
}
...
...
@@ -75,7 +85,7 @@ export class QueryTroubleshooterCtrl {
delete
data
.
$$config
;
}
this
.
$timeout
(
_
.
partial
(
this
.
renderJsonExplorer
,
data
)
,
10
);
this
.
$timeout
(
_
.
partial
(
this
.
renderJsonExplorer
,
data
));
}
}
...
...
@@ -94,7 +104,7 @@ export function queryTroubleshooter() {
ctrl
.
renderJsonExplorer
=
function
(
data
)
{
var
jsonElem
=
elem
.
find
(
'.query-troubleshooter-json'
);
const
formatter
=
new
JsonExplorer
(
data
,
2
,
{
const
formatter
=
new
JsonExplorer
(
data
,
3
,
{
theme
:
'dark'
,
});
...
...
public/app/plugins/datasource/influxdb/datasource.ts
View file @
5fcb9662
...
...
@@ -213,10 +213,12 @@ export default class InfluxDatasource {
var
currentUrl
=
self
.
urls
.
shift
();
self
.
urls
.
push
(
currentUrl
);
var
params
:
any
=
{
u
:
self
.
username
,
p
:
self
.
password
,
};
var
params
:
any
=
{};
if
(
self
.
username
)
{
params
.
username
=
self
.
username
;
params
.
password
=
self
.
password
;
}
if
(
self
.
database
)
{
params
.
db
=
self
.
database
;
...
...
public/sass/components/_collapse_box.scss
View file @
5fcb9662
.collapse-box
{
margin-bottom
:
$spacer
;
&
--error
{
.collapse-box__header
{
background-color
:
$red
;
color
:
$white
;
}
}
}
.collapse-box__header
{
...
...
@@ -27,3 +34,4 @@
border
:
$input-btn-border-width
solid
transparent
;
@include
border-radius
(
$label-border-radius-sm
);
}
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