Allow referencing work packages in action boards

pull/8603/head
Oliver Günther 4 years ago
parent e2db9e2063
commit c4648f65b3
  1. 10
      frontend/src/app/modules/boards/board/board-list/board-list.component.html
  2. 2
      frontend/src/app/modules/boards/board/board-list/board-list.component.ts
  3. 13
      frontend/src/app/modules/boards/board/inline-add/board-inline-add-autocompleter.component.ts
  4. 1
      frontend/src/app/modules/boards/board/inline-add/board-inline-add-autocompleter.html
  5. 5
      modules/boards/spec/features/action_boards/assignee_board_spec.rb
  6. 10
      modules/boards/spec/features/action_boards/status_board_spec.rb
  7. 6
      modules/boards/spec/features/action_boards/subtasks_board_spec.rb
  8. 7
      modules/boards/spec/features/action_boards/version_board_spec.rb
  9. 13
      modules/boards/spec/features/support/board_page.rb

@ -34,15 +34,7 @@
[ngClass]="{ '-with-create-button': board.isAction || showAddButton }">
<div class="board-list--button-container">
<button [title]="text.addCard"
*ngIf="board.isAction"
(accessibleClick)="addNewCard()"
[disabled]="!showAddButton"
class="board-list--add-button board-list--card-add-button button">
<op-icon icon-classes="icon-{{buttonPlaceholder ? buttonPlaceholder.icon : 'add'}}"></op-icon>
<span *ngIf="buttonPlaceholder"> {{ buttonPlaceholder.text }} </span>
</button>
<button [title]="text.addCard"
*ngIf="!board.isAction && showAddButton"
*ngIf="showAddButton"
class="board-list--add-button board-list--card-dropdown-button button"
addCardDropdown>
<op-icon icon-classes="icon-small icon-add"></op-icon>

@ -447,7 +447,7 @@ export class BoardListComponent extends AbstractWidgetComponent implements OnIni
// Only allow updates, otherwise this causes an error reloading the list
// before the work package can be added to the query order
filter(event => event.eventType === 'updated'),
map((event:HalEvent) => event.commit?.changes[this.board.actionAttribute!]),
map((event:HalEvent) => event.commit?.changes[this.actionService!.filterName]),
filter(value => !!value),
filter((value:ChangeItem) => {

@ -66,7 +66,7 @@ export class BoardInlineAddAutocompleterComponent implements AfterViewInit {
placeholder: this.I18n.t('js.relations_autocomplete.placeholder')
};
@Input() appendToContainer:string = '.work-packages-partitioned-query-space--container';
@Input() appendToContainer:string = 'body';
@ViewChild(NgSelectComponent) public ngSelectComponent:NgSelectComponent;
@Output() onCancel = new EventEmitter<undefined>();
@ -127,6 +127,17 @@ export class BoardInlineAddAutocompleterComponent implements AfterViewInit {
}
}
public opened() {
// Force reposition as a workaround for BUG
// https://github.com/ng-select/ng-select/issues/1259
setTimeout(() => {
const component = this.ngSelectComponent as any;
if (component && component.dropdownPanel) {
component.dropdownPanel._updatePosition();
}
}, 25);
}
private autocompleteWorkPackages(searchString:string):Observable<WorkPackageResource[]> {
// Return when the search string is empty
if (searchString.length === 0) {

@ -5,6 +5,7 @@
[loading]="isLoading"
[typeahead]="searchInput$"
[closeOnSelect]="false"
(open)="opened()"
(close)="cancel()"
(change)="addWorkPackageToQuery($event)">
<ng-template ng-label-tmp let-item="item">

@ -177,6 +177,11 @@ describe 'Assignee action board',
board_page.expect_card('Foo Bar', 'Some Task', present: true)
board_page.expect_card('Grouped', 'Some Task', present: false)
# Reassign to grouped
board_page.reference 'Grouped', work_package
board_page.expect_card('Grouped', 'Some Task', present: true)
board_page.expect_card('Foo Bar', 'Some Task', present: false)
end
end

@ -205,8 +205,8 @@ describe 'Status action board', type: :feature, js: true do
expect(queries.last.name).to eq 'Closed'
expect(queries.first.ordered_work_packages).to be_empty
subjects = WorkPackage.where(id: second.ordered_work_packages.pluck(:work_package_id)).pluck(:subject, :status_id)
expect(subjects).to match_array [['Task 1', closed_status.id]]
subjects = WorkPackage.where(id: second.ordered_work_packages.pluck(:work_package_id))
expect(subjects.pluck(:subject, :status_id)).to match_array [['Task 1', closed_status.id]]
# Open remaining in split view
wp = second.ordered_work_packages.first.work_package
@ -221,6 +221,12 @@ describe 'Status action board', type: :feature, js: true do
board_page.expect_card('Open', 'Task 1', present: true)
board_page.expect_card('Closed', 'Task 1', present: false)
# Re-add task 1 to closed
board_page.reference('Closed', subjects.first)
board_page.expect_card('Open', 'Task 1', present: false)
board_page.expect_card('Closed', 'Task 1', present: true)
end
end
end

@ -148,6 +148,12 @@ describe 'Subtasks action board', type: :feature, js: true do
wp = WorkPackage.where(id: second.ordered_work_packages.pluck(:work_package_id)).first
expect(wp.parent_id).to eq other_wp.id
# Reference back
board_page.reference('Parent WP', wp)
board_page.expect_card('Parent WP', 'Second child', present: true)
board_page.expect_card('Other WP', 'Second child', present: false)
end
end
end

@ -292,6 +292,13 @@ describe 'Version action board', type: :feature, js: true do
board_page.expect_card('Open version', 'Closed', present: true)
board_page.expect_card('Closed version', 'Closed', present: false)
board_page.expect_card('Closed version', 'Foo', present: false)
# We can reference the work package back
board_page.reference('A second version', work_package)
board_page.expect_card('A second version', 'Foo', present: true)
board_page.expect_card('Open version', 'Foo', present: false)
board_page.expect_card('Closed version', 'Foo', present: false)
end
end

@ -75,13 +75,11 @@ module Pages
def add_card(list_name, card_title)
within_list(list_name) do
page.find('.board-list--add-button ').click
page.find('.board-list--add-button').click
end
unless action?
# Add item in dropdown
page.find('.menu-item', text: 'Add new card').click
end
# Add item in dropdown
page.find('.menu-item', text: 'Add new card').click
subject = page.find('#wp-new-inline-edit--field-subject')
subject.set card_title
@ -107,7 +105,7 @@ module Pages
select_autocomplete(page.find('.wp-inline-create--reference-autocompleter'),
query: work_package.subject,
results_selector: '.work-packages-partitioned-query-space--container',
results_selector: 'body',
select_text: "##{work_package.id}")
expect_card(list_name, work_package.subject)
@ -290,8 +288,7 @@ module Pages
def expect_editable_list(editable)
# Add list button
if action?
expect(page).to have_conditional_selector(!editable, '.board-list--add-button[disabled]')
expect(page).to have_conditional_selector(editable, '.board-list--add-button:not([disabled])')
expect(page).to have_conditional_selector(editable, '.board-list--add-button')
else
expect(page).to have_conditional_selector(editable, '.board-list--card-dropdown-button')
end

Loading…
Cancel
Save