Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ACS-5611] Add custom metadata side panels as new extension feature #3466

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions extension.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,12 @@
}
]
},
"customMetadataPanels": {
"description": "List of cutom metadata panels to display in metadata card component",
"type": "array",
"items": { "ref": "#/definitions/contentActionRef" },
"minItems": 1
},
"badges": {
"description": "List of badges to display in the name column",
"type": "array",
Expand Down
78 changes: 39 additions & 39 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
},
"private": true,
"dependencies": {
"@alfresco/adf-content-services": "6.4.0-6377399867",
"@alfresco/adf-core": "6.4.0-6377399867",
"@alfresco/adf-extensions": "6.4.0-6377399867",
"@alfresco/eslint-plugin-eslint-angular": "6.4.0-6377399867",
"@alfresco/js-api": "7.1.0-1371",
"@alfresco/adf-content-services": "6.4.0-6497510485",
"@alfresco/adf-core": "6.4.0-6497510485",
"@alfresco/adf-extensions": "6.4.0-6497510485",
"@alfresco/eslint-plugin-eslint-angular": "6.4.0-6497510485",
"@alfresco/js-api": "7.1.0-1384",
"@angular/animations": "14.1.3",
"@angular/cdk": "14.1.3",
"@angular/common": "14.1.3",
Expand Down Expand Up @@ -69,8 +69,8 @@
"zone.js": "0.11.8"
},
"devDependencies": {
"@alfresco/adf-cli": "6.4.0-6377399867",
"@alfresco/adf-testing": "6.4.0-6377399867",
"@alfresco/adf-cli": "6.4.0-6497510485",
"@alfresco/adf-testing": "6.4.0-6497510485",
"@angular-devkit/build-angular": "14.2.11",
"@angular-devkit/core": "14.1.2",
"@angular-devkit/schematics": "14.1.2",
Expand Down
8 changes: 4 additions & 4 deletions projects/aca-content/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"peerDependencies": {
"@angular/common": ">=14.1.0",
"@angular/core": ">=14.1.0",
"@alfresco/adf-core": ">=6.4.0-6341205853",
"@alfresco/adf-content-services": ">=6.4.0-6341205853",
"@alfresco/adf-extensions": ">=6.4.0-6341205853",
"@alfresco/js-api": ">=7.1.0-1349",
"@alfresco/adf-core": ">=6.4.0-6497510485",
"@alfresco/adf-content-services": ">=6.4.0-6497510485",
"@alfresco/adf-extensions": ">=6.4.0-6497510485",
"@alfresco/js-api": ">=7.1.0-1384",
"@angular/animations": ">=14.1.3",
"@angular/cdk": ">=14.1.3",
"@angular/forms": ">=14.1.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="aca-custom-name-column">
<div [ngClass]="{ 'aca-name-column-container': isFile && isFileWriteLocked }">
<div class="aca-name-column-container">
<span
role="link"
tabindex="0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
}

.aca-name-column-container {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;

aca-locked-by {
display: flex;
align-items: center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ export class CustomNameColumnComponent extends NameColumnComponent implements On
}

onBadgeClick(badge: Badge) {
this.appExtensionService.runActionById(badge.actions?.click, this.node);
if (badge.actions?.click) {
this.appExtensionService.runActionById(badge.actions?.click, this.node);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ import { AppState, EditOfflineAction, SetInfoDrawerMetadataAspectAction } from '
import { By } from '@angular/platform-browser';
import { AppExtensionService, NodePermissionService } from '@alfresco/aca-shared';
import { Actions } from '@ngrx/effects';
import { Subject } from 'rxjs';
import { of, Subject } from 'rxjs';
import { ContentActionType } from '@alfresco/adf-extensions';

describe('MetadataTabComponent', () => {
let fixture: ComponentFixture<MetadataTabComponent>;
Expand All @@ -42,6 +43,7 @@ describe('MetadataTabComponent', () => {
let extensions: AppExtensionService;
let nodePermissionService: NodePermissionService;
let actions$: Subject<EditOfflineAction>;
let appExtensionService: AppExtensionService;

const presets = {
default: {
Expand All @@ -61,6 +63,7 @@ describe('MetadataTabComponent', () => {
]
});
nodePermissionService = TestBed.inject(NodePermissionService);
appExtensionService = TestBed.inject(AppExtensionService);
spyOn(nodePermissionService, 'check').and.callFake((source: Node, permissions: string[]) => {
return permissions.some((permission) => source.allowableOperations.includes(permission));
});
Expand Down Expand Up @@ -270,4 +273,24 @@ describe('MetadataTabComponent', () => {
expect(initialState.componentInstance.displayAspect).toBe('EXIF');
});
});

describe('Custom metadata panels', () => {
beforeEach(() => {
fixture = TestBed.createComponent(MetadataTabComponent);
component = fixture.componentInstance;
});

it('should get custom metadata panels', (done) => {
spyOn(appExtensionService, 'getCustomMetadataPanels').and.returnValue(
of([{ id: 'test', type: ContentActionType.custom, title: 'testTitle', component: 'test-id' }])
);
component.ngOnInit();
component.customPanels.subscribe((panels) => {
expect(panels.length).toBe(1);
expect(panels[0].panelTitle).toEqual('testTitle');
expect(panels[0].component).toEqual('test-id');
done();
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import { AppStore, EditOfflineAction, infoDrawerMetadataAspect, NodeActionTypes
import { AppConfigService, NotificationService } from '@alfresco/adf-core';
import { Observable, Subject } from 'rxjs';
import { Store } from '@ngrx/store';
import { ContentMetadataModule, ContentMetadataService } from '@alfresco/adf-content-services';
import { filter, takeUntil } from 'rxjs/operators';
import { ContentMetadataModule, ContentMetadataService, ContentMetadataCustomPanel } from '@alfresco/adf-content-services';
import { filter, map, takeUntil } from 'rxjs/operators';
import { CommonModule } from '@angular/common';
import { Actions, ofType } from '@ngrx/effects';

Expand All @@ -44,6 +44,7 @@ import { Actions, ofType } from '@ngrx/effects';
[preset]="'custom'"
[node]="node"
[displayAspect]="displayAspect$ | async"
[customPanels]="customPanels | async"
[(editable)]="editable"
>
</adf-content-metadata-card>
Expand All @@ -60,6 +61,7 @@ export class MetadataTabComponent implements OnInit, OnDestroy {
displayAspect$: Observable<string>;
canUpdateNode = false;
editable = false;
customPanels: Observable<ContentMetadataCustomPanel[]>;

constructor(
private permission: NodePermissionService,
Expand Down Expand Up @@ -93,6 +95,14 @@ export class MetadataTabComponent implements OnInit, OnDestroy {
this.editable = false;
}
});
this.customPanels = this.extensions.getCustomMetadataPanels({ entry: this.node }).pipe(
map((panels) => {
return panels.map((panel) => {
return { panelTitle: panel.title, component: panel.component };
});
}),
takeUntil(this.onDestroy$)
);
}

ngOnDestroy() {
Expand Down
8 changes: 4 additions & 4 deletions projects/aca-shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"license": "LGPL-3.0",
"scripts": {},
"peerDependencies": {
"@alfresco/adf-content-services": ">=6.4.0-6341205853",
"@alfresco/adf-core": ">=6.4.0-6341205853",
"@alfresco/adf-extensions": ">=6.4.0-6341205853",
"@alfresco/js-api": ">=7.1.0-1349",
"@alfresco/adf-content-services": ">=6.4.0-6497510485",
"@alfresco/adf-core": ">=6.4.0-6497510485",
"@alfresco/adf-extensions": ">=6.4.0-6497510485",
"@alfresco/js-api": ">=7.1.0-1384",
"@angular/animations": ">=14.1.3",
"@angular/common": ">=14.1.3",
"@angular/compiler": ">=14.1.3",
Expand Down
Loading
Loading