mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
library effects and actions (#441)
* library effects and actions * single selection and test fixes * navigate to site route * add experimental flag * disable test * update tests
This commit is contained in:
@@ -2,7 +2,24 @@
|
||||
<div class="inner-layout__header">
|
||||
<adf-breadcrumb root="APP.BROWSE.LIBRARIES.TITLE">
|
||||
</adf-breadcrumb>
|
||||
<adf-toolbar class="inline">
|
||||
<adf-toolbar class="inline" *ngIf="!selection.isEmpty">
|
||||
<ng-container *ifExperimental="'libraries'">
|
||||
<button
|
||||
color="primary"
|
||||
mat-icon-button
|
||||
title="{{ 'APP.ACTIONS.MORE' | translate }}"
|
||||
[matMenuTriggerFor]="actionsMenu">
|
||||
<mat-icon>more_vert</mat-icon>
|
||||
</button>
|
||||
<mat-menu #actionsMenu="matMenu" [overlapTrigger]="false">
|
||||
<button
|
||||
mat-menu-item
|
||||
(click)="deleteLibrary(selection.first)">
|
||||
<mat-icon>delete</mat-icon>
|
||||
<span>{{ 'APP.ACTIONS.DELETE' | translate }}</span>
|
||||
</button>
|
||||
</mat-menu>
|
||||
</ng-container>
|
||||
</adf-toolbar>
|
||||
</div>
|
||||
|
||||
@@ -10,7 +27,7 @@
|
||||
<div class="inner-layout__panel">
|
||||
<adf-document-list acaDocumentList #documentList
|
||||
currentFolderId="-mysites-"
|
||||
selectionMode="none"
|
||||
selectionMode="single"
|
||||
[navigate]="false"
|
||||
[sorting]="[ 'title', 'asc' ]"
|
||||
(node-dblclick)="onNodeDoubleClick($event)">
|
||||
|
@@ -47,6 +47,8 @@ import { LibrariesComponent } from './libraries.component';
|
||||
import { StoreModule } from '@ngrx/store';
|
||||
import { appReducer } from '../../store/reducers/app.reducer';
|
||||
import { INITIAL_STATE } from '../../store/states/app.state';
|
||||
import { ContentManagementService } from '../../common/services/content-management.service';
|
||||
import { ExperimentalDirective } from '../../directives/experimental.directive';
|
||||
|
||||
describe('Libraries Routed Component', () => {
|
||||
let fixture: ComponentFixture<LibrariesComponent>;
|
||||
@@ -91,7 +93,8 @@ describe('Libraries Routed Component', () => {
|
||||
NodeFavoriteDirective,
|
||||
DocumentListComponent,
|
||||
LibrariesComponent,
|
||||
AppConfigPipe
|
||||
AppConfigPipe,
|
||||
ExperimentalDirective
|
||||
],
|
||||
providers: [
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
@@ -105,7 +108,9 @@ describe('Libraries Routed Component', () => {
|
||||
NodesApiService,
|
||||
DocumentListService,
|
||||
ThumbnailService,
|
||||
CustomResourcesService
|
||||
CustomResourcesService,
|
||||
|
||||
ContentManagementService
|
||||
],
|
||||
schemas: [ NO_ERRORS_SCHEMA ]
|
||||
})
|
||||
|
@@ -23,7 +23,7 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Component } from '@angular/core';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { NodesApiService } from '@alfresco/adf-core';
|
||||
import { ShareDataRow } from '@alfresco/adf-content-services';
|
||||
@@ -31,19 +31,31 @@ import { ShareDataRow } from '@alfresco/adf-content-services';
|
||||
import { PageComponent } from '../page.component';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../store/states/app.state';
|
||||
import { DeleteLibraryAction } from '../../store/actions';
|
||||
import { SiteEntry } from 'alfresco-js-api';
|
||||
import { ContentManagementService } from '../../common/services/content-management.service';
|
||||
|
||||
@Component({
|
||||
templateUrl: './libraries.component.html'
|
||||
})
|
||||
export class LibrariesComponent extends PageComponent {
|
||||
export class LibrariesComponent extends PageComponent implements OnInit {
|
||||
|
||||
constructor(private nodesApi: NodesApiService,
|
||||
private route: ActivatedRoute,
|
||||
private content: ContentManagementService,
|
||||
store: Store<AppStore>,
|
||||
private router: Router) {
|
||||
super(store);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
super.ngOnInit();
|
||||
|
||||
this.subscriptions.push(
|
||||
this.content.siteDeleted.subscribe(() => this.reload())
|
||||
);
|
||||
}
|
||||
|
||||
makeLibraryTooltip(library: any): string {
|
||||
const { description, title } = library;
|
||||
|
||||
@@ -84,4 +96,10 @@ export class LibrariesComponent extends PageComponent {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
deleteLibrary(node: SiteEntry) {
|
||||
if (node && node.entry) {
|
||||
this.store.dispatch(new DeleteLibraryAction(node.entry.id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user