[ADF-3726] Enable/disable Copy to clipboard in Metadata from config (#5578)

* [ADF-3726] Enable/disable Copy to clipboard in Metadata from config

* Update app.config.json

* Fix e2e tests
This commit is contained in:
davidcanonieto
2020-03-31 14:10:52 +01:00
committed by GitHub
parent 50f19c99f2
commit c1bf8e4db9
11 changed files with 117 additions and 28 deletions

View File

@@ -14,7 +14,10 @@
(keydown)="keyDown($event)"
[properties]="basicProperties$ | async"
[editable]="editable"
[displayEmpty]="displayEmpty">
[displayEmpty]="displayEmpty"
[copyToClipboardAction]="copyToClipboardAction"
[useChipsForMultiValueProperty]="useChipsForMultiValueProperty"
[multiValueSeparator]="multiValueSeparator">
</adf-card-view>
</mat-expansion-panel>
@@ -34,7 +37,10 @@
(keydown)="keyDown($event)"
[properties]="group.properties"
[editable]="editable"
[displayEmpty]="displayEmpty">
[displayEmpty]="displayEmpty"
[copyToClipboardAction]="copyToClipboardAction"
[useChipsForMultiValueProperty]="useChipsForMultiValueProperty"
[multiValueSeparator]="multiValueSeparator">
</adf-card-view>
</mat-expansion-panel>

View File

@@ -24,7 +24,8 @@ import {
LogService,
CardViewUpdateService,
AlfrescoApiService,
TranslationService
TranslationService,
AppConfigService
} from '@alfresco/adf-core';
import { ContentMetadataService } from '../../services/content-metadata.service';
import { CardViewGroup } from '../../interfaces/content-metadata.interfaces';
@@ -39,6 +40,8 @@ import { switchMap, takeUntil, catchError } from 'rxjs/operators';
})
export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
static DEFAULT_SEPARATOR = ', ';
protected onDestroy$ = new Subject<boolean>();
/** (required) The node entity to fetch metadata about */
@@ -75,6 +78,15 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
@Input()
displayAspect: string = null;
/** Toggles whether or not to enable copy to clipboard action. */
@Input()
copyToClipboardAction: boolean = true;
/** Toggles whether or not to enable chips for multivalued properties. */
@Input()
useChipsForMultiValueProperty: boolean = true;
multiValueSeparator: string;
basicProperties$: Observable<CardViewItem[]>;
groupedProperties$: Observable<CardViewGroup[]>;
@@ -84,8 +96,12 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
private nodesApiService: NodesApiService,
private logService: LogService,
private alfrescoApiService: AlfrescoApiService,
private translationService: TranslationService
private translationService: TranslationService,
private appConfig: AppConfigService
) {
this.copyToClipboardAction = this.appConfig.get<boolean>('content-metadata.copy-to-clipboard-action');
this.multiValueSeparator = this.appConfig.get<string>('content-metadata.multi-value-pipe-separator') || ContentMetadataComponent.DEFAULT_SEPARATOR;
this.useChipsForMultiValueProperty = this.appConfig.get<boolean>('content-metadata.multi-value-chips');
}
ngOnInit() {