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
884eef32
Commit
884eef32
authored
Apr 22, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4793 from daniellee/panel_defaults
fix(panels): avoid deep copy problem for panel defaults
parents
be19f888
16dbf316
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
161 additions
and
163 deletions
+161
-163
public/app/plugins/panel/graph/module.ts
+83
-83
public/app/plugins/panel/pluginlist/module.ts
+5
-5
public/app/plugins/panel/singlestat/module.ts
+39
-39
public/app/plugins/panel/table/module.ts
+28
-28
public/app/plugins/panel/text/module.ts
+6
-8
No files found.
public/app/plugins/panel/graph/module.ts
View file @
884eef32
...
@@ -13,85 +13,6 @@ import TimeSeries from 'app/core/time_series2';
...
@@ -13,85 +13,6 @@ import TimeSeries from 'app/core/time_series2';
import
*
as
fileExport
from
'app/core/utils/file_export'
;
import
*
as
fileExport
from
'app/core/utils/file_export'
;
import
{
MetricsPanelCtrl
}
from
'app/plugins/sdk'
;
import
{
MetricsPanelCtrl
}
from
'app/plugins/sdk'
;
var
panelDefaults
=
{
// datasource name, null = default datasource
datasource
:
null
,
// sets client side (flot) or native graphite png renderer (png)
renderer
:
'flot'
,
yaxes
:
[
{
label
:
null
,
show
:
true
,
logBase
:
1
,
min
:
null
,
max
:
null
,
format
:
'short'
},
{
label
:
null
,
show
:
true
,
logBase
:
1
,
min
:
null
,
max
:
null
,
format
:
'short'
}
],
xaxis
:
{
show
:
true
},
grid
:
{
threshold1
:
null
,
threshold2
:
null
,
threshold1Color
:
'rgba(216, 200, 27, 0.27)'
,
threshold2Color
:
'rgba(234, 112, 112, 0.22)'
},
// show/hide lines
lines
:
true
,
// fill factor
fill
:
1
,
// line width in pixels
linewidth
:
2
,
// show hide points
points
:
false
,
// point radius in pixels
pointradius
:
5
,
// show hide bars
bars
:
false
,
// enable/disable stacking
stack
:
false
,
// stack percentage mode
percentage
:
false
,
// legend options
legend
:
{
show
:
true
,
// disable/enable legend
values
:
false
,
// disable/enable legend values
min
:
false
,
max
:
false
,
current
:
false
,
total
:
false
,
avg
:
false
},
// how null points should be handled
nullPointMode
:
'connected'
,
// staircase line mode
steppedLine
:
false
,
// tooltip options
tooltip
:
{
value_type
:
'cumulative'
,
shared
:
true
,
msResolution
:
false
,
},
// time overrides
timeFrom
:
null
,
timeShift
:
null
,
// metric queries
targets
:
[{}],
// series color overrides
aliasColors
:
{},
// other style overrides
seriesOverrides
:
[],
};
class
GraphCtrl
extends
MetricsPanelCtrl
{
class
GraphCtrl
extends
MetricsPanelCtrl
{
static
template
=
template
;
static
template
=
template
;
...
@@ -105,14 +26,93 @@ class GraphCtrl extends MetricsPanelCtrl {
...
@@ -105,14 +26,93 @@ class GraphCtrl extends MetricsPanelCtrl {
datapointsWarning
:
boolean
;
datapointsWarning
:
boolean
;
colors
:
any
=
[];
colors
:
any
=
[];
panelDefaults
=
{
// datasource name, null = default datasource
datasource
:
null
,
// sets client side (flot) or native graphite png renderer (png)
renderer
:
'flot'
,
yaxes
:
[
{
label
:
null
,
show
:
true
,
logBase
:
1
,
min
:
null
,
max
:
null
,
format
:
'short'
},
{
label
:
null
,
show
:
true
,
logBase
:
1
,
min
:
null
,
max
:
null
,
format
:
'short'
}
],
xaxis
:
{
show
:
true
},
grid
:
{
threshold1
:
null
,
threshold2
:
null
,
threshold1Color
:
'rgba(216, 200, 27, 0.27)'
,
threshold2Color
:
'rgba(234, 112, 112, 0.22)'
},
// show/hide lines
lines
:
true
,
// fill factor
fill
:
1
,
// line width in pixels
linewidth
:
2
,
// show hide points
points
:
false
,
// point radius in pixels
pointradius
:
5
,
// show hide bars
bars
:
false
,
// enable/disable stacking
stack
:
false
,
// stack percentage mode
percentage
:
false
,
// legend options
legend
:
{
show
:
true
,
// disable/enable legend
values
:
false
,
// disable/enable legend values
min
:
false
,
max
:
false
,
current
:
false
,
total
:
false
,
avg
:
false
},
// how null points should be handled
nullPointMode
:
'connected'
,
// staircase line mode
steppedLine
:
false
,
// tooltip options
tooltip
:
{
value_type
:
'cumulative'
,
shared
:
true
,
msResolution
:
false
,
},
// time overrides
timeFrom
:
null
,
timeShift
:
null
,
// metric queries
targets
:
[{}],
// series color overrides
aliasColors
:
{},
// other style overrides
seriesOverrides
:
[],
};
/** @ngInject */
/** @ngInject */
constructor
(
$scope
,
$injector
,
private
annotationsSrv
)
{
constructor
(
$scope
,
$injector
,
private
annotationsSrv
)
{
super
(
$scope
,
$injector
);
super
(
$scope
,
$injector
);
_
.
defaults
(
this
.
panel
,
angular
.
copy
(
panelDefaults
));
_
.
defaults
(
this
.
panel
,
angular
.
copy
(
this
.
panelDefaults
));
_
.
defaults
(
this
.
panel
.
tooltip
,
panelDefaults
.
tooltip
);
_
.
defaults
(
this
.
panel
.
tooltip
,
this
.
panelDefaults
.
tooltip
);
_
.
defaults
(
this
.
panel
.
grid
,
panelDefaults
.
grid
);
_
.
defaults
(
this
.
panel
.
grid
,
this
.
panelDefaults
.
grid
);
_
.
defaults
(
this
.
panel
.
legend
,
panelDefaults
.
legend
);
_
.
defaults
(
this
.
panel
.
legend
,
this
.
panelDefaults
.
legend
);
this
.
colors
=
$scope
.
$root
.
colors
;
this
.
colors
=
$scope
.
$root
.
colors
;
...
...
public/app/plugins/panel/pluginlist/module.ts
View file @
884eef32
...
@@ -4,20 +4,20 @@ import _ from 'lodash';
...
@@ -4,20 +4,20 @@ import _ from 'lodash';
import
config
from
'app/core/config'
;
import
config
from
'app/core/config'
;
import
{
PanelCtrl
}
from
'../../../features/panel/panel_ctrl'
;
import
{
PanelCtrl
}
from
'../../../features/panel/panel_ctrl'
;
// Set and populate defaults
var
panelDefaults
=
{
};
class
PluginListCtrl
extends
PanelCtrl
{
class
PluginListCtrl
extends
PanelCtrl
{
static
templateUrl
=
'module.html'
;
static
templateUrl
=
'module.html'
;
pluginList
:
any
[];
pluginList
:
any
[];
viewModel
:
any
;
viewModel
:
any
;
// Set and populate defaults
panelDefaults
=
{
};
/** @ngInject */
/** @ngInject */
constructor
(
$scope
,
$injector
,
private
backendSrv
,
private
$location
)
{
constructor
(
$scope
,
$injector
,
private
backendSrv
,
private
$location
)
{
super
(
$scope
,
$injector
);
super
(
$scope
,
$injector
);
_
.
defaults
(
this
.
panel
,
panelDefaults
);
_
.
defaults
(
this
.
panel
,
this
.
panelDefaults
);
this
.
events
.
on
(
'init-edit-mode'
,
this
.
onInitEditMode
.
bind
(
this
));
this
.
events
.
on
(
'init-edit-mode'
,
this
.
onInitEditMode
.
bind
(
this
));
this
.
pluginList
=
[];
this
.
pluginList
=
[];
...
...
public/app/plugins/panel/singlestat/module.ts
View file @
884eef32
...
@@ -11,44 +11,6 @@ import config from 'app/core/config';
...
@@ -11,44 +11,6 @@ import config from 'app/core/config';
import
TimeSeries
from
'app/core/time_series2'
;
import
TimeSeries
from
'app/core/time_series2'
;
import
{
MetricsPanelCtrl
}
from
'app/plugins/sdk'
;
import
{
MetricsPanelCtrl
}
from
'app/plugins/sdk'
;
// Set and populate defaults
var
panelDefaults
=
{
links
:
[],
datasource
:
null
,
maxDataPoints
:
100
,
interval
:
null
,
targets
:
[{}],
cacheTimeout
:
null
,
format
:
'none'
,
prefix
:
''
,
postfix
:
''
,
nullText
:
null
,
valueMaps
:
[
{
value
:
'null'
,
op
:
'='
,
text
:
'N/A'
}
],
nullPointMode
:
'connected'
,
valueName
:
'avg'
,
prefixFontSize
:
'50%'
,
valueFontSize
:
'80%'
,
postfixFontSize
:
'50%'
,
thresholds
:
''
,
colorBackground
:
false
,
colorValue
:
false
,
colors
:
[
"rgba(245, 54, 54, 0.9)"
,
"rgba(237, 129, 40, 0.89)"
,
"rgba(50, 172, 45, 0.97)"
],
sparkline
:
{
show
:
false
,
full
:
false
,
lineColor
:
'rgb(31, 120, 193)'
,
fillColor
:
'rgba(31, 118, 189, 0.18)'
,
},
gauge
:
{
show
:
false
,
minValue
:
0
,
maxValue
:
100
,
thresholdLabels
:
true
}
};
class
SingleStatCtrl
extends
MetricsPanelCtrl
{
class
SingleStatCtrl
extends
MetricsPanelCtrl
{
static
templateUrl
=
'module.html'
;
static
templateUrl
=
'module.html'
;
...
@@ -57,10 +19,48 @@ class SingleStatCtrl extends MetricsPanelCtrl {
...
@@ -57,10 +19,48 @@ class SingleStatCtrl extends MetricsPanelCtrl {
fontSizes
:
any
[];
fontSizes
:
any
[];
unitFormats
:
any
[];
unitFormats
:
any
[];
// Set and populate defaults
panelDefaults
=
{
links
:
[],
datasource
:
null
,
maxDataPoints
:
100
,
interval
:
null
,
targets
:
[{}],
cacheTimeout
:
null
,
format
:
'none'
,
prefix
:
''
,
postfix
:
''
,
nullText
:
null
,
valueMaps
:
[
{
value
:
'null'
,
op
:
'='
,
text
:
'N/A'
}
],
nullPointMode
:
'connected'
,
valueName
:
'avg'
,
prefixFontSize
:
'50%'
,
valueFontSize
:
'80%'
,
postfixFontSize
:
'50%'
,
thresholds
:
''
,
colorBackground
:
false
,
colorValue
:
false
,
colors
:
[
"rgba(245, 54, 54, 0.9)"
,
"rgba(237, 129, 40, 0.89)"
,
"rgba(50, 172, 45, 0.97)"
],
sparkline
:
{
show
:
false
,
full
:
false
,
lineColor
:
'rgb(31, 120, 193)'
,
fillColor
:
'rgba(31, 118, 189, 0.18)'
,
},
gauge
:
{
show
:
false
,
minValue
:
0
,
maxValue
:
100
,
thresholdLabels
:
true
}
};
/** @ngInject */
/** @ngInject */
constructor
(
$scope
,
$injector
,
private
$location
,
private
linkSrv
)
{
constructor
(
$scope
,
$injector
,
private
$location
,
private
linkSrv
)
{
super
(
$scope
,
$injector
);
super
(
$scope
,
$injector
);
_
.
defaults
(
this
.
panel
,
panelDefaults
);
_
.
defaults
(
this
.
panel
,
this
.
panelDefaults
);
this
.
events
.
on
(
'data-received'
,
this
.
onDataReceived
.
bind
(
this
));
this
.
events
.
on
(
'data-received'
,
this
.
onDataReceived
.
bind
(
this
));
this
.
events
.
on
(
'data-error'
,
this
.
onDataError
.
bind
(
this
));
this
.
events
.
on
(
'data-error'
,
this
.
onDataError
.
bind
(
this
));
...
...
public/app/plugins/panel/table/module.ts
View file @
884eef32
...
@@ -10,33 +10,6 @@ import {transformDataToTable} from './transformers';
...
@@ -10,33 +10,6 @@ import {transformDataToTable} from './transformers';
import
{
tablePanelEditor
}
from
'./editor'
;
import
{
tablePanelEditor
}
from
'./editor'
;
import
{
TableRenderer
}
from
'./renderer'
;
import
{
TableRenderer
}
from
'./renderer'
;
var
panelDefaults
=
{
targets
:
[{}],
transform
:
'timeseries_to_columns'
,
pageSize
:
null
,
showHeader
:
true
,
styles
:
[
{
type
:
'date'
,
pattern
:
'Time'
,
dateFormat
:
'YYYY-MM-DD HH:mm:ss'
,
},
{
unit
:
'short'
,
type
:
'number'
,
decimals
:
2
,
colors
:
[
"rgba(245, 54, 54, 0.9)"
,
"rgba(237, 129, 40, 0.89)"
,
"rgba(50, 172, 45, 0.97)"
],
colorMode
:
null
,
pattern
:
'/.*/'
,
thresholds
:
[],
}
],
columns
:
[],
scroll
:
true
,
fontSize
:
'100%'
,
sort
:
{
col
:
0
,
desc
:
true
},
};
class
TablePanelCtrl
extends
MetricsPanelCtrl
{
class
TablePanelCtrl
extends
MetricsPanelCtrl
{
static
templateUrl
=
'module.html'
;
static
templateUrl
=
'module.html'
;
...
@@ -44,6 +17,33 @@ class TablePanelCtrl extends MetricsPanelCtrl {
...
@@ -44,6 +17,33 @@ class TablePanelCtrl extends MetricsPanelCtrl {
dataRaw
:
any
;
dataRaw
:
any
;
table
:
any
;
table
:
any
;
panelDefaults
=
{
targets
:
[{}],
transform
:
'timeseries_to_columns'
,
pageSize
:
null
,
showHeader
:
true
,
styles
:
[
{
type
:
'date'
,
pattern
:
'Time'
,
dateFormat
:
'YYYY-MM-DD HH:mm:ss'
,
},
{
unit
:
'short'
,
type
:
'number'
,
decimals
:
2
,
colors
:
[
"rgba(245, 54, 54, 0.9)"
,
"rgba(237, 129, 40, 0.89)"
,
"rgba(50, 172, 45, 0.97)"
],
colorMode
:
null
,
pattern
:
'/.*/'
,
thresholds
:
[],
}
],
columns
:
[],
scroll
:
true
,
fontSize
:
'100%'
,
sort
:
{
col
:
0
,
desc
:
true
},
};
/** @ngInject */
/** @ngInject */
constructor
(
$scope
,
$injector
,
private
annotationsSrv
)
{
constructor
(
$scope
,
$injector
,
private
annotationsSrv
)
{
super
(
$scope
,
$injector
);
super
(
$scope
,
$injector
);
...
@@ -56,7 +56,7 @@ class TablePanelCtrl extends MetricsPanelCtrl {
...
@@ -56,7 +56,7 @@ class TablePanelCtrl extends MetricsPanelCtrl {
delete
this
.
panel
.
fields
;
delete
this
.
panel
.
fields
;
}
}
_
.
defaults
(
this
.
panel
,
panelDefaults
);
_
.
defaults
(
this
.
panel
,
this
.
panelDefaults
);
this
.
events
.
on
(
'data-received'
,
this
.
onDataReceived
.
bind
(
this
));
this
.
events
.
on
(
'data-received'
,
this
.
onDataReceived
.
bind
(
this
));
this
.
events
.
on
(
'data-error'
,
this
.
onDataError
.
bind
(
this
));
this
.
events
.
on
(
'data-error'
,
this
.
onDataError
.
bind
(
this
));
...
...
public/app/plugins/panel/text/module.ts
View file @
884eef32
...
@@ -3,23 +3,21 @@
...
@@ -3,23 +3,21 @@
import
_
from
'lodash'
;
import
_
from
'lodash'
;
import
{
PanelCtrl
}
from
'app/plugins/sdk'
;
import
{
PanelCtrl
}
from
'app/plugins/sdk'
;
// Set and populate defaults
var
panelDefaults
=
{
mode
:
"markdown"
,
// 'html', 'markdown', 'text'
content
:
"# title"
,
};
export
class
TextPanelCtrl
extends
PanelCtrl
{
export
class
TextPanelCtrl
extends
PanelCtrl
{
static
templateUrl
=
`public/app/plugins/panel/text/module.html`
;
static
templateUrl
=
`public/app/plugins/panel/text/module.html`
;
remarkable
:
any
;
remarkable
:
any
;
content
:
string
;
content
:
string
;
// Set and populate defaults
panelDefaults
=
{
mode
:
"markdown"
,
// 'html', 'markdown', 'text'
content
:
"# title"
,
};
/** @ngInject */
/** @ngInject */
constructor
(
$scope
,
$injector
,
private
templateSrv
,
private
$sce
)
{
constructor
(
$scope
,
$injector
,
private
templateSrv
,
private
$sce
)
{
super
(
$scope
,
$injector
);
super
(
$scope
,
$injector
);
_
.
defaults
(
this
.
panel
,
panelDefaults
);
_
.
defaults
(
this
.
panel
,
this
.
panelDefaults
);
this
.
events
.
on
(
'init-edit-mode'
,
this
.
onInitEditMode
.
bind
(
this
));
this
.
events
.
on
(
'init-edit-mode'
,
this
.
onInitEditMode
.
bind
(
this
));
this
.
events
.
on
(
'refresh'
,
this
.
onRender
.
bind
(
this
));
this
.
events
.
on
(
'refresh'
,
this
.
onRender
.
bind
(
this
));
...
...
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