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

Add meetings index API

Oliver Güntherf9f5287a8d78
diff --git a/frontend/src/app/shared/components/modals/view-settings-modal/view-settings.modal.html b/frontend/src/app/shared/components/modals/view-settings-modal/view-settings.modal.html
new file mode 100644
index 00000000000..36df1d2fcc6
--- /dev/null
+++ b/frontend/src/app/shared/components/modals/view-settings-modal/view-settings.modal.html
@@ -0,0 +1,58 @@
+<form
+ class="spot-modal loading-indicator--location"
+ data-indicator-name="modal"
+ name="modalSaveForm"
+ (submit)="saveQueryAs($event)"
+>
+ <h1 id="spotModalTitle" class="spot-modal--header">{{text.save_as}}</h1>
+
+ <div class="spot-divider"></div>
+
+ <div
+ name="modalSaveForm"
+ class="spot-modal--body spot-container"
+ >
+ <div class="form--field -required">
+ <label class="form--label -bold" for="save-query-name" [textContent]="text.label_name"></label>
+ <div class="form--field-container">
+ <div class="form--text-field-container">
+ <input
+ class="form--text-field"
+ type="text"
+ name="save-query-name"
+ id="save-query-name"
+ #queryNameField
+ [(ngModel)]="queryName"
+ required
+ />
+ </div>
+ </div>
+ </div>
+ <div class="spot-divider"></div>
+
+ <h2 class="spot-subheader-extra-small">{{ text.label_visibility_settings }}</h2>
+
+ <query-sharing-form
+ [isSave]="true"
+ (onChange)="setValues($event)"
+ [isStarred]="isStarred"
+ [isPublic]="isPublic">
+ </query-sharing-form>
+ </div>
+
+ <div class="spot-action-bar">
+ <div class="spot-action-bar--right">
+ <button
+ type="button"
+ class="button button_no-margin spot-modal--cancel-button spot-action-bar--action"
+ [textContent]="text.button_cancel"
+ (click)="closeMe($event)"
+ ></button>
+ <button
+ class="button button_no-margin -primary -with-icon icon-save spot-action-bar--action"
+ [textContent]="text.button_save"
+ [disabled]="isBusy || !queryName"
+ ></button>
+ </div>
+ </div>
+</form>
diff --git a/frontend/src/app/shared/components/modals/view-settings-modal/view-settings.modal.ts b/frontend/src/app/shared/components/modals/view-settings-modal/view-settings.modal.ts
new file mode 100644
index 00000000000..9a73dc10c24
--- /dev/null
+++ b/frontend/src/app/shared/components/modals/view-settings-modal/view-settings.modal.ts
@@ -0,0 +1,120 @@
+// -- copyright
+// OpenProject is an open source project management software.
+// Copyright (C) 2012-2024 the OpenProject GmbH
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License version 3.
+//
+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+// Copyright (C) 2006-2013 Jean-Philippe Lang
+// Copyright (C) 2010-2013 the ChiliProject Team
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// See COPYRIGHT and LICENSE files for more details.
+//++
+
+import { ChangeDetectorRef, Component, ElementRef, Inject, ViewChild } from '@angular/core';
+import { HalResourceNotificationService } from 'core-app/features/hal/services/hal-resource-notification.service';
+import { QueryResource } from 'core-app/features/hal/resources/query-resource';
+import { ToastService } from 'core-app/shared/components/toaster/toast.service';
+import { OpModalComponent } from 'core-app/shared/components/modal/modal.component';
+import { OpModalLocalsToken } from 'core-app/shared/components/modal/modal.service';
+import { OpModalLocalsMap } from 'core-app/shared/components/modal/modal.types';
+import { QuerySharingChange } from 'core-app/shared/components/modals/share-modal/query-sharing-form.component';
+import { I18nService } from 'core-app/core/i18n/i18n.service';
+import { IsolatedQuerySpace } from 'core-app/features/work-packages/directives/query-space/isolated-query-space';
+import { WorkPackagesListService } from 'core-app/features/work-packages/components/wp-list/wp-list.service';
+import { States } from 'core-app/core/states/states.service';
+import { WorkPackagesQueryViewService } from 'core-app/features/work-packages/components/wp-list/wp-query-view.service';
+
+@Component({
+ templateUrl: './view-settings.modal.html',
+})
+export class ViewSettingsModalComponent extends OpModalComponent {
+ public queryName = '';
+
+ public isStarred = false;
+
+ public isPublic = false;
+
+ public isBusy = false;
+
+ @ViewChild('queryNameField', { static: true }) queryNameField:ElementRef;
+
+ public text = {
+ title: this.I18n.t('js.modals.form_submit.title'),
+ text: this.I18n.t('js.modals.form_submit.text'),
+ save_as: this.I18n.t('js.label_save_as'),
+ label_name: this.I18n.t('js.modals.label_name'),
+ label_visibility_settings: this.I18n.t('js.label_visibility_settings'),
+ button_save: this.I18n.t('js.modals.button_save'),
+ button_cancel: this.I18n.t('js.button_cancel'),
+ close_popup: this.I18n.t('js.close_popup_title'),
+ };
+
+ constructor(
+ readonly elementRef:ElementRef,
+ @Inject(OpModalLocalsToken) public locals:OpModalLocalsMap,
+ readonly I18n:I18nService,
+ readonly states:States,
+ readonly querySpace:IsolatedQuerySpace,
+ readonly wpListService:WorkPackagesListService,
+ readonly wpView:WorkPackagesQueryViewService,
+ readonly halNotification:HalResourceNotificationService,
+ readonly cdRef:ChangeDetectorRef,
+ readonly toastService:ToastService,
+ ) {
+ super(locals, cdRef, elementRef);
+ }
+
+ public setValues(change:QuerySharingChange):void {
+ this.isStarred = change.isStarred;
+ this.isPublic = change.isPublic;
+ }
+
+ public onOpen():void {
+ this.queryNameField.nativeElement.focus();
+ }
+
+ public get afterFocusOn():HTMLElement {
+ return document.getElementById('work-packages-settings-button') as HTMLElement;
+ }
+
+ public saveQueryAs($event:Event):void {
+ $event.preventDefault();
+
+ if (this.isBusy || !this.queryName) {
+ return;
+ }
+
+ this.isBusy = true;
+ const query = this.querySpace.query.value!;
+ query.public = this.isPublic;
+
+ this.wpListService
+ .create(query, this.queryName)
+ .then((savedQuery:QueryResource):Promise<any> => {
+ if (this.isStarred && !savedQuery.starred) {
+ return this.wpListService.toggleStarred(savedQuery).then(() => this.closeMe($event));
+ }
+
+ this.closeMe($event);
+ return Promise.resolve(true);
+ })
+ .catch((error:any) => this.halNotification.handleRawError(error))
+ .then(() => this.isBusy = false); // Same as .finally()
+ }
+}
diff --git a/modules/meeting/lib/api/v3/meetings/meeting_collection_representer.rb b/modules/meeting/lib/api/v3/meetings/meeting_collection_representer.rb
new file mode 100644
index 00000000000..00ce8cd78c5
--- /dev/null
+++ b/modules/meeting/lib/api/v3/meetings/meeting_collection_representer.rb
@@ -0,0 +1,36 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2024 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+module API
+ module V3
+ module Meetings
+ class MeetingCollectionRepresenter < ::API::Decorators::OffsetPaginatedCollection
+ end
+ end
+ end
+end
diff --git a/modules/meeting/lib/api/v3/meetings/meetings_api.rb b/modules/meeting/lib/api/v3/meetings/meetings_api.rb
index 6a8e4a791a5..bcff3679e83 100644
--- a/modules/meeting/lib/api/v3/meetings/meetings_api.rb
+++ b/modules/meeting/lib/api/v3/meetings/meetings_api.rb
@@ -37,6 +37,8 @@ module API
end
end
+ get &::API::V3::Utilities::Endpoints::Index.new(model: Meeting).mount
+
route_param :id, type: Integer, desc: "Activity ID" do
after_validation do
@meeting = Meeting.visible.find(declared_params[:id])
diff --git a/modules/meeting/lib/open_project/meeting/engine.rb b/modules/meeting/lib/open_project/meeting/engine.rb
index b7faee8275b..dccd322a8bf 100644
--- a/modules/meeting/lib/open_project/meeting/engine.rb
+++ b/modules/meeting/lib/open_project/meeting/engine.rb
@@ -171,6 +171,10 @@ module OpenProject::Meeting
PermittedParams.permit(:search, :meetings)
end
+ add_api_path :meetings do
+ "#{root}/meetings"
+ end
+
add_api_path :meeting do |id|
"#{root}/meetings/#{id}"
end