mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
Optmise injections and imports (#3174)
* cleanup base page injections * optimise breakpoint observer * cleanup subscriptions * optimise upload service injections * optimise router imports * fix test setup * fix tests
This commit is contained in:
parent
1ca5a7af31
commit
23814e1e76
@ -24,10 +24,8 @@
|
||||
|
||||
import { Component, OnInit, ViewEncapsulation, OnDestroy } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { AppExtensionService, ContentApiService, PageComponent } 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 { ContentApiService, PageComponent } from '@alfresco/aca-shared';
|
||||
import { NavigateToPreviousPage, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
@ -42,14 +40,8 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy
|
||||
onDestroy$ = new Subject<boolean>();
|
||||
activeTab = 1;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private contentApi: ContentApiService,
|
||||
store: Store<AppStore>,
|
||||
content: ContentManagementService,
|
||||
extensions: AppExtensionService
|
||||
) {
|
||||
super(store, extensions, content);
|
||||
constructor(private route: ActivatedRoute, private contentApi: ContentApiService) {
|
||||
super();
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
|
@ -22,12 +22,9 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
||||
import { Component, OnInit, ChangeDetectorRef } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { SiteEntry, FavoritePaging, Pagination } from '@alfresco/js-api';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
import { AppExtensionService, AppHookService, ContentApiService, PageComponent } from '@alfresco/aca-shared';
|
||||
import { AppHookService, ContentApiService, PageComponent } from '@alfresco/aca-shared';
|
||||
import { NavigateLibraryAction } from '@alfresco/aca-shared/store';
|
||||
import { UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { DocumentListPresetRef } from '@alfresco/adf-extensions';
|
||||
@ -43,20 +40,15 @@ export class FavoriteLibrariesComponent extends PageComponent implements OnInit
|
||||
});
|
||||
isLoading = false;
|
||||
list: FavoritePaging;
|
||||
isSmallScreen = false;
|
||||
columns: DocumentListPresetRef[] = [];
|
||||
|
||||
constructor(
|
||||
content: ContentManagementService,
|
||||
store: Store<any>,
|
||||
extensions: AppExtensionService,
|
||||
private appHookService: AppHookService,
|
||||
private contentApiService: ContentApiService,
|
||||
private breakpointObserver: BreakpointObserver,
|
||||
private preferences: UserPreferencesService,
|
||||
private changeDetectorRef: ChangeDetectorRef
|
||||
) {
|
||||
super(store, extensions, content);
|
||||
super();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@ -69,11 +61,7 @@ export class FavoriteLibrariesComponent extends PageComponent implements OnInit
|
||||
this.appHookService.libraryUpdated.subscribe(() => this.reloadList()),
|
||||
this.appHookService.libraryJoined.subscribe(() => this.reloadList()),
|
||||
this.appHookService.libraryLeft.subscribe(() => this.reloadList()),
|
||||
this.appHookService.favoriteLibraryToggle.subscribe(() => this.reloadList()),
|
||||
|
||||
this.breakpointObserver.observe([Breakpoints.HandsetPortrait, Breakpoints.HandsetLandscape]).subscribe((result) => {
|
||||
this.isSmallScreen = result.matches;
|
||||
})
|
||||
this.appHookService.favoriteLibraryToggle.subscribe(() => this.reloadList())
|
||||
]);
|
||||
this.columns = this.extensions.documentListPresets.favoriteLibraries || [];
|
||||
}
|
||||
|
@ -22,49 +22,28 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { AcaFileAutoDownloadService, AppExtensionService, ContentApiService, PageComponent } from '@alfresco/aca-shared';
|
||||
import { AppStore } from '@alfresco/aca-shared/store';
|
||||
import { UploadService } from '@alfresco/adf-content-services';
|
||||
import { ContentApiService, PageComponent } from '@alfresco/aca-shared';
|
||||
import { MinimalNodeEntity, MinimalNodeEntryEntity, PathElementEntity, PathInfo } from '@alfresco/js-api';
|
||||
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { debounceTime, map } from 'rxjs/operators';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
import { DocumentListPresetRef } from '@alfresco/adf-extensions';
|
||||
|
||||
@Component({
|
||||
templateUrl: './favorites.component.html'
|
||||
})
|
||||
export class FavoritesComponent extends PageComponent implements OnInit {
|
||||
isSmallScreen = false;
|
||||
|
||||
columns: DocumentListPresetRef[] = [];
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
store: Store<AppStore>,
|
||||
extensions: AppExtensionService,
|
||||
private contentApi: ContentApiService,
|
||||
content: ContentManagementService,
|
||||
private uploadService: UploadService,
|
||||
private breakpointObserver: BreakpointObserver,
|
||||
fileAutoDownloadService: AcaFileAutoDownloadService
|
||||
) {
|
||||
super(store, extensions, content, fileAutoDownloadService);
|
||||
constructor(private contentApi: ContentApiService) {
|
||||
super();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
super.ngOnInit();
|
||||
|
||||
this.subscriptions = this.subscriptions.concat([
|
||||
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.uploadService.fileUploadComplete.pipe(debounceTime(300)).subscribe(() => this.reload()),
|
||||
this.uploadService.fileUploadDeleted.pipe(debounceTime(300)).subscribe(() => this.reload())
|
||||
]);
|
||||
|
||||
this.columns = this.extensions.documentListPresets.favorites;
|
||||
|
@ -24,63 +24,45 @@
|
||||
|
||||
import { ShowHeaderMode } from '@alfresco/adf-core';
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Params, Router } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { ActivatedRoute, Params } from '@angular/router';
|
||||
import { MinimalNodeEntity, MinimalNodeEntryEntity, PathElement, PathElementEntity } from '@alfresco/js-api';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
import { NodeActionsService } from '../../services/node-actions.service';
|
||||
import { AcaFileAutoDownloadService, AppExtensionService, ContentApiService, PageComponent } from '@alfresco/aca-shared';
|
||||
import { SetCurrentFolderAction, isAdmin, AppStore, UploadFileVersionAction, showLoaderSelector } from '@alfresco/aca-shared/store';
|
||||
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
||||
import { ContentApiService, PageComponent } from '@alfresco/aca-shared';
|
||||
import { SetCurrentFolderAction, isAdmin, UploadFileVersionAction, showLoaderSelector } from '@alfresco/aca-shared/store';
|
||||
import { debounceTime, takeUntil } from 'rxjs/operators';
|
||||
import { FilterSearch, ShareDataRow, UploadService, FileUploadEvent } from '@alfresco/adf-content-services';
|
||||
import { FilterSearch, ShareDataRow, FileUploadEvent } from '@alfresco/adf-content-services';
|
||||
import { DocumentListPresetRef } from '@alfresco/adf-extensions';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
templateUrl: './files.component.html'
|
||||
})
|
||||
export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
isValidPath = true;
|
||||
isSmallScreen = false;
|
||||
isAdmin = false;
|
||||
selectedNode: MinimalNodeEntity;
|
||||
queryParams = null;
|
||||
|
||||
showLoader$: Observable<boolean>;
|
||||
showLoader$ = this.store.select(showLoaderSelector);
|
||||
private nodePath: PathElement[];
|
||||
|
||||
columns: DocumentListPresetRef[] = [];
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private contentApi: ContentApiService,
|
||||
store: Store<AppStore>,
|
||||
private nodeActionsService: NodeActionsService,
|
||||
private uploadService: UploadService,
|
||||
content: ContentManagementService,
|
||||
extensions: AppExtensionService,
|
||||
private breakpointObserver: BreakpointObserver,
|
||||
fileAutoDownloadService: AcaFileAutoDownloadService
|
||||
) {
|
||||
super(store, extensions, content, fileAutoDownloadService);
|
||||
constructor(private route: ActivatedRoute, private contentApi: ContentApiService, private nodeActionsService: NodeActionsService) {
|
||||
super();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
super.ngOnInit();
|
||||
|
||||
const { route, nodeActionsService, uploadService } = this;
|
||||
const { data } = route.snapshot;
|
||||
const { data } = this.route.snapshot;
|
||||
|
||||
this.title = data.title;
|
||||
|
||||
this.showLoader$ = this.store.select(showLoaderSelector);
|
||||
route.queryParamMap.subscribe((queryMap: Params) => {
|
||||
this.route.queryParamMap.subscribe((queryMap: Params) => {
|
||||
this.queryParams = queryMap.params;
|
||||
});
|
||||
|
||||
route.params.subscribe(({ folderId }: Params) => {
|
||||
this.route.params.subscribe(({ folderId }: Params) => {
|
||||
const nodeId = folderId || data.defaultNodeId;
|
||||
|
||||
this.contentApi.getNode(nodeId).subscribe(
|
||||
@ -100,13 +82,9 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
|
||||
this.subscriptions = this.subscriptions.concat([
|
||||
nodeActionsService.contentCopied.subscribe((nodes) => this.onContentCopied(nodes)),
|
||||
uploadService.fileUploadComplete.pipe(debounceTime(300)).subscribe((file) => this.onFileUploadedEvent(file)),
|
||||
uploadService.fileUploadDeleted.pipe(debounceTime(300)).subscribe((file) => this.onFileUploadedEvent(file)),
|
||||
|
||||
this.breakpointObserver.observe([Breakpoints.HandsetPortrait, Breakpoints.HandsetLandscape]).subscribe((result) => {
|
||||
this.isSmallScreen = result.matches;
|
||||
})
|
||||
this.nodeActionsService.contentCopied.subscribe((nodes) => this.onContentCopied(nodes)),
|
||||
this.uploadService.fileUploadComplete.pipe(debounceTime(300)).subscribe((file) => this.onFileUploadedEvent(file)),
|
||||
this.uploadService.fileUploadDeleted.pipe(debounceTime(300)).subscribe((file) => this.onFileUploadedEvent(file))
|
||||
]);
|
||||
|
||||
this.store
|
||||
|
@ -22,31 +22,20 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { AppStore, NavigateLibraryAction } from '@alfresco/aca-shared/store';
|
||||
import { NavigateLibraryAction } from '@alfresco/aca-shared/store';
|
||||
import { SiteEntry } from '@alfresco/js-api';
|
||||
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
import { AppExtensionService, AppHookService, PageComponent } from '@alfresco/aca-shared';
|
||||
import { AppHookService, PageComponent } from '@alfresco/aca-shared';
|
||||
import { DocumentListPresetRef } from '@alfresco/adf-extensions';
|
||||
|
||||
@Component({
|
||||
templateUrl: './libraries.component.html'
|
||||
})
|
||||
export class LibrariesComponent extends PageComponent implements OnInit {
|
||||
isSmallScreen = false;
|
||||
|
||||
columns: DocumentListPresetRef[] = [];
|
||||
|
||||
constructor(
|
||||
content: ContentManagementService,
|
||||
store: Store<AppStore>,
|
||||
extensions: AppExtensionService,
|
||||
private appHookService: AppHookService,
|
||||
private breakpointObserver: BreakpointObserver
|
||||
) {
|
||||
super(store, extensions, content);
|
||||
constructor(private appHookService: AppHookService) {
|
||||
super();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@ -55,11 +44,7 @@ export class LibrariesComponent extends PageComponent implements OnInit {
|
||||
this.subscriptions.push(
|
||||
this.appHookService.libraryDeleted.subscribe(() => this.reload()),
|
||||
this.appHookService.libraryUpdated.subscribe(() => this.reload()),
|
||||
this.appHookService.libraryLeft.subscribe(() => this.reload()),
|
||||
|
||||
this.breakpointObserver.observe([Breakpoints.HandsetPortrait, Breakpoints.HandsetLandscape]).subscribe((result) => {
|
||||
this.isSmallScreen = result.matches;
|
||||
})
|
||||
this.appHookService.libraryLeft.subscribe(() => this.reload())
|
||||
);
|
||||
|
||||
this.columns = this.extensions.documentListPresets.libraries || [];
|
||||
|
@ -23,47 +23,27 @@
|
||||
*/
|
||||
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
||||
import { MinimalNodeEntity } from '@alfresco/js-api';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '@alfresco/aca-shared/store';
|
||||
import { UploadService } from '@alfresco/adf-content-services';
|
||||
import { debounceTime } from 'rxjs/operators';
|
||||
import { Router } from '@angular/router';
|
||||
import { AcaFileAutoDownloadService, AppExtensionService, PageComponent } from '@alfresco/aca-shared';
|
||||
import { PageComponent } from '@alfresco/aca-shared';
|
||||
import { DocumentListPresetRef } from '@alfresco/adf-extensions';
|
||||
|
||||
@Component({
|
||||
templateUrl: './recent-files.component.html'
|
||||
})
|
||||
export class RecentFilesComponent extends PageComponent implements OnInit {
|
||||
isSmallScreen = false;
|
||||
|
||||
columns: DocumentListPresetRef[] = [];
|
||||
|
||||
constructor(
|
||||
store: Store<AppStore>,
|
||||
extensions: AppExtensionService,
|
||||
content: ContentManagementService,
|
||||
private uploadService: UploadService,
|
||||
private breakpointObserver: BreakpointObserver,
|
||||
private router: Router,
|
||||
fileAutoDownloadService: AcaFileAutoDownloadService
|
||||
) {
|
||||
super(store, extensions, content, fileAutoDownloadService);
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
super.ngOnInit();
|
||||
|
||||
this.subscriptions = this.subscriptions.concat([
|
||||
this.uploadService.fileUploadComplete.pipe(debounceTime(300)).subscribe(() => this.onFileUploadedEvent()),
|
||||
this.uploadService.fileUploadDeleted.pipe(debounceTime(300)).subscribe(() => this.onFileUploadedEvent()),
|
||||
|
||||
this.breakpointObserver.observe([Breakpoints.HandsetPortrait, Breakpoints.HandsetLandscape]).subscribe((result) => {
|
||||
this.isSmallScreen = result.matches;
|
||||
})
|
||||
this.uploadService.fileUploadComplete.pipe(debounceTime(300)).subscribe(() => this.reload()),
|
||||
this.uploadService.fileUploadDeleted.pipe(debounceTime(300)).subscribe(() => this.reload())
|
||||
]);
|
||||
|
||||
this.columns = this.extensions.documentListPresets.recent || [];
|
||||
@ -78,8 +58,4 @@ export class RecentFilesComponent extends PageComponent implements OnInit {
|
||||
handleNodeClick(event: Event) {
|
||||
this.onNodeDoubleClick((event as CustomEvent).detail?.node);
|
||||
}
|
||||
|
||||
private onFileUploadedEvent() {
|
||||
this.reload();
|
||||
}
|
||||
}
|
||||
|
@ -22,15 +22,12 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { NavigateLibraryAction, AppStore } from '@alfresco/aca-shared/store';
|
||||
import { NavigateLibraryAction } from '@alfresco/aca-shared/store';
|
||||
import { NodePaging, Pagination, SiteEntry } from '@alfresco/js-api';
|
||||
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Params } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { ContentManagementService } from '../../../services/content-management.service';
|
||||
import { SearchLibrariesQueryBuilderService } from './search-libraries-query-builder.service';
|
||||
import { AppExtensionService, AppHookService, AppService, PageComponent } from '@alfresco/aca-shared';
|
||||
import { AppHookService, AppService, PageComponent } from '@alfresco/aca-shared';
|
||||
import { DocumentListPresetRef } from '@alfresco/adf-extensions';
|
||||
|
||||
@Component({
|
||||
@ -39,7 +36,6 @@ import { DocumentListPresetRef } from '@alfresco/adf-extensions';
|
||||
styleUrls: ['./search-libraries-results.component.scss']
|
||||
})
|
||||
export class SearchLibrariesResultsComponent extends PageComponent implements OnInit {
|
||||
isSmallScreen = false;
|
||||
searchedWord: string;
|
||||
queryParamName = 'q';
|
||||
data: NodePaging;
|
||||
@ -48,16 +44,12 @@ export class SearchLibrariesResultsComponent extends PageComponent implements On
|
||||
columns: DocumentListPresetRef[] = [];
|
||||
|
||||
constructor(
|
||||
private breakpointObserver: BreakpointObserver,
|
||||
private librariesQueryBuilder: SearchLibrariesQueryBuilderService,
|
||||
private route: ActivatedRoute,
|
||||
private appHookService: AppHookService,
|
||||
private appService: AppService,
|
||||
store: Store<AppStore>,
|
||||
extensions: AppExtensionService,
|
||||
content: ContentManagementService
|
||||
private appService: AppService
|
||||
) {
|
||||
super(store, extensions, content);
|
||||
super();
|
||||
|
||||
librariesQueryBuilder.paging = {
|
||||
skipCount: 0,
|
||||
@ -96,10 +88,6 @@ export class SearchLibrariesResultsComponent extends PageComponent implements On
|
||||
this.appHookService.library400Error.next();
|
||||
}
|
||||
} catch (e) {}
|
||||
}),
|
||||
|
||||
this.breakpointObserver.observe([Breakpoints.HandsetPortrait, Breakpoints.HandsetLandscape]).subscribe((result) => {
|
||||
this.isSmallScreen = result.matches;
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -24,11 +24,9 @@
|
||||
|
||||
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { MinimalNodeEntity, Pagination, ResultSetPaging } from '@alfresco/js-api';
|
||||
import { ActivatedRoute, Params, Router } from '@angular/router';
|
||||
import { ActivatedRoute, Params } from '@angular/router';
|
||||
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
|
||||
import { Store } from '@ngrx/store';
|
||||
import {
|
||||
AppStore,
|
||||
infoDrawerPreview,
|
||||
NavigateToFolder,
|
||||
SetInfoDrawerPreviewStateAction,
|
||||
@ -37,13 +35,11 @@ import {
|
||||
ShowInfoDrawerPreviewAction,
|
||||
SnackbarErrorAction
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { ContentManagementService } from '../../../services/content-management.service';
|
||||
import { TranslationService } from '@alfresco/adf-core';
|
||||
import { combineLatest, Observable } from 'rxjs';
|
||||
import { AcaFileAutoDownloadService, AppExtensionService, PageComponent } from '@alfresco/aca-shared';
|
||||
import { combineLatest } from 'rxjs';
|
||||
import { PageComponent } from '@alfresco/aca-shared';
|
||||
import { SearchSortingDefinition } from '@alfresco/adf-content-services/lib/search/models/search-sorting-definition.interface';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
||||
|
||||
@Component({
|
||||
selector: 'aca-search-results',
|
||||
@ -52,36 +48,23 @@ import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
||||
styleUrls: ['./search-results.component.scss']
|
||||
})
|
||||
export class SearchResultsComponent extends PageComponent implements OnInit {
|
||||
showFacetFilter$: Observable<boolean>;
|
||||
infoDrawerPreview$: Observable<boolean>;
|
||||
showFacetFilter$ = this.store.select(showFacetFilter);
|
||||
infoDrawerPreview$ = this.store.select(infoDrawerPreview);
|
||||
|
||||
searchedWord: string;
|
||||
queryParamName = 'q';
|
||||
data: ResultSetPaging;
|
||||
sorting = ['name', 'asc'];
|
||||
isLoading = false;
|
||||
isSmallScreen = false;
|
||||
|
||||
constructor(
|
||||
private queryBuilder: SearchQueryBuilderService,
|
||||
private route: ActivatedRoute,
|
||||
store: Store<AppStore>,
|
||||
extensions: AppExtensionService,
|
||||
content: ContentManagementService,
|
||||
private translationService: TranslationService,
|
||||
private router: Router,
|
||||
private breakpointObserver: BreakpointObserver,
|
||||
fileAutoDownloadService: AcaFileAutoDownloadService
|
||||
) {
|
||||
super(store, extensions, content, fileAutoDownloadService);
|
||||
constructor(private queryBuilder: SearchQueryBuilderService, private route: ActivatedRoute, private translationService: TranslationService) {
|
||||
super();
|
||||
|
||||
queryBuilder.paging = {
|
||||
skipCount: 0,
|
||||
maxItems: 25
|
||||
};
|
||||
|
||||
this.showFacetFilter$ = store.select(showFacetFilter);
|
||||
this.infoDrawerPreview$ = store.select(infoDrawerPreview);
|
||||
combineLatest([this.route.params, this.queryBuilder.configUpdated])
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(([params, searchConfig]) => {
|
||||
@ -92,13 +75,6 @@ export class SearchResultsComponent extends PageComponent implements OnInit {
|
||||
this.queryBuilder.userQuery = decodeURIComponent(query);
|
||||
}
|
||||
});
|
||||
|
||||
this.breakpointObserver
|
||||
.observe([Breakpoints.HandsetPortrait, Breakpoints.HandsetLandscape])
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe((result) => {
|
||||
this.isSmallScreen = result.matches;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -23,34 +23,18 @@
|
||||
*/
|
||||
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { debounceTime } from 'rxjs/operators';
|
||||
import { UploadService } from '@alfresco/adf-content-services';
|
||||
import { Router } from '@angular/router';
|
||||
import { MinimalNodeEntity } from '@alfresco/js-api';
|
||||
import { AcaFileAutoDownloadService, AppExtensionService, AppHookService, PageComponent } from '@alfresco/aca-shared';
|
||||
import { AppHookService, PageComponent } 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,
|
||||
fileAutoDownloadService: AcaFileAutoDownloadService
|
||||
) {
|
||||
super(store, extensions, content, fileAutoDownloadService);
|
||||
constructor(private appHookService: AppHookService) {
|
||||
super();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@ -58,13 +42,8 @@ export class SharedFilesComponent extends PageComponent implements OnInit {
|
||||
|
||||
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.uploadService.fileUploadComplete.pipe(debounceTime(300)).subscribe(() => this.reload()),
|
||||
this.uploadService.fileUploadDeleted.pipe(debounceTime(300)).subscribe(() => this.reload())
|
||||
]);
|
||||
|
||||
this.columns = this.extensions.documentListPresets.shared || [];
|
||||
|
@ -22,43 +22,20 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { AppStore, getUserProfile } from '@alfresco/aca-shared/store';
|
||||
import { DocumentListPresetRef, ProfileState } from '@alfresco/adf-extensions';
|
||||
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
||||
import { getUserProfile } from '@alfresco/aca-shared/store';
|
||||
import { DocumentListPresetRef } from '@alfresco/adf-extensions';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Observable } from 'rxjs';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
import { AppExtensionService, PageComponent } from '@alfresco/aca-shared';
|
||||
import { PageComponent } from '@alfresco/aca-shared';
|
||||
|
||||
@Component({
|
||||
templateUrl: './trashcan.component.html'
|
||||
})
|
||||
export class TrashcanComponent extends PageComponent implements OnInit {
|
||||
isSmallScreen = false;
|
||||
user$: Observable<ProfileState>;
|
||||
|
||||
user$ = this.store.select(getUserProfile);
|
||||
columns: DocumentListPresetRef[] = [];
|
||||
|
||||
constructor(
|
||||
content: ContentManagementService,
|
||||
extensions: AppExtensionService,
|
||||
store: Store<AppStore>,
|
||||
private breakpointObserver: BreakpointObserver
|
||||
) {
|
||||
super(store, extensions, content);
|
||||
this.user$ = this.store.select(getUserProfile);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
super.ngOnInit();
|
||||
|
||||
this.subscriptions.push(
|
||||
this.breakpointObserver.observe([Breakpoints.HandsetPortrait, Breakpoints.HandsetLandscape]).subscribe((result) => {
|
||||
this.isSmallScreen = result.matches;
|
||||
})
|
||||
);
|
||||
|
||||
this.columns = this.extensions.documentListPresets.trashcan || [];
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,8 @@ import { MaterialModule } from '../material.module';
|
||||
import { INITIAL_STATE } from '../store/initial-state';
|
||||
import { TranslatePipeMock } from './translate-pipe.directive';
|
||||
import { BehaviorSubject, Observable, of } from 'rxjs';
|
||||
import { ContentManagementService } from '../services/content-management.service';
|
||||
import { DocumentBasePageService } from '@alfresco/aca-shared';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@ -71,6 +73,7 @@ import { BehaviorSubject, Observable, of } from 'rxjs';
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
{ provide: TranslatePipe, useClass: TranslatePipeMock },
|
||||
{ provide: DocumentBasePageService, useExisting: ContentManagementService },
|
||||
{
|
||||
provide: DiscoveryApiService,
|
||||
useValue: {
|
||||
|
@ -24,17 +24,16 @@
|
||||
|
||||
import { Component, OnInit, OnDestroy, ViewEncapsulation, HostListener } from '@angular/core';
|
||||
import { Location } from '@angular/common';
|
||||
import { ActivatedRoute, Router, UrlTree, UrlSegmentGroup, UrlSegment, PRIMARY_OUTLET } from '@angular/router';
|
||||
import { ActivatedRoute, UrlTree, UrlSegmentGroup, UrlSegment, PRIMARY_OUTLET } from '@angular/router';
|
||||
import { debounceTime, map, takeUntil } from 'rxjs/operators';
|
||||
import { UserPreferencesService, ObjectUtils } from '@alfresco/adf-core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore, ClosePreviewAction, ViewerActionTypes, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
||||
import { PageComponent, AppExtensionService, AppHookService, ContentApiService, DocumentBasePageService } from '@alfresco/aca-shared';
|
||||
import { ClosePreviewAction, ViewerActionTypes, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
||||
import { PageComponent, AppHookService, ContentApiService } from '@alfresco/aca-shared';
|
||||
import { ContentActionRef, ViewerExtensionRef } from '@alfresco/adf-extensions';
|
||||
import { SearchRequest } from '@alfresco/js-api';
|
||||
import { from } from 'rxjs';
|
||||
import { Actions, ofType } from '@ngrx/effects';
|
||||
import { NodesApiService, UploadService } from '@alfresco/adf-content-services';
|
||||
import { NodesApiService } from '@alfresco/adf-content-services';
|
||||
|
||||
@Component({
|
||||
selector: 'app-preview',
|
||||
@ -89,17 +88,12 @@ export class PreviewComponent extends PageComponent implements OnInit, OnDestroy
|
||||
private contentApi: ContentApiService,
|
||||
private preferences: UserPreferencesService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private nodesApiService: NodesApiService,
|
||||
private uploadService: UploadService,
|
||||
private actions$: Actions,
|
||||
private location: Location,
|
||||
store: Store<AppStore>,
|
||||
extensions: AppExtensionService,
|
||||
content: DocumentBasePageService,
|
||||
private appHookService: AppHookService
|
||||
) {
|
||||
super(store, extensions, content);
|
||||
super();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -22,10 +22,10 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { DocumentListComponent, ShareDataRow } from '@alfresco/adf-content-services';
|
||||
import { DocumentListComponent, ShareDataRow, UploadService } from '@alfresco/adf-content-services';
|
||||
import { ShowHeaderMode } from '@alfresco/adf-core';
|
||||
import { ContentActionRef, DocumentListPresetRef, SelectionState } from '@alfresco/adf-extensions';
|
||||
import { OnDestroy, OnInit, OnChanges, ViewChild, SimpleChanges, Directive } from '@angular/core';
|
||||
import { OnDestroy, OnInit, OnChanges, ViewChild, SimpleChanges, Directive, inject } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { MinimalNodeEntity, MinimalNodeEntryEntity, NodePaging } from '@alfresco/js-api';
|
||||
import { Observable, Subject, Subscription } from 'rxjs';
|
||||
@ -46,6 +46,8 @@ import {
|
||||
import { AppExtensionService } from '../../services/app.extension.service';
|
||||
import { isLibrary, isLocked } from '../../utils/node.utils';
|
||||
import { AcaFileAutoDownloadService } from '../../services/aca-file-auto-download.service';
|
||||
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
/* eslint-disable @angular-eslint/directive-class-suffix */
|
||||
@Directive()
|
||||
@ -69,16 +71,18 @@ export abstract class PageComponent implements OnInit, OnDestroy, OnChanges {
|
||||
showHeader = ShowHeaderMode.Data;
|
||||
filterSorting = 'name-asc';
|
||||
createActions: Array<ContentActionRef> = [];
|
||||
isSmallScreen = false;
|
||||
|
||||
protected extensions = inject(AppExtensionService);
|
||||
protected content = inject(DocumentBasePageService);
|
||||
protected store = inject<Store<AppStore>>(Store<AppStore>);
|
||||
protected breakpointObserver = inject(BreakpointObserver);
|
||||
protected uploadService = inject(UploadService);
|
||||
protected router = inject(Router);
|
||||
private fileAutoDownloadService = inject(AcaFileAutoDownloadService, { optional: true });
|
||||
|
||||
protected subscriptions: Subscription[] = [];
|
||||
|
||||
protected constructor(
|
||||
protected store: Store<AppStore>,
|
||||
protected extensions: AppExtensionService,
|
||||
protected content: DocumentBasePageService,
|
||||
private fileAutoDownloadService: AcaFileAutoDownloadService = null
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.extensions
|
||||
.getCreateActions()
|
||||
@ -120,6 +124,13 @@ export abstract class PageComponent implements OnInit, OnDestroy, OnChanges {
|
||||
.subscribe((node) => {
|
||||
this.canUpload = node && this.content.canUploadContent(node);
|
||||
});
|
||||
|
||||
this.breakpointObserver
|
||||
.observe([Breakpoints.HandsetPortrait, Breakpoints.HandsetLandscape])
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe((result) => {
|
||||
this.isSmallScreen = result.matches;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
|
@ -24,20 +24,20 @@
|
||||
|
||||
import { TestBed, ComponentFixture } from '@angular/core/testing';
|
||||
import { PageComponent } from './document-base-page.component';
|
||||
import { ReloadDocumentListAction, SetSelectedNodesAction, AppState, AppStore, ViewNodeAction } from '@alfresco/aca-shared/store';
|
||||
import { ReloadDocumentListAction, SetSelectedNodesAction, AppState, ViewNodeAction } from '@alfresco/aca-shared/store';
|
||||
import { AppExtensionService } from '@alfresco/aca-shared';
|
||||
import { MinimalNodeEntity, Node, NodePaging } from '@alfresco/js-api';
|
||||
import { MinimalNodeEntity, NodePaging, RepositoryInfo } from '@alfresco/js-api';
|
||||
import { DocumentBasePageService } from './document-base-page.service';
|
||||
import { Store, StoreModule } from '@ngrx/store';
|
||||
import { Component, Injectable } from '@angular/core';
|
||||
import { DocumentListComponent } from '@alfresco/adf-content-services';
|
||||
import { DiscoveryApiService, DocumentListComponent } from '@alfresco/adf-content-services';
|
||||
import { MockStore, provideMockStore } from '@ngrx/store/testing';
|
||||
import { MaterialModule, PipeModule } from '@alfresco/adf-core';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { EffectsModule } from '@ngrx/effects';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { BehaviorSubject, Observable, Subscription, of } from 'rxjs';
|
||||
|
||||
export const INITIAL_APP_STATE: AppState = {
|
||||
appName: 'Alfresco Content Application',
|
||||
@ -77,10 +77,10 @@ export const INITIAL_APP_STATE: AppState = {
|
||||
|
||||
@Injectable()
|
||||
class DocumentBasePageServiceMock extends DocumentBasePageService {
|
||||
canUpdateNode(_node: MinimalNodeEntity): boolean {
|
||||
canUpdateNode(): boolean {
|
||||
return true;
|
||||
}
|
||||
canUploadContent(_node: Node): boolean {
|
||||
canUploadContent(): boolean {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -92,8 +92,8 @@ class DocumentBasePageServiceMock extends DocumentBasePageService {
|
||||
class TestComponent extends PageComponent {
|
||||
node: any;
|
||||
|
||||
constructor(store: Store<AppStore>, extensions: AppExtensionService, content: DocumentBasePageService) {
|
||||
super(store, extensions, content);
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
addSubscription(entry: Subscription) {
|
||||
@ -138,6 +138,13 @@ describe('PageComponent', () => {
|
||||
provide: DocumentBasePageService,
|
||||
useClass: DocumentBasePageServiceMock
|
||||
},
|
||||
{
|
||||
provide: DiscoveryApiService,
|
||||
useValue: {
|
||||
ecmProductInfo$: new BehaviorSubject<RepositoryInfo | null>(null),
|
||||
getEcmProductInfo: (): Observable<RepositoryInfo> => of(new RepositoryInfo({ version: '10.0.0' }))
|
||||
}
|
||||
},
|
||||
AppExtensionService
|
||||
]
|
||||
});
|
||||
@ -283,11 +290,18 @@ describe('Info Drawer state', () => {
|
||||
};
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
imports: [NoopAnimationsModule, HttpClientModule, RouterTestingModule],
|
||||
imports: [NoopAnimationsModule, HttpClientModule, RouterTestingModule, MaterialModule],
|
||||
declarations: [TestComponent],
|
||||
providers: [
|
||||
{ provide: DocumentBasePageService, useClass: DocumentBasePageServiceMock },
|
||||
AppExtensionService,
|
||||
{
|
||||
provide: DiscoveryApiService,
|
||||
useValue: {
|
||||
ecmProductInfo$: new BehaviorSubject<RepositoryInfo | null>(null),
|
||||
getEcmProductInfo: (): Observable<RepositoryInfo> => of(new RepositoryInfo({ version: '10.0.0' }))
|
||||
}
|
||||
},
|
||||
provideMockStore({
|
||||
initialState: { app: appState }
|
||||
})
|
||||
|
@ -54,7 +54,7 @@ import { NodesApiService, UploadService } from '@alfresco/adf-content-services';
|
||||
host: { class: 'app-viewer' }
|
||||
})
|
||||
export class AcaViewerComponent implements OnInit, OnDestroy {
|
||||
_versionsApi: VersionsApi;
|
||||
private _versionsApi: VersionsApi;
|
||||
get versionsApi(): VersionsApi {
|
||||
this._versionsApi = this._versionsApi ?? new VersionsApi(this.apiService.getInstance());
|
||||
return this._versionsApi;
|
||||
|
Loading…
x
Reference in New Issue
Block a user