Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@
}
}

public switchToFullscreenForWp(wp:WorkPackageResource):void {
const link = this.pathHelper.genericWorkPackagePath(wp.project?.identifier, wp.id!) + window.location.search;
Turbo.visit(link, { action: 'advance' });
public parentLink(parent:WorkPackageResource):string {
return this.pathHelper.genericWorkPackagePath(parent.project?.identifier, parent.id!) + window.location.search;

Check failure on line 113 in frontend/src/app/features/work-packages/components/wp-breadcrumb/wp-breadcrumb-parent.component.ts

View workflow job for this annotation

GitHub Actions / eslint

[eslint] frontend/src/app/features/work-packages/components/wp-breadcrumb/wp-breadcrumb-parent.component.ts#L113 <@typescript-eslint/no-unsafe-argument>(https://typescript-eslint.io/rules/no-unsafe-argument)

Unsafe argument of type `any` assigned to a parameter of type `string | null`.
Raw output
{"ruleId":"@typescript-eslint/no-unsafe-argument","severity":2,"message":"Unsafe argument of type `any` assigned to a parameter of type `string | null`.","line":113,"column":51,"nodeType":"ChainExpression","messageId":"unsafeArgument","endLine":113,"endColumn":77}

Check failure on line 113 in frontend/src/app/features/work-packages/components/wp-breadcrumb/wp-breadcrumb-parent.component.ts

View workflow job for this annotation

GitHub Actions / eslint

[eslint] frontend/src/app/features/work-packages/components/wp-breadcrumb/wp-breadcrumb-parent.component.ts#L113 <@typescript-eslint/no-unsafe-member-access>(https://typescript-eslint.io/rules/no-unsafe-member-access)

Unsafe member access .identifier on an `any` value.
Raw output
{"ruleId":"@typescript-eslint/no-unsafe-member-access","severity":2,"message":"Unsafe member access .identifier on an `any` value.","line":113,"column":67,"nodeType":"Identifier","messageId":"unsafeMemberExpression","endLine":113,"endColumn":77}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
@if (parent) {
<a
[attr.title]="parent.name"
(click)="switchToFullscreenForWp(parent)"
class="op-wp-breadcrumb-parent nocut"
data-test-selector="op-wp-breadcrumb-parent">
<span [textContent]="parent.name"></span>
[href]="parentLink(parent)"
class="op-wp-breadcrumb-parent"
data-test-selector="op-wp-breadcrumb-parent"
data-turbo="false"
[textContent]="parent.name">
</a>
}
@if (canModifyParent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import { Component, Input } from '@angular/core';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';

@Component({
templateUrl: './wp-breadcrumb.html',
Expand All @@ -44,8 +45,10 @@
hierarchy: this.I18n.t('js.relations_hierarchy.hierarchy_headline'),
};

constructor(private I18n:I18nService) {
}
constructor(
private I18n:I18nService,

Check failure on line 49 in frontend/src/app/features/work-packages/components/wp-breadcrumb/wp-breadcrumb.component.ts

View workflow job for this annotation

GitHub Actions / eslint

[eslint] frontend/src/app/features/work-packages/components/wp-breadcrumb/wp-breadcrumb.component.ts#L49 <@angular-eslint/prefer-inject>(https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-inject.md)

Prefer using the inject() function over constructor parameter injection. Use Angular's migration schematic to automatically refactor: ng generate @angular/core:inject
Raw output
{"ruleId":"@angular-eslint/prefer-inject","severity":2,"message":"Prefer using the inject() function over constructor parameter injection. Use Angular's migration schematic to automatically refactor: ng generate @angular/core:inject","line":49,"column":5,"nodeType":"TSParameterProperty","messageId":"preferInject","endLine":49,"endColumn":29}
private pathHelper:PathHelperService,

Check failure on line 50 in frontend/src/app/features/work-packages/components/wp-breadcrumb/wp-breadcrumb.component.ts

View workflow job for this annotation

GitHub Actions / eslint

[eslint] frontend/src/app/features/work-packages/components/wp-breadcrumb/wp-breadcrumb.component.ts#L50 <@angular-eslint/prefer-inject>(https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-inject.md)

Prefer using the inject() function over constructor parameter injection. Use Angular's migration schematic to automatically refactor: ng generate @angular/core:inject
Raw output
{"ruleId":"@angular-eslint/prefer-inject","severity":2,"message":"Prefer using the inject() function over constructor parameter injection. Use Angular's migration schematic to automatically refactor: ng generate @angular/core:inject","line":50,"column":5,"nodeType":"TSParameterProperty","messageId":"preferInject","endLine":50,"endColumn":41}
) {}

public inputActive = false;

Expand All @@ -57,6 +60,10 @@
return (this.hierarchyCount === 1) ? this.text.parent : this.text.hierarchy;
}

public ancestorPath(ancestor:WorkPackageResource):string {
return this.pathHelper.genericWorkPackagePath(this.workPackage.project?.identifier, ancestor.id!) + window.location.search;

Check failure on line 64 in frontend/src/app/features/work-packages/components/wp-breadcrumb/wp-breadcrumb.component.ts

View workflow job for this annotation

GitHub Actions / eslint

[eslint] frontend/src/app/features/work-packages/components/wp-breadcrumb/wp-breadcrumb.component.ts#L64 <@typescript-eslint/no-unsafe-argument>(https://typescript-eslint.io/rules/no-unsafe-argument)

Unsafe argument of type `any` assigned to a parameter of type `string | null`.
Raw output
{"ruleId":"@typescript-eslint/no-unsafe-argument","severity":2,"message":"Unsafe argument of type `any` assigned to a parameter of type `string | null`.","line":64,"column":51,"nodeType":"ChainExpression","messageId":"unsafeArgument","endLine":64,"endColumn":87}

Check failure on line 64 in frontend/src/app/features/work-packages/components/wp-breadcrumb/wp-breadcrumb.component.ts

View workflow job for this annotation

GitHub Actions / eslint

[eslint] frontend/src/app/features/work-packages/components/wp-breadcrumb/wp-breadcrumb.component.ts#L64 <@typescript-eslint/no-unsafe-member-access>(https://typescript-eslint.io/rules/no-unsafe-member-access)

Unsafe member access .identifier on an `any` value.
Raw output
{"ruleId":"@typescript-eslint/no-unsafe-member-access","severity":2,"message":"Unsafe member access .identifier on an `any` value.","line":64,"column":77,"nodeType":"Identifier","messageId":"unsafeMemberExpression","endLine":64,"endColumn":87}
}

public updateActiveInput(val:boolean) {
this.inputActive = val;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
class="op-wp-breadcrumb--ellipsed"
[ngClass]="{ 'icon4 icon-small icon-arrow-right5': !first }">
<a [attr.title]="ancestor.name"
[textContent]="ancestor.name"
uiSref="work-packages.show"
[uiParams]="{workPackageId: ancestor.id}"
class="nocut"></a>
[textContent]="ancestor.name"
data-test-selector="op-wp-breadcrumb--hierarchy-element"
[href]="ancestorPath(ancestor)"
data-turbo="false"></a>
</li>
}
}
Expand Down
30 changes: 30 additions & 0 deletions spec/features/work_package_show_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,19 @@
RSpec.describe "Work package show page", :selenium do
let(:user) { create(:admin) }
let(:project) { create(:project) }
let(:grand_parent) do
build(:work_package,
project:)
end
let(:parent) do
build(:work_package,
project:,
parent: grand_parent)
end
let(:work_package) do
build(:work_package,
project:,
parent:,
assigned_to: user,
responsible: user)
end
Expand All @@ -56,4 +66,24 @@
assignee: work_package.assigned_to.name,
responsible: work_package.responsible.name
end

it "navigates the breadcrumb (#69640)", :js do
wp_page = Pages::FullWorkPackage.new(work_package)

wp_page.visit!

# Navigate to parent element
page.find_test_selector("op-wp-breadcrumb-parent", text: parent.subject).click
expect(page).to have_test_selector "op-wp-breadcrumb-parent", text: grand_parent.subject, wait: 10

expect(page).to have_current_path project_work_packages_path(project) + "/#{parent.id}/activity"

# Go back
page.go_back
expect(page).to have_test_selector "op-wp-breadcrumb-parent", text: parent.subject, wait: 10

# Navigate to Grandparent
page.find_test_selector("op-wp-breadcrumb--hierarchy-element", text: grand_parent.subject).click
expect(page).to have_current_path project_work_packages_path(project) + "/#{grand_parent.id}/activity", wait: 10
end
end
Loading