[ISSUE 195] fixed

This commit is contained in:
richard-loafle 2020-02-05 17:57:18 +09:00
parent e307cdb3b6
commit 11fc391fc4
5 changed files with 69 additions and 82 deletions

View File

@ -1160,22 +1160,18 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
fui => fui.file.size > fileAllowSize * 1024 * 1024 fui => fui.file.size > fileAllowSize * 1024 * 1024
).length ).length
) { ) {
this.dialogService.open< this.snackBarService.open(
AlertDialogComponent, this.translateService.instant('common.file.errors.oversize', {
AlertDialogData, maxSize: fileAllowSize
AlertDialogResult }),
>(AlertDialogComponent, { '',
width: '360px', {
data: { duration: 1000,
title: '', verticalPosition: 'bottom',
message: this.translateService.instant( horizontalPosition: 'center'
'common.file.errors.oversize',
{
maxSize: fileAllowSize
}
)
} }
}); );
if (!!this.fileUploadQueue) { if (!!this.fileUploadQueue) {
this.fileUploadQueue.onUploadComplete(); this.fileUploadQueue.onUploadComplete();
} }
@ -1191,22 +1187,18 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
this.fileUploadQueue.onUploadComplete(); this.fileUploadQueue.onUploadComplete();
} }
this.dialogService.open< this.snackBarService.open(
AlertDialogComponent, this.translateService.instant('common.file.errors.notSupporedType', {
AlertDialogData, supporedType:
AlertDialogResult checkExt.reject.length > 0 ? checkExt.reject.join(',') : ''
>(AlertDialogComponent, { }),
data: { '',
title: 'Alert', {
html: `${this.translateService.instant( duration: 1000,
'common.file.errors.notSupporedType' verticalPosition: 'bottom',
)} ${ horizontalPosition: 'center'
checkExt.reject.length > 0
? '<br/>(' + checkExt.reject.join(',') + ')'
: ''
}`
} }
}); );
return; return;
} }

View File

@ -434,7 +434,7 @@
"expired": "This file has expired", "expired": "This file has expired",
"noPreview": "This file does not support preview.", "noPreview": "This file does not support preview.",
"cantPlay": "This file does not support playing.", "cantPlay": "This file does not support playing.",
"notSupporedType": "File format is not supported.", "notSupporedType": "File format is not supported. <br/> ({{supporedType}})",
"oversize": "You cannot upload files larger than {{size}} megabytes." "oversize": "You cannot upload files larger than {{size}} megabytes."
} }
}, },

View File

@ -434,7 +434,7 @@
"expired": "기간이 만료된 파일입니다", "expired": "기간이 만료된 파일입니다",
"noPreview": "미리보기를 지원하지 않는 파일입니다.", "noPreview": "미리보기를 지원하지 않는 파일입니다.",
"cantPlay": "재생을 지원하지 않는 파일입니다.", "cantPlay": "재생을 지원하지 않는 파일입니다.",
"notSupporedType": "지원하지 않는 파일형식입니다.", "notSupporedType": "지원하지 않는 파일형식입니다. <br/> ({{supporedType}})",
"oversize": "{{maxSize}}MB 이상 파일을 업로드 할 수 없습니다." "oversize": "{{maxSize}}MB 이상 파일을 업로드 할 수 없습니다."
} }
}, },

View File

