mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[AAE-11496] Move 'content-plugin' to projects folder as 'aca-content' (#2817)
* [AAE-11496] Move content-plugin to projects * Fix unit test
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
<aca-page-layout>
|
||||
<aca-page-layout-header>
|
||||
<adf-breadcrumb root="APP.BROWSE.SHARED.TITLE"></adf-breadcrumb>
|
||||
|
||||
<adf-toolbar class="adf-toolbar--inline">
|
||||
<ng-container *ngFor="let entry of actions; trackBy: trackByActionId">
|
||||
<aca-toolbar-action [actionRef]="entry"></aca-toolbar-action>
|
||||
</ng-container>
|
||||
</adf-toolbar>
|
||||
</aca-page-layout-header>
|
||||
|
||||
<aca-page-layout-content>
|
||||
<div class="main-content">
|
||||
<adf-document-list
|
||||
#documentList
|
||||
acaDocumentList
|
||||
acaContextActions
|
||||
[display]="documentDisplayMode$ | async"
|
||||
currentFolderId="-sharedlinks-"
|
||||
selectionMode="multiple"
|
||||
[sorting]="['modifiedAt', 'desc']"
|
||||
[imageResolver]="imageResolver"
|
||||
sortingMode="client"
|
||||
(node-dblclick)="handleNodeClick($event)"
|
||||
(name-click)="handleNodeClick($event)"
|
||||
>
|
||||
<adf-custom-empty-content-template>
|
||||
<adf-empty-content icon="people" [title]="'APP.BROWSE.SHARED.EMPTY_STATE.TITLE'" subtitle="APP.BROWSE.SHARED.EMPTY_STATE.TEXT">
|
||||
</adf-empty-content>
|
||||
</adf-custom-empty-content-template>
|
||||
|
||||
<data-columns>
|
||||
<ng-container *ngFor="let column of columns; trackBy: trackByColumnId">
|
||||
<ng-container *ngIf="column.template && !(column.desktopOnly && isSmallScreen)">
|
||||
<data-column
|
||||
[key]="column.key"
|
||||
[title]="column.title"
|
||||
[type]="column.type"
|
||||
[format]="column.format"
|
||||
[class]="column.class"
|
||||
[sortable]="column.sortable"
|
||||
>
|
||||
<ng-template let-context>
|
||||
<adf-dynamic-column [id]="column.template" [context]="context"> </adf-dynamic-column>
|
||||
</ng-template>
|
||||
</data-column>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="!column.template && !(column.desktopOnly && isSmallScreen)">
|
||||
<data-column
|
||||
[key]="column.key"
|
||||
[title]="column.title"
|
||||
[type]="column.type"
|
||||
[format]="column.format"
|
||||
[class]="column.class"
|
||||
[sortable]="column.sortable"
|
||||
>
|
||||
</data-column>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
</data-columns>
|
||||
</adf-document-list>
|
||||
|
||||
<adf-pagination acaPagination [target]="documentList"> </adf-pagination>
|
||||
</div>
|
||||
|
||||
<div class="sidebar" *ngIf="infoDrawerOpened$ | async">
|
||||
<aca-info-drawer [node]="selection.last"></aca-info-drawer>
|
||||
</div>
|
||||
</aca-page-layout-content>
|
||||
</aca-page-layout>
|
@@ -0,0 +1,77 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2020 Alfresco Software Limited
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { TestBed, ComponentFixture } from '@angular/core/testing';
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { DataTableComponent, AppConfigModule } from '@alfresco/adf-core';
|
||||
import { CustomResourcesService, DocumentListComponent, NodeFavoriteDirective } from '@alfresco/adf-content-services';
|
||||
import { SharedFilesComponent } from './shared-files.component';
|
||||
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||
import { Router } from '@angular/router';
|
||||
import { of } from 'rxjs';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { SharedLinkPaging } from '@alfresco/js-api';
|
||||
|
||||
describe('SharedFilesComponent', () => {
|
||||
let fixture: ComponentFixture<SharedFilesComponent>;
|
||||
let page: SharedLinkPaging;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [AppTestingModule, AppConfigModule],
|
||||
declarations: [DataTableComponent, NodeFavoriteDirective, DocumentListComponent, SharedFilesComponent],
|
||||
providers: [
|
||||
{
|
||||
provide: Router,
|
||||
useValue: {
|
||||
url: 'shared-files'
|
||||
}
|
||||
}
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
});
|
||||
|
||||
page = {
|
||||
list: {
|
||||
entries: [{ entry: { id: '1' } }, { entry: { id: '2' } }],
|
||||
pagination: { count: 2 }
|
||||
}
|
||||
};
|
||||
|
||||
const customResourcesService = TestBed.inject(CustomResourcesService);
|
||||
spyOn(customResourcesService, 'loadSharedLinks').and.returnValue(of(page));
|
||||
fixture = TestBed.createComponent(SharedFilesComponent);
|
||||
});
|
||||
|
||||
it('[C280093] should not display pagination for empty data', async () => {
|
||||
page = { list: { pagination: { totalItems: 0 }, entries: [] } };
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
const pagination = fixture.debugElement.query(By.css('.adf-pagination'));
|
||||
expect(pagination).toBeNull();
|
||||
});
|
||||
});
|
@@ -0,0 +1,82 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2020 Alfresco Software Limited
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
import { PageComponent } from '../page.component';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { debounceTime } from 'rxjs/operators';
|
||||
import { UploadService } from '@alfresco/adf-core';
|
||||
import { Router } from '@angular/router';
|
||||
import { MinimalNodeEntity } from '@alfresco/js-api';
|
||||
import { AppExtensionService, AppHookService } from '@alfresco/aca-shared';
|
||||
import { DocumentListPresetRef } from '@alfresco/adf-extensions';
|
||||
|
||||
@Component({
|
||||
templateUrl: './shared-files.component.html'
|
||||
})
|
||||
export class SharedFilesComponent extends PageComponent implements OnInit {
|
||||
isSmallScreen = false;
|
||||
|
||||
columns: DocumentListPresetRef[] = [];
|
||||
|
||||
constructor(
|
||||
store: Store<any>,
|
||||
extensions: AppExtensionService,
|
||||
content: ContentManagementService,
|
||||
private appHookService: AppHookService,
|
||||
private uploadService: UploadService,
|
||||
private breakpointObserver: BreakpointObserver,
|
||||
private router: Router
|
||||
) {
|
||||
super(store, extensions, content);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
super.ngOnInit();
|
||||
|
||||
this.subscriptions = this.subscriptions.concat([
|
||||
this.appHookService.linksUnshared.pipe(debounceTime(300)).subscribe(() => this.reload()),
|
||||
|
||||
this.uploadService.fileUploadComplete.pipe(debounceTime(300)).subscribe((_) => this.reload()),
|
||||
this.uploadService.fileUploadDeleted.pipe(debounceTime(300)).subscribe((_) => this.reload()),
|
||||
|
||||
this.breakpointObserver.observe([Breakpoints.HandsetPortrait, Breakpoints.HandsetLandscape]).subscribe((result) => {
|
||||
this.isSmallScreen = result.matches;
|
||||
})
|
||||
]);
|
||||
|
||||
this.columns = this.extensions.documentListPresets.shared || [];
|
||||
}
|
||||
|
||||
preview(node: MinimalNodeEntity) {
|
||||
this.showPreview(node, { location: this.router.url });
|
||||
}
|
||||
|
||||
handleNodeClick(event: Event) {
|
||||
this.preview((event as CustomEvent).detail?.node);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user