parent
323487bee0
commit
e63b1fa021
@ -1,24 +1,47 @@ |
||||
import {Component, OnInit} from "@angular/core"; |
||||
import {Component, OnInit, OnDestroy, ViewChild, AfterViewInit} from "@angular/core"; |
||||
import {ApiV3FilterBuilder} from "core-components/api/api-v3/api-v3-filter-builder"; |
||||
import {WidgetWpListComponent} from "core-app/modules/grids/widgets/wp-widget/wp-widget.component"; |
||||
import {WorkPackageTableConfiguration} from "core-components/wp-table/wp-table-configuration"; |
||||
import {QueryResource} from "core-app/modules/hal/resources/query-resource"; |
||||
import {I18nService} from "core-app/modules/common/i18n/i18n.service"; |
||||
import {IsolatedQuerySpace} from "core-app/modules/work_packages/query-space/isolated-query-space"; |
||||
import {untilComponentDestroyed} from 'ng2-rx-componentdestroyed'; |
||||
import {WorkPackageIsolatedQuerySpaceDirective} from "core-app/modules/work_packages/query-space/wp-isolated-query-space.directive"; |
||||
|
||||
@Component({ |
||||
templateUrl: '../wp-widget/wp-widget.component.html', |
||||
styleUrls: ['../wp-widget/wp-widget.component.css'] |
||||
}) |
||||
export class WidgetWpTableComponent extends WidgetWpListComponent implements OnInit { |
||||
export class WidgetWpTableComponent extends WidgetWpListComponent implements OnInit, OnDestroy, AfterViewInit { |
||||
public text = { title: this.i18n.t('js.grid.widgets.work_packages_table.title') }; |
||||
public queryProps:any; |
||||
public queryProps = {}; |
||||
|
||||
public configuration:Partial<WorkPackageTableConfiguration> = { |
||||
actionsColumnEnabled: false, |
||||
columnMenuEnabled: true, |
||||
hierarchyToggleEnabled: true, |
||||
contextMenuEnabled: false |
||||
}; |
||||
|
||||
@ViewChild(WorkPackageIsolatedQuerySpaceDirective) public querySpaceDirective:WorkPackageIsolatedQuerySpaceDirective; |
||||
|
||||
ngOnInit() { |
||||
super.ngOnInit(); |
||||
// TODO: adapt to arbitrary query
|
||||
let filters = new ApiV3FilterBuilder(); |
||||
filters.add('watcher', '=', ["me"]); |
||||
filters.add('status', 'o', []); |
||||
|
||||
this.queryProps = {"columns[]":["id", "project", "type", "subject"], |
||||
"filters":filters.toJson()}; |
||||
} |
||||
|
||||
ngAfterViewInit() { |
||||
this |
||||
.querySpaceDirective |
||||
.querySpace |
||||
.query |
||||
.values$() |
||||
.pipe( |
||||
untilComponentDestroyed(this) |
||||
).subscribe(() => console.log('query updated')); |
||||
} |
||||
|
||||
ngOnDestroy() { |
||||
// nothing to do
|
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue