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
15cc1979
Commit
15cc1979
authored
Nov 29, 2019
by
Dhiraj Bodicherla
Committed by
Miguel Rincon
Dec 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replaced js- class with refs
parent
08b64655
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
11 deletions
+12
-11
app/assets/javascripts/monitoring/components/dashboard.vue
app/assets/javascripts/monitoring/components/dashboard.vue
+4
-3
ee/spec/javascripts/monitoring/components/dashboard_spec.js
ee/spec/javascripts/monitoring/components/dashboard_spec.js
+8
-8
No files found.
app/assets/javascripts/monitoring/components/dashboard.vue
View file @
15cc1979
...
@@ -11,12 +11,12 @@ import {
...
@@ -11,12 +11,12 @@ import {
GlModalDirective
,
GlModalDirective
,
GlTooltipDirective
,
GlTooltipDirective
,
}
from
'
@gitlab/ui
'
;
}
from
'
@gitlab/ui
'
;
import
PanelType
from
'
ee_else_ce/monitoring/components/panel_type.vue
'
;
import
{
s__
}
from
'
~/locale
'
;
import
{
s__
}
from
'
~/locale
'
;
import
createFlash
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
{
getParameterValues
,
mergeUrlParams
,
redirectTo
}
from
'
~/lib/utils/url_utility
'
;
import
{
getParameterValues
,
mergeUrlParams
,
redirectTo
}
from
'
~/lib/utils/url_utility
'
;
import
invalidUrl
from
'
~/lib/utils/invalid_url
'
;
import
invalidUrl
from
'
~/lib/utils/invalid_url
'
;
import
PanelType
from
'
ee_else_ce/monitoring/components/panel_type.vue
'
;
import
DateTimePicker
from
'
./date_time_picker/date_time_picker.vue
'
;
import
DateTimePicker
from
'
./date_time_picker/date_time_picker.vue
'
;
import
MonitorTimeSeriesChart
from
'
./charts/time_series.vue
'
;
import
MonitorTimeSeriesChart
from
'
./charts/time_series.vue
'
;
import
MonitorSingleStatChart
from
'
./charts/single_stat.vue
'
;
import
MonitorSingleStatChart
from
'
./charts/single_stat.vue
'
;
...
@@ -392,9 +392,10 @@ export default {
...
@@ -392,9 +392,10 @@ export default {
</gl-button>
</gl-button>
<gl-button
<gl-button
v-if=
"addingMetricsAvailable"
v-if=
"addingMetricsAvailable"
ref=
"addMetricBtn"
v-gl-modal=
"$options.addMetric.modalId"
v-gl-modal=
"$options.addMetric.modalId"
variant=
"outline-success"
variant=
"outline-success"
class=
"mr-2 mt-1
js-add-metric-button
"
class=
"mr-2 mt-1"
>
>
{{ $options.addMetric.title }}
{{ $options.addMetric.title }}
</gl-button>
</gl-button>
...
@@ -414,9 +415,9 @@ export default {
...
@@ -414,9 +415,9 @@ export default {
<div
slot=
"modal-footer"
>
<div
slot=
"modal-footer"
>
<gl-button
@
click=
"hideAddMetricModal"
>
{{ __('Cancel') }}
</gl-button>
<gl-button
@
click=
"hideAddMetricModal"
>
{{ __('Cancel') }}
</gl-button>
<gl-button
<gl-button
ref=
"submitCustomMetricsFormBtn"
v-track-event=
"getAddMetricTrackingOptions()"
v-track-event=
"getAddMetricTrackingOptions()"
:disabled=
"!formIsValid"
:disabled=
"!formIsValid"
class=
"js-submit-custom-metrics-form"
variant=
"success"
variant=
"success"
@
click=
"submitCustomMetricsForm"
@
click=
"submitCustomMetricsForm"
>
>
...
...
ee/spec/javascripts/monitoring/components/dashboard_spec.js
View file @
15cc1979
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
{
GlModal
,
GlButton
}
from
'
@gitlab/ui
'
;
import
{
GlModal
,
GlButton
}
from
'
@gitlab/ui
'
;
import
Tracking
from
'
~/tracking
'
;
import
Dashboard
from
'
ee/monitoring/components/dashboard.vue
'
;
import
Dashboard
from
'
ee/monitoring/components/dashboard.vue
'
;
import
{
createStore
}
from
'
~/monitoring/stores
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
import
{
metricsGroupsAPIResponse
,
metricsGroupsAPIResponse
,
mockApiEndpoint
,
mockApiEndpoint
,
...
@@ -13,6 +10,9 @@ import {
...
@@ -13,6 +10,9 @@ import {
}
from
'
spec/monitoring/mock_data
'
;
}
from
'
spec/monitoring/mock_data
'
;
import
propsData
from
'
spec/monitoring/components/dashboard_spec
'
;
import
propsData
from
'
spec/monitoring/components/dashboard_spec
'
;
import
CustomMetricsFormFields
from
'
ee/custom_metrics/components/custom_metrics_form_fields.vue
'
;
import
CustomMetricsFormFields
from
'
ee/custom_metrics/components/custom_metrics_form_fields.vue
'
;
import
Tracking
from
'
~/tracking
'
;
import
{
createStore
}
from
'
~/monitoring/stores
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
*
as
types
from
'
~/monitoring/stores/mutation_types
'
;
import
*
as
types
from
'
~/monitoring/stores/mutation_types
'
;
const
localVue
=
createLocalVue
();
const
localVue
=
createLocalVue
();
...
@@ -23,7 +23,7 @@ describe('Dashboard', () => {
...
@@ -23,7 +23,7 @@ describe('Dashboard', () => {
let
store
;
let
store
;
let
wrapper
;
let
wrapper
;
const
findAddMetricButton
=
()
=>
wrapper
.
find
(
'
.js-add-metric-button
'
)
;
const
findAddMetricButton
=
()
=>
wrapper
.
vm
.
$refs
.
addMetricBtn
;
const
createComponent
=
(
props
=
{})
=>
{
const
createComponent
=
(
props
=
{})
=>
{
wrapper
=
shallowMount
(
localVue
.
extend
(
Component
),
{
wrapper
=
shallowMount
(
localVue
.
extend
(
Component
),
{
...
@@ -89,7 +89,7 @@ describe('Dashboard', () => {
...
@@ -89,7 +89,7 @@ describe('Dashboard', () => {
});
});
it
(
'
does not render add button on the dashboard
'
,
()
=>
{
it
(
'
does not render add button on the dashboard
'
,
()
=>
{
expect
(
findAddMetricButton
()
.
exists
()).
toBe
(
false
);
expect
(
findAddMetricButton
()
).
toBeUndefined
(
);
});
});
});
});
...
@@ -120,7 +120,7 @@ describe('Dashboard', () => {
...
@@ -120,7 +120,7 @@ describe('Dashboard', () => {
});
});
it
(
'
renders add button on the dashboard
'
,
()
=>
{
it
(
'
renders add button on the dashboard
'
,
()
=>
{
expect
(
findAddMetricButton
()
.
exists
()).
toBe
(
true
);
expect
(
findAddMetricButton
()
).
toBeDefined
(
);
});
});
it
(
'
uses modal for custom metrics form
'
,
()
=>
{
it
(
'
uses modal for custom metrics form
'
,
()
=>
{
...
@@ -129,10 +129,10 @@ describe('Dashboard', () => {
...
@@ -129,10 +129,10 @@ describe('Dashboard', () => {
});
});
it
(
'
adding new metric is tracked
'
,
done
=>
{
it
(
'
adding new metric is tracked
'
,
done
=>
{
const
submitButton
=
wrapper
.
find
(
'
.js-submit-custom-metrics-form
'
)
;
const
submitButton
=
wrapper
.
vm
.
$refs
.
submitCustomMetricsFormBtn
;
wrapper
.
setData
({
formIsValid
:
true
});
wrapper
.
setData
({
formIsValid
:
true
});
wrapper
.
vm
.
$nextTick
(()
=>
{
wrapper
.
vm
.
$nextTick
(()
=>
{
submitButton
.
trigger
(
'
click
'
);
submitButton
.
$el
.
click
(
);
wrapper
.
vm
.
$nextTick
(()
=>
{
wrapper
.
vm
.
$nextTick
(()
=>
{
expect
(
Tracking
.
event
).
toHaveBeenCalledWith
(
expect
(
Tracking
.
event
).
toHaveBeenCalledWith
(
document
.
body
.
dataset
.
page
,
document
.
body
.
dataset
.
page
,
...
...
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