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

Do not display the "Add widget" button unless the available widgets are loaded.

Dombi Attilabf5a0dbf9eef
diff --git a/frontend/src/app/shared/components/grids/grid/add-widget.service.ts b/frontend/src/app/shared/components/grids/grid/add-widget.service.ts
index 5fefda51b7a..06030f8dcab 100644
--- a/frontend/src/app/shared/components/grids/grid/add-widget.service.ts
+++ b/frontend/src/app/shared/components/grids/grid/add-widget.service.ts
@@ -16,14 +16,16 @@ import { I18nService } from 'core-app/core/i18n/i18n.service';
export class GridAddWidgetService {
text = { add: this.i18n.t('js.grid.add_widget') };
- constructor(readonly opModalService:OpModalService,
+ constructor(
+ readonly opModalService:OpModalService,
readonly injector:Injector,
readonly halResource:HalResourceService,
readonly layout:GridAreaService,
readonly drag:GridDragAndDropService,
readonly move:GridMoveService,
readonly resize:GridResizeService,
- readonly i18n:I18nService) {
+ readonly i18n:I18nService
+ ) {
}
public isAddable(area:GridArea) {
@@ -120,6 +122,6 @@ export class GridAddWidgetService {
}
public get isAllowed() {
- return this.layout.gridResource && this.layout.gridResource.updateImmediately;
+ return this.layout.gridResource && this.layout.gridResource.updateImmediately && this.layout.schema;
}
}
diff --git a/modules/grids/spec/support/pages/grid.rb b/modules/grids/spec/support/pages/grid.rb
index 96446872a0c..c9fab0c6636 100644
--- a/modules/grids/spec/support/pages/grid.rb
+++ b/modules/grids/spec/support/pages/grid.rb
@@ -83,17 +83,21 @@ module Pages
area = area_of(row_number, column_number, location)
area.hover
- add_widget_button = if using_cuprite?
- area.find(".grid--widget-add")
- else
- area.find(".grid--widget-add", visible: :all)
- end
+ enable_add_widget_mode_for(area)
+ add_widget_button = area.find(".grid--widget-add")
add_widget_button.click
within(".spot-modal", &)
end
+ def enable_add_widget_mode_for(area)
+ within('.toolbar-items') do
+ button = find_button "Add widget"
+ button.click if button[:class].exclude? "-active"
+ end
+ end
+
def expect_widget_adding_prohibited_generally(row_number = 1, column_number = 1)
area = area_of(row_number, column_number)
area.hover