Let BCF list container inherit from the list view to avoid unnecessary multiple loading. Also move the resizer directly to the WP grid.
parent
d4c97b5197
commit
ef2a3eadff
@ -1,7 +0,0 @@ |
||||
<wp-embedded-table [queryProps]="queryProps" |
||||
[configuration]="configuration" |
||||
[externalHeight]="true" |
||||
[showResizer]="true" |
||||
resizerClass="work-packages-partitioned-page--content-right" |
||||
resizerStorageKey="openProject-splitViewFlexBasis"> |
||||
</wp-embedded-table> |
@ -1,89 +1,34 @@ |
||||
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Injector, OnDestroy, OnInit} from "@angular/core"; |
||||
import {I18nService} from "core-app/modules/common/i18n/i18n.service"; |
||||
import {PathHelperService} from "core-app/modules/common/path-helper/path-helper.service"; |
||||
import {CurrentProjectService} from "core-components/projects/current-project.service"; |
||||
import {WorkPackageTableConfigurationObject} from "core-components/wp-table/wp-table-configuration"; |
||||
import {StateService} from '@uirouter/core'; |
||||
import {GonService} from "core-app/modules/common/gon/gon.service"; |
||||
import {QueryParamListenerService} from "core-components/wp-query/query-param-listener.service"; |
||||
import {InjectField} from "core-app/helpers/angular/inject-field.decorator"; |
||||
import {WorkPackagesListService} from "core-components/wp-list/wp-list.service"; |
||||
import {UrlParamsHelperService} from "core-components/wp-query/url-params-helper"; |
||||
import {ChangeDetectionStrategy, Component, OnInit} from "@angular/core"; |
||||
import {WorkPackageViewHandlerToken} from "core-app/modules/work_packages/routing/wp-view-base/event-handling/event-handler-registry"; |
||||
import {BcfCardViewHandlerRegistry} from "core-app/modules/bim/ifc_models/ifc-base-view/event-handler/bcf-card-view-handler-registry"; |
||||
import {UntilDestroyedMixin} from "core-app/helpers/angular/until-destroyed.mixin"; |
||||
import {WorkPackageListViewComponent} from "core-app/modules/work_packages/routing/wp-list-view/wp-list-view.component"; |
||||
import {QueryResource} from "core-app/modules/hal/resources/query-resource"; |
||||
import {HalResourceNotificationService} from "core-app/modules/hal/services/hal-resource-notification.service"; |
||||
import {WorkPackageNotificationService} from "core-app/modules/work_packages/notifications/work-package-notification.service"; |
||||
import {DragAndDropService} from "core-app/modules/common/drag-and-drop/drag-and-drop.service"; |
||||
import {CausedUpdatesService} from "core-app/modules/boards/board/caused-updates/caused-updates.service"; |
||||
import {bimSplitViewIdentifier, BimViewService} from "core-app/modules/bim/ifc_models/pages/viewer/bim-view.service"; |
||||
import {InjectField} from "core-app/helpers/angular/inject-field.decorator"; |
||||
|
||||
@Component({ |
||||
templateUrl: './bcf-list-container.component.html', |
||||
templateUrl: '/app/modules/work_packages/routing/wp-list-view/wp-list-view.component.html', |
||||
styleUrls: ['../../../../../../app/modules/work_packages/routing/wp-list-view/wp-list-view.component.sass'], |
||||
providers: [ |
||||
{ provide: WorkPackageViewHandlerToken, useValue: BcfCardViewHandlerRegistry } |
||||
{ provide: WorkPackageViewHandlerToken, useValue: BcfCardViewHandlerRegistry }, |
||||
{ provide: HalResourceNotificationService, useClass: WorkPackageNotificationService }, |
||||
DragAndDropService, |
||||
CausedUpdatesService |
||||
], |
||||
changeDetection: ChangeDetectionStrategy.OnPush |
||||
}) |
||||
export class BcfListContainerComponent extends UntilDestroyedMixin implements OnInit, OnDestroy { |
||||
@InjectField() public queryParamListener:QueryParamListenerService; |
||||
@InjectField() public wpListService:WorkPackagesListService; |
||||
@InjectField() public urlParamsHelper:UrlParamsHelperService; |
||||
|
||||
public queryProps:{ [key:string]:any }; |
||||
|
||||
public configuration:WorkPackageTableConfigurationObject = { |
||||
actionsColumnEnabled: false, |
||||
columnMenuEnabled: false, |
||||
contextMenuEnabled: false, |
||||
inlineCreateEnabled: false, |
||||
withFilters: false, |
||||
showFilterButton: false, |
||||
isCardView: true |
||||
}; |
||||
|
||||
constructor(readonly state:StateService, |
||||
readonly i18n:I18nService, |
||||
readonly paths:PathHelperService, |
||||
readonly currentProject:CurrentProjectService, |
||||
readonly gon:GonService, |
||||
readonly injector:Injector, |
||||
readonly cdRef:ChangeDetectorRef) { |
||||
super(); |
||||
} |
||||
|
||||
ngOnInit():void { |
||||
this.refresh(); |
||||
|
||||
this.queryParamListener |
||||
.observe$ |
||||
.pipe( |
||||
this.untilDestroyed() |
||||
).subscribe((queryProps) => { |
||||
this.refresh(this.urlParamsHelper.buildV3GetQueryFromJsonParams(queryProps)); |
||||
}); |
||||
} |
||||
|
||||
ngOnDestroy():void { |
||||
super.ngOnDestroy(); |
||||
this.queryParamListener.removeQueryChangeListener(); |
||||
} |
||||
|
||||
private defaultQueryProps() { |
||||
let filters = []; |
||||
filters.push({ |
||||
status: { |
||||
operator: 'o', |
||||
values: [] |
||||
} |
||||
}); |
||||
|
||||
return { |
||||
'columns[]': ['id', 'subject'], |
||||
filters: JSON.stringify(filters), |
||||
sortBy: JSON.stringify([['updatedAt', 'desc']]), |
||||
showHierarchies: false |
||||
}; |
||||
export class BcfListContainerComponent extends WorkPackageListViewComponent implements OnInit { |
||||
protected shouldShowAsListView(query:QueryResource):boolean { |
||||
return false; |
||||
} |
||||
|
||||
public refresh(queryProps:{ [key:string]:any }|undefined = undefined) { |
||||
this.wpListService.loadCurrentQueryFromParams(this.currentProject.identifier!); |
||||
this.queryProps = queryProps || this.state.params.query_props || this.defaultQueryProps(); |
||||
this.cdRef.detectChanges(); |
||||
protected showResizerInCardView():boolean { |
||||
// TODO
|
||||
//return this.bimView.currentViewerState() !== bimSplitViewIdentifier;
|
||||
return true; |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue