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
9e926093
Unverified
Commit
9e926093
authored
Dec 19, 2018
by
Torkel Ödegaard
Committed by
GitHub
Dec 19, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14113 from cinaglia/fix-csv-decimal-places
Retain decimal precision when exporting CSV
parents
cbeefcd3
4ed0a3d2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
public/app/core/specs/file_export.test.ts
+2
-0
public/app/core/utils/file_export.ts
+1
-3
No files found.
public/app/core/specs/file_export.test.ts
View file @
9e926093
...
...
@@ -73,6 +73,7 @@ describe('file_export', () => {
],
rows
:
[
[
123
,
'some_string'
,
1.234
,
true
],
[
1000
,
'some_string'
,
1.234567891
,
true
],
[
0o765
,
'some string with " in the middle'
,
1
e
-
2
,
false
],
[
0o765
,
'some string with "" in the middle'
,
1
e
-
2
,
false
],
[
0o765
,
'some string with """ in the middle'
,
1
e
-
2
,
false
],
...
...
@@ -89,6 +90,7 @@ describe('file_export', () => {
const
expectedText
=
'"integer_value";"string_value";"float_value";"boolean_value"
\
r
\
n'
+
'123;"some_string";1.234;true
\
r
\
n'
+
'1000;"some_string";1.234567891;true
\
r
\
n'
+
'501;"some string with "" in the middle";0.01;false
\
r
\
n'
+
'501;"some string with """" in the middle";0.01;false
\
r
\
n'
+
'501;"some string with """""" in the middle";0.01;false
\
r
\
n'
+
...
...
public/app/core/utils/file_export.ts
View file @
9e926093
...
...
@@ -41,10 +41,8 @@ function formatSpecialHeader(useExcelHeader) {
function
formatRow
(
row
,
addEndRowDelimiter
=
true
)
{
let
text
=
''
;
for
(
let
i
=
0
;
i
<
row
.
length
;
i
+=
1
)
{
if
(
isBoolean
(
row
[
i
])
||
isNullOrUndefined
(
row
[
i
]))
{
if
(
isBoolean
(
row
[
i
])
||
isNu
mber
(
row
[
i
])
||
isNu
llOrUndefined
(
row
[
i
]))
{
text
+=
row
[
i
];
}
else
if
(
isNumber
(
row
[
i
]))
{
text
+=
row
[
i
].
toLocaleString
();
}
else
{
text
+=
`
${
QUOTE
}${
csvEscaped
(
htmlUnescaped
(
htmlDecoded
(
row
[
i
])))}${
QUOTE
}
`
;
}
...
...
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