Resolve "User activity is stuck loading when there is none"
This commit is contained in:
parent
dab5eaf8da
commit
86b6053867
5 changed files with 24 additions and 7 deletions
|
@ -29,18 +29,21 @@ export default class UserOverviewBlock {
|
|||
|
||||
render(data) {
|
||||
const { html, count } = data;
|
||||
const contentList = document.querySelector(`${this.container} .overview-content-list`);
|
||||
const containerEl = document.querySelector(this.container);
|
||||
const contentList = containerEl.querySelector('.overview-content-list');
|
||||
|
||||
contentList.innerHTML += html;
|
||||
|
||||
const loadingEl = document.querySelector(`${this.container} .loading`);
|
||||
const loadingEl = containerEl.querySelector('.loading');
|
||||
|
||||
if (count && count > 0) {
|
||||
document.querySelector(`${this.container} .js-view-all`).classList.remove('hide');
|
||||
containerEl.querySelector('.js-view-all').classList.remove('hide');
|
||||
} else {
|
||||
document
|
||||
.querySelector(`${this.container} .nothing-here-block`)
|
||||
.classList.add('text-left', 'p-0');
|
||||
const nothingHereBlock = containerEl.querySelector('.nothing-here-block');
|
||||
|
||||
if (nothingHereBlock) {
|
||||
nothingHereBlock.classList.add('text-left', 'p-0');
|
||||
}
|
||||
}
|
||||
|
||||
loadingEl.classList.add('hide');
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
= render partial: 'events/event', collection: @events
|
||||
- if @events.present?
|
||||
= render partial: 'events/event', collection: @events
|
||||
- else
|
||||
.nothing-here-block= _("No activities found")
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Hide spinner on empty activites list on user profile overview
|
||||
merge_request: 24063
|
||||
author:
|
||||
type: other
|
|
@ -4416,6 +4416,9 @@ msgstr ""
|
|||
msgid "No"
|
||||
msgstr ""
|
||||
|
||||
msgid "No activities found"
|
||||
msgstr ""
|
||||
|
||||
msgid "No assignee"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@ describe 'Overview tab on a user profile', :js do
|
|||
|
||||
it 'does not show any entries in the list of activities' do
|
||||
page.within('.activities-block') do
|
||||
expect(page).to have_selector('.loading', visible: false)
|
||||
expect(page).to have_content('No activities found')
|
||||
expect(page).not_to have_selector('.event-item')
|
||||
end
|
||||
end
|
||||
|
@ -93,6 +95,7 @@ describe 'Overview tab on a user profile', :js do
|
|||
|
||||
it 'it shows an empty project list with an info message' do
|
||||
page.within('.projects-block') do
|
||||
expect(page).to have_selector('.loading', visible: false)
|
||||
expect(page).to have_content('No projects found')
|
||||
expect(page).not_to have_selector('.project-row')
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue