mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
undo ADF-3176 changes
This commit is contained in:
parent
491cc3253f
commit
061a2e5567
@ -21,7 +21,7 @@ import { Observable } from 'rxjs/Observable';
|
|||||||
import { CardViewItem, NodesApiService, LogService, CardViewUpdateService, AlfrescoApiService } from '@alfresco/adf-core';
|
import { CardViewItem, NodesApiService, LogService, CardViewUpdateService, AlfrescoApiService } from '@alfresco/adf-core';
|
||||||
import { ContentMetadataService } from '../../services/content-metadata.service';
|
import { ContentMetadataService } from '../../services/content-metadata.service';
|
||||||
import { CardViewGroup } from '../../interfaces/content-metadata.interfaces';
|
import { CardViewGroup } from '../../interfaces/content-metadata.interfaces';
|
||||||
import { Subscription } from 'rxjs/Subscription';
|
import { Subscription } from 'rxjs/Rx';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'adf-content-metadata',
|
selector: 'adf-content-metadata',
|
||||||
@ -57,7 +57,6 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
@Input()
|
@Input()
|
||||||
preset: string;
|
preset: string;
|
||||||
|
|
||||||
componentInited: boolean = false;
|
|
||||||
basicProperties$: Observable<CardViewItem[]>;
|
basicProperties$: Observable<CardViewItem[]>;
|
||||||
groupedProperties$: Observable<CardViewGroup[]>;
|
groupedProperties$: Observable<CardViewGroup[]>;
|
||||||
disposableNodeUpdate: Subscription;
|
disposableNodeUpdate: Subscription;
|
||||||
@ -71,22 +70,27 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.disposableNodeUpdate = this.cardViewUpdateService.itemUpdated$.switchMap(this.saveNode.bind(this)).subscribe(
|
this.disposableNodeUpdate = this.cardViewUpdateService.itemUpdated$
|
||||||
updatedNode => {
|
.switchMap(this.saveNode.bind(this))
|
||||||
Object.assign(this.node, updatedNode);
|
.subscribe(
|
||||||
this.alfrescoApiService.nodeUpdated.next(this.node);
|
updatedNode => {
|
||||||
},
|
Object.assign(this.node, updatedNode);
|
||||||
error => this.logService.error(error)
|
this.alfrescoApiService.nodeUpdated.next(this.node);
|
||||||
);
|
},
|
||||||
|
error => this.logService.error(error)
|
||||||
|
);
|
||||||
|
|
||||||
this.componentInited = true;
|
this.loadProperties(this.node);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
const changedNode: MinimalNodeEntryEntity = changes['node'] && changes['node'].currentValue;
|
if (changes.node && !changes.node.firstChange) {
|
||||||
|
this.loadProperties(changes.node.currentValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.componentInited || (changedNode && changedNode !== this.node)) {
|
private loadProperties(node: MinimalNodeEntryEntity) {
|
||||||
const node = changedNode || this.node;
|
if (node) {
|
||||||
this.basicProperties$ = this.contentMetadataService.getBasicProperties(node);
|
this.basicProperties$ = this.contentMetadataService.getBasicProperties(node);
|
||||||
this.groupedProperties$ = this.contentMetadataService.getGroupedProperties(node, this.preset);
|
this.groupedProperties$ = this.contentMetadataService.getGroupedProperties(node, this.preset);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user