1. 빈확장자 파일업로드시 오류처리.
2. 지원하지 않는 파일입니다. <br/> (ext..) 의 줄바꿈 처리.
This commit is contained in:
leejinho 2020-02-10 09:33:41 +09:00
parent 928e77d54c
commit b0b5ed2209
5 changed files with 68 additions and 40 deletions

View File

@ -207,12 +207,13 @@ export class CommonApiService {
const reject: string[] = [];
for (const extension of extensions) {
if (
!extension ||
-1 ===
this.moduleConfig.acceptableFileExtensions.indexOf(
extension.toLowerCase()
)
) {
reject.push(extension);
reject.push(!!extension ? extension : 'empty-ext');
accept = false;
}
}

View File

@ -22,7 +22,9 @@ import {
AlertDialogData,
AlertDialogResult,
FileUploadQueueComponent,
StringUtil
StringUtil,
AlertSnackbarComponent,
AlertSnackbarData
} from '@ucap-webmessenger/ui';
import { Store, select } from '@ngrx/store';
import { NGXLogger } from 'ngx-logger';
@ -1107,18 +1109,23 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
this.fileUploadQueue.onUploadComplete();
}
this.snackBarService.open(
this.translateService.instant('common.file.errors.notSupporedType', {
supporedType:
checkExt.reject.length > 0 ? checkExt.reject.join(',') : ''
}),
'',
{
this.snackBarService.openFromComponent<
AlertSnackbarComponent,
AlertSnackbarData
>(AlertSnackbarComponent, {
duration: 1000,
verticalPosition: 'bottom',
horizontalPosition: 'center'
horizontalPosition: 'center',
data: {
html: this.translateService.instant(
'common.file.errors.notSupporedType',
{
supporedType:
checkExt.reject.length > 0 ? checkExt.reject.join(',') : ''
}
);
)
}
});
return;
}

View File

@ -18,7 +18,9 @@ import {
AlertDialogResult,
AlertDialogComponent,
AlertDialogData,
SnackBarService
SnackBarService,
AlertSnackbarComponent,
AlertSnackbarData
} from '@ucap-webmessenger/ui';
import { NGXLogger } from 'ngx-logger';
@ -250,18 +252,23 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
);
if (!checkExt.accept) {
this.ngZone.run(() => {
this.snackBarService.open(
this.translateService.instant('common.file.errors.notSupporedType', {
supporedType:
checkExt.reject.length > 0 ? checkExt.reject.join(',') : ''
}),
'',
{
this.snackBarService.openFromComponent<
AlertSnackbarComponent,
AlertSnackbarData
>(AlertSnackbarComponent, {
duration: 1000,
verticalPosition: 'bottom',
horizontalPosition: 'center'
horizontalPosition: 'center',
data: {
html: this.translateService.instant(
'common.file.errors.notSupporedType',
{
supporedType:
checkExt.reject.length > 0 ? checkExt.reject.join(',') : ''
}
);
)
}
});
});
return valid;
}

View File

@ -20,6 +20,10 @@ import {
} from '../dialogs/alert.dialog.component';
import { TranslateService } from '@ngx-translate/core';
import { SnackBarService } from '../services/snack-bar.service';
import {
AlertSnackbarComponent,
AlertSnackbarData
} from '../snackbars/alert.snackbar.component';
@Directive({
selector: 'input[ucapFileUploadFor], div[ucapFileUploadFor]'
@ -121,18 +125,23 @@ export class FileUploadForDirective implements AfterViewInit {
this.elementRef.nativeElement.value = '';
this.dragOver = false;
this.snackBarService.open(
this.translateService.instant('common.file.errors.notSupporedType', {
supporedType:
checkExt.reject.length > 0 ? checkExt.reject.join(',') : ''
}),
'',
{
this.snackBarService.openFromComponent<
AlertSnackbarComponent,
AlertSnackbarData
>(AlertSnackbarComponent, {
duration: 1000,
verticalPosition: 'bottom',
horizontalPosition: 'center'
horizontalPosition: 'center',
data: {
html: this.translateService.instant(
'common.file.errors.notSupporedType',
{
supporedType:
checkExt.reject.length > 0 ? checkExt.reject.join(',') : ''
}
);
)
}
});
return;
}

View File

@ -5,7 +5,11 @@
fxFlexAlign="center"
class="mat-simple-snackbar-action ng-star-inserted"
>
<button mat-stroked-button (click)="onClickConfirm()">
<button
*ngIf="!!data.buttonText"
mat-stroked-button
(click)="onClickConfirm()"
>
<ng-container
*ngIf="data.buttonText; then buttonText; else default"
></ng-container>