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
e2df0d24
Commit
e2df0d24
authored
Mar 02, 2020
by
Martin Wortschack
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass SVG path from BE to FE
- Also replace custom empty state screen with GlEmptyState
parent
796cd50d
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
33 additions
and
85 deletions
+33
-85
changelogs/unreleased/208479-requests-for-svgs-returning-404-in-issues-analytics-feature.yml
...ts-for-svgs-returning-404-in-issues-analytics-feature.yml
+5
-0
ee/app/assets/javascripts/issues_analytics/components/empty_state.vue
...s/javascripts/issues_analytics/components/empty_state.vue
+0
-38
ee/app/assets/javascripts/issues_analytics/components/issues_analytics.vue
...ascripts/issues_analytics/components/issues_analytics.vue
+17
-12
ee/app/assets/javascripts/issues_analytics/index.js
ee/app/assets/javascripts/issues_analytics/index.js
+5
-1
ee/app/views/groups/issues_analytics/show.html.haml
ee/app/views/groups/issues_analytics/show.html.haml
+1
-1
ee/app/views/projects/analytics/issues_analytics/show.html.haml
.../views/projects/analytics/issues_analytics/show.html.haml
+1
-1
ee/spec/frontend/issues_analytics/components/issues_analytics_spec.js
...tend/issues_analytics/components/issues_analytics_spec.js
+4
-3
ee/spec/javascripts/issues_analytics/components/empty_state_spec.js
...vascripts/issues_analytics/components/empty_state_spec.js
+0
-29
No files found.
changelogs/unreleased/208479-requests-for-svgs-returning-404-in-issues-analytics-feature.yml
0 → 100644
View file @
e2df0d24
---
title
:
'
Issue
Analytics:
Fix
svg
illustration
path
for
empty
state'
merge_request
:
26219
author
:
type
:
fixed
ee/app/assets/javascripts/issues_analytics/components/empty_state.vue
deleted
100644 → 0
View file @
796cd50d
<
script
>
import
{
imagePath
}
from
'
~/lib/utils/common_utils
'
;
export
default
{
props
:
{
title
:
{
type
:
String
,
required
:
true
,
},
summary
:
{
type
:
String
,
required
:
true
,
},
image
:
{
type
:
String
,
required
:
true
,
},
},
computed
:
{
imagePath
()
{
return
imagePath
(
this
.
image
);
},
},
};
</
script
>
<
template
>
<div
class=
"row empty-state"
>
<div
class=
"col-12"
>
<div
class=
"svg-content"
><img
class=
"content-image"
:src=
"imagePath"
/></div>
</div>
<div
class=
"col-12"
>
<div
class=
"text-content"
>
<h4
class=
"content-title text-center"
>
{{
title
}}
</h4>
<p
class=
"content-summary"
>
{{
summary
}}
</p>
</div>
</div>
</div>
</
template
>
ee/app/assets/javascripts/issues_analytics/components/issues_analytics.vue
View file @
e2df0d24
<
script
>
<
script
>
import
{
mapGetters
,
mapActions
,
mapState
}
from
'
vuex
'
;
import
{
mapGetters
,
mapActions
,
mapState
}
from
'
vuex
'
;
import
{
engineeringNotation
,
sum
,
average
}
from
'
@gitlab/ui/src/utils/number_utils
'
;
import
{
engineeringNotation
,
sum
,
average
}
from
'
@gitlab/ui/src/utils/number_utils
'
;
import
{
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
{
GlLoadingIcon
,
GlEmptyState
}
from
'
@gitlab/ui
'
;
import
{
GlColumnChart
,
GlChartLegend
}
from
'
@gitlab/ui/dist/charts
'
;
import
{
GlColumnChart
,
GlChartLegend
}
from
'
@gitlab/ui/dist/charts
'
;
import
{
s__
}
from
'
~/locale
'
;
import
{
s__
}
from
'
~/locale
'
;
import
{
getMonthNames
}
from
'
~/lib/utils/datetime_utility
'
;
import
{
getMonthNames
}
from
'
~/lib/utils/datetime_utility
'
;
import
{
getSvgIconPathContent
}
from
'
~/lib/utils/icon_utils
'
;
import
{
getSvgIconPathContent
}
from
'
~/lib/utils/icon_utils
'
;
import
EmptyState
from
'
./empty_state.vue
'
;
export
default
{
export
default
{
components
:
{
components
:
{
EmptyState
,
GlLoadingIcon
,
GlLoadingIcon
,
GlEmptyState
,
GlColumnChart
,
GlColumnChart
,
GlChartLegend
,
GlChartLegend
,
},
},
...
@@ -24,6 +23,14 @@ export default {
...
@@ -24,6 +23,14 @@ export default {
type
:
HTMLDivElement
,
type
:
HTMLDivElement
,
required
:
true
,
required
:
true
,
},
},
noDataEmptyStateSvgPath
:
{
type
:
String
,
required
:
true
,
},
filtersEmptyStateSvgPath
:
{
type
:
String
,
required
:
true
,
},
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -135,9 +142,7 @@ export default {
...
@@ -135,9 +142,7 @@ export default {
</
script
>
</
script
>
<
template
>
<
template
>
<div
class=
"issues-analytics-wrapper"
data-qa-selector=
"issues_analytics_wrapper"
>
<div
class=
"issues-analytics-wrapper"
data-qa-selector=
"issues_analytics_wrapper"
>
<div
v-if=
"loading"
class=
"issues-analytics-loading text-center"
>
<gl-loading-icon
v-if=
"loading"
:size=
"4"
class=
"issues-analytics-loading"
/>
<gl-loading-icon
:inline=
"true"
:size=
"4"
/>
</div>
<div
v-if=
"showChart"
class=
"issues-analytics-chart"
>
<div
v-if=
"showChart"
class=
"issues-analytics-chart"
>
<h4
class=
"chart-title"
>
{{
s__
(
'
IssuesAnalytics|Issues created per month
'
)
}}
</h4>
<h4
class=
"chart-title"
>
{{
s__
(
'
IssuesAnalytics|Issues created per month
'
)
}}
</h4>
...
@@ -161,26 +166,26 @@ export default {
...
@@ -161,26 +166,26 @@ export default {
</div>
</div>
</div>
</div>
<empty-state
<
gl-
empty-state
v-if=
"showFiltersEmptyState"
v-if=
"showFiltersEmptyState"
image=
"illustrations/issues.svg"
:title=
"s__('IssuesAnalytics|Sorry, your filter produced no results')"
:title=
"s__('IssuesAnalytics|Sorry, your filter produced no results')"
:
summary
=
"
:
description
=
"
s__(
s__(
'IssuesAnalytics|To widen your search, change or remove filters in the filter bar above',
'IssuesAnalytics|To widen your search, change or remove filters in the filter bar above',
)
)
"
"
:svg-path=
"filtersEmptyStateSvgPath"
/>
/>
<empty-state
<
gl-
empty-state
v-if=
"showNoDataEmptyState"
v-if=
"showNoDataEmptyState"
image=
"illustrations/monitoring/getting_started.svg"
:title=
"s__('IssuesAnalytics|There are no issues for the projects in your group')"
:title=
"s__('IssuesAnalytics|There are no issues for the projects in your group')"
:
summary
=
"
:
description
=
"
s__(
s__(
'IssuesAnalytics|After you begin creating issues for your projects, we can start tracking and displaying metrics for them',
'IssuesAnalytics|After you begin creating issues for your projects, we can start tracking and displaying metrics for them',
)
)
"
"
:svg-path=
"noDataEmptyStateSvgPath"
/>
/>
</div>
</div>
</
template
>
</
template
>
ee/app/assets/javascripts/issues_analytics/index.js
View file @
e2df0d24
...
@@ -9,6 +9,8 @@ export default () => {
...
@@ -9,6 +9,8 @@ export default () => {
if
(
!
el
)
return
null
;
if
(
!
el
)
return
null
;
const
{
endpoint
,
noDataEmptyStateSvgPath
,
filtersEmptyStateSvgPath
}
=
el
.
dataset
;
// Set default filters from URL
// Set default filters from URL
store
.
dispatch
(
'
issueAnalytics/setFilters
'
,
window
.
location
.
search
);
store
.
dispatch
(
'
issueAnalytics/setFilters
'
,
window
.
location
.
search
);
...
@@ -25,8 +27,10 @@ export default () => {
...
@@ -25,8 +27,10 @@ export default () => {
render
(
createElement
)
{
render
(
createElement
)
{
return
createElement
(
'
issues-analytics
'
,
{
return
createElement
(
'
issues-analytics
'
,
{
props
:
{
props
:
{
endpoint
:
el
.
dataset
.
endpoint
,
endpoint
,
filterBlockEl
,
filterBlockEl
,
noDataEmptyStateSvgPath
,
filtersEmptyStateSvgPath
,
},
},
});
});
},
},
...
...
ee/app/views/groups/issues_analytics/show.html.haml
View file @
e2df0d24
-
page_title
_
(
'Issues Analytics'
)
-
page_title
_
(
'Issues Analytics'
)
=
render
'shared/issuable/search_bar'
,
type: :issues_analytics
,
show_sorting_dropdown:
false
=
render
'shared/issuable/search_bar'
,
type: :issues_analytics
,
show_sorting_dropdown:
false
#js-issues-analytics
{
data:
{
endpoint:
group_issues_analytics_path
(
@group
)
}
}
#js-issues-analytics
{
data:
{
endpoint:
group_issues_analytics_path
(
@group
)
,
no_data_empty_state_svg_path:
image_path
(
'illustrations/monitoring/getting_started.svg'
),
filters_empty_state_svg_path:
image_path
(
'illustrations/issues.svg'
)
}
}
ee/app/views/projects/analytics/issues_analytics/show.html.haml
View file @
e2df0d24
-
page_title
_
(
'Issues Analytics'
)
-
page_title
_
(
'Issues Analytics'
)
=
render
'shared/issuable/search_bar'
,
type: :issues_analytics
,
show_sorting_dropdown:
false
=
render
'shared/issuable/search_bar'
,
type: :issues_analytics
,
show_sorting_dropdown:
false
#js-issues-analytics
{
data:
{
endpoint:
project_analytics_issues_analytics_path
(
@project
)
}
}
#js-issues-analytics
{
data:
{
endpoint:
project_analytics_issues_analytics_path
(
@project
)
,
no_data_empty_state_svg_path:
image_path
(
'illustrations/monitoring/getting_started.svg'
),
filters_empty_state_svg_path:
image_path
(
'illustrations/issues.svg'
)
}
}
ee/spec/frontend/issues_analytics/components/issues_analytics_spec.js
View file @
e2df0d24
...
@@ -3,9 +3,8 @@ import MockAdapter from 'axios-mock-adapter';
...
@@ -3,9 +3,8 @@ import MockAdapter from 'axios-mock-adapter';
import
Vuex
from
'
vuex
'
;
import
Vuex
from
'
vuex
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
IssuesAnalytics
from
'
ee/issues_analytics/components/issues_analytics.vue
'
;
import
IssuesAnalytics
from
'
ee/issues_analytics/components/issues_analytics.vue
'
;
import
EmptyState
from
'
ee/issues_analytics/components/empty_state.vue
'
;
import
{
createLocalVue
,
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
createLocalVue
,
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
{
Gl
EmptyState
,
Gl
LoadingIcon
}
from
'
@gitlab/ui
'
;
import
{
createStore
}
from
'
ee/issues_analytics/stores
'
;
import
{
createStore
}
from
'
ee/issues_analytics/stores
'
;
const
localVue
=
createLocalVue
();
const
localVue
=
createLocalVue
();
...
@@ -28,6 +27,8 @@ describe('Issues Analytics component', () => {
...
@@ -28,6 +27,8 @@ describe('Issues Analytics component', () => {
const
propsData
=
data
||
{
const
propsData
=
data
||
{
endpoint
:
TEST_HOST
,
endpoint
:
TEST_HOST
,
filterBlockEl
:
document
.
querySelector
(
'
#mock-filter
'
),
filterBlockEl
:
document
.
querySelector
(
'
#mock-filter
'
),
noDataEmptyStateSvgPath
:
'
svg
'
,
filtersEmptyStateSvgPath
:
'
svg
'
,
};
};
return
shallowMount
(
IssuesAnalytics
,
{
return
shallowMount
(
IssuesAnalytics
,
{
...
@@ -50,7 +51,7 @@ describe('Issues Analytics component', () => {
...
@@ -50,7 +51,7 @@ describe('Issues Analytics component', () => {
const
findLoadingIcon
=
()
=>
wrapper
.
find
(
GlLoadingIcon
);
const
findLoadingIcon
=
()
=>
wrapper
.
find
(
GlLoadingIcon
);
const
findChartContainer
=
()
=>
wrapper
.
find
(
'
.issues-analytics-chart
'
);
const
findChartContainer
=
()
=>
wrapper
.
find
(
'
.issues-analytics-chart
'
);
const
findEmptyState
=
()
=>
wrapper
.
find
(
EmptyState
);
const
findEmptyState
=
()
=>
wrapper
.
find
(
Gl
EmptyState
);
it
(
'
fetches chart data when mounted
'
,
()
=>
{
it
(
'
fetches chart data when mounted
'
,
()
=>
{
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
'
issueAnalytics/fetchChartData
'
,
TEST_HOST
);
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
'
issueAnalytics/fetchChartData
'
,
TEST_HOST
);
...
...
ee/spec/javascripts/issues_analytics/components/empty_state_spec.js
deleted
100644 → 0
View file @
796cd50d
import
Vue
from
'
vue
'
;
import
EmptyState
from
'
ee/issues_analytics/components/empty_state.vue
'
;
import
mountComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
describe
(
'
Empty state component
'
,
()
=>
{
let
vm
;
const
Component
=
Vue
.
extend
(
EmptyState
);
const
props
=
{
image
:
'
illustrations/issues.svg
'
,
title
:
'
Hello World
'
,
summary
:
'
Lorem, ipsum dolor sit amet consectetur adipisicing elit.
'
,
};
beforeEach
(()
=>
{
vm
=
mountComponent
(
Component
,
props
);
});
it
(
'
renders the image
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.content-image
'
).
src
).
toContain
(
props
.
image
);
});
it
(
'
renders the title
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.content-title
'
).
textContent
.
trim
()).
toEqual
(
props
.
title
);
});
it
(
'
renders the summary
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.content-summary
'
).
textContent
.
trim
()).
toEqual
(
props
.
summary
);
});
});
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