dialogs of app are refactored

This commit is contained in:
병준 박 2019-10-17 09:18:55 +09:00
parent 00abdb4cd7
commit 94dcd79055
39 changed files with 215 additions and 22 deletions

View File

@ -5,7 +5,7 @@ import {
CreateChatDialogComponent, CreateChatDialogComponent,
CreateChatDialogData, CreateChatDialogData,
CreateChatDialogResult CreateChatDialogResult
} from '../dialogs/create-chat.dialog.component'; } from '@app/layouts/messenger/dialogs/chat/create-chat.dialog.component';
@Component({ @Component({
selector: 'app-layout-messenger-left-side', selector: 'app-layout-messenger-left-side',

View File

@ -20,7 +20,7 @@ import {
CreateGroupDialogComponent, CreateGroupDialogComponent,
CreateGroupDialogData, CreateGroupDialogData,
CreateGroupDialogResult CreateGroupDialogResult
} from '@app/layouts/messenger/dialogs/create-group.dialog.component'; } from '@app/layouts/messenger/dialogs/group/create-group.dialog.component';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { import {
DeptSearchType, DeptSearchType,
@ -35,18 +35,18 @@ import {
DeleteGroupDialogComponent, DeleteGroupDialogComponent,
DeleteGroupDialogData, DeleteGroupDialogData,
DeleteGroupDialogResult DeleteGroupDialogResult
} from '@app/layouts/messenger/dialogs/delete-group.dialog.component'; } from '@app/layouts/messenger/dialogs/group/delete-group.dialog.component';
import { import {
EditGroupDialogComponent, EditGroupDialogComponent,
EditGroupDialogData, EditGroupDialogData,
EditGroupDialogResult EditGroupDialogResult
} from '@app/layouts/messenger/dialogs/edit-group.dialog.component'; } from '@app/layouts/messenger/dialogs/group/edit-group.dialog.component';
import { import {
EditGroupMemberDialogComponent, EditGroupMemberDialogComponent,
EditGroupMemberDialogData, EditGroupMemberDialogData,
EditGroupMemberDialogResult EditGroupMemberDialogResult
} from '@app/layouts/messenger/dialogs/edit-group-member.dialog.component'; } from '@app/layouts/messenger/dialogs/group/edit-group-member.dialog.component';
@Component({ @Component({
selector: 'app-layout-chat-left-sidenav-group', selector: 'app-layout-chat-left-sidenav-group',

View File

@ -43,11 +43,21 @@ import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import { MatMenuTrigger } from '@angular/material'; import { MatMenuTrigger } from '@angular/material';
import { CommonApiService } from '@ucap-webmessenger/api-common'; import { CommonApiService } from '@ucap-webmessenger/api-common';
import {
DeleteMessageDialogComponent,
DeleteMessageDialogData,
DeleteMessageDialogResult
} from '@app/layouts/messenger/dialogs/message/delete-message.dialog.component';
import { import {
RelayMessageDialogComponent, RelayMessageDialogComponent,
RelayMessageDialogData, RelayMessageDialogData,
RelayMessageDialogResult RelayMessageDialogResult
} from '@app/layouts/messenger/dialogs/relay-message.dialog.component'; } from '@app/layouts/messenger/dialogs/message/relay-message.dialog.component';
import {
RecallMessageDialogComponent,
RecallMessageDialogData,
RecallMessageDialogResult
} from '@app/layouts/messenger/dialogs/message/recall-message.dialog.component';
@Component({ @Component({
selector: 'app-layout-messenger-messages', selector: 'app-layout-messenger-messages',
@ -272,10 +282,32 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewChecked {
break; break;
case 'DELETE': case 'DELETE':
{ {
const result = await this.dialogService.open<
DeleteMessageDialogComponent,
DeleteMessageDialogData,
DeleteMessageDialogResult
>(DeleteMessageDialogComponent, {
width: '220px',
data: {
title: 'Logout',
message: 'Logout ?'
}
});
} }
break; break;
case 'RECALL': case 'RECALL':
{ {
const result = await this.dialogService.open<
RecallMessageDialogComponent,
RecallMessageDialogData,
RecallMessageDialogResult
>(RecallMessageDialogComponent, {
width: '220px',
data: {
title: 'Logout',
message: 'Logout ?'
}
});
} }
break; break;
default: default:

View File

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

View File

@ -0,0 +1,11 @@
import { CreateGroupDialogComponent } from './create-group.dialog.component';
import { DeleteGroupDialogComponent } from './delete-group.dialog.component';
import { EditGroupDialogComponent } from './edit-group.dialog.component';
import { EditGroupMemberDialogComponent } from './edit-group-member.dialog.component';
export const DIALOGS = [
CreateGroupDialogComponent,
DeleteGroupDialogComponent,
EditGroupDialogComponent,
EditGroupMemberDialogComponent
];

View File

@ -1,17 +1,5 @@
import { CreateGroupDialogComponent } from './create-group.dialog.component'; import { DIALOGS as CHAT_DIALOGS } from './chat';
import { CreateChatDialogComponent } from './create-chat.dialog.component'; import { DIALOGS as GROUP_DIALOGS } from './group';
import { DeleteGroupDialogComponent } from './delete-group.dialog.component'; import { DIALOGS as MESSAGE_DIALOGS } from './message';
import { EditGroupDialogComponent } from './edit-group.dialog.component';
import { EditGroupMemberDialogComponent } from './edit-group-member.dialog.component';
import { RelayMessageDialogComponent } from './relay-message.dialog.component'; export const DIALOGS = [...CHAT_DIALOGS, ...GROUP_DIALOGS, ...MESSAGE_DIALOGS];
export const DIALOGS = [
CreateChatDialogComponent,
CreateGroupDialogComponent,
DeleteGroupDialogComponent,
EditGroupDialogComponent,
EditGroupMemberDialogComponent,
RelayMessageDialogComponent
];

View File

@ -0,0 +1,18 @@
<mat-card class="confirm-card">
<mat-card-header>
<mat-card-title>대화 삭제</mat-card-title>
</mat-card-header>
<mat-card-content> </mat-card-content>
<mat-card-actions class="button-farm flex-row">
<button
mat-stroked-button
(click)="onClickChoice(false)"
class="mat-primary"
>
No
</button>
<button mat-flat-button (click)="onClickChoice(true)" class="mat-primary">
Yes
</button>
</mat-card-actions>
</mat-card>

View File

@ -0,0 +1,24 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { DeleteMessageDialogComponent } from './delete-message.dialog.component';
describe('app::layouts::messenger::DeleteMessageDialogComponent', () => {
let component: DeleteMessageDialogComponent;
let fixture: ComponentFixture<DeleteMessageDialogComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [DeleteMessageDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(DeleteMessageDialogComponent);
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 DeleteMessageDialogData {
title: string;
message?: string;
}
export interface DeleteMessageDialogResult {
choice: boolean;
}
@Component({
selector: 'app-layout-messenger-delete-message',
templateUrl: './delete-message.dialog.component.html',
styleUrls: ['./delete-message.dialog.component.scss']
})
export class DeleteMessageDialogComponent implements OnInit {
constructor(
public dialogRef: MatDialogRef<
DeleteMessageDialogData,
DeleteMessageDialogResult
>,
@Inject(MAT_DIALOG_DATA) public data: DeleteMessageDialogData
) {}
ngOnInit(): void {}
onClickChoice(choice: boolean): void {
this.dialogRef.close({
choice
});
}
}

View File

@ -0,0 +1,7 @@
import { DeleteMessageDialogComponent } from './delete-message.dialog.component';
import { RelayMessageDialogComponent } from './relay-message.dialog.component';
export const DIALOGS = [
DeleteMessageDialogComponent,
RelayMessageDialogComponent
];

View File

@ -0,0 +1,18 @@
<mat-card class="confirm-card">
<mat-card-header>
<mat-card-title>대화 회수</mat-card-title>
</mat-card-header>
<mat-card-content> </mat-card-content>
<mat-card-actions class="button-farm flex-row">
<button
mat-stroked-button
(click)="onClickChoice(false)"
class="mat-primary"
>
No
</button>
<button mat-flat-button (click)="onClickChoice(true)" class="mat-primary">
Yes
</button>
</mat-card-actions>
</mat-card>

View File

@ -0,0 +1,24 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RecallMessageDialogComponent } from './recall-message.dialog.component';
describe('app::layouts::messenger::RecallMessageDialogComponent', () => {
let component: RecallMessageDialogComponent;
let fixture: ComponentFixture<RecallMessageDialogComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [RecallMessageDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(RecallMessageDialogComponent);
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 RecallMessageDialogData {
title: string;
message?: string;
}
export interface RecallMessageDialogResult {
choice: boolean;
}
@Component({
selector: 'app-layout-messenger-recall-message',
templateUrl: './recall-message.dialog.component.html',
styleUrls: ['./recall-message.dialog.component.scss']
})
export class RecallMessageDialogComponent implements OnInit {
constructor(
public dialogRef: MatDialogRef<
RecallMessageDialogData,
RecallMessageDialogResult
>,
@Inject(MAT_DIALOG_DATA) public data: RecallMessageDialogData
) {}
ngOnInit(): void {}
onClickChoice(choice: boolean): void {
this.dialogRef.close({
choice
});
}
}