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 resource planning module to full calendar

Benjamin Bädorf81957d2fa3fc
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index 984789f9592..2330264beaa 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -2916,6 +2916,76 @@
}
}
},
+ "@fullcalendar/premium-common": {
+ "version": "5.5.1",
+ "resolved": "https://registry.npmjs.org/@fullcalendar/premium-common/-/premium-common-5.5.1.tgz",
+ "integrity": "sha512-xFf4MafsRN7XCohiJzBo02Qk2n1wyO66RjGoo+GOPIADq+4+TQbloQGltBq05tkjTsOZXnE6i2LIWOw/y8pShQ==",
+ "requires": {
+ "@fullcalendar/common": "~5.5.0",
+ "tslib": "^2.0.3"
+ },
+ "dependencies": {
+ "tslib": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
+ "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
+ }
+ }
+ },
+ "@fullcalendar/resource-common": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/@fullcalendar/resource-common/-/resource-common-5.5.0.tgz",
+ "integrity": "sha512-Bp1oqL30p9UGJ28ippsXtaHrBxbDXdcM5z/ZLEnmjbDB2wAHhy4oMXHZITbDvv1NlCqw0HUKjNz/gjWIhhSFiA==",
+ "requires": {
+ "@fullcalendar/common": "~5.5.0",
+ "@fullcalendar/premium-common": "~5.5.0",
+ "tslib": "^2.0.3"
+ },
+ "dependencies": {
+ "tslib": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
+ "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
+ }
+ }
+ },
+ "@fullcalendar/resource-timeline": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/@fullcalendar/resource-timeline/-/resource-timeline-5.5.0.tgz",
+ "integrity": "sha512-HLjs9RbidX9p3XStOuOz/8x/jPBJ4/9B2SUSU7KlhjEWnwvaxAgfeNApXSFy1c2IUh40t3rxf31Z3z+HcbEyZw==",
+ "requires": {
+ "@fullcalendar/common": "~5.5.0",
+ "@fullcalendar/premium-common": "~5.5.0",
+ "@fullcalendar/resource-common": "~5.5.0",
+ "@fullcalendar/scrollgrid": "~5.5.0",
+ "@fullcalendar/timeline": "~5.5.0",
+ "tslib": "^2.0.3"
+ },
+ "dependencies": {
+ "tslib": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
+ "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
+ }
+ }
+ },
+ "@fullcalendar/scrollgrid": {
+ "version": "5.5.1",
+ "resolved": "https://registry.npmjs.org/@fullcalendar/scrollgrid/-/scrollgrid-5.5.1.tgz",
+ "integrity": "sha512-oPmsIlyanVGSIoWoGcOYLvFZi/GVTTN4SOqS9PpiOXZPP+4UDP8PXTe4avA+doKC/DgHVpb7lBcpTFGSyRAISw==",
+ "requires": {
+ "@fullcalendar/common": "~5.5.0",
+ "@fullcalendar/premium-common": "~5.5.0",
+ "tslib": "^2.0.3"
+ },
+ "dependencies": {
+ "tslib": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
+ "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
+ }
+ }
+ },
"@fullcalendar/timegrid": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/@fullcalendar/timegrid/-/timegrid-5.5.0.tgz",
@@ -2933,6 +3003,24 @@
}
}
},
+ "@fullcalendar/timeline": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/@fullcalendar/timeline/-/timeline-5.5.0.tgz",
+ "integrity": "sha512-W7Bj7X/+tKK62oT/KrSrcelpYFVt3MgEDnt2ju9BZzkjk5LX+Xa8jiH+PLFtUZasF9pJ50i86KICC9WnFZzu3g==",
+ "requires": {
+ "@fullcalendar/common": "~5.5.0",
+ "@fullcalendar/premium-common": "~5.5.0",
+ "@fullcalendar/scrollgrid": "~5.5.0",
+ "tslib": "^2.0.3"
+ },
+ "dependencies": {
+ "tslib": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
+ "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
+ }
+ }
+ },
"@gar/promisify": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.2.tgz",
diff --git a/frontend/package.json b/frontend/package.json
index 5a9203ba08f..82a3e47b544 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -76,6 +76,7 @@
"@fullcalendar/core": "5.5.0",
"@fullcalendar/daygrid": "5.5.0",
"@fullcalendar/interaction": "5.5.0",
+ "@fullcalendar/resource-timeline": "5.5.0",
"@fullcalendar/timegrid": "5.5.0",
"@kolkov/ngx-gallery": "^1.0.11",
"@ng-select/ng-option-highlight": "0.0.5",
diff --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.ts
index 932f9c106cc..92b4528518c 100644
--- 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.ts
@@ -2,10 +2,12 @@ import {
ChangeDetectionStrategy,
Component,
} from '@angular/core';
+import { EventInput } from '@fullcalendar/core';
+import resourceTimelinePlugin from '@fullcalendar/resource-timeline';
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';
+
+console.log(resourceTimelinePlugin);
@Component({
selector: 'op-team-planner',
@@ -15,15 +17,31 @@ import { EventInput } from '@fullcalendar/core';
})
export class TeamPlannerComponent {
calendarOptions = {
+ schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',
editable: false,
locale: this.I18n.locale,
fixedWeekCount: false,
firstDay: this.configuration.startOfWeek(),
events: this.calendarEventsFunction.bind(this) as unknown,
- toolbar: this.buildHeader(),
- plugins: [dayGridPlugin],
- initialView: 'dayGridMonth',
+ // toolbar: this.buildHeader(),
+ plugins: [
+ resourceTimelinePlugin,
+ ],
+ initialView: 'resourceTimelineWeekDaysOnly',
height: 500,
+ views: {
+ resourceTimelineWeekDaysOnly: {
+ type: 'resourceTimeline',
+ duration: { weeks: 1 },
+ slotDuration: { days: 1 },
+ },
+ },
+ resources: [
+ {
+ id: '1',
+ title: 'User 1',
+ },
+ ],
};
constructor(
@@ -31,19 +49,23 @@ export class TeamPlannerComponent {
readonly configuration:ConfigurationService,
) {}
- public calendarEventsFunction(fetchInfo:{ start:Date, end:Date, timeZone:string },
- successCallback:(events:EventInput[]) => void):void|PromiseLike<EventInput[]> {
+ 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',
+ resourceId: '1',
allDay: true,
}]);
}
public buildHeader():{ right:string, center:string, left:string } {
return {
- right: 'dayGridMonth,dayGridWeek',
+ right: 'dayGridWeek',
center: 'title',
left: 'prev,next today',
};
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.ts
index 7570335b50a..64c4f92ceda 100644
--- 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.ts
@@ -1,15 +1,15 @@
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 { FullCalendarModule } from '@fullcalendar/angular';
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';
+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';
@NgModule({
declarations: [