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
b1721584
Commit
b1721584
authored
Apr 16, 2020
by
Simon Knox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better check for feature using mixin
parent
39abea2b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
32 deletions
+14
-32
ee/app/assets/javascripts/burndown_chart/components/burn_charts.vue
...ets/javascripts/burndown_chart/components/burn_charts.vue
+8
-10
ee/spec/frontend/burndown_chart/components/burn_charts_spec.js
...ec/frontend/burndown_chart/components/burn_charts_spec.js
+6
-22
No files found.
ee/app/assets/javascripts/burndown_chart/components/burn_charts.vue
View file @
b1721584
<
script
>
<
script
>
import
{
GlButton
,
GlButtonGroup
}
from
'
@gitlab/ui
'
;
import
{
GlButton
,
GlButtonGroup
}
from
'
@gitlab/ui
'
;
import
glFeatureFlagsMixin
from
'
~/vue_shared/mixins/gl_feature_flags_mixin
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
__
}
from
'
~/locale
'
;
import
BurndownChart
from
'
./burndown_chart.vue
'
;
import
BurndownChart
from
'
./burndown_chart.vue
'
;
...
@@ -9,6 +10,7 @@ export default {
...
@@ -9,6 +10,7 @@ export default {
GlButtonGroup
,
GlButtonGroup
,
BurndownChart
,
BurndownChart
,
},
},
mixins
:
[
glFeatureFlagsMixin
()],
props
:
{
props
:
{
startDate
:
{
startDate
:
{
type
:
String
,
type
:
String
,
...
@@ -32,12 +34,11 @@ export default {
...
@@ -32,12 +34,11 @@ export default {
data
()
{
data
()
{
return
{
return
{
issuesSelected
:
true
,
issuesSelected
:
true
,
burnupChartsEnabled
:
gon
.
features
.
burnupCharts
,
};
};
},
},
computed
:
{
computed
:
{
title
()
{
title
()
{
return
this
.
burnupChartsEnabled
?
__
(
'
Charts
'
)
:
__
(
'
Burndown chart
'
);
return
this
.
glFeatures
.
burnupCharts
?
__
(
'
Charts
'
)
:
__
(
'
Burndown chart
'
);
},
},
issueButtonCategory
()
{
issueButtonCategory
()
{
return
this
.
issuesSelected
?
'
primary
'
:
'
secondary
'
;
return
this
.
issuesSelected
?
'
primary
'
:
'
secondary
'
;
...
@@ -47,11 +48,8 @@ export default {
...
@@ -47,11 +48,8 @@ export default {
},
},
},
},
methods
:
{
methods
:
{
showIssueCount
()
{
setIssueSelected
(
selected
)
{
this
.
issuesSelected
=
true
;
this
.
issuesSelected
=
selected
;
},
showIssueWeight
()
{
this
.
issuesSelected
=
false
;
},
},
},
},
};
};
...
@@ -67,7 +65,7 @@ export default {
...
@@ -67,7 +65,7 @@ export default {
:category=
"issueButtonCategory"
:category=
"issueButtonCategory"
variant=
"info"
variant=
"info"
size=
"small"
size=
"small"
@
click=
"s
howIssueCount
"
@
click=
"s
etIssueSelected(true)
"
>
>
{{
__
(
'
Issues
'
)
}}
{{
__
(
'
Issues
'
)
}}
</gl-button>
</gl-button>
...
@@ -77,13 +75,13 @@ export default {
...
@@ -77,13 +75,13 @@ export default {
variant=
"info"
variant=
"info"
size=
"small"
size=
"small"
data-qa-selector=
"weight_button"
data-qa-selector=
"weight_button"
@
click=
"s
howIssueWeight
"
@
click=
"s
etIssueSelected(false)
"
>
>
{{
__
(
'
Issue weight
'
)
}}
{{
__
(
'
Issue weight
'
)
}}
</gl-button>
</gl-button>
</gl-button-group>
</gl-button-group>
</div>
</div>
<div
v-if=
"
burnupChartsEnabled
"
class=
"row"
>
<div
v-if=
"
glFeatures.burnupCharts
"
class=
"row"
>
<burndown-chart
<burndown-chart
:start-date=
"startDate"
:start-date=
"startDate"
:due-date=
"dueDate"
:due-date=
"dueDate"
...
...
ee/spec/frontend/burndown_chart/components/burn_charts_spec.js
View file @
b1721584
...
@@ -20,29 +20,17 @@ describe('burndown_chart', () => {
...
@@ -20,29 +20,17 @@ describe('burndown_chart', () => {
openIssuesWeight
:
[],
openIssuesWeight
:
[],
};
};
const
createComponent
=
(
props
=
{})
=>
{
const
createComponent
=
(
{
props
=
{},
featureEnabled
=
false
}
=
{})
=>
{
wrapper
=
shallowMount
(
BurnCharts
,
{
wrapper
=
shallowMount
(
BurnCharts
,
{
propsData
:
{
propsData
:
{
...
defaultProps
,
...
defaultProps
,
...
props
,
...
props
,
},
},
});
provide
:
{
};
glFeatures
:
{
burnupCharts
:
featureEnabled
},
let
origProp
;
beforeEach
(()
=>
{
origProp
=
window
.
gon
;
window
.
gon
=
{
features
:
{
burnupCharts
:
false
,
},
},
};
});
afterEach
(()
=>
{
window
.
gon
=
origProp
;
});
});
};
it
(
'
includes Issues and Issue weight buttons
'
,
()
=>
{
it
(
'
includes Issues and Issue weight buttons
'
,
()
=>
{
createComponent
();
createComponent
();
...
@@ -80,9 +68,7 @@ describe('burndown_chart', () => {
...
@@ -80,9 +68,7 @@ describe('burndown_chart', () => {
describe
(
'
feature disabled
'
,
()
=>
{
describe
(
'
feature disabled
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
window
.
gon
.
features
.
burnupCharts
=
false
;
createComponent
({
featureEnabled
:
false
});
createComponent
();
});
});
it
(
'
does not reduce width of burndown chart
'
,
()
=>
{
it
(
'
does not reduce width of burndown chart
'
,
()
=>
{
...
@@ -97,9 +83,7 @@ describe('burndown_chart', () => {
...
@@ -97,9 +83,7 @@ describe('burndown_chart', () => {
describe
(
'
feature enabled
'
,
()
=>
{
describe
(
'
feature enabled
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
window
.
gon
.
features
.
burnupCharts
=
true
;
createComponent
({
featureEnabled
:
true
});
createComponent
();
});
});
it
(
'
reduces width of burndown chart
'
,
()
=>
{
it
(
'
reduces width of burndown chart
'
,
()
=>
{
...
...
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