Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
0938ec2a
Commit
0938ec2a
authored
Sep 17, 2019
by
lauraMon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removes all mention of downloadcsv ff
parent
afc723b0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
56 deletions
+0
-56
app/assets/javascripts/monitoring/components/charts/time_series.vue
.../javascripts/monitoring/components/charts/time_series.vue
+0
-24
spec/javascripts/monitoring/charts/time_series_spec.js
spec/javascripts/monitoring/charts/time_series_spec.js
+0
-32
No files found.
app/assets/javascripts/monitoring/components/charts/time_series.vue
View file @
0938ec2a
<
script
>
import
{
__
}
from
'
~/locale
'
;
import
{
mapState
}
from
'
vuex
'
;
import
{
GlLink
,
GlButton
}
from
'
@gitlab/ui
'
;
import
{
GlAreaChart
,
GlLineChart
,
GlChartSeriesLabel
}
from
'
@gitlab/ui/dist/charts
'
;
import
dateFormat
from
'
dateformat
'
;
...
...
@@ -70,7 +69,6 @@ export default {
};
},
computed
:
{
...
mapState
(
'
monitoringDashboard
'
,
[
'
exportMetricsToCsvEnabled
'
]),
chartData
()
{
// Transforms & supplements query data to render appropriate labels & styles
// Input: [{ queryAttributes1 }, { queryAttributes2 }]
...
...
@@ -190,18 +188,6 @@ export default {
yAxisLabel
()
{
return
`
${
this
.
graphData
.
y_label
}
`
;
},
csvText
()
{
const
chartData
=
this
.
chartData
[
0
].
data
;
const
header
=
`timestamp,
${
this
.
graphData
.
y_label
}
\r\n`
;
// eslint-disable-line @gitlab/i18n/no-non-i18n-strings
return
chartData
.
reduce
((
csv
,
data
)
=>
{
const
row
=
data
.
join
(
'
,
'
);
return
`
${
csv
}${
row
}
\r\n`
;
},
header
);
},
downloadLink
()
{
const
data
=
new
Blob
([
this
.
csvText
],
{
type
:
'
text/plain
'
});
return
window
.
URL
.
createObjectURL
(
data
);
},
},
watch
:
{
containerWidth
:
'
onResize
'
,
...
...
@@ -270,16 +256,6 @@ export default {
<div
class=
"prometheus-graph"
>
<div
class=
"prometheus-graph-header"
>
<h5
class=
"prometheus-graph-title js-graph-title"
>
{{
graphData
.
title
}}
</h5>
<gl-button
v-if=
"exportMetricsToCsvEnabled"
:href=
"downloadLink"
:title=
"__('Download CSV')"
:aria-label=
"__('Download CSV')"
style=
"margin-left: 200px;"
download=
"chart_metrics.csv"
>
{{
__
(
'
Download CSV
'
)
}}
</gl-button>
<div
class=
"prometheus-graph-widgets js-graph-widgets"
>
<slot></slot>
</div>
...
...
spec/javascripts/monitoring/charts/time_series_spec.js
View file @
0938ec2a
...
...
@@ -23,7 +23,6 @@ describe('Time series component', () => {
store
=
createStore
();
store
.
commit
(
`monitoringDashboard/
${
types
.
RECEIVE_METRICS_DATA_SUCCESS
}
`
,
MonitoringMock
.
data
);
store
.
commit
(
`monitoringDashboard/
${
types
.
RECEIVE_DEPLOYMENTS_DATA_SUCCESS
}
`
,
deploymentData
);
store
.
dispatch
(
'
monitoringDashboard/setFeatureFlags
'
,
{
exportMetricsToCsvEnabled
:
true
});
[
mockGraphData
]
=
store
.
state
.
monitoringDashboard
.
groups
[
0
].
metrics
;
makeTimeSeriesChart
=
(
graphData
,
type
)
=>
...
...
@@ -61,19 +60,6 @@ describe('Time series component', () => {
expect
(
timeSeriesChart
.
find
(
'
.js-graph-widgets
'
).
text
()).
toBe
(
mockWidgets
);
});
describe
(
'
when exportMetricsToCsvEnabled is disabled
'
,
()
=>
{
beforeEach
(()
=>
{
store
.
dispatch
(
'
monitoringDashboard/setFeatureFlags
'
,
{
exportMetricsToCsvEnabled
:
false
});
});
it
(
'
does not render the Download CSV button
'
,
done
=>
{
timeSeriesChart
.
vm
.
$nextTick
(()
=>
{
expect
(
timeSeriesChart
.
contains
(
'
glbutton-stub
'
)).
toBe
(
false
);
done
();
});
});
});
describe
(
'
methods
'
,
()
=>
{
describe
(
'
formatTooltipText
'
,
()
=>
{
const
mockDate
=
deploymentData
[
0
].
created_at
;
...
...
@@ -234,24 +220,6 @@ describe('Time series component', () => {
expect
(
timeSeriesChart
.
vm
.
yAxisLabel
).
toBe
(
'
CPU
'
);
});
});
describe
(
'
csvText
'
,
()
=>
{
it
(
'
converts data from json to csv
'
,
()
=>
{
const
header
=
`timestamp,
${
mockGraphData
.
y_label
}
`
;
const
data
=
mockGraphData
.
queries
[
0
].
result
[
0
].
values
;
const
firstRow
=
`
${
data
[
0
][
0
]}
,
${
data
[
0
][
1
]}
`
;
expect
(
timeSeriesChart
.
vm
.
csvText
).
toMatch
(
`^
${
header
}
\r\n
${
firstRow
}
`
);
});
});
describe
(
'
downloadLink
'
,
()
=>
{
it
(
'
produces a link to download metrics as csv
'
,
()
=>
{
const
link
=
timeSeriesChart
.
vm
.
downloadLink
;
expect
(
link
).
toContain
(
'
blob:
'
);
});
});
});
afterEach
(()
=>
{
...
...
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