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

[32133] Show loading indicator until timeline refreshed if it is open

Oliver Günther324f5b6965cc
diff --git a/frontend/src/app/components/wp-card-view/services/wp-card-view.service.ts b/frontend/src/app/components/wp-card-view/services/wp-card-view.service.ts
index 47d0c044f87..35786457c7a 100644
--- a/frontend/src/app/components/wp-card-view/services/wp-card-view.service.ts
+++ b/frontend/src/app/components/wp-card-view/services/wp-card-view.service.ts
@@ -13,7 +13,7 @@ export class WorkPackageCardViewService {
}
public get renderedCards() {
- return this.querySpace.rendered.getValueOr([]);
+ return this.querySpace.tableRendered.getValueOr([]);
}
public findRenderedCard(classIdentifier:string):number {
@@ -23,7 +23,7 @@ export class WorkPackageCardViewService {
}
public updateRenderedCardsValues(workPackages:WorkPackageResource[]) {
- this.querySpace.rendered.putValue(
+ this.querySpace.tableRendered.putValue(
workPackages.map((wp) => {
return {
classIdentifier: this.classIdentifier(wp),
diff --git a/frontend/src/app/components/wp-fast-table/builders/modes/grouped/grouped-rows-builder.ts b/frontend/src/app/components/wp-fast-table/builders/modes/grouped/grouped-rows-builder.ts
index d9f99525ffb..baa258f50e6 100644
--- a/frontend/src/app/components/wp-fast-table/builders/modes/grouped/grouped-rows-builder.ts
+++ b/frontend/src/app/components/wp-fast-table/builders/modes/grouped/grouped-rows-builder.ts
@@ -70,7 +70,7 @@ export class GroupedRowsBuilder extends RowsBuilder {
public refreshExpansionState() {
const groups = this.getGroupData();
const colspan = this.wpTableColumns.columnCount + 1;
- const rendered = this.querySpace.rendered.value!;
+ const rendered = this.querySpace.tableRendered.value!;
const builder = new GroupHeaderBuilder(this.injector);
jQuery(this.workPackageTable.tableAndTimelineContainer)
@@ -100,7 +100,7 @@ export class GroupedRowsBuilder extends RowsBuilder {
});
});
- this.querySpace.rendered.putValue(rendered, 'Updated hidden state of rows after group change.');
+ this.querySpace.tableRendered.putValue(rendered, 'Updated hidden state of rows after group change.');
}
/**
diff --git a/frontend/src/app/components/wp-fast-table/handlers/state/hierarchy-transformer.ts b/frontend/src/app/components/wp-fast-table/handlers/state/hierarchy-transformer.ts
index 538d8f6c54b..325a653cf87 100644
--- a/frontend/src/app/components/wp-fast-table/handlers/state/hierarchy-transformer.ts
+++ b/frontend/src/app/components/wp-fast-table/handlers/state/hierarchy-transformer.ts
@@ -41,7 +41,7 @@ export class HierarchyTransformer {
.updates$()
.pipe(
takeUntil(this.querySpace.stopAllSubscriptions),
- filter(() => this.querySpace.rendered.hasValue())
+ filter(() => this.querySpace.tableRendered.hasValue())
)
.subscribe((state:WorkPackageViewHierarchies) => {
@@ -57,7 +57,7 @@ export class HierarchyTransformer {
* Update all currently visible rows to match the selection state.
*/
private renderHierarchyState(state:WorkPackageViewHierarchies) {
- const rendered = this.querySpace.rendered.value!;
+ const rendered = this.querySpace.tableRendered.value!;
// Show all hierarchies
jQuery('[class^="__hierarchy-group-"]').removeClass((i:number, classNames:string):string => {
@@ -99,6 +99,6 @@ export class HierarchyTransformer {
}
- this.querySpace.rendered.putValue(rendered, 'Updated hidden state of rows after hierarchy change.');
+ this.querySpace.tableRendered.putValue(rendered, 'Updated hidden state of rows after hierarchy change.');
}
}
diff --git a/frontend/src/app/components/wp-fast-table/handlers/state/rows-transformer.ts b/frontend/src/app/components/wp-fast-table/handlers/state/rows-transformer.ts
index d0c25261506..2edf05ff40b 100644
--- a/frontend/src/app/components/wp-fast-table/handlers/state/rows-transformer.ts
+++ b/frontend/src/app/components/wp-fast-table/handlers/state/rows-transformer.ts
@@ -42,7 +42,7 @@ export class RowsTransformer {
.pipe(
takeUntil(this.querySpace.stopAllSubscriptions.asObservable()),
filter(() => {
- let rendered = this.querySpace.rendered.getValueOr([]);
+ let rendered = this.querySpace.tableRendered.getValueOr([]);
return rendered && rendered.length > 0;
})
)
diff --git a/frontend/src/app/components/wp-fast-table/handlers/state/selection-transformer.ts b/frontend/src/app/components/wp-fast-table/handlers/state/selection-transformer.ts
index bb0d71555f0..f3966a3ea65 100644
--- a/frontend/src/app/components/wp-fast-table/handlers/state/selection-transformer.ts
+++ b/frontend/src/app/components/wp-fast-table/handlers/state/selection-transformer.ts
@@ -23,7 +23,7 @@ export class SelectionTransformer {
public readonly table:WorkPackageTable) {
// Focus a single selection when active
- this.querySpace.rendered.values$()
+ this.querySpace.tableRendered.values$()
.pipe(
takeUntil(this.querySpace.stopAllSubscriptions)
)
diff --git a/frontend/src/app/components/wp-fast-table/wp-fast-table.ts b/frontend/src/app/components/wp-fast-table/wp-fast-table.ts
index 8c745b99806..78084503c61 100644
--- a/frontend/src/app/components/wp-fast-table/wp-fast-table.ts
+++ b/frontend/src/app/components/wp-fast-table/wp-fast-table.ts
@@ -56,7 +56,7 @@ export class WorkPackageTable {
}
public get renderedRows() {
- return this.querySpace.rendered.getValueOr([]);
+ return this.querySpace.tableRendered.getValueOr([]);
}
public findRenderedRow(classIdentifier:string):[number, RenderedWorkPackage] {
@@ -103,14 +103,19 @@ export class WorkPackageTable {
* all elements.
*/
public redrawTableAndTimeline() {
- const renderPass = this.performRenderPass();
+ const renderPass = this.performRenderPass(false);
// Insert timeline body
requestAnimationFrame(() => {
+ this.tbody.innerHTML = '';
this.timelineBody.innerHTML = '';
+ this.tbody.appendChild(renderPass.tableBody);
this.timelineBody.appendChild(renderPass.timeline.timelineBody);
- this.querySpace.rendered.putValue(renderPass.result);
+ // Mark rendering event in a timeout to let DOM process
+ setTimeout(() =>
+ this.querySpace.tableRendered.putValue(renderPass.result)
+ );
});
}
@@ -119,7 +124,7 @@ export class WorkPackageTable {
*/
public redrawTable() {
const renderPass = this.performRenderPass();
- this.querySpace.rendered.putValue(renderPass.result);
+ this.querySpace.tableRendered.putValue(renderPass.result);
}
/**
@@ -151,16 +156,22 @@ export class WorkPackageTable {
}
- private performRenderPass() {
+ /**
+ * Perform the render pass
+ * @param insert whether to insert the result (set to false for timeline)
+ */
+ private performRenderPass(insert:boolean = true) {
this.portalCleanupService.clear();
this.editing.reset();
const renderPass = this.lastRenderPass = this.rowBuilder.buildRows();
// Insert table body
- requestAnimationFrame(() => {
- this.tbody.innerHTML = '';
- this.tbody.appendChild(renderPass.tableBody);
- });
+ if (insert) {
+ requestAnimationFrame(() => {
+ this.tbody.innerHTML = '';
+ this.tbody.appendChild(renderPass.tableBody);
+ });
+ }
return renderPass;
}
diff --git a/frontend/src/app/components/wp-list/wp-states-initialization.service.ts b/frontend/src/app/components/wp-list/wp-states-initialization.service.ts
index ac4d3b54d4b..c029c1e9279 100644
--- a/frontend/src/app/components/wp-list/wp-states-initialization.service.ts
+++ b/frontend/src/app/components/wp-list/wp-states-initialization.service.ts
@@ -92,7 +92,7 @@ export class WorkPackageStatesInitializationService {
public updateQuerySpace(query:QueryResource, results:WorkPackageCollectionResource) {
// Clear table required data states
this.querySpace.additionalRequiredWorkPackages.clear('Clearing additional WPs before updating rows');
- this.querySpace.rendered.clear('Clearing rendered data before upgrading query space');
+ this.querySpace.tableRendered.clear('Clearing rendered data before upgrading query space');
if (results.schemas) {
_.each(results.schemas.elements, (schema:SchemaResource) => {
@@ -178,6 +178,6 @@ export class WorkPackageStatesInitializationService {
this.wpTableSum.clear(reason);
// Clear rendered state
- this.querySpace.rendered.clear(reason);
+ this.querySpace.tableRendered.clear(reason);
}
}
diff --git a/frontend/src/app/components/wp-table/timeline/cells/wp-timeline-cell-mouse-handler.ts b/frontend/src/app/components/wp-table/timeline/cells/wp-timeline-cell-mouse-handler.ts
index 24cb0d38cb7..8055a46f52d 100644
--- a/frontend/src/app/components/wp-table/timeline/cells/wp-timeline-cell-mouse-handler.ts
+++ b/frontend/src/app/components/wp-table/timeline/cells/wp-timeline-cell-mouse-handler.ts
@@ -251,7 +251,7 @@ export function registerWorkPackageMouseHandler(this:void,
return loadingIndicator.table.promise = halEditing.save<WorkPackageResource, WorkPackageChangeset>(change)
.then((result) => {
notificationService.showSave(result.resource);
- const ids = _.map(querySpace.rendered.value!, row => row.workPackageId);
+ const ids = _.map(querySpace.tableRendered.value!, row => row.workPackageId);
loadingIndicator.table.promise =
queryDm.loadIdsUpdatedSince(ids, updatedAt).then(workPackageCollection => {
wpCacheService.updateWorkPackageList(workPackageCollection.elements);
diff --git a/frontend/src/app/components/wp-table/timeline/container/wp-timeline-container.directive.ts b/frontend/src/app/components/wp-table/timeline/container/wp-timeline-container.directive.ts
index 82e8a82fbd6..6acbe83ab8f 100644
--- a/frontend/src/app/components/wp-table/timeline/container/wp-timeline-container.directive.ts
+++ b/frontend/src/app/components/wp-table/timeline/container/wp-timeline-container.directive.ts
@@ -131,7 +131,7 @@ export class WorkPackageTimelineTableController implements AfterViewInit, OnDest
window.addEventListener('wp-resize.timeline', () => this.refreshRequest.putValue(undefined));
// Refresh timeline view after table rendered
- this.querySpace.rendered.values$()
+ this.querySpace.tableRendered.values$()
.pipe(
takeUntil(this.querySpace.stopAllSubscriptions),
filter(() => this.initialized)
@@ -204,7 +204,7 @@ export class WorkPackageTimelineTableController implements AfterViewInit, OnDest
}
get initialized():boolean {
- return this.workPackageTable && this.querySpace.rendered.hasValue();
+ return this.workPackageTable && this.querySpace.tableRendered.hasValue();
}
refreshView() {
@@ -240,6 +240,11 @@ export class WorkPackageTimelineTableController implements AfterViewInit, OnDest
// The header is the only one reliable, as it already has the final width.
const currentWidth = this.$element.find(timelineHeaderSelector)[0].scrollWidth;
this.outerContainer.width(currentWidth);
+
+ // Mark rendering event in a timeout to let DOM process
+ setTimeout(() => {
+ this.querySpace.timelineRendered.putValue(null);
+ });
});
}
diff --git a/frontend/src/app/modules/work_packages/query-space/isolated-query-space.ts b/frontend/src/app/modules/work_packages/query-space/isolated-query-space.ts
index 1abbf813ae9..60fa1e45874 100644
--- a/frontend/src/app/modules/work_packages/query-space/isolated-query-space.ts
+++ b/frontend/src/app/modules/work_packages/query-space/isolated-query-space.ts
@@ -35,9 +35,12 @@ export class IsolatedQuerySpace extends StatesGroup {
collapsedGroups = input<{ [identifier:string]:boolean }>();
// State to be updated when the table is up to date
- rendered = input<RenderedWorkPackage[]>();
+ tableRendered = input<RenderedWorkPackage[]>();
- renderedWorkPackages:State<RenderedWorkPackage[]> = derive(this.rendered, $ => $.pipe(
+ // State to be updated when the timeline is up to date
+ timelineRendered = input<null>();
+
+ renderedWorkPackages:State<RenderedWorkPackage[]> = derive(this.tableRendered, $ => $.pipe(
map(rows => rows.filter(row => !!row.workPackageId)))
);
diff --git a/frontend/src/app/modules/work_packages/routing/wp-list/wp-list.component.ts b/frontend/src/app/modules/work_packages/routing/wp-list/wp-list.component.ts
index 900f8a1f0fd..0b81d9c3975 100644
--- a/frontend/src/app/modules/work_packages/routing/wp-list/wp-list.component.ts
+++ b/frontend/src/app/modules/work_packages/routing/wp-list/wp-list.component.ts
@@ -272,7 +272,11 @@ export class WorkPackagesListComponent extends WorkPackagesViewBase implements O
this.wpListService
.loadCurrentQueryFromParams(this.projectIdentifier)
.then(() => {
- this.querySpace.rendered.valuesPromise();
+ if (this.wpTableTimeline.isVisible) {
+ return this.querySpace.timelineRendered.valuesPromise();
+ } else {
+ return this.querySpace.tableRendered.valuesPromise();
+ }
});
}
}
diff --git a/frontend/src/app/modules/work_packages/routing/wp-view-base/view-services/wp-view-hierarchy-indentation.service.spec.ts b/frontend/src/app/modules/work_packages/routing/wp-view-base/view-services/wp-view-hierarchy-indentation.service.spec.ts
index 7a1e2b753da..07cdf10b031 100644
--- a/frontend/src/app/modules/work_packages/routing/wp-view-base/view-services/wp-view-hierarchy-indentation.service.spec.ts
+++ b/frontend/src/app/modules/work_packages/routing/wp-view-base/view-services/wp-view-hierarchy-indentation.service.spec.ts
@@ -99,7 +99,7 @@ describe('WorkPackageViewIndentation service', function() {
});
it('Cannot indent when is first index', () => {
- querySpace.rendered.putValue([
+ querySpace.tableRendered.putValue([
{ workPackageId: '1234', hidden: false, classIdentifier: 'foo' },
{ workPackageId: '2345', hidden: false, classIdentifier: 'foo' }
]);
@@ -109,7 +109,7 @@ describe('WorkPackageViewIndentation service', function() {
});
it('Can indent as second when it has no ancestors', () => {
- querySpace.rendered.putValue([
+ querySpace.tableRendered.putValue([
{ workPackageId: '2345', hidden: false, classIdentifier: 'foo' },
{ workPackageId: '1234', hidden: false, classIdentifier: 'foo' }
]);
@@ -119,7 +119,7 @@ describe('WorkPackageViewIndentation service', function() {
});
it('Cannot indent when possible but hierarchy disabled', () => {
- querySpace.rendered.putValue([
+ querySpace.tableRendered.putValue([
{ workPackageId: '2345', hidden: false, classIdentifier: 'foo' },
{ workPackageId: '1234', hidden: false, classIdentifier: 'foo' }
]);
@@ -132,7 +132,7 @@ describe('WorkPackageViewIndentation service', function() {
});
it('Can not indent with a predecessor that is an ancestor already', () => {
- querySpace.rendered.putValue([
+ querySpace.tableRendered.putValue([
{ workPackageId: '2345', hidden: false, classIdentifier: 'foo' },
{ workPackageId: '1234', hidden: false, classIdentifier: 'foo' }
]);
@@ -142,7 +142,7 @@ describe('WorkPackageViewIndentation service', function() {
});
it('Can indent with a predecessor that is NOT an ancestor already', () => {
- querySpace.rendered.putValue([
+ querySpace.tableRendered.putValue([
{ workPackageId: '2345', hidden: false, classIdentifier: 'foo' },
{ workPackageId: '5555', hidden: false, classIdentifier: 'foo' },
{ workPackageId: '1234', hidden: false, classIdentifier: 'foo' }
@@ -177,7 +177,7 @@ describe('WorkPackageViewIndentation service', function() {
describe('indent', () => {
it('Can indent with a predecessor that is NOT an ancestor already', (done) => {
- querySpace.rendered.putValue([
+ querySpace.tableRendered.putValue([
{ workPackageId: '5555', hidden: false, classIdentifier: 'foo' },
{ workPackageId: '2345', hidden: false, classIdentifier: 'foo' },
{ workPackageId: '1234', hidden: false, classIdentifier: 'foo' }
@@ -195,7 +195,7 @@ describe('WorkPackageViewIndentation service', function() {
});
it('Can indent with a predecessor that shares an ancestor chain', (done) => {
- querySpace.rendered.putValue([
+ querySpace.tableRendered.putValue([
{ workPackageId: '5555', hidden: false, classIdentifier: 'foo' },
{ workPackageId: '2345', hidden: false, classIdentifier: 'foo' },
{ workPackageId: '1234', hidden: false, classIdentifier: 'foo' }
@@ -213,7 +213,7 @@ describe('WorkPackageViewIndentation service', function() {
});
it('Can indent with a predecessor that shares an ancestor chain', (done) => {
- querySpace.rendered.putValue([
+ querySpace.tableRendered.putValue([
{ workPackageId: '5555', hidden: false, classIdentifier: 'foo' },
{ workPackageId: '2345', hidden: false, classIdentifier: 'foo' },
{ workPackageId: '1234', hidden: false, classIdentifier: 'foo' }
@@ -233,7 +233,7 @@ describe('WorkPackageViewIndentation service', function() {
describe('outdent', () => {
it('will outdent to the previous last ancestorId', (done) => {
- querySpace.rendered.putValue([
+ querySpace.tableRendered.putValue([
{ workPackageId: '1234', hidden: false, classIdentifier: 'foo' },
]);
@@ -246,7 +246,7 @@ describe('WorkPackageViewIndentation service', function() {
});
it('will outdent to null in case of ancestorIds.length < 2', (done) => {
- querySpace.rendered.putValue([
+ querySpace.tableRendered.putValue([
{ workPackageId: '1234', hidden: false, classIdentifier: 'foo' },
]);