dialog of group create is added

This commit is contained in:
병준 박 2019-10-08 09:18:40 +09:00
parent 2ee7dd2526
commit bf2490dda3
10 changed files with 110 additions and 95 deletions

View File

@ -37,6 +37,7 @@ import { AppTranslateModule } from './app-translate.module';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { GUARDS } from './guards'; import { GUARDS } from './guards';
import { AppMessengerLayoutModule } from './layouts/messenger/messenger.layout.module';
@NgModule({ @NgModule({
imports: [ imports: [
@ -83,6 +84,8 @@ import { GUARDS } from './guards';
AppStoreModule, AppStoreModule,
AppTranslateModule, AppTranslateModule,
AppMessengerLayoutModule,
LoggerModule.forRoot({ LoggerModule.forRoot({
level: NgxLoggerLevel.DEBUG level: NgxLoggerLevel.DEBUG
}) })

View File

@ -5,7 +5,7 @@ import { map } from 'rxjs/operators';
import { Store, select } from '@ngrx/store'; 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 { UserInfo, GroupDetailData } from '@ucap-webmessenger/protocol-sync';
import * as AppStore from '@app/store'; 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 { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { LoginInfo, KEY_LOGIN_INFO } from '@app/types'; import { LoginInfo, KEY_LOGIN_INFO } from '@app/types';
import { ExpansionPanelComponent as GroupExpansionPanelComponent } from '@ucap-webmessenger/ui-group'; import { ExpansionPanelComponent as GroupExpansionPanelComponent } from '@ucap-webmessenger/ui-group';
import {
CreateGroupDialogComponent,
CreateGroupDialogData,
CreateGroupDialogResult
} from '@app/layouts/messenger/dialogs/create-group.dialog.component';
@Component({ @Component({
selector: 'app-layout-chat-left-sidenav-group', selector: 'app-layout-chat-left-sidenav-group',
@ -35,6 +40,7 @@ export class GroupComponent implements OnInit {
constructor( constructor(
private store: Store<any>, private store: Store<any>,
private sessionStorageService: SessionStorageService, private sessionStorageService: SessionStorageService,
private dialogService: DialogService,
private logger: NGXLogger private logger: NGXLogger
) {} ) {}
@ -43,11 +49,7 @@ export class GroupComponent implements OnInit {
this.companyCode = loginInfo.companyCode; this.companyCode = loginInfo.companyCode;
this.companyList$ = this.store.pipe( this.companyList$ = this.store.pipe(
select(AppStore.SettingSelector.CompanySelector.companyList), select(AppStore.SettingSelector.CompanySelector.companyList)
map(list => {
this.logger.debug('list', list);
return list;
})
); );
this.groupBuddyList$ = this.store 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); this.logger.debug('menuType', menuType);
switch (menuType) { switch (menuType) {
case 'GROUP_NEW': case 'GROUP_NEW':
{
const result = await this.dialogService.open<
CreateGroupDialogComponent,
CreateGroupDialogData,
CreateGroupDialogResult
>(CreateGroupDialogComponent, {
width: '220px',
data: {
title: 'Logout',
message: 'Logout ?'
}
});
}
break; break;
case 'GROUP_EXPAND_MORE': case 'GROUP_EXPAND_MORE':
this.groupExpansionPanel.expandMore(); {
this.groupExpansionPanel.expandMore();
}
break; break;
case 'GROUP_EXPAND_LESS': case 'GROUP_EXPAND_LESS':
this.groupExpansionPanel.expandLess(); {
this.groupExpansionPanel.expandLess();
}
break; break;
case 'GROUP_SAVE': case 'GROUP_SAVE':
break; break;

View File

@ -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<ConfirmDialogComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ConfirmDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ConfirmDialogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -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<ConfirmDialogComponent, ConfirmDialogResult>,
@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
});
}
}

View File

@ -1,14 +1,9 @@
<mat-card class="confirm-card"> <mat-card class="confirm-card">
<mat-card-header cdkDrag cdkDragRootElement=".cdk-overlay-pane" cdkDragHandle> <mat-card-header cdkDrag cdkDragRootElement=".cdk-overlay-pane" cdkDragHandle>
<mat-card-title>{{ data.title }}</mat-card-title> <mat-card-title>새 그룹 추가</mat-card-title>
<!-- <mat-card-subtitle>Confirm</mat-card-subtitle> -->
</mat-card-header> </mat-card-header>
<mat-card-content> <mat-card-content> </mat-card-content>
<div #messageContainer class="notice"> <mat-card-actions class="button-farm flex-row">
{{ data.message }}
</div>
</mat-card-content>
<mat-card-actions *ngIf="!hideAction" class="button-farm flex-row">
<button <button
mat-stroked-button mat-stroked-button
(click)="onClickChoice(false)" (click)="onClickChoice(false)"

View File

@ -0,0 +1,24 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { CreateGroupDialogComponent } from './create-group.dialog.component';
describe('app::layouts::messenger::CreateGroupDialogComponent', () => {
let component: CreateGroupDialogComponent;
let fixture: ComponentFixture<CreateGroupDialogComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [CreateGroupDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(CreateGroupDialogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,34 @@
import { Component, OnInit, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
export interface CreateGroupDialogData {
title: string;
message?: string;
}
export interface CreateGroupDialogResult {
choice: boolean;
}
@Component({
selector: 'app-layout-messenger-create-group',
templateUrl: './create-group.dialog.component.html',
styleUrls: ['./create-group.dialog.component.scss']
})
export class CreateGroupDialogComponent implements OnInit {
constructor(
public dialogRef: MatDialogRef<
CreateGroupDialogData,
CreateGroupDialogResult
>,
@Inject(MAT_DIALOG_DATA) public data: CreateGroupDialogData
) {}
ngOnInit(): void {}
onClickChoice(choice: boolean): void {
this.dialogRef.close({
choice
});
}
}

View File

@ -0,0 +1,3 @@
import { CreateGroupDialogComponent } from './create-group.dialog.component';
export const DIALOGS = [CreateGroupDialogComponent];

View File

@ -3,31 +3,43 @@ import { CommonModule } from '@angular/common';
import { FlexLayoutModule } from '@angular/flex-layout'; import { FlexLayoutModule } from '@angular/flex-layout';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatDialogModule } from '@angular/material/dialog';
import { MatIconModule } from '@angular/material/icon'; import { MatIconModule } from '@angular/material/icon';
import { MatMenuModule } from '@angular/material/menu'; import { MatMenuModule } from '@angular/material/menu';
import { MatTabsModule } from '@angular/material/tabs'; import { MatTabsModule } from '@angular/material/tabs';
import { MatToolbarModule } from '@angular/material/toolbar'; import { MatToolbarModule } from '@angular/material/toolbar';
import { DragDropModule } from '@angular/cdk/drag-drop';
import { UCapUiModule } from '@ucap-webmessenger/ui';
import { UCapUiChatModule } from '@ucap-webmessenger/ui-chat'; import { UCapUiChatModule } from '@ucap-webmessenger/ui-chat';
import { UCapUiGroupModule } from '@ucap-webmessenger/ui-group'; import { UCapUiGroupModule } from '@ucap-webmessenger/ui-group';
import { UCapUiOrganizationModule } from '@ucap-webmessenger/ui-organization'; import { UCapUiOrganizationModule } from '@ucap-webmessenger/ui-organization';
import { COMPONENTS } from './components'; import { COMPONENTS } from './components';
import { DIALOGS } from './dialogs';
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, CommonModule,
FlexLayoutModule, FlexLayoutModule,
DragDropModule,
MatButtonModule,
MatCardModule,
MatDialogModule,
MatIconModule, MatIconModule,
MatMenuModule, MatMenuModule,
MatTabsModule, MatTabsModule,
MatToolbarModule, MatToolbarModule,
UCapUiModule,
UCapUiChatModule, UCapUiChatModule,
UCapUiGroupModule, UCapUiGroupModule,
UCapUiOrganizationModule UCapUiOrganizationModule
], ],
exports: [...COMPONENTS], exports: [...COMPONENTS, ...DIALOGS],
declarations: [...COMPONENTS], declarations: [...COMPONENTS, ...DIALOGS],
entryComponents: [] entryComponents: [...DIALOGS]
}) })
export class AppMessengerLayoutModule {} export class AppMessengerLayoutModule {}