[ISSUE 225] fixed

This commit is contained in:
richard-loafle 2020-02-07 17:48:52 +09:00
parent 2ce0f3af3b
commit 1fb8b4864f
4 changed files with 59 additions and 21 deletions

View File

@ -37,6 +37,11 @@
| translate: { bannedWords: bannedWords.join(',') } | translate: { bannedWords: bannedWords.join(',') }
}} }}
</mat-error> </mat-error>
<mat-error
*ngIf="inputForm.get('groupName').hasError('groupNameSamed')"
>
{{ 'group.errors.sameNameExist' | translate }}
</mat-error>
</mat-form-field> </mat-form-field>
</form> </form>
</div> </div>
@ -99,6 +104,7 @@
[selectedUserList]="selectedUserList" [selectedUserList]="selectedUserList"
[ignoreUserList]="data.curRoomUser" [ignoreUserList]="data.curRoomUser"
[checkable]="true" [checkable]="true"
[activate$]="groupTreeActivatedSubject.asObservable()"
(checkGroup)="onCheckGroup($event)" (checkGroup)="onCheckGroup($event)"
class="group-expansion" class="group-expansion"
> >
@ -194,7 +200,7 @@
</mat-icon> </mat-icon>
</ng-template> </ng-template>
<div fxFlexFill style="max-height: 508px;"> <div fxFlexFill style="max-height: 508px;">
<perfect-scrollbar fxFlex="1 1 auto" > <perfect-scrollbar fxFlex="1 1 auto">
<div class="mat-tab-frame dialog-tab-chatlist"> <div class="mat-tab-frame dialog-tab-chatlist">
<ucap-room-list-item <ucap-room-list-item
*ngFor="let room of roomList" *ngFor="let room of roomList"

View File

@ -19,7 +19,13 @@ import {
MatTabChangeEvent MatTabChangeEvent
} from '@angular/material'; } from '@angular/material';
import { NGXLogger } from 'ngx-logger'; import { NGXLogger } from 'ngx-logger';
import { Observable, combineLatest, Subscription, of } from 'rxjs'; import {
Observable,
combineLatest,
Subscription,
of,
BehaviorSubject
} from 'rxjs';
import { map, tap, catchError, take } from 'rxjs/operators'; import { map, tap, catchError, take } from 'rxjs/operators';
import { Store, select } from '@ngrx/store'; import { Store, select } from '@ngrx/store';
@ -170,6 +176,7 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
{ group: GroupDetailData; buddyList: UserInfo[] }[] { group: GroupDetailData; buddyList: UserInfo[] }[]
>; >;
favoritBuddyList$: Observable<UserInfo[]>; favoritBuddyList$: Observable<UserInfo[]>;
groupList: GroupDetailData[];
// 대화방 // 대화방
roomList: RoomInfo[]; roomList: RoomInfo[];
@ -192,6 +199,8 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
bannedWords: string[] = []; bannedWords: string[] = [];
groupTreeActivatedSubject = new BehaviorSubject<boolean>(false);
ngOnInit() { ngOnInit() {
const loginInfo = this.sessionStorageService.get<LoginInfo>(KEY_LOGIN_INFO); const loginInfo = this.sessionStorageService.get<LoginInfo>(KEY_LOGIN_INFO);
this.companyCode = loginInfo.companyCode; this.companyCode = loginInfo.companyCode;
@ -256,6 +265,8 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
groupList = tempOrderArr; groupList = tempOrderArr;
} }
this.groupList = groupList;
const groupBuddyList: { const groupBuddyList: {
group: GroupDetailData; group: GroupDetailData;
buddyList: UserInfo[]; buddyList: UserInfo[];
@ -318,7 +329,8 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
[ [
Validators.required, Validators.required,
this.checkSpecialCharacter(), this.checkSpecialCharacter(),
this.checkBanWords() this.checkBanWords(),
this.checkSameName()
] ]
] ]
}); });
@ -350,6 +362,22 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
}; };
} }
checkSameName(): ValidatorFn {
return (control: AbstractControl): { [key: string]: any } | null => {
if (
!control ||
!control.value ||
!this.groupList ||
0 === this.groupList.length
) {
return null;
}
const v = (control.value as string).trim();
const ban = -1 < this.groupList.findIndex(g => g.name === v);
return ban ? { groupNameSamed: { value: control.value } } : null;
};
}
ngOnDestroy(): void { ngOnDestroy(): void {
if (!!this.roomSubscription) { if (!!this.roomSubscription) {
this.roomSubscription.unsubscribe(); this.roomSubscription.unsubscribe();
@ -403,6 +431,8 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
this.selectedRoom = null; this.selectedRoom = null;
} }
this.groupTreeActivatedSubject.next(0 === tabChangeEvent.index);
this.store.dispatch( this.store.dispatch(
SettingsStore.organizationTreeActivated({ SettingsStore.organizationTreeActivated({
activate: 1 === tabChangeEvent.index activate: 1 === tabChangeEvent.index

View File

@ -178,7 +178,8 @@
"errors": { "errors": {
"label": "Group errors", "label": "Group errors",
"requireName": "Group name is required.", "requireName": "Group name is required.",
"bannedWords": "Prohibited word. [{{bannedWords}}]" "bannedWords": "Prohibited word. [{{bannedWords}}]",
"sameNameExist": "Group name already exists."
} }
}, },
"chat": { "chat": {

View File

@ -178,7 +178,8 @@
"errors": { "errors": {
"label": "그룹 에러", "label": "그룹 에러",
"requireName": "그룹명은 필수입력입니다.", "requireName": "그룹명은 필수입력입니다.",
"bannedWords": "금지단어 [{{bannedWords}}]" "bannedWords": "금지단어 [{{bannedWords}}]",
"sameNameExist": "이미 존재하는 그룹명입니다."
} }
}, },
"chat": { "chat": {