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": {
|
||||
"type": "string",
|
||||
"description": "Unique identifier"
|
||||
},
|
||||
"includeAll": {
|
||||
"type": "boolean",
|
||||
"description": "Enable to automatically show all properties"
|
||||
},
|
||||
"disabled": {
|
||||
"description": "Toggles disabled state",
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"patternProperties": {
|
||||
@ -748,6 +756,10 @@
|
||||
"id": {
|
||||
"type": "string",
|
||||
"description": "Unique identifier"
|
||||
},
|
||||
"disabled": {
|
||||
"type": "boolean",
|
||||
"description": "Toggle disabled state"
|
||||
}
|
||||
},
|
||||
"patternProperties": {
|
||||
|
@ -114,25 +114,25 @@
|
||||
"content-metadata": {
|
||||
"presets": {
|
||||
"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",
|
||||
"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"
|
||||
]
|
||||
"properties": "*"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -141,13 +141,7 @@
|
||||
},
|
||||
"search": {
|
||||
"filterWithContains": true,
|
||||
"aca:fields": [
|
||||
"cm:name",
|
||||
"cm:title",
|
||||
"cm:description",
|
||||
"TEXT",
|
||||
"TAG"
|
||||
],
|
||||
"aca:fields": ["cm:name", "cm:title", "cm:description", "TEXT", "TAG"],
|
||||
"include": ["path", "allowableOperations", "properties"],
|
||||
"sorting": {
|
||||
"options": [
|
||||
@ -260,7 +254,10 @@
|
||||
"label": "SEARCH.CATEGORIES.MODIFIED_DATE",
|
||||
"expanded": true,
|
||||
"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",
|
||||
"query": "cm:modified:[NOW/DAY-7DAYS TO NOW/DAY+1DAY]"
|
||||
@ -288,7 +285,10 @@
|
||||
"selector": "check-list",
|
||||
"settings": {
|
||||
"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",
|
||||
"value": "content.size:[1048576 TO 52428800]"
|
||||
@ -297,7 +297,10 @@
|
||||
"name": "SEARCH.CATEGORIES.SIZE_OPTIONS.LARGE",
|
||||
"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 { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
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 { Store } from '@ngrx/store';
|
||||
import {
|
||||
@ -35,28 +35,60 @@ import {
|
||||
AppState
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { AppExtensionService } from '../../../extensions/extension.service';
|
||||
|
||||
describe('MetadataTabComponent', () => {
|
||||
let fixture: ComponentFixture<MetadataTabComponent>;
|
||||
let component: MetadataTabComponent;
|
||||
let store: Store<AppState>;
|
||||
let appConfig: AppConfigService;
|
||||
let extensions: AppExtensionService;
|
||||
|
||||
setupTestBed({
|
||||
imports: [AppTestingModule, ContentMetadataModule],
|
||||
declarations: [MetadataTabComponent]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(MetadataTabComponent);
|
||||
store = TestBed.get(Store);
|
||||
component = fixture.componentInstance;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
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()', () => {
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(MetadataTabComponent);
|
||||
component = fixture.componentInstance;
|
||||
});
|
||||
|
||||
it('should return true if node is not locked and has update permission', () => {
|
||||
const node = <Node>{
|
||||
isLocked: false,
|
||||
@ -102,6 +134,12 @@ describe('MetadataTabComponent', () => {
|
||||
});
|
||||
|
||||
describe('displayAspect', () => {
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(MetadataTabComponent);
|
||||
store = TestBed.get(Store);
|
||||
component = fixture.componentInstance;
|
||||
});
|
||||
|
||||
it('show pass empty when store is in initial state', () => {
|
||||
const initialState = fixture.debugElement.query(
|
||||
By.css('adf-content-metadata-card')
|
||||
|
@ -59,15 +59,10 @@ export class MetadataTabComponent {
|
||||
private appConfig: AppConfigService,
|
||||
private store: Store<AppStore>
|
||||
) {
|
||||
try {
|
||||
if (this.extensions.contentMetadata) {
|
||||
this.appConfig.config[
|
||||
'content-metadata'
|
||||
] = this.extensions.contentMetadata;
|
||||
} catch (error) {
|
||||
console.error(
|
||||
error,
|
||||
'- could not change content-metadata from app.config'
|
||||
);
|
||||
}
|
||||
this.displayAspect$ = this.store.select(infoDrawerMetadataAspect);
|
||||
}
|
||||
|
@ -307,6 +307,10 @@ export class AppExtensionService implements RuleContext {
|
||||
config,
|
||||
'features.content-metadata-presets'
|
||||
);
|
||||
if (!elements.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let presets = {};
|
||||
presets = this.filterDisabled(mergeObjects(presets, ...elements));
|
||||
|
||||
|
@ -1029,6 +1029,20 @@
|
||||
{
|
||||
"id": "app.content.metadata.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",
|
||||
"title": "APP.CONTENT_METADATA.EXIF_GROUP_TITLE",
|
||||
@ -1036,20 +1050,7 @@
|
||||
{
|
||||
"id": "app.content.metadata.exifAspect",
|
||||
"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"
|
||||
]
|
||||
"properties": "*"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user