mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +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,44 @@
|
||||
<aca-page-layout>
|
||||
<aca-page-layout-header>
|
||||
<adf-breadcrumb [root]="title" [folderNode]="node" (navigate)="goBack()"> </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="acs-details-container">
|
||||
<div class="acs-details-title">
|
||||
<div class="acs-details-breadcrumb" role="heading" aria-level="2" *ngIf="node">
|
||||
<span class="acs-details-breadcrumb-library"> {{ node.name }} </span>
|
||||
-
|
||||
<span class="acs-details-breadcrumb-item">{{ 'APP.INFO_DRAWER.TITLE' | translate }}</span>
|
||||
</div>
|
||||
<div class="acs-close-members-container">
|
||||
<button mat-icon-button data-automation-id="close-library" title="{{ 'APP.INFO_DRAWER.CLOSE_LIBRARY' | translate }}" (click)="goBack()">
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<mat-tab-group [selectedIndex]="activeTab" class="adw-details-tabs">
|
||||
<mat-tab label="{{ 'APP.INFO_DRAWER.TABS.PROPERTIES' | translate }}">
|
||||
<app-metadata-tab *ngIf="node && !isLoading; else loading" [node]="node"> </app-metadata-tab>
|
||||
</mat-tab>
|
||||
<mat-tab label="{{ 'APP.INFO_DRAWER.TABS.COMMENTS' | translate }}">
|
||||
<app-comments-tab *ngIf="node && !isLoading; else loading" [node]="node"> </app-comments-tab>
|
||||
</mat-tab>
|
||||
<mat-tab label="{{ 'APP.INFO_DRAWER.TABS.PERMISSIONS' | translate }}">
|
||||
<adf-permission-list *ngIf="node && !isLoading; else loading" [nodeId]="node.id"></adf-permission-list>
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
</div>
|
||||
</aca-page-layout-content>
|
||||
</aca-page-layout>
|
||||
|
||||
<ng-template #loading>
|
||||
<mat-progress-bar color="primary" mode="indeterminate"> </mat-progress-bar>
|
||||
</ng-template>
|
@@ -0,0 +1,41 @@
|
||||
.acs-details-container {
|
||||
background-color: var(--theme-card-background-color);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.adw-details-tabs {
|
||||
margin-top: 40px;
|
||||
height: calc(100% - 80px);
|
||||
|
||||
.mat-tab-body-wrapper {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.mat-tab-labels {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
}
|
||||
|
||||
.acs-details-title {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.acs-close-members-container {
|
||||
margin-right: 15px;
|
||||
}
|
||||
}
|
||||
|
||||
.acs-details-breadcrumb {
|
||||
font-size: 18px;
|
||||
margin-left: 20px;
|
||||
|
||||
.acs-details-breadcrumb-library {
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.acs-details-breadcrumb-item {
|
||||
font-weight: 100;
|
||||
}
|
||||
}
|
@@ -0,0 +1,109 @@
|
||||
/*!
|
||||
* @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 { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||
import { DetailsComponent } from './details.component';
|
||||
import { MetadataTabComponent } from '../info-drawer/metadata-tab/metadata-tab.component';
|
||||
import { CommentsTabComponent } from '../info-drawer/comments-tab/comments-tab.component';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { of, Subject } from 'rxjs';
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
import { AppExtensionService } from '@alfresco/adf-extensions';
|
||||
import { ContentApiService } from '@alfresco/aca-shared';
|
||||
import { SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
||||
import { NodeEntry } from '@alfresco/js-api';
|
||||
|
||||
describe('DetailsComponent', () => {
|
||||
let component: DetailsComponent;
|
||||
let fixture: ComponentFixture<DetailsComponent>;
|
||||
let contentApiService: ContentApiService;
|
||||
let store;
|
||||
const router: any = {
|
||||
url: '',
|
||||
navigate: jasmine.createSpy('navigate')
|
||||
};
|
||||
const mockStream = new Subject();
|
||||
const storeMock = {
|
||||
dispatch: jasmine.createSpy('dispatch'),
|
||||
select: () => mockStream
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [AppTestingModule],
|
||||
declarations: [DetailsComponent, CommentsTabComponent, MetadataTabComponent],
|
||||
providers: [
|
||||
ContentManagementService,
|
||||
AppExtensionService,
|
||||
{
|
||||
provide: Router,
|
||||
useValue: router
|
||||
},
|
||||
{ provide: Store, useValue: storeMock },
|
||||
{
|
||||
provide: ActivatedRoute,
|
||||
useValue: {
|
||||
snapshot: { data: { preferencePrefix: 'prefix' } },
|
||||
params: of({ nodeId: 'someId', activeTab: 'permissions' })
|
||||
}
|
||||
}
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
});
|
||||
|
||||
fixture = TestBed.createComponent(DetailsComponent);
|
||||
component = fixture.componentInstance;
|
||||
contentApiService = TestBed.inject(ContentApiService);
|
||||
store = TestBed.inject(Store);
|
||||
spyOn(contentApiService, 'getNode').and.returnValue(of({ entry: { id: 'libraryId' } } as NodeEntry));
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
fixture.destroy();
|
||||
});
|
||||
|
||||
it('should get node id from router', () => {
|
||||
fixture.detectChanges();
|
||||
expect(component.nodeId).toBe('someId');
|
||||
});
|
||||
|
||||
it('should set active tab from router', () => {
|
||||
fixture.detectChanges();
|
||||
expect(component.activeTab).toBe(2);
|
||||
});
|
||||
|
||||
it('should get node info after setting node from router', () => {
|
||||
fixture.detectChanges();
|
||||
expect(contentApiService.getNode).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should dispatch node selection', () => {
|
||||
fixture.detectChanges();
|
||||
expect(store.dispatch).toHaveBeenCalledWith(new SetSelectedNodesAction([{ entry: { id: 'libraryId' } } as NodeEntry]));
|
||||
});
|
||||
});
|
@@ -0,0 +1,99 @@
|
||||
/*!
|
||||
* @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, ViewEncapsulation, OnDestroy } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { PageComponent } from '../page.component';
|
||||
import { AppExtensionService, ContentApiService } from '@alfresco/aca-shared';
|
||||
import { AppStore, NavigateToPreviousPage, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'app-details-manager',
|
||||
templateUrl: './details.component.html',
|
||||
styleUrls: ['./details.component.scss'],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class DetailsComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
nodeId: string;
|
||||
isLoading: boolean;
|
||||
onDestroy$ = new Subject<boolean>();
|
||||
activeTab = 1;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private contentApi: ContentApiService,
|
||||
store: Store<AppStore>,
|
||||
content: ContentManagementService,
|
||||
extensions: AppExtensionService
|
||||
) {
|
||||
super(store, extensions, content);
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
super.ngOnInit();
|
||||
this.isLoading = true;
|
||||
const { route } = this;
|
||||
const { data } = route.snapshot;
|
||||
this.title = data.title;
|
||||
|
||||
this.route.params.subscribe((params) => {
|
||||
this.isLoading = true;
|
||||
this.setActiveTab(params.activeTab);
|
||||
this.nodeId = params.nodeId;
|
||||
this.contentApi.getNode(this.nodeId).subscribe((node) => {
|
||||
this.node = node.entry;
|
||||
this.isLoading = false;
|
||||
this.store.dispatch(new SetSelectedNodesAction([{ entry: this.node }]));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
setActiveTab(tabName: string) {
|
||||
switch (tabName) {
|
||||
case 'comments':
|
||||
this.activeTab = 1;
|
||||
break;
|
||||
case 'permissions':
|
||||
this.activeTab = 2;
|
||||
break;
|
||||
case 'metadata':
|
||||
default:
|
||||
this.activeTab = 0;
|
||||
}
|
||||
}
|
||||
|
||||
goBack() {
|
||||
this.store.dispatch(new NavigateToPreviousPage());
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.store.dispatch(new SetSelectedNodesAction([]));
|
||||
this.onDestroy$.next();
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user