[ACA-1101] Metadata - Image Properties (#246)

This commit is contained in:
Cilibiu Bogdan
2018-03-21 01:55:34 +02:00
committed by Denys Vuika
parent acd31c524f
commit e686034026
8 changed files with 82 additions and 15 deletions

View File

@@ -126,5 +126,33 @@
"key": "zh-CN",
"label": "Simplified Chinese"
}
]
],
"content-metadata": {
"presets": {
"custom": [
{
"title": "APP.CONTENT_METADATA.EXIF_GROUP_TITLE",
"items": [
{
"aspect": "exif:exif",
"properties": [
"exif:pixelXDimension",
"exif:pixelYDimension",
"exif:dateTimeOriginal",
"exif:exposureTime",
"exif:fNumber",
"exif:flash",
"exif:focalLength",
"exif:isoSpeedRatings",
"exif:orientation",
"exif:manufacturer",
"exif:model",
"exif:software"
]
}
]
}
]
}
}
}

View File

@@ -55,8 +55,6 @@ describe('NodeInfoDirective', () => {
component = fixture.componentInstance;
apiService = TestBed.get(AlfrescoApiService);
nodeService = apiService.getInstance().nodes;
fixture.detectChanges();
}));
beforeEach(() => {
@@ -65,19 +63,37 @@ describe('NodeInfoDirective', () => {
}));
});
it('should not get node info when selection is empty', () => {
it('should not get node info onInit when selection is empty', () => {
component.selection = [];
fixture.detectChanges();
expect(nodeService.getNodeInfo).not.toHaveBeenCalled();
});
it('should get node info onInit when selection is not empty', () => {
component.selection = [{ entry: { id: 'id' } }];
fixture.detectChanges();
expect(nodeService.getNodeInfo).toHaveBeenCalled();
});
it('should not get node info on event when selection is empty', () => {
component.selection = [];
fixture.detectChanges();
document.dispatchEvent(new CustomEvent('click'));
expect(nodeService.getNodeInfo).not.toHaveBeenCalled();
});
it('should get node info from selection', () => {
it('should get node info on event from selection', () => {
component.selection = [{ entry: { id: 'id' } }];
fixture.detectChanges();
document.dispatchEvent(new CustomEvent('click'));
expect(nodeService.getNodeInfo).toHaveBeenCalledWith('id');

View File

@@ -23,30 +23,34 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { Directive, HostListener, Input, Output, EventEmitter } from '@angular/core';
import { Directive, HostListener, Input, Output, EventEmitter, OnInit } from '@angular/core';
import { AlfrescoApiService } from '@alfresco/adf-core';
import { MinimalNodeEntity, MinimalNodeEntryEntity, Node } from 'alfresco-js-api';
import { MinimalNodeEntity, MinimalNodeEntryEntity } from 'alfresco-js-api';
@Directive({
selector: '[app-node-info]',
exportAs: 'nodeInfo'
})
export class NodeInfoDirective {
export class NodeInfoDirective implements OnInit {
@Input('app-node-info') selection: MinimalNodeEntity[];
@Output() changed: EventEmitter<null|Node> = new EventEmitter<null|Node>();
@Output() changed: EventEmitter<null|MinimalNodeEntryEntity> = new EventEmitter<null|MinimalNodeEntryEntity>();
@Output() error: EventEmitter<null> = new EventEmitter<null>();
node: Node;
node: MinimalNodeEntryEntity;
loading: boolean = null;
@HostListener('document:click', ['$event'])
@HostListener('document:node-click', ['$event'])
onClick(event) {
this.getNodeInfo();
}
constructor(private apiService: AlfrescoApiService) {}
ngOnInit() {
this.getNodeInfo();
}
getNodeInfo() {
if (!this.selection.length) {
this.node = null;

View File

@@ -166,7 +166,11 @@
<adf-info-drawer title="Details">
<adf-info-drawer-tab label="Properties">
<adf-content-metadata-card [node]="infoInstance.node"></adf-content-metadata-card>
<adf-content-metadata-card
[displayEmpty]="true"
[preset]="'custom'"
[node]="infoInstance.node">
</adf-content-metadata-card>
</adf-info-drawer-tab>
</adf-info-drawer>
</div>

View File

@@ -173,7 +173,11 @@
<adf-info-drawer title="Details">
<adf-info-drawer-tab label="Properties">
<adf-content-metadata-card [node]="infoInstance.node"></adf-content-metadata-card>
<adf-content-metadata-card
[displayEmpty]="true"
[preset]="'custom'"
[node]="infoInstance.node">
</adf-content-metadata-card>
</adf-info-drawer-tab>
</adf-info-drawer>
</div>

View File

@@ -155,7 +155,11 @@
<adf-info-drawer title="Details">
<adf-info-drawer-tab label="Properties">
<adf-content-metadata-card [node]="infoInstance.node"></adf-content-metadata-card>
<adf-content-metadata-card
[displayEmpty]="true"
[preset]="'custom'"
[node]="infoInstance.node">
</adf-content-metadata-card>
</adf-info-drawer-tab>
</adf-info-drawer>
</div>

View File

@@ -173,7 +173,11 @@
<adf-info-drawer title="Details">
<adf-info-drawer-tab label="Properties">
<adf-content-metadata-card [node]="infoInstance.node"></adf-content-metadata-card>
<adf-content-metadata-card
[displayEmpty]="true"
[preset]="'custom'"
[node]="infoInstance.node">
</adf-content-metadata-card>
</adf-info-drawer-tab>
</adf-info-drawer>
</div>

View File

@@ -185,6 +185,9 @@
}
}
}
},
"CONTENT_METADATA": {
"EXIF_GROUP_TITLE": "Image EXIF"
}
},
"NODE_SELECTOR": {