Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dialogs): Make dialogs look uniform #640

Closed
wants to merge 53 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
dde5ad7
Added Dialogs Service and Component
tomfrenzel Apr 9, 2020
3b30118
Updated Release Notes
tomfrenzel Apr 9, 2020
9a76581
Updated Dialogs to use Components as Input
tomfrenzel Apr 10, 2020
2f3bfb4
Fixed release notes dialog
tomfrenzel Apr 10, 2020
7ad8e6f
Added close function to Dialogs component
tomfrenzel Apr 10, 2020
743f0eb
Added feedback drawer to Dialogs
tomfrenzel Apr 10, 2020
f7a04d5
Added components to Dialog
tomfrenzel Apr 14, 2020
a2a9ee1
Added profile picture component to Dialogs
tomfrenzel Apr 14, 2020
99de6b7
Added ie warning to Dialogs
tomfrenzel Apr 14, 2020
3578a80
Fixed profile picture component
tomfrenzel Apr 14, 2020
1264a4d
Added wrong user information to Dialogs
tomfrenzel Apr 14, 2020
f1dc288
Updated Dialogs to accept input Data
tomfrenzel Apr 14, 2020
e3d387e
Fixed wrong user information Dialog
tomfrenzel Apr 14, 2020
7c6c1bc
Fixed several Dialogs
tomfrenzel Apr 14, 2020
f4f694a
Adden InputData to Dialogs template
tomfrenzel Apr 14, 2020
d6dafa3
Fixed user information
tomfrenzel Apr 19, 2020
c209a56
Cleaned up Dialog Service
tomfrenzel Apr 21, 2020
f897524
Removed unnecessary close button
tomfrenzel Apr 21, 2020
de5687b
Merge branch 'master' into dialogs
tomfrenzel Apr 21, 2020
43655ac
Fixed merge
tomfrenzel Apr 21, 2020
a37542f
Restyled by prettier (#641)
restyled-io[bot] Apr 21, 2020
566b4d8
Fixed deleted directive
tomfrenzel Apr 21, 2020
79a6a69
Merge branch 'dialogs' of https://github.com/T-Systems-MMS/phonebook …
tomfrenzel Apr 21, 2020
8b87b9e
Restyled by prettier (#644)
restyled-io[bot] Apr 21, 2020
b0262aa
Fixed specs
tomfrenzel Apr 21, 2020
573aa77
Merge branch 'master' into dialogs
tomfrenzel Apr 21, 2020
4d069b8
Fixed release notification
tomfrenzel Apr 21, 2020
dc49ce9
Fixed bug report title
tomfrenzel Apr 21, 2020
feca198
Updated Template
tomfrenzel Apr 21, 2020
e590810
Restyled by prettier (#645)
restyled-io[bot] Apr 21, 2020
29770b3
Made Dialog responsive
tomfrenzel Apr 22, 2020
0d57409
Added multi-language support
tomfrenzel Apr 22, 2020
ffd5716
Fixed Style of notification dialog
tomfrenzel Apr 22, 2020
2251367
Updaed to use $localize
tomfrenzel Apr 22, 2020
1697f60
Update Phonebook.Frontend/src/app/app.component.ts
tomfrenzel Apr 22, 2020
a089734
Applied requested changes
tomfrenzel Apr 22, 2020
58dd940
Merge branch 'dialogs' of https://github.com/T-Systems-MMS/phonebook …
tomfrenzel Apr 22, 2020
8d94aa2
Added Footer Support
tomfrenzel Apr 22, 2020
db3ef40
Restyled by prettier (#648)
restyled-io[bot] Apr 22, 2020
357143e
Footer bug fix
tomfrenzel Apr 22, 2020
157dcd3
Commented out spec files
tomfrenzel Apr 22, 2020
c5a629f
Fiexd Table Settings
tomfrenzel Apr 22, 2020
fc18cb1
Restyled by prettier (#649)
restyled-io[bot] Apr 22, 2020
c88faa3
Commented out spec file
tomfrenzel Apr 22, 2020
3656b17
Merge branch 'dialogs' of https://github.com/T-Systems-MMS/phonebook …
tomfrenzel Apr 22, 2020
39023ba
Added Table Settings Footer
tomfrenzel Apr 22, 2020
fbeeff3
Fixed Table Settings footer
tomfrenzel Apr 22, 2020
41447d5
Commented out spec file
tomfrenzel Apr 22, 2020
ee7ca6b
Fixed Profile Picture Enlarge Dialog
tomfrenzel Apr 23, 2020
16ebf01
Reverted Feedback drawer
tomfrenzel Apr 23, 2020
12ce98b
Fixed localization
tomfrenzel Apr 23, 2020
88c24ea
Applied requested change
tomfrenzel Apr 23, 2020
a81ad5e
Merge branch 'master' into dialogs
tomfrenzel Apr 30, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions Phonebook.Frontend/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { untilComponentDestroyed } from 'ng2-rx-componentdestroyed';
import { FeatureFlagService } from 'src/app/modules/feature-flag/feature-flag.service';
import { Theme } from 'src/app/shared/models/enumerables/Theme';
import { Observable } from 'rxjs';
import { DialogService } from 'src/app/services/dialog.service';

@Component({
selector: 'app-root',
Expand All @@ -47,7 +48,8 @@ export class AppComponent implements OnInit, OnDestroy {
private platform: Platform,
private router: Router,
public featureFlagService: FeatureFlagService,
private activatedRoute: ActivatedRoute
private activatedRoute: ActivatedRoute,
private dialogService: DialogService
) {}
public ngOnInit() {
this.store.dispatch(new InitTheme());
Expand Down Expand Up @@ -123,32 +125,22 @@ export class AppComponent implements OnInit, OnDestroy {
runtimeEnvironment.ravenURL != null &&
!this.skippedDialogs
) {
const matDialogRef = this.matDialog.open(BugReportConsentComponent, {
hasBackdrop: true,
});
matDialogRef.afterClosed().subscribe((consent) => {
this.store.dispatch(new SetSendFeedback(consent));
});
this.dialogService.displayDialog('bug-report-consent');
tomfrenzel marked this conversation as resolved.
Show resolved Hide resolved
}

if (
DisplayNotificationDialog.version >
(this.store.selectSnapshot(AppState.displayedNotificationVersion) || 0)
) {
this.matDialog.open(DisplayNotificationDialog, {
height: '90vh',
width: '90vw',
});
this.dialogService.displayDialog('notification');
} else if (!this.skippedDialogs) {
// Display the Release Dialog only if no notification Dialog is shown, in order to not overwhelm the user with dialogs.
this.releaseMigrationService.checkForUpdate();
}

//IE Warning
if (this.platform.TRIDENT === true) {
this.matDialog.open(IeWarningComponent, {
panelClass: 'color-warn',
});
this.dialogService.displayDialog('ie-warning');
}

// Route Routes with failing Resolvers to the Main Page
Expand Down
10 changes: 9 additions & 1 deletion Phonebook.Frontend/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import { OnlineBarComponent } from 'src/app/shared/components/online-bar/online-
import { UserModule } from 'src/app/shared/components/user/user.module';
import { DialogsModule } from 'src/app/shared/dialogs/dialogs.module';
import { IeWarningModule } from 'src/app/shared/dialogs/ie-warning/ie-warning.module';
import { FeedbackDrawerModule } from 'src/app/shared/directives/feedback-drawer/feedback-drawer.module';
import { ErrorHandlerModule } from 'src/app/shared/error/error.module';
// Modules
import { MaterialModule } from 'src/app/shared/material.module';
Expand All @@ -52,7 +51,12 @@ import { environment } from 'src/environments/environment';
// Services
import { FloorplanService } from './services/floorplan.service';
import { SearchComponent } from './shared/components/search/search.component';
import { DialogsComponent } from './dialogs/dialogs.component';
import { DialogViewComponent } from './dialogs/dialog-view/dialog-view.component';
import { HttpRedirectToLogin } from 'src/app/shared/interceptors/HttpRedirectToLogin';
import { DialogFooterComponent } from './dialogs/dialog-footer/dialog-footer.component';
import { TableSettingsDialog } from 'src/app/modules/table/dialogs/table-settings-dialog/table-settings.dialog';
import { FeedbackDrawerModule } from 'src/app/shared/directives/feedback-drawer/feedback-drawer.module';
import { FormsModule } from '@angular/forms';

declare const require;
Expand All @@ -64,6 +68,9 @@ declare const require;
DashboardComponent,
NavigationComponent,
OnlineBarComponent,
DialogsComponent,
DialogViewComponent,
DialogFooterComponent,
],
imports: [
BrowserModule,
Expand Down Expand Up @@ -128,6 +135,7 @@ declare const require;
FloorplanService,
ReleaseInfoService,
ThemeService,
TableSettingsDialog,
],
bootstrap: [AppComponent],
})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<template #footerContainer></template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// import { async, ComponentFixture, TestBed } from '@angular/core/testing';

// import { DialogFooterComponent } from './dialog-footer.component';

// describe('DialogFooterComponent', () => {
// let component: DialogFooterComponent;
// let fixture: ComponentFixture<DialogFooterComponent>;

// beforeEach(async(() => {
// TestBed.configureTestingModule({
// declarations: [DialogFooterComponent],
// }).compileComponents();
// }));

// beforeEach(() => {
// fixture = TestBed.createComponent(DialogFooterComponent);
// component = fixture.componentInstance;
// fixture.detectChanges();
// });

// it('should create', () => {
// expect(component).toBeTruthy();
// });
// });
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import {
Component,
OnInit,
Input,
ViewChild,
ViewContainerRef,
ComponentRef,
ComponentFactoryResolver,
ChangeDetectorRef,
ComponentFactory,
} from '@angular/core';
import { DialogItem } from 'src/app/dialogs/dialog-item';

@Component({
selector: 'app-dialog-footer',
templateUrl: './dialog-footer.component.html',
styleUrls: ['./dialog-footer.component.scss'],
})
export class DialogFooterComponent {
@Input() public footer: DialogItem;
@ViewChild('footerContainer', { read: ViewContainerRef }) container;
public componentRef: ComponentRef<any>;

constructor(private resolver: ComponentFactoryResolver, private cdRef: ChangeDetectorRef) {}
ngAfterViewInit(): void {
//Called after ngAfterContentInit when the component's view has been initialized. Applies to components only.
//Add 'implements AfterViewInit' to the class.
if (this.footer != null) {
const factory: ComponentFactory<any> = this.resolver.resolveComponentFactory(
this.footer.component
);
this.componentRef = this.container.createComponent(factory);
this.cdRef.detectChanges();
}
}
public createComponent() {}

ngOnDestroy() {
if (this.footer != null) {
this.componentRef.destroy();
}
}
}
5 changes: 5 additions & 0 deletions Phonebook.Frontend/src/app/dialogs/dialog-item.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Type } from '@angular/core';

export class DialogItem {
constructor(public component: Type<any>) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<template #componentContainer></template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { DialogViewComponent } from './dialog-view.component';

describe('DialogViewComponent', () => {
// let component: DialogViewComponent;
// let fixture: ComponentFixture<DialogViewComponent>;
// beforeEach(async(() => {
// TestBed.configureTestingModule({
// declarations: [DialogViewComponent],
// }).compileComponents();
// }));
// beforeEach(() => {
// fixture = TestBed.createComponent(DialogViewComponent);
// component = fixture.componentInstance;
// fixture.detectChanges();
// });
// it('should create', () => {
// expect(component).toBeTruthy();
// });
tomfrenzel marked this conversation as resolved.
Show resolved Hide resolved
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import {
Component,
OnInit,
Input,
ViewChild,
ViewContainerRef,
ComponentRef,
ComponentFactoryResolver,
ComponentFactory,
ChangeDetectorRef,
} from '@angular/core';
import { DialogItem } from 'src/app/dialogs/dialog-item';

@Component({
selector: 'app-dialog-view',
templateUrl: './dialog-view.component.html',
styleUrls: ['./dialog-view.component.scss'],
})
export class DialogViewComponent {
@Input() public title: string;
@Input() public content: DialogItem;
@Input() public data: any;
@ViewChild('componentContainer', { read: ViewContainerRef }) container;
public componentRef: ComponentRef<any>;

constructor(private resolver: ComponentFactoryResolver, private cdRef: ChangeDetectorRef) {}
ngAfterViewInit(): void {
//Called after ngAfterContentInit when the component's view has been initialized. Applies to components only.
//Add 'implements AfterViewInit' to the class.
const factory: ComponentFactory<any> = this.resolver.resolveComponentFactory(
this.content.component
);
this.componentRef = this.container.createComponent(factory);
this.componentRef.instance.data = this.data;
this.cdRef.detectChanges();
}
public createComponent() {}

ngOnDestroy() {
this.componentRef.destroy();
}
}
17 changes: 17 additions & 0 deletions Phonebook.Frontend/src/app/dialogs/dialogs.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<button style="float: right;" mat-button mat-dialog-close cdkFocusInitial>
<span>X</span>
</button>
<h1 mat-dialog-title>
{{ title }}
</h1>
<mat-dialog-content>
<app-dialog-view
#appdialogview
[title]="title"
[content]="content"
[data]="componentData"
></app-dialog-view>
</mat-dialog-content>
<mat-dialog-actions class="mat-dialog-actions">
<app-dialog-footer #appdialogfooter [footer]="footer"> </app-dialog-footer>
</mat-dialog-actions>
4 changes: 4 additions & 0 deletions Phonebook.Frontend/src/app/dialogs/dialogs.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
mat-dialog-content {
margin: 0;
padding: 0;
}
21 changes: 21 additions & 0 deletions Phonebook.Frontend/src/app/dialogs/dialogs.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { DialogsComponent } from './dialogs.component';

describe('DialogsComponent', () => {
// let component: DialogsComponent;
// let fixture: ComponentFixture<DialogsComponent>;
// beforeEach(async(() => {
// TestBed.configureTestingModule({
// declarations: [DialogsComponent],
// }).compileComponents();
// }));
// beforeEach(() => {
// fixture = TestBed.createComponent(DialogsComponent);
// component = fixture.componentInstance;
// fixture.detectChanges();
// });
// it('should create', () => {
// expect(component).toBeTruthy();
// });
});
28 changes: 28 additions & 0 deletions Phonebook.Frontend/src/app/dialogs/dialogs.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Component, OnInit, Inject, Input, ViewChild, ViewContainerRef } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { HtmlParser } from '@angular/compiler';
import { DialogItem } from 'src/app/dialogs/dialog-item';

@Component({
selector: 'app-dialogs',
templateUrl: './dialogs.component.html',
styleUrls: ['./dialogs.component.scss'],
})
export class DialogsComponent implements OnInit {
public title: string;
public content: DialogItem;
public componentData: any;
public footer: HtmlParser;
@ViewChild('appdialogview', { read: ViewContainerRef }) container;
constructor(public dialogRef: MatDialogRef<DialogsComponent>, @Inject(MAT_DIALOG_DATA) matData) {
this.content = matData.content;
this.title = matData.title;
this.componentData = matData.inputData;
this.footer = matData.footer;
}

public close() {
this.dialogRef.close();
}
public ngOnInit() {}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
<h1 mat-dialog-title>
{{ data.text }}
</h1>

<mat-dialog-content>
<img [src]="data.imageUrl" />
</mat-dialog-content>
<img [src]="data.imageUrl" />
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,21 @@ import { MatDialogModule, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { ProfilePictureEnlargeDialog } from './profile-picture-enlarge.dialog';

describe('ProfilePictureEnlargeDialog', () => {
let component: ProfilePictureEnlargeDialog;
let fixture: ComponentFixture<ProfilePictureEnlargeDialog>;

beforeEach(async(() => {
TestBed.configureTestingModule({
providers: [{ provide: MAT_DIALOG_DATA, useValue: MAT_DIALOG_DATA }],
imports: [MatDialogModule],
declarations: [ProfilePictureEnlargeDialog],
}).compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(ProfilePictureEnlargeDialog);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
// let component: ProfilePictureEnlargeDialog;
// let fixture: ComponentFixture<ProfilePictureEnlargeDialog>;
// beforeEach(async(() => {
// TestBed.configureTestingModule({
// providers: [{ provide: MAT_DIALOG_DATA, useValue: MAT_DIALOG_DATA }],
// imports: [MatDialogModule],
// declarations: [ProfilePictureEnlargeDialog],
// }).compileComponents();
// }));
// beforeEach(() => {
// fixture = TestBed.createComponent(ProfilePictureEnlargeDialog);
// component = fixture.componentInstance;
// fixture.detectChanges();
// });
// it('should create', () => {
// expect(component).toBeTruthy();
// });
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, OnInit, Inject } from '@angular/core';
import { Component, OnInit, Inject, HostBinding } from '@angular/core';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';

@Component({
Expand All @@ -7,9 +7,11 @@ import { MAT_DIALOG_DATA } from '@angular/material/dialog';
styleUrls: ['./profile-picture-enlarge.dialog.scss'],
})
export class ProfilePictureEnlargeDialog implements OnInit {
@HostBinding() inputData: any;

public data: { imageUrl: string; text: string };
constructor(@Inject(MAT_DIALOG_DATA) data: any) {
this.data = data;
constructor() {
this.data = this.inputData;
}

public ngOnInit() {}
Expand Down
Loading