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
2fb721d3
Commit
2fb721d3
authored
Oct 14, 2018
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
various fixes to to queries tab (in react mode)
parent
8e85295b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
49 additions
and
34 deletions
+49
-34
public/app/features/dashboard/dashgrid/QueriesTab.tsx
+9
-7
public/app/features/dashboard/panel_model.ts
+11
-1
public/app/features/dashboard/specs/exporter.test.ts
+1
-1
public/app/features/panel/metrics_panel_ctrl.ts
+0
-22
public/app/features/panel/metrics_tab.ts
+28
-2
public/app/plugins/panel/graph/module.ts
+0
-1
No files found.
public/app/features/dashboard/dashgrid/QueriesTab.tsx
View file @
2fb721d3
import
React
from
'react'
;
// Libraries
import
React
,
{
PureComponent
}
from
'react'
;
// Services & utils
import
{
getAngularLoader
,
AngularComponent
}
from
'app/core/services/AngularLoader'
;
// Types
import
{
PanelModel
}
from
'../panel_model'
;
import
{
DashboardModel
}
from
'../dashboard_model'
;
import
{
getAngularLoader
,
AngularComponent
}
from
'app/core/services/AngularLoader'
;
interface
Props
{
panel
:
PanelModel
;
dashboard
:
DashboardModel
;
}
export
class
QueriesTab
extends
React
.
Component
<
Props
,
any
>
{
export
class
QueriesTab
extends
PureComponent
<
Props
>
{
element
:
any
;
component
:
AngularComponent
;
...
...
@@ -29,10 +34,7 @@ export class QueriesTab extends React.Component<Props, any> {
ctrl
:
{
panel
:
panel
,
dashboard
:
dashboard
,
panelCtrl
:
{
panel
:
panel
,
dashboard
:
dashboard
,
},
refresh
:
()
=>
panel
.
refresh
(),
},
};
...
...
public/app/features/dashboard/panel_model.ts
View file @
2fb721d3
...
...
@@ -16,6 +16,12 @@ const notPersistedProperties: { [str: string]: boolean } = {
hasRefreshed
:
true
,
};
const
defaults
:
any
=
{
gridPos
:
{
x
:
0
,
y
:
0
,
h
:
3
,
w
:
6
},
datasource
:
null
,
targets
:
[{}],
};
export
class
PanelModel
{
id
:
number
;
gridPos
:
GridPos
;
...
...
@@ -51,7 +57,7 @@ export class PanelModel {
}
// defaults
this
.
gridPos
=
this
.
gridPos
||
{
x
:
0
,
y
:
0
,
h
:
3
,
w
:
6
}
;
_
.
defaultsDeep
(
this
,
_
.
cloneDeep
(
defaults
))
;
}
getSaveModel
()
{
...
...
@@ -61,6 +67,10 @@ export class PanelModel {
continue
;
}
if
(
_
.
isEqual
(
this
[
property
],
defaults
[
property
]))
{
continue
;
}
model
[
property
]
=
_
.
cloneDeep
(
this
[
property
]);
}
...
...
public/app/features/dashboard/specs/exporter.test.ts
View file @
2fb721d3
...
...
@@ -240,5 +240,5 @@ stubs['-- Grafana --'] = {
};
function
getStub
(
arg
)
{
return
Promise
.
resolve
(
stubs
[
arg
]);
return
Promise
.
resolve
(
stubs
[
arg
||
'gfdb'
]);
}
public/app/features/panel/metrics_panel_ctrl.ts
View file @
2fb721d3
...
...
@@ -12,7 +12,6 @@ import { metricsTabDirective } from './metrics_tab';
class
MetricsPanelCtrl
extends
PanelCtrl
{
scope
:
any
;
datasource
:
any
;
datasourceName
:
any
;
$q
:
any
;
$timeout
:
any
;
contextSrv
:
any
;
...
...
@@ -287,27 +286,6 @@ class MetricsPanelCtrl extends PanelCtrl {
});
}
setDatasource
(
datasource
)
{
// switching to mixed
if
(
datasource
.
meta
.
mixed
)
{
_
.
each
(
this
.
panel
.
targets
,
target
=>
{
target
.
datasource
=
this
.
panel
.
datasource
;
if
(
!
target
.
datasource
)
{
target
.
datasource
=
config
.
defaultDatasource
;
}
});
}
else
if
(
this
.
datasource
&&
this
.
datasource
.
meta
.
mixed
)
{
_
.
each
(
this
.
panel
.
targets
,
target
=>
{
delete
target
.
datasource
;
});
}
this
.
panel
.
datasource
=
datasource
.
value
;
this
.
datasourceName
=
datasource
.
name
;
this
.
datasource
=
null
;
this
.
refresh
();
}
getAdditionalMenuItems
()
{
const
items
=
[];
if
(
...
...
public/app/features/panel/metrics_tab.ts
View file @
2fb721d3
import
{
DashboardModel
}
from
'../dashboard/dashboard_model'
;
// Libraries
import
_
from
'lodash'
;
import
Remarkable
from
'remarkable'
;
// Services & utils
import
coreModule
from
'app/core/core_module'
;
import
config
from
'app/core/config'
;
// Types
import
{
DashboardModel
}
from
'../dashboard/dashboard_model'
;
export
class
MetricsTabCtrl
{
dsName
:
string
;
...
...
@@ -70,10 +77,29 @@ export class MetricsTabCtrl {
}
this
.
datasourceInstance
=
option
.
datasource
;
this
.
panelCtrl
.
setDatasource
(
option
.
datasource
);
this
.
setDatasource
(
option
.
datasource
);
this
.
updateDatasourceOptions
();
}
setDatasource
(
datasource
)
{
// switching to mixed
if
(
datasource
.
meta
.
mixed
)
{
_
.
each
(
this
.
panel
.
targets
,
target
=>
{
target
.
datasource
=
this
.
panel
.
datasource
;
if
(
!
target
.
datasource
)
{
target
.
datasource
=
config
.
defaultDatasource
;
}
});
}
else
if
(
this
.
datasourceInstance
&&
this
.
datasourceInstance
.
meta
.
mixed
)
{
_
.
each
(
this
.
panel
.
targets
,
target
=>
{
delete
target
.
datasource
;
});
}
this
.
panel
.
datasource
=
datasource
.
value
;
this
.
panel
.
refresh
();
}
addMixedQuery
(
option
)
{
if
(
!
option
)
{
return
;
...
...
public/app/plugins/panel/graph/module.ts
View file @
2fb721d3
...
...
@@ -179,7 +179,6 @@ class GraphCtrl extends MetricsPanelCtrl {
}
onDataReceived
(
dataList
)
{
console
.
log
(
dataList
);
this
.
dataList
=
dataList
;
this
.
seriesList
=
this
.
processor
.
getSeriesList
({
dataList
:
dataList
,
...
...
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