|
|
|
@ -26,7 +26,7 @@ |
|
|
|
|
// See docs/COPYRIGHT.rdoc for more details.
|
|
|
|
|
// ++
|
|
|
|
|
|
|
|
|
|
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Injector, OnInit, OnChanges, SimpleChanges} from "@angular/core"; |
|
|
|
|
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Injector, OnInit} from "@angular/core"; |
|
|
|
|
import {take} from "rxjs/operators"; |
|
|
|
|
import {CausedUpdatesService} from "core-app/modules/boards/board/caused-updates/caused-updates.service"; |
|
|
|
|
import {DragAndDropService} from "core-app/modules/common/drag-and-drop/drag-and-drop.service"; |
|
|
|
@ -44,9 +44,6 @@ import {CurrentProjectService} from "core-components/projects/current-project.se |
|
|
|
|
import {WorkPackageViewFiltersService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-filters.service"; |
|
|
|
|
import {UntilDestroyedMixin} from "core-app/helpers/angular/until-destroyed.mixin"; |
|
|
|
|
import {QueryResource} from "core-app/modules/hal/resources/query-resource"; |
|
|
|
|
import {WorkPackageViewColumnsService} from 'core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-columns.service'; |
|
|
|
|
import {InjectField} from "core-app/helpers/angular/inject-field.decorator"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'wp-list-view', |
|
|
|
@ -60,8 +57,7 @@ import {InjectField} from "core-app/helpers/angular/inject-field.decorator"; |
|
|
|
|
CausedUpdatesService |
|
|
|
|
] |
|
|
|
|
}) |
|
|
|
|
export class WorkPackageListViewComponent extends UntilDestroyedMixin implements OnInit, OnChanges { |
|
|
|
|
@InjectField() wpTableColumns:WorkPackageViewColumnsService; |
|
|
|
|
export class WorkPackageListViewComponent extends UntilDestroyedMixin implements OnInit { |
|
|
|
|
|
|
|
|
|
text = { |
|
|
|
|
'jump_to_pagination': this.I18n.t('js.work_packages.jump_marks.pagination'), |
|
|
|
@ -70,7 +66,7 @@ export class WorkPackageListViewComponent extends UntilDestroyedMixin implements |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** Switch between list and card view */ |
|
|
|
|
showListView:boolean = true; |
|
|
|
|
showTableView:boolean = true; |
|
|
|
|
|
|
|
|
|
/** Determine when query is initially loaded */ |
|
|
|
|
tableInformationLoaded = false; |
|
|
|
@ -104,7 +100,6 @@ export class WorkPackageListViewComponent extends UntilDestroyedMixin implements |
|
|
|
|
this.querySpace.query.values$().pipe( |
|
|
|
|
this.untilDestroyed() |
|
|
|
|
).subscribe((query) => { |
|
|
|
|
console.log('this.querySpace: ', query, this.wpTableColumns.getColumns()); |
|
|
|
|
// Update the visible representation
|
|
|
|
|
this.updateViewRepresentation(query); |
|
|
|
|
this.noResults = query.results.total === 0; |
|
|
|
@ -112,10 +107,6 @@ export class WorkPackageListViewComponent extends UntilDestroyedMixin implements |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ngOnChanges(changes: SimpleChanges) { |
|
|
|
|
console.log('changes: ', changes); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected setupInformationLoadedListener() { |
|
|
|
|
this |
|
|
|
|
.querySpace |
|
|
|
@ -123,7 +114,6 @@ export class WorkPackageListViewComponent extends UntilDestroyedMixin implements |
|
|
|
|
.values$() |
|
|
|
|
.pipe(take(1)) |
|
|
|
|
.subscribe(() => { |
|
|
|
|
// console.log('this.querySpace 2: ', this.wpTableColumns.getColumns());
|
|
|
|
|
this.tableInformationLoaded = true; |
|
|
|
|
this.cdRef.detectChanges(); |
|
|
|
|
}); |
|
|
|
@ -134,7 +124,7 @@ export class WorkPackageListViewComponent extends UntilDestroyedMixin implements |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected updateViewRepresentation(query:QueryResource) { |
|
|
|
|
this.showListView = !(this.deviceService.isMobile || |
|
|
|
|
this.showTableView = !(this.deviceService.isMobile || |
|
|
|
|
this.wpDisplayRepresentation.valueFromQuery(query) === wpDisplayCardRepresentation); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|