@ -8,7 +8,8 @@ import {
ChangeDetectorRef, ChangeDetectorRef,
OnDestroy, OnDestroy,
ElementRef, ElementRef,
Input Input,
NgZone
} from '@angular/core'; } from '@angular/core';
import { import {
@ -16,7 +17,8 @@ import {
DialogService, DialogService,
AlertDialogResult, AlertDialogResult,
AlertDialogComponent, AlertDialogComponent,
AlertDialogData AlertDialogData,
SnackBarService
} from '@ucap-webmessenger/ui'; } from '@ucap-webmessenger/ui';
import { NGXLogger } from 'ngx-logger'; import { NGXLogger } from 'ngx-logger';
@ -118,6 +120,8 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
private changeDetectorRef: ChangeDetectorRef, private changeDetectorRef: ChangeDetectorRef,
private translateService: TranslateService, private translateService: TranslateService,
private commonApiService: CommonApiService, private commonApiService: CommonApiService,
private snackBarService: SnackBarService,
private readonly ngZone: NgZone,
private logger: NGXLogger private logger: NGXLogger
) {} ) {}
@ -193,6 +197,7 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
const fileList: FileList = this.fileInput.nativeElement.files; const fileList: FileList = this.fileInput.nativeElement.files;
if (!this.validUploadFile(fileList)) { if (!this.validUploadFile(fileList)) {
self.fileInput.nativeElement.value = '';
return; return;
} }
@ -222,21 +227,18 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
} }
} }
if (!valid) { if (!valid) {
this.dialogService.open< this.ngZone.run(() => {
AlertDialogComponent, this.snackBarService.open(
AlertDialogData, this.translateService.instant('common.file.errors.oversize', {
AlertDialogResult maxSize: this.fileAllowSize
>(AlertDialogComponent, { }),
width: '360px', '',
data: { {
title: '', duration: 1000,
message: this.translateService.instant( verticalPosition: 'bottom',
'common.file.errors.oversize', horizontalPosition: 'center'
{ }
maxSize: this.fileAllowSize );
}
)
}
}); });
return valid; return valid;
@ -247,23 +249,20 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
FileUtil.getExtensions(fileList) FileUtil.getExtensions(fileList)
); );
if (!checkExt.accept) { if (!checkExt.accept) {
this.dialogService.open< this.ngZone.run(() => {
AlertDialogComponent, this.snackBarService.open(
AlertDialogData, this.translateService.instant('common.file.errors.notSupporedType', {
AlertDialogResult supporedType:
>(AlertDialogComponent, { checkExt.reject.length > 0 ? checkExt.reject.join(',') : ''
data: { }),
title: 'Alert', '',
html: `${this.translateService.instant( {
'common.file.errors.notSupporedType' duration: 1000,
)} ${ verticalPosition: 'bottom',
checkExt.reject.length > 0 horizontalPosition: 'center'
? '<br/>(' + checkExt.reject.join(',') + ')' }
: '' );
}`
}
}); });
return valid; return valid;
} }

View File

@ -13,13 +13,13 @@ import { FileUploadQueueComponent } from '../components/file-upload-queue.compon
import { FileUploadItem } from '@ucap-webmessenger/api'; import { FileUploadItem } from '@ucap-webmessenger/api';
import { CommonApiService } from '@ucap-webmessenger/api-common'; import { CommonApiService } from '@ucap-webmessenger/api-common';
import { FileUtil } from '@ucap-webmessenger/core'; import { FileUtil } from '@ucap-webmessenger/core';
import { DialogService } from '../services/dialog.service';
import { import {
AlertDialogComponent, AlertDialogComponent,
AlertDialogResult, AlertDialogResult,
AlertDialogData AlertDialogData
} from '../dialogs/alert.dialog.component'; } from '../dialogs/alert.dialog.component';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { SnackBarService } from '../services/snack-bar.service';
@Directive({ @Directive({
selector: 'input[ucapFileUploadFor], div[ucapFileUploadFor]' selector: 'input[ucapFileUploadFor], div[ucapFileUploadFor]'
@ -47,7 +47,7 @@ export class FileUploadForDirective implements AfterViewInit {
private elementRef: ElementRef, private elementRef: ElementRef,
private logger: NGXLogger, private logger: NGXLogger,
private translateService: TranslateService, private translateService: TranslateService,
private dialogService: DialogService private snackBarService: SnackBarService
) {} ) {}
ngAfterViewInit(): void {} ngAfterViewInit(): void {}
@ -121,22 +121,18 @@ export class FileUploadForDirective implements AfterViewInit {
this.elementRef.nativeElement.value = ''; this.elementRef.nativeElement.value = '';
this.dragOver = false; this.dragOver = false;
this.dialogService.open< this.snackBarService.open(
AlertDialogComponent, this.translateService.instant('common.file.errors.notSupporedType', {
AlertDialogData, supporedType:
AlertDialogResult checkExt.reject.length > 0 ? checkExt.reject.join(',') : ''
>(AlertDialogComponent, { }),
data: { '',
title: 'Alert', {
html: `${this.translateService.instant( duration: 1000,
'common.file.errors.notSupporedType' verticalPosition: 'bottom',
)} ${ horizontalPosition: 'center'
checkExt.reject.length > 0
? '<br/>(' + checkExt.reject.join(',') + ')'
: ''
}`
} }
}); );
return; return;
} }