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
287d19a6
Commit
287d19a6
authored
Dec 13, 2019
by
Miguel Rincon
Committed by
Clement Ho
Dec 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change the `clipboardText` to optional in panel_type component
parent
dc323e47
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
31 deletions
+50
-31
app/assets/javascripts/monitoring/components/embed.vue
app/assets/javascripts/monitoring/components/embed.vue
+0
-1
app/assets/javascripts/monitoring/components/panel_type.vue
app/assets/javascripts/monitoring/components/panel_type.vue
+3
-1
spec/frontend/monitoring/panel_type_spec.js
spec/frontend/monitoring/panel_type_spec.js
+47
-29
No files found.
app/assets/javascripts/monitoring/components/embed.vue
View file @
287d19a6
...
@@ -97,7 +97,6 @@ export default {
...
@@ -97,7 +97,6 @@ export default {
v-for=
"(graphData, graphIndex) in charts"
v-for=
"(graphData, graphIndex) in charts"
:key=
"`panel-type-$
{graphIndex}`"
:key=
"`panel-type-$
{graphIndex}`"
class="w-100"
class="w-100"
clipboard-text=""
:graph-data="graphData"
:graph-data="graphData"
:group-id="dashboardUrl"
:group-id="dashboardUrl"
/>
/>
...
...
app/assets/javascripts/monitoring/components/panel_type.vue
View file @
287d19a6
...
@@ -36,7 +36,8 @@ export default {
...
@@ -36,7 +36,8 @@ export default {
props
:
{
props
:
{
clipboardText
:
{
clipboardText
:
{
type
:
String
,
type
:
String
,
required
:
true
,
required
:
false
,
default
:
''
,
},
},
graphData
:
{
graphData
:
{
type
:
Object
,
type
:
Object
,
...
@@ -152,6 +153,7 @@ export default {
...
@@ -152,6 +153,7 @@ export default {
{{ __('Download CSV') }}
{{ __('Download CSV') }}
</gl-dropdown-item>
</gl-dropdown-item>
<gl-dropdown-item
<gl-dropdown-item
v-if=
"clipboardText"
v-track-event=
"generateLinkToChartOptions(clipboardText)"
v-track-event=
"generateLinkToChartOptions(clipboardText)"
class=
"js-chart-link"
class=
"js-chart-link"
:data-clipboard-text=
"clipboardText"
:data-clipboard-text=
"clipboardText"
...
...
spec/frontend/monitoring/panel_type_spec.js
View file @
287d19a6
...
@@ -20,6 +20,16 @@ describe('Panel Type component', () => {
...
@@ -20,6 +20,16 @@ describe('Panel Type component', () => {
const
dashboardWidth
=
100
;
const
dashboardWidth
=
100
;
const
exampleText
=
'
example_text
'
;
const
exampleText
=
'
example_text
'
;
const
createWrapper
=
props
=>
shallowMount
(
PanelType
,
{
propsData
:
{
...
props
,
},
store
,
sync
:
false
,
attachToDocument
:
true
,
});
beforeEach
(()
=>
{
beforeEach
(()
=>
{
setTestTimeout
(
1000
);
setTestTimeout
(
1000
);
axiosMock
=
new
AxiosMockAdapter
(
axios
);
axiosMock
=
new
AxiosMockAdapter
(
axios
);
...
@@ -36,14 +46,9 @@ describe('Panel Type component', () => {
...
@@ -36,14 +46,9 @@ describe('Panel Type component', () => {
graphDataNoResult
.
metrics
[
0
].
result
=
[];
graphDataNoResult
.
metrics
[
0
].
result
=
[];
beforeEach
(()
=>
{
beforeEach
(()
=>
{
panelType
=
shallowMount
(
PanelType
,
{
panelType
=
createWrapper
({
propsData
:
{
clipboardText
:
'
dashboard_link
'
,
dashboardWidth
,
dashboardWidth
,
graphData
:
graphDataNoResult
,
graphData
:
graphDataNoResult
,
},
sync
:
false
,
attachToDocument
:
true
,
});
});
});
});
...
@@ -68,41 +73,30 @@ describe('Panel Type component', () => {
...
@@ -68,41 +73,30 @@ describe('Panel Type component', () => {
});
});
});
});
describe
(
'
when Graph data is available
'
,
()
=>
{
describe
(
'
when graph data is available
'
,
()
=>
{
const
propsData
=
{
beforeEach
(()
=>
{
clipboardText
:
exampleText
,
store
=
createStore
();
panelType
=
createWrapper
({
dashboardWidth
,
dashboardWidth
,
graphData
:
graphDataPrometheusQueryRange
,
graphData
:
graphDataPrometheusQueryRange
,
};
beforeEach
(
done
=>
{
store
=
createStore
();
panelType
=
shallowMount
(
PanelType
,
{
propsData
,
store
,
sync
:
false
,
attachToDocument
:
true
,
});
});
panelType
.
vm
.
$nextTick
(
done
);
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
panelType
.
destroy
();
panelType
.
destroy
();
});
});
it
(
'
sets no clipboard copy link on dropdown by default
'
,
()
=>
{
const
link
=
()
=>
panelType
.
find
(
'
.js-chart-link
'
);
expect
(
link
().
exists
()).
toBe
(
false
);
});
describe
(
'
Time Series Chart panel type
'
,
()
=>
{
describe
(
'
Time Series Chart panel type
'
,
()
=>
{
it
(
'
is rendered
'
,
()
=>
{
it
(
'
is rendered
'
,
()
=>
{
expect
(
panelType
.
find
(
TimeSeriesChart
).
isVueInstance
()).
toBe
(
true
);
expect
(
panelType
.
find
(
TimeSeriesChart
).
isVueInstance
()).
toBe
(
true
);
expect
(
panelType
.
find
(
TimeSeriesChart
).
exists
()).
toBe
(
true
);
expect
(
panelType
.
find
(
TimeSeriesChart
).
exists
()).
toBe
(
true
);
});
});
it
(
'
sets clipboard text on the dropdown
'
,
()
=>
{
const
link
=
()
=>
panelType
.
find
(
'
.js-chart-link
'
);
const
clipboardText
=
()
=>
link
().
element
.
dataset
.
clipboardText
;
expect
(
clipboardText
()).
toBe
(
exampleText
);
});
it
(
'
includes a default group id
'
,
()
=>
{
it
(
'
includes a default group id
'
,
()
=>
{
expect
(
panelType
.
vm
.
groupId
).
toBe
(
'
panel-type-chart
'
);
expect
(
panelType
.
vm
.
groupId
).
toBe
(
'
panel-type-chart
'
);
});
});
...
@@ -123,6 +117,30 @@ describe('Panel Type component', () => {
...
@@ -123,6 +117,30 @@ describe('Panel Type component', () => {
});
});
});
});
describe
(
'
when cliboard data is available
'
,
()
=>
{
const
clipboardText
=
'
A value to copy.
'
;
beforeEach
(()
=>
{
store
=
createStore
();
panelType
=
createWrapper
({
clipboardText
,
dashboardWidth
,
graphData
:
graphDataPrometheusQueryRange
,
});
});
afterEach
(()
=>
{
panelType
.
destroy
();
});
it
(
'
sets clipboard text on the dropdown
'
,
()
=>
{
const
link
=
()
=>
panelType
.
find
(
'
.js-chart-link
'
);
expect
(
link
().
exists
()).
toBe
(
true
);
expect
(
link
().
element
.
dataset
.
clipboardText
).
toBe
(
clipboardText
);
});
});
describe
(
'
when downloading metrics data as CSV
'
,
()
=>
{
describe
(
'
when downloading metrics data as CSV
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
done
=>
{
graphDataPrometheusQueryRange
.
y_label
=
'
metric
'
;
graphDataPrometheusQueryRange
.
y_label
=
'
metric
'
;
...
...
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