mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
[ACA-1619] automatically show content metadata (#1104)
* [ACA-1619] overwrite the app.config metadata settings only of the 'content-metadata-presets' is non-empty * [ACA-1619] app config to show automatically all metadata aspects - not extendable version * [ACA-1619] app extension to show automatically all metadata aspects - extendable version - the app.config setting is overwritten by the one with ids from app.extensions - could remove completely the content metadata setting from app.json * [ACA-1619] allow 'disabled' property on content metadata configuration * [ACA-1619] test content-metadata plugin extension - allow 'disabled' property on content metadata configuration * [ACA-1619] remove test reference to metadata plugin * [ACA-1619] backwards compatibility for metadata plugin extensions - add back initial structure (& ids) of content-metadata "custom" preset - revert change to sample metadata extension plugin * [ACA-1619] forgotten change * [ACA-1619] tests
This commit is contained in:
parent
b4e6b43787
commit
5ffdf75f52
@ -371,6 +371,14 @@
|
|||||||
"id": {
|
"id": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Unique identifier"
|
"description": "Unique identifier"
|
||||||
|
},
|
||||||
|
"includeAll": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Enable to automatically show all properties"
|
||||||
|
},
|
||||||
|
"disabled": {
|
||||||
|
"description": "Toggles disabled state",
|
||||||
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"patternProperties": {
|
"patternProperties": {
|
||||||
@ -748,6 +756,10 @@
|
|||||||
"id": {
|
"id": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Unique identifier"
|
"description": "Unique identifier"
|
||||||
|
},
|
||||||
|
"disabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Toggle disabled state"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"patternProperties": {
|
"patternProperties": {
|
||||||
|
@ -114,25 +114,25 @@
|
|||||||
"content-metadata": {
|
"content-metadata": {
|
||||||
"presets": {
|
"presets": {
|
||||||
"custom": [
|
"custom": [
|
||||||
|
{
|
||||||
|
"includeAll": true,
|
||||||
|
"exclude": [
|
||||||
|
"rn:renditioned",
|
||||||
|
"cm:versionable",
|
||||||
|
"cm:auditable",
|
||||||
|
"cm:thumbnailModification",
|
||||||
|
"cm:content",
|
||||||
|
"qshare:shared",
|
||||||
|
|
||||||
|
"exif:exif"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"title": "APP.CONTENT_METADATA.EXIF_GROUP_TITLE",
|
"title": "APP.CONTENT_METADATA.EXIF_GROUP_TITLE",
|
||||||
"items": [
|
"items": [
|
||||||
{
|
{
|
||||||
"aspect": "exif:exif",
|
"aspect": "exif:exif",
|
||||||
"properties": [
|
"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"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -141,13 +141,7 @@
|
|||||||
},
|
},
|
||||||
"search": {
|
"search": {
|
||||||
"filterWithContains": true,
|
"filterWithContains": true,
|
||||||
"aca:fields": [
|
"aca:fields": ["cm:name", "cm:title", "cm:description", "TEXT", "TAG"],
|
||||||
"cm:name",
|
|
||||||
"cm:title",
|
|
||||||
"cm:description",
|
|
||||||
"TEXT",
|
|
||||||
"TAG"
|
|
||||||
],
|
|
||||||
"include": ["path", "allowableOperations", "properties"],
|
"include": ["path", "allowableOperations", "properties"],
|
||||||
"sorting": {
|
"sorting": {
|
||||||
"options": [
|
"options": [
|
||||||
@ -260,7 +254,10 @@
|
|||||||
"label": "SEARCH.CATEGORIES.MODIFIED_DATE",
|
"label": "SEARCH.CATEGORIES.MODIFIED_DATE",
|
||||||
"expanded": true,
|
"expanded": true,
|
||||||
"queries": [
|
"queries": [
|
||||||
{ "label": "SEARCH.FACET_QUERIES.TODAY", "query": "cm:modified:[TODAY to TODAY]" },
|
{
|
||||||
|
"label": "SEARCH.FACET_QUERIES.TODAY",
|
||||||
|
"query": "cm:modified:[TODAY to TODAY]"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"label": "SEARCH.FACET_QUERIES.THIS_WEEK",
|
"label": "SEARCH.FACET_QUERIES.THIS_WEEK",
|
||||||
"query": "cm:modified:[NOW/DAY-7DAYS TO NOW/DAY+1DAY]"
|
"query": "cm:modified:[NOW/DAY-7DAYS TO NOW/DAY+1DAY]"
|
||||||
@ -288,7 +285,10 @@
|
|||||||
"selector": "check-list",
|
"selector": "check-list",
|
||||||
"settings": {
|
"settings": {
|
||||||
"options": [
|
"options": [
|
||||||
{ "name": "SEARCH.CATEGORIES.SIZE_OPTIONS.SMALL", "value": "content.size:[0 TO 1048576>" },
|
{
|
||||||
|
"name": "SEARCH.CATEGORIES.SIZE_OPTIONS.SMALL",
|
||||||
|
"value": "content.size:[0 TO 1048576>"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "SEARCH.CATEGORIES.SIZE_OPTIONS.MEDIUM",
|
"name": "SEARCH.CATEGORIES.SIZE_OPTIONS.MEDIUM",
|
||||||
"value": "content.size:[1048576 TO 52428800]"
|
"value": "content.size:[1048576 TO 52428800]"
|
||||||
@ -297,7 +297,10 @@
|
|||||||
"name": "SEARCH.CATEGORIES.SIZE_OPTIONS.LARGE",
|
"name": "SEARCH.CATEGORIES.SIZE_OPTIONS.LARGE",
|
||||||
"value": "content.size:<52428800 TO 524288000]"
|
"value": "content.size:<52428800 TO 524288000]"
|
||||||
},
|
},
|
||||||
{ "name": "SEARCH.CATEGORIES.SIZE_OPTIONS.HUGE", "value": "content.size:<524288000 TO MAX]" }
|
{
|
||||||
|
"name": "SEARCH.CATEGORIES.SIZE_OPTIONS.HUGE",
|
||||||
|
"value": "content.size:<524288000 TO MAX]"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ import { MetadataTabComponent } from './metadata-tab.component';
|
|||||||
import { Node } from '@alfresco/js-api';
|
import { Node } from '@alfresco/js-api';
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { AppTestingModule } from '../../../testing/app-testing.module';
|
import { AppTestingModule } from '../../../testing/app-testing.module';
|
||||||
import { setupTestBed } from '@alfresco/adf-core';
|
import { AppConfigService, setupTestBed } from '@alfresco/adf-core';
|
||||||
import { ContentMetadataModule } from '@alfresco/adf-content-services';
|
import { ContentMetadataModule } from '@alfresco/adf-content-services';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import {
|
import {
|
||||||
@ -35,28 +35,60 @@ import {
|
|||||||
AppState
|
AppState
|
||||||
} from '@alfresco/aca-shared/store';
|
} from '@alfresco/aca-shared/store';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
|
import { AppExtensionService } from '../../../extensions/extension.service';
|
||||||
|
|
||||||
describe('MetadataTabComponent', () => {
|
describe('MetadataTabComponent', () => {
|
||||||
let fixture: ComponentFixture<MetadataTabComponent>;
|
let fixture: ComponentFixture<MetadataTabComponent>;
|
||||||
let component: MetadataTabComponent;
|
let component: MetadataTabComponent;
|
||||||
let store: Store<AppState>;
|
let store: Store<AppState>;
|
||||||
|
let appConfig: AppConfigService;
|
||||||
|
let extensions: AppExtensionService;
|
||||||
|
|
||||||
setupTestBed({
|
setupTestBed({
|
||||||
imports: [AppTestingModule, ContentMetadataModule],
|
imports: [AppTestingModule, ContentMetadataModule],
|
||||||
declarations: [MetadataTabComponent]
|
declarations: [MetadataTabComponent]
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(MetadataTabComponent);
|
|
||||||
store = TestBed.get(Store);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
fixture.destroy();
|
fixture.destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('content-metadata configuration', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
appConfig = TestBed.get(AppConfigService);
|
||||||
|
extensions = TestBed.get(AppExtensionService);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should remain unchanged when metadata extension is missing', () => {
|
||||||
|
appConfig.config['content-metadata'] = 'initial config';
|
||||||
|
extensions.contentMetadata = null;
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(MetadataTabComponent);
|
||||||
|
|
||||||
|
expect(appConfig.config['content-metadata']).toEqual('initial config');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be overwritten by the one from extension', () => {
|
||||||
|
appConfig.config['content-metadata'] = 'initial config';
|
||||||
|
extensions.contentMetadata = [{ 'new config': true }];
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(MetadataTabComponent);
|
||||||
|
|
||||||
|
expect(appConfig.config['content-metadata']).not.toEqual(
|
||||||
|
'initial config'
|
||||||
|
);
|
||||||
|
expect(appConfig.config['content-metadata']).toEqual(
|
||||||
|
extensions.contentMetadata
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('canUpdateNode()', () => {
|
describe('canUpdateNode()', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(MetadataTabComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
});
|
||||||
|
|
||||||
it('should return true if node is not locked and has update permission', () => {
|
it('should return true if node is not locked and has update permission', () => {
|
||||||
const node = <Node>{
|
const node = <Node>{
|
||||||
isLocked: false,
|
isLocked: false,
|
||||||
@ -102,6 +134,12 @@ describe('MetadataTabComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('displayAspect', () => {
|
describe('displayAspect', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(MetadataTabComponent);
|
||||||
|
store = TestBed.get(Store);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
});
|
||||||
|
|
||||||
it('show pass empty when store is in initial state', () => {
|
it('show pass empty when store is in initial state', () => {
|
||||||
const initialState = fixture.debugElement.query(
|
const initialState = fixture.debugElement.query(
|
||||||
By.css('adf-content-metadata-card')
|
By.css('adf-content-metadata-card')
|
||||||
|
@ -59,15 +59,10 @@ export class MetadataTabComponent {
|
|||||||
private appConfig: AppConfigService,
|
private appConfig: AppConfigService,
|
||||||
private store: Store<AppStore>
|
private store: Store<AppStore>
|
||||||
) {
|
) {
|
||||||
try {
|
if (this.extensions.contentMetadata) {
|
||||||
this.appConfig.config[
|
this.appConfig.config[
|
||||||
'content-metadata'
|
'content-metadata'
|
||||||
] = this.extensions.contentMetadata;
|
] = this.extensions.contentMetadata;
|
||||||
} catch (error) {
|
|
||||||
console.error(
|
|
||||||
error,
|
|
||||||
'- could not change content-metadata from app.config'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
this.displayAspect$ = this.store.select(infoDrawerMetadataAspect);
|
this.displayAspect$ = this.store.select(infoDrawerMetadataAspect);
|
||||||
}
|
}
|
||||||
|
@ -307,6 +307,10 @@ export class AppExtensionService implements RuleContext {
|
|||||||
config,
|
config,
|
||||||
'features.content-metadata-presets'
|
'features.content-metadata-presets'
|
||||||
);
|
);
|
||||||
|
if (!elements.length) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
let presets = {};
|
let presets = {};
|
||||||
presets = this.filterDisabled(mergeObjects(presets, ...elements));
|
presets = this.filterDisabled(mergeObjects(presets, ...elements));
|
||||||
|
|
||||||
|
@ -1029,6 +1029,20 @@
|
|||||||
{
|
{
|
||||||
"id": "app.content.metadata.custom",
|
"id": "app.content.metadata.custom",
|
||||||
"custom": [
|
"custom": [
|
||||||
|
{
|
||||||
|
"id": "app.content.metadata.customSetting",
|
||||||
|
"includeAll": true,
|
||||||
|
"exclude": [
|
||||||
|
"rn:renditioned",
|
||||||
|
"cm:versionable",
|
||||||
|
"cm:auditable",
|
||||||
|
"cm:thumbnailModification",
|
||||||
|
"cm:content",
|
||||||
|
"qshare:shared",
|
||||||
|
|
||||||
|
"exif:exif"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "app.content.metadata.customGroup",
|
"id": "app.content.metadata.customGroup",
|
||||||
"title": "APP.CONTENT_METADATA.EXIF_GROUP_TITLE",
|
"title": "APP.CONTENT_METADATA.EXIF_GROUP_TITLE",
|
||||||
@ -1036,20 +1050,7 @@
|
|||||||
{
|
{
|
||||||
"id": "app.content.metadata.exifAspect",
|
"id": "app.content.metadata.exifAspect",
|
||||||
"aspect": "exif:exif",
|
"aspect": "exif:exif",
|
||||||
"properties": [
|
"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"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user