mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACA-4679] Added code changes and env variables to enable DownloadPrompt and FileAutoDownload features on ACA (#3127)
* [ACA-4679] Added docker variables, app.config.json.tpl config and additional code for enabling non-responsive file preview download and file auto download features in ACA * [ACA-4679] Added defaults for downloadPrompt for viewer and fileAutoDownload features. Updated variable names from 'nonResponsiveDialog' to 'downloadPrompt' * [ACA-4679] Added unit test cases for FileAutoDownloadService * [ACA-4679] Updated env variable references from NonResponsiveDialog to DownloadPrompt * [ACA-4679] Added missing licence header on new files * [ACA-4679] Added env variable configuration for GithubActions jobs * [ACA-4679] Added env variable configuration for GithubActions jobs * [ACA-4679] Removed unneeded env variable configuration for GithubActions jobs * [ACA-4679] Updated .env file configuration in README.md
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { AppExtensionService, ContentApiService, PageComponent } from '@alfresco/aca-shared';
|
||||
import { AcaFileAutoDownloadService, AppExtensionService, ContentApiService, PageComponent } from '@alfresco/aca-shared';
|
||||
import { AppStore } from '@alfresco/aca-shared/store';
|
||||
import { UploadService } from '@alfresco/adf-content-services';
|
||||
import { MinimalNodeEntity, MinimalNodeEntryEntity, PathElementEntity, PathInfo } from '@alfresco/js-api';
|
||||
@@ -49,9 +49,10 @@ export class FavoritesComponent extends PageComponent implements OnInit {
|
||||
private contentApi: ContentApiService,
|
||||
content: ContentManagementService,
|
||||
private uploadService: UploadService,
|
||||
private breakpointObserver: BreakpointObserver
|
||||
private breakpointObserver: BreakpointObserver,
|
||||
fileAutoDownloadService: AcaFileAutoDownloadService
|
||||
) {
|
||||
super(store, extensions, content);
|
||||
super(store, extensions, content, fileAutoDownloadService);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
@@ -29,7 +29,7 @@ import { Store } from '@ngrx/store';
|
||||
import { MinimalNodeEntity, MinimalNodeEntryEntity, PathElement, PathElementEntity } from '@alfresco/js-api';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
import { NodeActionsService } from '../../services/node-actions.service';
|
||||
import { AppExtensionService, ContentApiService, PageComponent } from '@alfresco/aca-shared';
|
||||
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 { debounceTime, takeUntil } from 'rxjs/operators';
|
||||
@@ -61,9 +61,10 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
private uploadService: UploadService,
|
||||
content: ContentManagementService,
|
||||
extensions: AppExtensionService,
|
||||
private breakpointObserver: BreakpointObserver
|
||||
private breakpointObserver: BreakpointObserver,
|
||||
fileAutoDownloadService: AcaFileAutoDownloadService
|
||||
) {
|
||||
super(store, extensions, content);
|
||||
super(store, extensions, content, fileAutoDownloadService);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
@@ -31,7 +31,7 @@ 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 { AppExtensionService, PageComponent } from '@alfresco/aca-shared';
|
||||
import { AcaFileAutoDownloadService, AppExtensionService, PageComponent } from '@alfresco/aca-shared';
|
||||
import { DocumentListPresetRef } from '@alfresco/adf-extensions';
|
||||
|
||||
@Component({
|
||||
@@ -48,9 +48,10 @@ export class RecentFilesComponent extends PageComponent implements OnInit {
|
||||
content: ContentManagementService,
|
||||
private uploadService: UploadService,
|
||||
private breakpointObserver: BreakpointObserver,
|
||||
private router: Router
|
||||
private router: Router,
|
||||
fileAutoDownloadService: AcaFileAutoDownloadService
|
||||
) {
|
||||
super(store, extensions, content);
|
||||
super(store, extensions, content, fileAutoDownloadService);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
@@ -30,6 +30,7 @@ import { BehaviorSubject, Subject } from 'rxjs';
|
||||
import { NodesApiService } from '@alfresco/adf-content-services';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { Router } from '@angular/router';
|
||||
import { AcaFileAutoDownloadService } from '@alfresco/aca-shared';
|
||||
|
||||
@Component({
|
||||
selector: 'aca-search-results-row',
|
||||
@@ -49,7 +50,12 @@ export class SearchResultsRowComponent implements OnInit, OnDestroy {
|
||||
name$ = new BehaviorSubject<string>('');
|
||||
title$ = new BehaviorSubject<string>('');
|
||||
|
||||
constructor(private store: Store<any>, private nodesApiService: NodesApiService, private router: Router) {}
|
||||
constructor(
|
||||
private store: Store<any>,
|
||||
private nodesApiService: NodesApiService,
|
||||
private router: Router,
|
||||
private fileAutoDownloadService: AcaFileAutoDownloadService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.updateValues();
|
||||
@@ -93,7 +99,11 @@ export class SearchResultsRowComponent implements OnInit, OnDestroy {
|
||||
|
||||
showPreview(event: Event) {
|
||||
event.stopPropagation();
|
||||
this.store.dispatch(new ViewNodeAction(this.node.entry.id, { location: this.router.url }));
|
||||
if (this.fileAutoDownloadService.shouldFileAutoDownload(this.node.entry.content.sizeInBytes)) {
|
||||
this.fileAutoDownloadService.autoDownloadFile(this.node);
|
||||
} else {
|
||||
this.store.dispatch(new ViewNodeAction(this.node.entry.id, { location: this.router.url }));
|
||||
}
|
||||
}
|
||||
|
||||
navigate(event: Event) {
|
||||
|
@@ -40,7 +40,7 @@ import {
|
||||
import { ContentManagementService } from '../../../services/content-management.service';
|
||||
import { TranslationService } from '@alfresco/adf-core';
|
||||
import { combineLatest, Observable } from 'rxjs';
|
||||
import { AppExtensionService, PageComponent } from '@alfresco/aca-shared';
|
||||
import { AcaFileAutoDownloadService, AppExtensionService, 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';
|
||||
@@ -70,9 +70,10 @@ export class SearchResultsComponent extends PageComponent implements OnInit {
|
||||
content: ContentManagementService,
|
||||
private translationService: TranslationService,
|
||||
private router: Router,
|
||||
private breakpointObserver: BreakpointObserver
|
||||
private breakpointObserver: BreakpointObserver,
|
||||
fileAutoDownloadService: AcaFileAutoDownloadService
|
||||
) {
|
||||
super(store, extensions, content);
|
||||
super(store, extensions, content, fileAutoDownloadService);
|
||||
|
||||
queryBuilder.paging = {
|
||||
skipCount: 0,
|
||||
|
@@ -30,9 +30,8 @@ import { debounceTime } from 'rxjs/operators';
|
||||
import { UploadService } from '@alfresco/adf-content-services';
|
||||
import { Router } from '@angular/router';
|
||||
import { MinimalNodeEntity } from '@alfresco/js-api';
|
||||
import { AppExtensionService, AppHookService, PageComponent } from '@alfresco/aca-shared';
|
||||
import { AcaFileAutoDownloadService, AppExtensionService, AppHookService, PageComponent } from '@alfresco/aca-shared';
|
||||
import { DocumentListPresetRef } from '@alfresco/adf-extensions';
|
||||
|
||||
@Component({
|
||||
templateUrl: './shared-files.component.html'
|
||||
})
|
||||
@@ -48,9 +47,10 @@ export class SharedFilesComponent extends PageComponent implements OnInit {
|
||||
private appHookService: AppHookService,
|
||||
private uploadService: UploadService,
|
||||
private breakpointObserver: BreakpointObserver,
|
||||
private router: Router
|
||||
private router: Router,
|
||||
fileAutoDownloadService: AcaFileAutoDownloadService
|
||||
) {
|
||||
super(store, extensions, content);
|
||||
super(store, extensions, content, fileAutoDownloadService);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
@@ -28,6 +28,7 @@ import { AppStore, ViewNodeAction, getAppSelection } from '@alfresco/aca-shared/
|
||||
import { Router } from '@angular/router';
|
||||
import { take } from 'rxjs/operators';
|
||||
import { SharedLinkEntry } from '@alfresco/js-api';
|
||||
import { AcaFileAutoDownloadService } from '@alfresco/aca-shared';
|
||||
|
||||
@Component({
|
||||
selector: 'app-view-node',
|
||||
@@ -53,22 +54,26 @@ import { SharedLinkEntry } from '@alfresco/js-api';
|
||||
export class ViewNodeComponent {
|
||||
@Input() data: { title?: string; menuButton?: boolean; iconButton?: boolean };
|
||||
|
||||
constructor(private store: Store<AppStore>, private router: Router) {}
|
||||
constructor(private store: Store<AppStore>, private router: Router, private fileAutoDownloadService: AcaFileAutoDownloadService) {}
|
||||
|
||||
onClick() {
|
||||
this.store
|
||||
.select(getAppSelection)
|
||||
.pipe(take(1))
|
||||
.subscribe((selection) => {
|
||||
let id: string;
|
||||
|
||||
if (selection.file.entry.nodeType === 'app:filelink') {
|
||||
id = selection.file.entry.properties['cm:destination'];
|
||||
if (this.fileAutoDownloadService.shouldFileAutoDownload(selection.file.entry?.content?.sizeInBytes)) {
|
||||
this.fileAutoDownloadService.autoDownloadFile(selection.file);
|
||||
} else {
|
||||
id = (selection.file as SharedLinkEntry).entry.nodeId || (selection.file as any).entry.guid || selection.file.entry.id;
|
||||
}
|
||||
let id: string;
|
||||
|
||||
this.store.dispatch(new ViewNodeAction(id, { location: this.router.url }));
|
||||
if (selection.file.entry.nodeType === 'app:filelink') {
|
||||
id = selection.file.entry.properties['cm:destination'];
|
||||
} else {
|
||||
id = (selection.file as SharedLinkEntry).entry.nodeId || (selection.file as any).entry.guid || selection.file.entry.id;
|
||||
}
|
||||
|
||||
this.store.dispatch(new ViewNodeAction(id, { location: this.router.url }));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user