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

Move timer button behind create button

Oliver Günther6bb3448ded81
diff --git a/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.html b/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.html
index 39bd117658b..8d70566ded2 100644
--- a/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.html
+++ b/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.html
@@ -19,18 +19,18 @@
</div>
</div>
<ul id="toolbar-items" class="toolbar-items hide-when-print">
- <li class="toolbar-item hidden-for-mobile" *ngIf="displayTimerButton">
- <op-wp-timer-button
- [workPackage]="workPackage"
- >
- </op-wp-timer-button>
- </li>
<li class="toolbar-item hidden-for-mobile">
<wp-create-button
[allowed]="['work_package.addChild', 'work_package.copy']"
[stateName$]="stateName$">
</wp-create-button>
</li>
+ <li class="toolbar-item hidden-for-mobile" *ngIf="displayTimerButton">
+ <op-wp-timer-button
+ [workPackage]="workPackage"
+ >
+ </op-wp-timer-button>
+ </li>
<li class="toolbar-item" *ngIf="displayWatchButton">
<wp-watcher-button [workPackage]="workPackage"
[showText]="false">
diff --git a/frontend/src/app/shared/components/fields/edit/field-types/select-edit-field/select-edit-field.component.ts b/frontend/src/app/shared/components/fields/edit/field-types/select-edit-field/select-edit-field.component.ts
index b9c197583ec..c2e2ce0f0fe 100644
--- a/frontend/src/app/shared/components/fields/edit/field-types/select-edit-field/select-edit-field.component.ts
+++ b/frontend/src/app/shared/components/fields/edit/field-types/select-edit-field/select-edit-field.component.ts
@@ -49,6 +49,7 @@ import { CollectionResource } from 'core-app/features/hal/resources/collection-r
import { HalResourceNotificationService } from 'core-app/features/hal/services/hal-resource-notification.service';
import { HalResourceSortingService } from 'core-app/features/hal/services/hal-resource-sorting.service';
import { EditFieldComponent } from '../../edit-field.component';
+import { HalLink } from 'core-app/features/hal/hal-link/hal-link';
export interface ValueOption {
name:string;
@@ -199,7 +200,16 @@ export class SelectEditFieldComponent extends EditFieldComponent implements OnIn
}
protected fetchAllowedValueQuery(query?:string):Promise<CollectionResource> {
- return this.schema.allowedValues.$link.$fetch(this.allowedValuesFilter(query)) as Promise<CollectionResource>;
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+ const link = this.schema.allowedValues?.$link as HalLink|undefined;
+
+ // Race condition: Field was under edit but is no longer editable / values not loadable
+ // which means the schema switched during the period it opened / updated after saved.
+ if (!link) {
+ return new Promise(() => {});
+ }
+
+ return link.$fetch(this.allowedValuesFilter(query)) as Promise<CollectionResource>;
}
private addValue(val:HalResource) {
diff --git a/spec/support/components/work_packages/timer_button.rb b/spec/support/components/work_packages/timer_button.rb
index 05a80145c39..bba258c17bc 100644
--- a/spec/support/components/work_packages/timer_button.rb
+++ b/spec/support/components/work_packages/timer_button.rb
@@ -50,6 +50,7 @@ module Components
end
def start
+ close_dropdown
page.within('op-wp-timer-button') do
find('[data-qa-selector="timer-inactive"]').click
end
@@ -60,6 +61,15 @@ module Components
find('[data-qa-selector="timer-active"]').click
end
end
+
+ # Fix to close active dropdowns in the top menu
+ def close_dropdown
+ page.evaluate_script <<~JS
+ document
+ .getElementById('wrapper')
+ .dispatchEvent(new MouseEvent('click'))
+ JS
+ end
end
end
end