mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[ACA-1442] improved notifications and delete/restore (#393)
* remove notifications from files component * remove notifications from favorites page * remove irrelevant tests * snackbar effects * snackbar theme * improve permanent delete messaging * cleanup tests * strongly typed node delete directive, node actions * strongly-typed directives * test fixes * redux dev tools, migrate permanent delete directive * reload trashcan on service events * delete and restore nodes, snackbar effects with undo * wire viewer with store and effects * test fixes * migrate events * fix spelling * bug fixes * use notification effects on restore node * remove fdescribe * node-versions using snackbar actions * dispatch snackbars from node-move directive * store-enabled create folder * reduce dependency on ContentService for list reloads * favorites use unified preview api for files * simplify preview for shared files * remove test
This commit is contained in:
@@ -28,17 +28,20 @@ import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { TestBed, async, ComponentFixture } from '@angular/core/testing';
|
||||
import {
|
||||
AlfrescoApiService, UserPreferencesService, TranslationService, TranslationMock,
|
||||
AppConfigService, StorageService, CookieService, NotificationService, NodeFavoriteDirective
|
||||
AlfrescoApiService, UserPreferencesService,
|
||||
TranslationService, TranslationMock,
|
||||
CoreModule
|
||||
} from '@alfresco/adf-core';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
|
||||
import { PreviewComponent } from './preview.component';
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
import { NodePermissionService } from '../../common/services/node-permission.service';
|
||||
import { ContentManagementService } from '../../common/services/content-management.service';
|
||||
import { MatSnackBarModule } from '@angular/material';
|
||||
import { StoreModule } from '@ngrx/store';
|
||||
import { appReducer } from '../../store/reducers/app.reducer';
|
||||
import { INITIAL_STATE } from '../../store/states/app.state';
|
||||
import { EffectsModule } from '@ngrx/effects';
|
||||
import { NodeEffects } from '../../store/effects/node.effects';
|
||||
|
||||
describe('PreviewComponent', () => {
|
||||
|
||||
@@ -52,25 +55,19 @@ describe('PreviewComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
HttpClientModule,
|
||||
RouterTestingModule,
|
||||
TranslateModule.forRoot(),
|
||||
MatSnackBarModule
|
||||
CoreModule.forRoot(),
|
||||
StoreModule.forRoot({ app: appReducer }, { initialState: INITIAL_STATE }),
|
||||
EffectsModule.forRoot([NodeEffects])
|
||||
],
|
||||
providers: [
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
AlfrescoApiService,
|
||||
AppConfigService,
|
||||
StorageService,
|
||||
CookieService,
|
||||
NotificationService,
|
||||
UserPreferencesService,
|
||||
NodePermissionService,
|
||||
ContentManagementService
|
||||
],
|
||||
declarations: [
|
||||
PreviewComponent,
|
||||
NodeFavoriteDirective
|
||||
// NodeFavoriteDirective
|
||||
],
|
||||
schemas: [ NO_ERRORS_SCHEMA ]
|
||||
})
|
||||
|
@@ -28,7 +28,9 @@ import { ActivatedRoute, Router, UrlTree, UrlSegmentGroup, UrlSegment, PRIMARY_O
|
||||
import { AlfrescoApiService, UserPreferencesService, ObjectUtils } from '@alfresco/adf-core';
|
||||
import { Node, MinimalNodeEntity } from 'alfresco-js-api';
|
||||
import { NodePermissionService } from '../../common/services/node-permission.service';
|
||||
import { ContentManagementService } from '../../common/services/content-management.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../store/states/app.state';
|
||||
import { DeleteNodesAction } from '../../store/actions';
|
||||
|
||||
@Component({
|
||||
selector: 'app-preview',
|
||||
@@ -54,11 +56,12 @@ export class PreviewComponent implements OnInit {
|
||||
|
||||
selectedEntities: MinimalNodeEntity[] = [];
|
||||
|
||||
constructor(private router: Router,
|
||||
constructor(
|
||||
private store: Store<AppStore>,
|
||||
private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private apiService: AlfrescoApiService,
|
||||
private preferences: UserPreferencesService,
|
||||
private content: ContentManagementService,
|
||||
public permission: NodePermissionService) {
|
||||
}
|
||||
|
||||
@@ -326,12 +329,14 @@ export class PreviewComponent implements OnInit {
|
||||
return path;
|
||||
}
|
||||
|
||||
async deleteFile() {
|
||||
try {
|
||||
await this.content.deleteNode(this.node);
|
||||
this.onVisibilityChanged(false);
|
||||
} catch {
|
||||
}
|
||||
deleteFile() {
|
||||
this.store.dispatch(new DeleteNodesAction([
|
||||
{
|
||||
id: this.node.nodeId || this.node.id,
|
||||
name: this.node.name
|
||||
}
|
||||
]));
|
||||
this.onVisibilityChanged(false);
|
||||
}
|
||||
|
||||
private getNavigationCommands(url: string): any[] {
|
||||
|
Reference in New Issue
Block a user