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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Add team planner query page component
Oliver Günther4f531086caec
diff --git a/config/locales/js-en.yml b/config/locales/js-en.ymlindex ad3c6a09938..36fe43b174e 100644--- a/config/locales/js-en.yml+++ b/config/locales/js-en.yml@@ -691,6 +691,8 @@ en:first_day: 'First day'last_day: 'Last day'+ team_planner:+ title: 'Team planner'text_are_you_sure: "Are you sure?"text_data_lost: "All entered data will be lost."diff --git a/frontend/src/app/core/routing/openproject.routes.ts b/frontend/src/app/core/routing/openproject.routes.tsindex cbb18f5d808..2906f6d699d 100644--- a/frontend/src/app/core/routing/openproject.routes.ts+++ b/frontend/src/app/core/routing/openproject.routes.ts@@ -56,6 +56,7 @@ import {mobileGuardActivated,redirectToMobileAlternative,} from 'core-app/shared/helpers/routing/mobile-guard.helper';+import { TEAM_PLANNER_LAZY_ROUTES } from 'core-app/features/team-planner/team-planner/team-planner.lazy-routes';export const OPENPROJECT_ROUTES:Ng2StateDeclaration[] = [{@@ -144,6 +145,7 @@ export const OPENPROJECT_ROUTES:Ng2StateDeclaration[] = [},...MY_ACCOUNT_LAZY_ROUTES,...IAN_LAZY_ROUTES,+ ...TEAM_PLANNER_LAZY_ROUTES,];/**diff --git a/frontend/src/app/features/team-planner/team-planner/page/team-planner-page.component.ts b/frontend/src/app/features/team-planner/team-planner/page/team-planner-page.component.tsnew file mode 100644index 00000000000..10a475e04ea--- /dev/null+++ b/frontend/src/app/features/team-planner/team-planner/page/team-planner-page.component.ts@@ -0,0 +1,101 @@+import {+ ChangeDetectionStrategy,+ ChangeDetectorRef,+ Component,+ Injector,+ OnInit,+} from '@angular/core';+import {+ ToolbarButtonComponentDefinition,+ ViewPartitionState,+} from 'core-app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component';+import {+ StateService,+ TransitionService,+} from '@uirouter/core';+import { I18nService } from 'core-app/core/i18n/i18n.service';+import { APIV3Service } from 'core-app/core/apiv3/api-v3.service';+import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';+import { BackRoutingService } from 'core-app/features/work-packages/components/back-routing/back-routing.service';+import { ZenModeButtonComponent } from 'core-app/features/work-packages/components/wp-buttons/zen-mode-toggle-button/zen-mode-toggle-button.component';++@Component({+ templateUrl: '../../../work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.html',+ styleUrls: [+ '../../../work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.sass',+ ],+ changeDetection: ChangeDetectionStrategy.OnPush,+})+export class TeamPlannerPageComponent extends UntilDestroyedMixin {+ text = {+ title: this.I18n.t('js.team_planner.title'),+ };++ /** Go back using back-button */+ backButtonCallback:() => void = this.backButtonFn.bind(this);++ /** Current query title to render */+ selectedTitle = this.text.title;++ /** Disable filter container for now */+ filterContainerDefinition = null;++ /** We need to pass the correct partition state to the view to manage the grid */+ currentPartition:ViewPartitionState = '-split';++ /** Show a toolbar */+ showToolbar = true;++ /** Toolbar is not editable */+ titleEditingEnabled = false;++ /** Not savable */+ showToolbarSaveButton = false;++ /** Toolbar is always enabled */+ toolbarDisabled = false;++ /** Define the buttons shown in the toolbar */+ toolbarButtonComponents:ToolbarButtonComponentDefinition[] = [+ {+ component: ZenModeButtonComponent,+ },+ ];++ constructor(+ readonly I18n:I18nService,+ readonly cdRef:ChangeDetectorRef,+ readonly $transitions:TransitionService,+ readonly state:StateService,+ readonly injector:Injector,+ readonly apiV3Service:APIV3Service,+ readonly backRoutingService:BackRoutingService,+ ) {+ super();+ }++ /**+ * We need to set the current partition to the grid to ensure+ * either side gets expanded to full width if we're not in '-split' mode.+ *+ * @param state The current or entering state+ */+ setPartition(state:{ data:{ partition?:ViewPartitionState } }):void {+ this.currentPartition = state.data?.partition || '-split';+ }++ // For shared template compliance+ // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars+ updateTitleName(val:string):void {+ }++ // For shared template compliance+ // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars+ changeChangesFromTitle(val:string):void {+ }++ private backButtonFn():void {+ // Default fallback+ window.history.back();+ }+}diff --git a/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.html b/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.htmlnew file mode 100644index 00000000000..9aea5b5dc89--- /dev/null+++ b/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.html@@ -0,0 +1,4 @@+<full-calendar #ucCalendar+ *ngIf="calendarOptions"+ [options]="calendarOptions">+</full-calendar>\ No newline at end of filediff --git a/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.sass b/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.sassnew file mode 100644index 00000000000..e69de29bb2ddiff --git a/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts b/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.tsnew file mode 100644index 00000000000..861960e32d1--- /dev/null+++ b/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts@@ -0,0 +1,53 @@+import {+ ChangeDetectionStrategy,+ Component,+} from '@angular/core';+import { I18nService } from 'core-app/core/i18n/i18n.service';+import dayGridPlugin from '@fullcalendar/daygrid';+import { ConfigurationService } from 'core-app/core/config/configuration.service';+import { EventInput } from '@fullcalendar/core';++@Component({+ selector: 'op-team-planner',+ templateUrl: './team-planner.component.html',+ styleUrls: ['./team-planner.component.sass'],+ changeDetection: ChangeDetectionStrategy.OnPush,+})+export class TeamPlannerComponent {+ calendarOptions = {+ editable: false,+ locale: this.I18n.locale,+ fixedWeekCount: false,+ firstDay: this.configuration.startOfWeek(),+ events: this.calendarEventsFunction.bind(this),+ toolbar: this.buildHeader(),+ plugins: [dayGridPlugin],+ initialView: 'dayGridMonth',+ height: 500,+ };++ constructor(+ readonly I18n:I18nService,+ readonly configuration:ConfigurationService,+ ) {}++ public calendarEventsFunction(fetchInfo:{ start:Date, end:Date, timeZone:string },+ successCallback:(events:EventInput[]) => void,+ failureCallback:(error:any) => void):void|PromiseLike<EventInput[]> {++ successCallback([{+ title: "Important todo",+ start: '2021-11-10',+ end: '2021-11-21',+ allDay: true,+ }]);+ }++ public buildHeader() {+ return {+ right: 'dayGridMonth,dayGridWeek',+ center: 'title',+ left: 'prev,next today',+ };+ }+}diff --git a/frontend/src/app/features/team-planner/team-planner/team-planner.lazy-routes.ts b/frontend/src/app/features/team-planner/team-planner/team-planner.lazy-routes.tsnew file mode 100644index 00000000000..348054b1d16--- /dev/null+++ b/frontend/src/app/features/team-planner/team-planner/team-planner.lazy-routes.ts@@ -0,0 +1,38 @@+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2021 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 { Ng2StateDeclaration } from '@uirouter/angular';++export const TEAM_PLANNER_LAZY_ROUTES:Ng2StateDeclaration[] = [+ {+ name: 'team_planner.**',+ parent: 'optional_project',+ url: '/team_planner',+ loadChildren: () => import('./team-planner.module').then((m) => m.TeamPlannerModule),+ },+];diff --git a/frontend/src/app/features/team-planner/team-planner/team-planner.module.ts b/frontend/src/app/features/team-planner/team-planner/team-planner.module.tsnew file mode 100644index 00000000000..7570335b50a--- /dev/null+++ b/frontend/src/app/features/team-planner/team-planner/team-planner.module.ts@@ -0,0 +1,33 @@+import { NgModule } from '@angular/core';+import { CommonModule } from '@angular/common';+import { TeamPlannerComponent } from 'core-app/features/team-planner/team-planner/planner/team-planner.component';+import { TeamPlannerPageComponent } from 'core-app/features/team-planner/team-planner/page/team-planner-page.component';+import { OPSharedModule } from 'core-app/shared/shared.module';+import { UIRouterModule } from '@uirouter/angular';+import { DynamicModule } from 'ng-dynamic-component';+import { IconModule } from 'core-app/shared/components/icon/icon.module';+import { OpenprojectPrincipalRenderingModule } from 'core-app/shared/components/principal/principal-rendering.module';+import { OpenprojectWorkPackagesModule } from 'core-app/features/work-packages/openproject-work-packages.module';+import { TEAM_PLANNER_ROUTES } from 'core-app/features/team-planner/team-planner/team-planner.routes';+import { FullCalendarModule } from '@fullcalendar/angular';++@NgModule({+ declarations: [+ TeamPlannerComponent,+ TeamPlannerPageComponent,+ ],+ imports: [+ OPSharedModule,+ // Routes for /backlogs+ UIRouterModule.forChild({+ states: TEAM_PLANNER_ROUTES,+ }),+ DynamicModule,+ CommonModule,+ IconModule,+ OpenprojectPrincipalRenderingModule,+ OpenprojectWorkPackagesModule,+ FullCalendarModule,+ ],+})+export class TeamPlannerModule {}diff --git a/frontend/src/app/features/team-planner/team-planner/team-planner.routes.ts b/frontend/src/app/features/team-planner/team-planner/team-planner.routes.tsnew file mode 100644index 00000000000..dc1402a903c--- /dev/null+++ b/frontend/src/app/features/team-planner/team-planner/team-planner.routes.ts@@ -0,0 +1,65 @@+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2021 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 { Ng2StateDeclaration } from '@uirouter/angular';+import { makeSplitViewRoutes } from 'core-app/features/work-packages/routing/split-view-routes.template';+import { WorkPackageSplitViewComponent } from 'core-app/features/work-packages/routing/wp-split-view/wp-split-view.component';+import { WorkPackagesBaseComponent } from 'core-app/features/work-packages/routing/wp-base/wp--base.component';+import { TeamPlannerPageComponent } from 'core-app/features/team-planner/team-planner/page/team-planner-page.component';+import { TeamPlannerComponent } from 'core-app/features/team-planner/team-planner/planner/team-planner.component';++export const TEAM_PLANNER_ROUTES:Ng2StateDeclaration[] = [+ {+ name: 'team_planner',+ parent: 'optional_project',+ url: '/team_planner',+ redirectTo: 'team_planner.page',+ views: {+ '!$default': { component: WorkPackagesBaseComponent },+ },+ },+ {+ name: 'team_planner.page',+ component: TeamPlannerPageComponent,+ redirectTo: 'team_planner.page.show',+ },+ {+ name: 'team_planner.page.show',+ data: {+ baseRoute: 'team_planner.page.show',+ },+ views: {+ 'content-left': { component: TeamPlannerComponent },+ },+ },+ ...makeSplitViewRoutes(+ 'team_planner.page.show',+ undefined,+ WorkPackageSplitViewComponent,+ ),+];diff --git a/modules/team_planner/config/routes.rb b/modules/team_planner/config/routes.rbindex 4c2e0d8a958..b175df93065 100644--- a/modules/team_planner/config/routes.rb+++ b/modules/team_planner/config/routes.rb@@ -1,6 +1,5 @@OpenProject::Application.routes.draw do- #scope 'projects/:project_id', as: 'project' do- # get '/team_planner(/*state)', to: 'team_planner/team_planner#index'- #end- get '/projects/:project_id/team_planner', to: 'team_planner/team_planner#index'+ scope 'projects/:project_id', as: 'project' do+ get '/team_planner(/*state)', to: 'team_planner/team_planner#index'+ endend