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
47f81452
Commit
47f81452
authored
Aug 24, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:grafana/grafana
parents
71c22fdb
632a5e9b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
13 deletions
+32
-13
pkg/services/sqlstore/sqlstore.go
+1
-1
public/app/core/utils/file_export.ts
+6
-6
public/app/features/dashboard/export_data/export_data_modal.html
+6
-2
public/app/features/dashboard/export_data/export_data_modal.ts
+11
-3
public/app/plugins/panel/table/module.ts
+8
-1
No files found.
pkg/services/sqlstore/sqlstore.go
View file @
47f81452
...
...
@@ -114,7 +114,7 @@ func getEngine() (*xorm.Engine, error) {
protocol
=
"unix"
}
cnnstr
=
fmt
.
Sprintf
(
"%s:%s@%s(%s)/%s?charset=utf8mb4"
,
cnnstr
=
fmt
.
Sprintf
(
"%s:%s@%s(%s)/%s?charset=utf8mb4
&allowNativePasswords=true
"
,
DbCfg
.
User
,
DbCfg
.
Pwd
,
protocol
,
DbCfg
.
Host
,
DbCfg
.
Name
)
if
DbCfg
.
SslMode
==
"true"
||
DbCfg
.
SslMode
==
"skip-verify"
{
...
...
public/app/core/utils/file_export.ts
View file @
47f81452
...
...
@@ -7,8 +7,8 @@ declare var window: any;
const
DEFAULT_DATETIME_FORMAT
:
String
=
'YYYY-MM-DDTHH:mm:ssZ'
;
export
function
exportSeriesListToCsv
(
seriesList
,
dateTimeFormat
=
DEFAULT_DATETIME_FORMAT
)
{
var
text
=
'Series;Time;Value
\
n'
;
export
function
exportSeriesListToCsv
(
seriesList
,
dateTimeFormat
=
DEFAULT_DATETIME_FORMAT
,
excel
=
false
)
{
var
text
=
excel
?
'sep=;
\
n'
:
''
+
'Series;Time;Value
\
n'
;
_
.
each
(
seriesList
,
function
(
series
)
{
_
.
each
(
series
.
datapoints
,
function
(
dp
)
{
text
+=
series
.
alias
+
';'
+
moment
(
dp
[
1
]).
format
(
dateTimeFormat
)
+
';'
+
dp
[
0
]
+
'
\
n'
;
...
...
@@ -17,8 +17,8 @@ export function exportSeriesListToCsv(seriesList, dateTimeFormat = DEFAULT_DATET
saveSaveBlob
(
text
,
'grafana_data_export.csv'
);
}
export
function
exportSeriesListToCsvColumns
(
seriesList
,
dateTimeFormat
=
DEFAULT_DATETIME_FORMAT
)
{
var
text
=
'Time;'
;
export
function
exportSeriesListToCsvColumns
(
seriesList
,
dateTimeFormat
=
DEFAULT_DATETIME_FORMAT
,
excel
=
false
)
{
var
text
=
excel
?
'sep=;
\
n'
:
''
+
'Time;'
;
// add header
_
.
each
(
seriesList
,
function
(
series
)
{
text
+=
series
.
alias
+
';'
;
...
...
@@ -52,8 +52,8 @@ export function exportSeriesListToCsvColumns(seriesList, dateTimeFormat = DEFAUL
saveSaveBlob
(
text
,
'grafana_data_export.csv'
);
}
export
function
exportTableDataToCsv
(
table
)
{
var
text
=
''
;
export
function
exportTableDataToCsv
(
table
,
excel
=
false
)
{
var
text
=
excel
?
'sep=;
\
n'
:
''
;
// add header
_
.
each
(
table
.
columns
,
function
(
column
)
{
text
+=
(
column
.
title
||
column
.
text
)
+
';'
;
...
...
public/app/features/dashboard/export_data/export_data_modal.html
View file @
47f81452
...
...
@@ -11,17 +11,21 @@
<div
class=
"modal-content"
>
<div
class=
"p-t-2"
>
<div
class=
"gf-form"
>
<div
class=
"gf-form"
ng-hide=
"ctrl.panel === 'table'"
>
<label
class=
"gf-form-label width-10"
>
Mode
</label>
<div
class=
"gf-form-select-wrapper"
>
<select
class=
"gf-form-input"
ng-model=
"ctrl.asRows"
ng-options=
"f.value as f.text for f in [{text: 'Series as rows', value: true}, {text: 'Series as columns', value: false}]"
>
</select>
</div>
</div>
<div
class=
"gf-form"
>
<div
class=
"gf-form"
ng-hide=
"ctrl.panel === 'table'"
>
<label
class=
"gf-form-label width-10"
>
Date Time Format
</label>
<input
type=
"text"
class=
"gf-form-input"
ng-model=
"ctrl.dateTimeFormat"
>
</div>
<gf-form-switch
class=
"gf-form"
label=
"Export To Excel"
label-class=
"width-12"
switch-class=
"max-width-6"
checked=
"ctrl.excel"
>
</gf-form-switch>
</div>
<div
class=
"gf-form-button-row text-center"
>
...
...
public/app/features/dashboard/export_data/export_data_modal.ts
View file @
47f81452
...
...
@@ -6,17 +6,24 @@ import appEvents from 'app/core/app_events';
export
class
ExportDataModalCtrl
{
private
data
:
any
[];
private
panel
:
string
;
asRows
:
Boolean
=
true
;
dateTimeFormat
:
String
=
'YYYY-MM-DDTHH:mm:ssZ'
;
excel
:
false
;
/** @ngInject */
constructor
(
private
$scope
)
{
}
export
()
{
if
(
this
.
asRows
)
{
fileExport
.
export
SeriesListToCsv
(
this
.
data
,
this
.
dateTimeFormat
);
if
(
this
.
panel
===
'table'
)
{
fileExport
.
export
TableDataToCsv
(
this
.
data
,
this
.
excel
);
}
else
{
fileExport
.
exportSeriesListToCsvColumns
(
this
.
data
,
this
.
dateTimeFormat
);
if
(
this
.
asRows
)
{
fileExport
.
exportSeriesListToCsv
(
this
.
data
,
this
.
dateTimeFormat
,
this
.
excel
);
}
else
{
fileExport
.
exportSeriesListToCsvColumns
(
this
.
data
,
this
.
dateTimeFormat
,
this
.
excel
);
}
}
this
.
dismiss
();
}
...
...
@@ -32,6 +39,7 @@ export function exportDataModal() {
controller
:
ExportDataModalCtrl
,
controllerAs
:
'ctrl'
,
scope
:
{
panel
:
'<'
,
data
:
'<'
// The difference to '=' is that the bound properties are not watched
},
bindToController
:
true
...
...
public/app/plugins/panel/table/module.ts
View file @
47f81452
...
...
@@ -150,7 +150,14 @@ class TablePanelCtrl extends MetricsPanelCtrl {
}
exportCsv
()
{
FileExport
.
exportTableDataToCsv
(
this
.
renderer
.
render_values
());
var
scope
=
this
.
$scope
.
$new
(
true
);
scope
.
tableData
=
this
.
renderer
.
render_values
();
scope
.
panel
=
'table'
;
this
.
publishAppEvent
(
'show-modal'
,
{
templateHtml
:
'<export-data-modal panel="panel" data="tableData"></export-data-modal>'
,
scope
,
modalClass
:
'modal--narrow'
});
}
link
(
scope
,
elem
,
attrs
,
ctrl
)
{
...
...
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