From bf2490dda3279f8eb24ba8e1c3dd1754a1e4e8ee Mon Sep 17 00:00:00 2001 From: Richard Park Date: Tue, 8 Oct 2019 09:18:40 +0900 Subject: [PATCH] dialog of group create is added --- .../src/app/app.module.ts | 3 ++ .../left-sidenav/group.component.ts | 37 ++++++++++---- .../dialogs/confirm.dialog.component.spec.ts | 24 --------- .../dialogs/confirm.dialog.component.ts | 51 ------------------- ...tml => create-group.dialog.component.html} | 11 ++-- ...css => create-group.dialog.component.scss} | 0 .../create-group.dialog.component.spec.ts | 24 +++++++++ .../dialogs/create-group.dialog.component.ts | 34 +++++++++++++ .../app/layouts/messenger/dialogs/index.ts | 3 ++ .../messenger/messenger.layout.module.ts | 18 +++++-- 10 files changed, 110 insertions(+), 95 deletions(-) delete mode 100644 projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/confirm.dialog.component.spec.ts delete mode 100644 projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/confirm.dialog.component.ts rename projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/{confirm.dialog.component.html => create-group.dialog.component.html} (56%) rename projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/{confirm.dialog.component.scss => create-group.dialog.component.scss} (100%) create mode 100644 projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/create-group.dialog.component.spec.ts create mode 100644 projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/create-group.dialog.component.ts create mode 100644 projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/index.ts diff --git a/projects/ucap-webmessenger-app/src/app/app.module.ts b/projects/ucap-webmessenger-app/src/app/app.module.ts index b0f1936a..ff01e3d5 100644 --- a/projects/ucap-webmessenger-app/src/app/app.module.ts +++ b/projects/ucap-webmessenger-app/src/app/app.module.ts @@ -37,6 +37,7 @@ import { AppTranslateModule } from './app-translate.module'; import { AppComponent } from './app.component'; import { GUARDS } from './guards'; +import { AppMessengerLayoutModule } from './layouts/messenger/messenger.layout.module'; @NgModule({ imports: [ @@ -83,6 +84,8 @@ import { GUARDS } from './guards'; AppStoreModule, AppTranslateModule, + AppMessengerLayoutModule, + LoggerModule.forRoot({ level: NgxLoggerLevel.DEBUG }) diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts index 8d034931..7046e4ef 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts @@ -5,7 +5,7 @@ import { map } from 'rxjs/operators'; import { Store, select } from '@ngrx/store'; -import { ucapAnimations } from '@ucap-webmessenger/ui'; +import { ucapAnimations, DialogService } from '@ucap-webmessenger/ui'; import { UserInfo, GroupDetailData } from '@ucap-webmessenger/protocol-sync'; import * as AppStore from '@app/store'; @@ -15,6 +15,11 @@ import { Company } from '@ucap-webmessenger/api-external'; import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { LoginInfo, KEY_LOGIN_INFO } from '@app/types'; import { ExpansionPanelComponent as GroupExpansionPanelComponent } from '@ucap-webmessenger/ui-group'; +import { + CreateGroupDialogComponent, + CreateGroupDialogData, + CreateGroupDialogResult +} from '@app/layouts/messenger/dialogs/create-group.dialog.component'; @Component({ selector: 'app-layout-chat-left-sidenav-group', @@ -35,6 +40,7 @@ export class GroupComponent implements OnInit { constructor( private store: Store, private sessionStorageService: SessionStorageService, + private dialogService: DialogService, private logger: NGXLogger ) {} @@ -43,11 +49,7 @@ export class GroupComponent implements OnInit { this.companyCode = loginInfo.companyCode; this.companyList$ = this.store.pipe( - select(AppStore.SettingSelector.CompanySelector.companyList), - map(list => { - this.logger.debug('list', list); - return list; - }) + select(AppStore.SettingSelector.CompanySelector.companyList) ); this.groupBuddyList$ = this.store @@ -95,16 +97,33 @@ export class GroupComponent implements OnInit { ); } - onClickGroupMenu(menuType: string) { + async onClickGroupMenu(menuType: string) { this.logger.debug('menuType', menuType); switch (menuType) { case 'GROUP_NEW': + { + const result = await this.dialogService.open< + CreateGroupDialogComponent, + CreateGroupDialogData, + CreateGroupDialogResult + >(CreateGroupDialogComponent, { + width: '220px', + data: { + title: 'Logout', + message: 'Logout ?' + } + }); + } break; case 'GROUP_EXPAND_MORE': - this.groupExpansionPanel.expandMore(); + { + this.groupExpansionPanel.expandMore(); + } break; case 'GROUP_EXPAND_LESS': - this.groupExpansionPanel.expandLess(); + { + this.groupExpansionPanel.expandLess(); + } break; case 'GROUP_SAVE': break; diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/confirm.dialog.component.spec.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/confirm.dialog.component.spec.ts deleted file mode 100644 index de089c82..00000000 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/confirm.dialog.component.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { ConfirmDialogComponent } from './confirm.dialog.component'; - -describe('ui::ConfirmDialogComponent', () => { - let component: ConfirmDialogComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ConfirmDialogComponent] - }).compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ConfirmDialogComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/confirm.dialog.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/confirm.dialog.component.ts deleted file mode 100644 index 4ca3a569..00000000 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/confirm.dialog.component.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { - Component, - OnInit, - Inject, - ViewChild, - ElementRef -} from '@angular/core'; -import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; - -export interface ConfirmDialogData { - title: string; - message?: string; - html?: string; - hideAction?: boolean; -} - -export interface ConfirmDialogResult { - choice: boolean; -} - -@Component({ - selector: 'ucap-ui-confirm-dialog', - templateUrl: './confirm.dialog.component.html', - styleUrls: ['./confirm.dialog.component.scss'] -}) -export class ConfirmDialogComponent implements OnInit { - @ViewChild('messageContainer', { static: true }) - messageContainer: ElementRef; - - hideAction = false; - - constructor( - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public data: ConfirmDialogData - ) {} - - ngOnInit(): void { - if (!!this.data.html) { - this.messageContainer.nativeElement.innerHTML = this.data.html; - } - if (!!this.data.hideAction) { - this.hideAction = this.data.hideAction; - } - } - - onClickChoice(choice: boolean): void { - this.dialogRef.close({ - choice - }); - } -} diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/confirm.dialog.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/create-group.dialog.component.html similarity index 56% rename from projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/confirm.dialog.component.html rename to projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/create-group.dialog.component.html index 7ea339fa..09d25dfe 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/confirm.dialog.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/create-group.dialog.component.html @@ -1,14 +1,9 @@ - {{ data.title }} - + 새 그룹 추가 - -
- {{ data.message }} -
-
- + +