diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 0f7167c2..78411df4 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -149,7 +149,7 @@ const routes: Routes = [ ]; @NgModule({ - imports: [RouterModule.forRoot(routes)], + imports: [RouterModule.forRoot(routes, { anchorScrolling: 'enabled', scrollPositionRestoration: 'enabled'})], exports: [RouterModule] }) export class AppRoutingModule {} diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 55735f9c..8401062a 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -1,5 +1,5 @@ import * as Raven from 'raven-js'; -import { BrowserModule } from '@angular/platform-browser'; +import { BrowserModule, Title } from '@angular/platform-browser'; import { NgModule, ErrorHandler } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { CdkTableModule } from '@angular/cdk/table'; @@ -538,7 +538,8 @@ if (environment.production) { NotificationService, Gns3vmService, ThemeService, - GoogleAnalyticsService + GoogleAnalyticsService, + Title ], entryComponents: [ AddServerDialogComponent, @@ -580,7 +581,8 @@ if (environment.production) { NavigationDialogComponent, ScreenshotDialogComponent, ConfirmationBottomSheetComponent, - ConfigDialogComponent + ConfigDialogComponent, + AdbutlerComponent ], bootstrap: [AppComponent] }) diff --git a/src/app/common/progress-dialog/progress-dialog.service.ts b/src/app/common/progress-dialog/progress-dialog.service.ts index ab7e4462..5f0f12e1 100644 --- a/src/app/common/progress-dialog/progress-dialog.service.ts +++ b/src/app/common/progress-dialog/progress-dialog.service.ts @@ -9,7 +9,8 @@ export class ProgressDialogService { public open() { const ref = this.dialog.open(ProgressDialogComponent, { width: '250px', - autoFocus: false + autoFocus: false, + disableClose: true }); return ref; } diff --git a/src/app/components/adbutler/adbutler.component.ts b/src/app/components/adbutler/adbutler.component.ts index f0ee27a7..acee2902 100644 --- a/src/app/components/adbutler/adbutler.component.ts +++ b/src/app/components/adbutler/adbutler.component.ts @@ -11,13 +11,12 @@ import { ToasterService } from '../../services/toaster.service'; }) export class AdbutlerComponent implements OnInit { @ViewChild('ad', {static: false}) ad: ElementRef; - @Input() theme: string; - @Output() onLoad = new EventEmitter(); + theme: string; + onLoad = new EventEmitter(); htmlCode: string; constructor( - private httpClient: HttpClient, - private toasterService: ToasterService + private httpClient: HttpClient ) {} ngOnInit() { diff --git a/src/app/components/notification-box/notification-box.component.html b/src/app/components/notification-box/notification-box.component.html index c5bcafef..350fe7ce 100644 --- a/src/app/components/notification-box/notification-box.component.html +++ b/src/app/components/notification-box/notification-box.component.html @@ -2,7 +2,7 @@
- + close
diff --git a/src/app/components/notification-box/notification-box.component.ts b/src/app/components/notification-box/notification-box.component.ts index a07bd770..416981a7 100644 --- a/src/app/components/notification-box/notification-box.component.ts +++ b/src/app/components/notification-box/notification-box.component.ts @@ -1,6 +1,7 @@ -import { Component, OnInit, OnDestroy } from '@angular/core'; +import { Component, OnInit, OnDestroy, ComponentFactoryResolver, ViewContainerRef, ViewChild } from '@angular/core'; import { timer, Observable, Subscription } from 'rxjs'; import { ThemeService } from '../../services/theme.service'; +import { AdbutlerComponent } from '../adbutler/adbutler.component'; @Component({ selector: 'app-notification-box', @@ -8,6 +9,8 @@ import { ThemeService } from '../../services/theme.service'; styleUrls: ['./notification-box.component.scss'] }) export class NotificationBoxComponent implements OnInit, OnDestroy { + @ViewChild('dynamicComponentContainer', {read: ViewContainerRef, static: false}) dynamicComponentContainer; + timer: Observable; viewTimer: Observable; timerSubscription: Subscription; @@ -26,7 +29,9 @@ export class NotificationBoxComponent implements OnInit, OnDestroy { isLightThemeEnabled: boolean = false; constructor( - private themeService: ThemeService + private themeService: ThemeService, + private componentFactoryResolver: ComponentFactoryResolver, + private viewContainerRef: ViewContainerRef ){} ngOnInit() { @@ -34,6 +39,20 @@ export class NotificationBoxComponent implements OnInit, OnDestroy { this.themeService.getActualTheme() === 'light' ? this.isLightThemeEnabled = true : this.isLightThemeEnabled = false; } + ngAfterViewInit() { + this.createDynamicAdComponent(); + } + + createDynamicAdComponent() : void { + const factory = this.componentFactoryResolver.resolveComponentFactory(AdbutlerComponent); + const componentRef = this.dynamicComponentContainer.createComponent(factory); + componentRef.instance.theme = this.themeService.getActualTheme() === 'light'; + componentRef.instance.onLoad.subscribe(event => { + this.onLoadingAdbutler(event); + }) + componentRef.changeDetectorRef.detectChanges(); + } + startTimer() { this.timer = timer(this.delayTime, 1000); diff --git a/src/app/components/preferences/common/delete-template-component/delete-template.component.ts b/src/app/components/preferences/common/delete-template-component/delete-template.component.ts index b300866a..098f6967 100644 --- a/src/app/components/preferences/common/delete-template-component/delete-template.component.ts +++ b/src/app/components/preferences/common/delete-template-component/delete-template.component.ts @@ -27,7 +27,8 @@ export class DeleteTemplateComponent { data: { templateName: templateName }, - autoFocus: false + autoFocus: false, + disableClose: true }); dialogRef.afterClosed().subscribe((answer: boolean) => { diff --git a/src/app/components/project-map/context-menu/actions/change-symbol/change-symbol-action.component.ts b/src/app/components/project-map/context-menu/actions/change-symbol/change-symbol-action.component.ts index af4f8d67..46761ed9 100644 --- a/src/app/components/project-map/context-menu/actions/change-symbol/change-symbol-action.component.ts +++ b/src/app/components/project-map/context-menu/actions/change-symbol/change-symbol-action.component.ts @@ -20,7 +20,8 @@ export class ChangeSymbolActionComponent implements OnInit { const dialogRef = this.dialog.open(ChangeSymbolDialogComponent, { width: '1000px', height: '500px', - autoFocus: false + autoFocus: false, + disableClose: true }); let instance = dialogRef.componentInstance; instance.server = this.server; diff --git a/src/app/components/project-map/context-menu/actions/config-action/config-action.component.ts b/src/app/components/project-map/context-menu/actions/config-action/config-action.component.ts index f732f445..28fb67de 100644 --- a/src/app/components/project-map/context-menu/actions/config-action/config-action.component.ts +++ b/src/app/components/project-map/context-menu/actions/config-action/config-action.component.ts @@ -27,7 +27,8 @@ export class ConfigActionComponent { @Input() node: Node; private conf = { autoFocus: false, - width: '800px' + width: '800px', + disableClose: true }; dialogRef; diff --git a/src/app/components/project-map/context-menu/actions/edit-config/edit-config-action.component.ts b/src/app/components/project-map/context-menu/actions/edit-config/edit-config-action.component.ts index de87c525..59299bd8 100644 --- a/src/app/components/project-map/context-menu/actions/edit-config/edit-config-action.component.ts +++ b/src/app/components/project-map/context-menu/actions/edit-config/edit-config-action.component.ts @@ -20,7 +20,8 @@ export class EditConfigActionComponent { const dialogRef = this.dialog.open(ConfigEditorDialogComponent, { width: '600px', height: '500px', - autoFocus: false + autoFocus: false, + disableClose: true }); let instance = dialogRef.componentInstance; instance.server = this.server; diff --git a/src/app/components/project-map/context-menu/actions/edit-style-action/edit-style-action.component.ts b/src/app/components/project-map/context-menu/actions/edit-style-action/edit-style-action.component.ts index 36b30cd7..6f22d7a3 100644 --- a/src/app/components/project-map/context-menu/actions/edit-style-action/edit-style-action.component.ts +++ b/src/app/components/project-map/context-menu/actions/edit-style-action/edit-style-action.component.ts @@ -25,7 +25,8 @@ export class EditStyleActionComponent implements OnChanges { editStyle() { const dialogRef = this.dialog.open(StyleEditorDialogComponent, { width: '800px', - autoFocus: false + autoFocus: false, + disableClose: true }); let instance = dialogRef.componentInstance; instance.server = this.server; diff --git a/src/app/components/project-map/context-menu/actions/edit-text-action/edit-text-action.component.ts b/src/app/components/project-map/context-menu/actions/edit-text-action/edit-text-action.component.ts index 219c475b..f7314709 100644 --- a/src/app/components/project-map/context-menu/actions/edit-text-action/edit-text-action.component.ts +++ b/src/app/components/project-map/context-menu/actions/edit-text-action/edit-text-action.component.ts @@ -29,7 +29,8 @@ export class EditTextActionComponent implements OnInit { editText() { const dialogRef = this.dialog.open(TextEditorDialogComponent, { width: '300px', - autoFocus: false + autoFocus: false, + disableClose: true }); let instance = dialogRef.componentInstance; instance.server = this.server; diff --git a/src/app/components/project-map/context-menu/actions/export-config/export-config-action.component.ts b/src/app/components/project-map/context-menu/actions/export-config/export-config-action.component.ts index edc77de2..42c502ec 100644 --- a/src/app/components/project-map/context-menu/actions/export-config/export-config-action.component.ts +++ b/src/app/components/project-map/context-menu/actions/export-config/export-config-action.component.ts @@ -26,7 +26,8 @@ export class ExportConfigActionComponent { } else { const dialogRef = this.dialog.open(ConfigDialogComponent, { width: '500px', - autoFocus: false + autoFocus: false, + disableClose: true }); let instance = dialogRef.componentInstance; dialogRef.afterClosed().subscribe((configType: string) => { diff --git a/src/app/components/project-map/context-menu/actions/import-config/import-config-action.component.ts b/src/app/components/project-map/context-menu/actions/import-config/import-config-action.component.ts index 830d02ee..3e6fde6f 100644 --- a/src/app/components/project-map/context-menu/actions/import-config/import-config-action.component.ts +++ b/src/app/components/project-map/context-menu/actions/import-config/import-config-action.component.ts @@ -27,7 +27,8 @@ export class ImportConfigActionComponent { if (this.node.node_type !== 'vpcs') { const dialogRef = this.dialog.open(ConfigDialogComponent, { width: '500px', - autoFocus: false + autoFocus: false, + disableClose: true }); let instance = dialogRef.componentInstance; dialogRef.afterClosed().subscribe((configType: string) => { diff --git a/src/app/components/project-map/context-menu/actions/packet-filters-action/packet-filters-action.component.ts b/src/app/components/project-map/context-menu/actions/packet-filters-action/packet-filters-action.component.ts index 54dca3e0..b6e6b7c0 100644 --- a/src/app/components/project-map/context-menu/actions/packet-filters-action/packet-filters-action.component.ts +++ b/src/app/components/project-map/context-menu/actions/packet-filters-action/packet-filters-action.component.ts @@ -20,7 +20,8 @@ export class PacketFiltersActionComponent { const dialogRef = this.dialog.open(PacketFiltersDialogComponent, { width: '900px', height: '400px', - autoFocus: false + autoFocus: false, + disableClose: true }); let instance = dialogRef.componentInstance; instance.server = this.server; diff --git a/src/app/components/project-map/context-menu/actions/show-node-action/show-node-action.component.ts b/src/app/components/project-map/context-menu/actions/show-node-action/show-node-action.component.ts index 3f70d051..533d6ad2 100644 --- a/src/app/components/project-map/context-menu/actions/show-node-action/show-node-action.component.ts +++ b/src/app/components/project-map/context-menu/actions/show-node-action/show-node-action.component.ts @@ -17,7 +17,9 @@ export class ShowNodeActionComponent { showNode() { const dialogRef = this.dialog.open(InfoDialogComponent, { width: '600px', - autoFocus: false + maxHeight: '600px', + autoFocus: false, + disableClose: true }); let instance = dialogRef.componentInstance; instance.node = this.node; diff --git a/src/app/components/project-map/context-menu/actions/start-capture/start-capture-action.component.ts b/src/app/components/project-map/context-menu/actions/start-capture/start-capture-action.component.ts index 091b86cb..500ff9c5 100644 --- a/src/app/components/project-map/context-menu/actions/start-capture/start-capture-action.component.ts +++ b/src/app/components/project-map/context-menu/actions/start-capture/start-capture-action.component.ts @@ -19,7 +19,8 @@ export class StartCaptureActionComponent { startCapture() { const dialogRef = this.dialog.open(StartCaptureDialogComponent, { width: '400px', - autoFocus: false + autoFocus: false, + disableClose: true }); let instance = dialogRef.componentInstance; instance.server = this.server; diff --git a/src/app/components/project-map/node-editors/configurator/qemu/configurator-qemu.component.ts b/src/app/components/project-map/node-editors/configurator/qemu/configurator-qemu.component.ts index 939e2ad0..aa79e646 100644 --- a/src/app/components/project-map/node-editors/configurator/qemu/configurator-qemu.component.ts +++ b/src/app/components/project-map/node-editors/configurator/qemu/configurator-qemu.component.ts @@ -35,7 +35,8 @@ export class ConfiguratorDialogQemuComponent implements OnInit { private conf = { autoFocus: false, - width: '800px' + width: '800px', + disableClose: true }; dialogRefQemuImageCreator; diff --git a/src/app/components/project-map/nodes-menu/nodes-menu.component.ts b/src/app/components/project-map/nodes-menu/nodes-menu.component.ts index 93ae7f11..0c9a1d2c 100644 --- a/src/app/components/project-map/nodes-menu/nodes-menu.component.ts +++ b/src/app/components/project-map/nodes-menu/nodes-menu.component.ts @@ -1,4 +1,4 @@ -import { Component, Input } from "@angular/core"; +import { Component, Input, ChangeDetectionStrategy } from "@angular/core"; import { Project } from '../../../models/project'; import { Server } from '../../../models/server'; import { NodeService } from '../../../services/node.service'; @@ -11,7 +11,8 @@ import { ServerService } from '../../../services/server.service'; @Component({ selector: 'app-nodes-menu', templateUrl: './nodes-menu.component.html', - styleUrls: ['./nodes-menu.component.scss'] + styleUrls: ['./nodes-menu.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush }) export class NodesMenuComponent { @Input('project') project: Project; diff --git a/src/app/components/project-map/packet-capturing/packet-filters/packet-filters.component.ts b/src/app/components/project-map/packet-capturing/packet-filters/packet-filters.component.ts index 19cf6e7f..653f0fad 100644 --- a/src/app/components/project-map/packet-capturing/packet-filters/packet-filters.component.ts +++ b/src/app/components/project-map/packet-capturing/packet-filters/packet-filters.component.ts @@ -80,7 +80,8 @@ export class PacketFiltersDialogComponent implements OnInit{ onHelpClick() { const dialogRef = this.dialog.open(HelpDialogComponent, { width: '500px', - autoFocus: false + autoFocus: false, + disableClose: true }); let instance = dialogRef.componentInstance; instance.title = 'Help for filters'; diff --git a/src/app/components/project-map/project-map-menu/project-map-menu.component.html b/src/app/components/project-map/project-map-menu/project-map-menu.component.html index c86e770d..3834d991 100644 --- a/src/app/components/project-map/project-map-menu/project-map-menu.component.html +++ b/src/app/components/project-map/project-map-menu/project-map-menu.component.html @@ -3,7 +3,7 @@ mat-icon-button class="menu-button" (click)="addDrawing('text')"> - create + create - crop_3_2 + crop_3_2