mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
core electron integration (#356)
* core electron integration * test fixes
This commit is contained in:
committed by
Cilibiu Bogdan
parent
daf7d65c03
commit
e1ea9fbfc1
@@ -23,9 +23,13 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, OnInit, EventEmitter } from '@angular/core';
|
||||
import { Router, ActivatedRoute, NavigationEnd } from '@angular/router';
|
||||
import { TranslationService, PageTitleService, UserPreferencesService, AppConfigService } from '@alfresco/adf-core';
|
||||
import {
|
||||
TranslationService, PageTitleService, UserPreferencesService, AppConfigService,
|
||||
FileModel, UploadService
|
||||
} from '@alfresco/adf-core';
|
||||
import { ElectronService } from '@ngstack/electron';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
@@ -39,7 +43,9 @@ export class AppComponent implements OnInit {
|
||||
private pageTitle: PageTitleService,
|
||||
private translateService: TranslationService,
|
||||
preferences: UserPreferencesService,
|
||||
config: AppConfigService) {
|
||||
config: AppConfigService,
|
||||
private electronService: ElectronService,
|
||||
private uploadService: UploadService) {
|
||||
// TODO: remove once ADF 2.3.0 is out (needs bug fixes)
|
||||
preferences.defaults.supportedPageSizes = config.get('pagination.supportedPageSizes');
|
||||
preferences.defaults.paginationSize = config.get('pagination.size');
|
||||
@@ -69,5 +75,25 @@ export class AppComponent implements OnInit {
|
||||
pageTitle.setTitle(data.title || '');
|
||||
}
|
||||
});
|
||||
|
||||
this.electronService.on('app:navigateRoute', (event: any, ...args: string[]) => {
|
||||
this.router.navigate([...args]);
|
||||
});
|
||||
|
||||
this.electronService.on('app:upload', (event: any, files: any[] = []) => {
|
||||
const models = files.map(fileInfo => {
|
||||
const file = new File([fileInfo.data], fileInfo.name);
|
||||
|
||||
return new FileModel(file, {
|
||||
path: fileInfo.path,
|
||||
parentId: fileInfo.parentId
|
||||
});
|
||||
});
|
||||
|
||||
if (models.length > 0) {
|
||||
this.uploadService.addToQueue(...models);
|
||||
this.uploadService.uploadFilesInTheQueue(new EventEmitter());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user