Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[40188]Empty states for team planner (#9966)

Behrokh Satarnejad8cfacb9c1762
diff --git a/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.html b/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.html
index d66b1708b2c..e7805f8cf80 100644
--- a/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.html
+++ b/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.html
@@ -10,6 +10,11 @@
*ngIf="static"
[textContent]="calendar.tooManyResultsText"
class="op-wp-calendar--notification"></div>
+ <div
+ *ngIf="!(principalIds$ | async)?.length && !(showAddAssignee$ | async)"
+ class="op-team-planner--no-data">
+ <span [textContent]="text.noData"></span>
+ </div>
</ng-container>
<ng-template #resourceContent let-resource="resource">
diff --git a/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.sass b/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.sass
index 302ab38e752..46158dad2dc 100644
--- a/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.sass
+++ b/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.sass
@@ -7,5 +7,14 @@
// Avoid empty space on the right since the styled scrollbar would only be visible on hover.
@include no-visible-scroll-bar
+.op-team-planner
+ &--no-data
+ height: 250px
+ background-color: lightgray
+ display: flex
+ justify-content: center
+ align-items: center
+
.tp-assignee-add-button
margin-top: 1rem
+
diff --git a/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts b/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts
index 985bbaf2786..da3af615a12 100644
--- a/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts
+++ b/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts
@@ -101,6 +101,7 @@ export class TeamPlannerComponent extends UntilDestroyedMixin implements OnInit,
assignees: this.I18n.t('js.team_planner.label_assignee_plural'),
add_assignee: this.I18n.t('js.team_planner.add_assignee'),
remove_assignee: this.I18n.t('js.team_planner.remove_assignee'),
+ noData: this.I18n.t('js.team_planner.no_data'),
};
principals$ = this.principalIds$
diff --git a/modules/team_planner/config/locales/js-en.yml b/modules/team_planner/config/locales/js-en.yml
index 8d51d11f8af..1551da3d555 100644
--- a/modules/team_planner/config/locales/js-en.yml
+++ b/modules/team_planner/config/locales/js-en.yml
@@ -5,5 +5,6 @@ en:
title: 'Team planner'
unsaved_title: 'Unnamed team planner'
label_assignee_plural: 'Assignees'
+ no_data: 'Add assignees to set up your team planner.'
add_assignee: 'Add assignee'
remove_assignee: 'Remove assignee'
diff --git a/modules/team_planner/spec/features/team_planner_spec.rb b/modules/team_planner/spec/features/team_planner_spec.rb
index 3dcd040b1e0..d8aeb8f86bf 100644
--- a/modules/team_planner/spec/features/team_planner_spec.rb
+++ b/modules/team_planner/spec/features/team_planner_spec.rb
@@ -109,6 +109,7 @@ describe 'Team planner', type: :feature, js: true do
team_planner.title
+ team_planner.expect_empty_state
team_planner.expect_assignee(user, present: false)
team_planner.expect_assignee(other_user, present: false)
@@ -118,6 +119,8 @@ describe 'Team planner', type: :feature, js: true do
team_planner.select_user_to_add user.name
end
+ team_planner.expect_empty_state(present: false)
+
retry_block do
team_planner.click_add_user
page.find('[data-qa-selector="tp-add-assignee"] input')
@@ -159,11 +162,14 @@ describe 'Team planner', type: :feature, js: true do
team_planner.expect_assignee(user, present: true)
team_planner.expect_assignee(other_user, present: true)
+
+ team_planner.expect_empty_state(present: false)
end
it 'can add and remove assignees' do
team_planner.visit!
+ team_planner.expect_empty_state
team_planner.expect_assignee(user, present: false)
team_planner.expect_assignee(other_user, present: false)
@@ -173,6 +179,7 @@ describe 'Team planner', type: :feature, js: true do
team_planner.select_user_to_add user.name
end
+ team_planner.expect_empty_state(present: false)
team_planner.expect_assignee(user)
team_planner.expect_assignee(other_user, present: false)
@@ -194,6 +201,7 @@ describe 'Team planner', type: :feature, js: true do
team_planner.expect_assignee(user, present: false)
team_planner.expect_assignee(other_user, present: false)
+ team_planner.expect_empty_state
# Try one more time to make sure deleting the full filter didn't kill the functionality
retry_block do
diff --git a/modules/team_planner/spec/support/pages/team_planner.rb b/modules/team_planner/spec/support/pages/team_planner.rb
index 455a99dd608..93ec73b5a29 100644
--- a/modules/team_planner/spec/support/pages/team_planner.rb
+++ b/modules/team_planner/spec/support/pages/team_planner.rb
@@ -50,6 +50,10 @@ module Pages
expect(page).to have_selector '.editable-toolbar-title--fixed', text: title
end
+ def expect_empty_state(present: true)
+ expect(page).to have_conditional_selector(present, '.op-team-planner--no-data', text: 'Add assignees to set up your team planner.')
+ end
+
def expect_assignee(user, present: true)
name = user.is_a?(User) ? user.name : user.to_s
expect(page).to have_conditional_selector(present, '.fc-resource', text: name, wait: 10)