Commit d85e68318c60394b9c14c4822871fd958cc5d5fb
Exists in
develop
Merge branch 'develop' into 'develop'
Develop See merge request !83
Showing
1 changed file
Show diff stats
src/app/app.component.ts
| 1 | import { Component } from '@angular/core'; | 1 | import { Component } from '@angular/core'; |
| 2 | import { ConnectionService } from 'ng-connection-service'; | 2 | import { ConnectionService } from 'ng-connection-service'; |
| 3 | import { BsModalService, BsModalRef } from 'ngx-bootstrap/modal'; | 3 | import { BsModalService, BsModalRef } from 'ngx-bootstrap/modal'; |
| 4 | import { InternetConnectionComponent } from './shared/internet-connection/internet-connection.component'; | 4 | import { InternetConnectionComponent } from './shared/internet-connection/internet-connection.component'; |
| 5 | 5 | ||
| 6 | @Component({ | 6 | @Component({ |
| 7 | selector: 'app-root', | 7 | selector: 'app-root', |
| 8 | templateUrl: './app.component.html', | 8 | templateUrl: './app.component.html', |
| 9 | styleUrls: ['./app.component.scss'] | 9 | styleUrls: ['./app.component.scss'] |
| 10 | }) | 10 | }) |
| 11 | export class AppComponent { | 11 | export class AppComponent { |
| 12 | title = 'autoservicio-axion'; | 12 | title = 'autoservicio-axion'; |
| 13 | status = 'ONLINE'; | 13 | status = 'ONLINE'; |
| 14 | isConnected = true; | 14 | isConnected = true; |
| 15 | modalRef: BsModalRef; | 15 | modalRef: BsModalRef; |
| 16 | 16 | ||
| 17 | constructor( | 17 | constructor( |
| 18 | private connectionService: ConnectionService, | 18 | private connectionService: ConnectionService, |
| 19 | private modalService: BsModalService, | 19 | private modalService: BsModalService, |
| 20 | ) { | 20 | ) { |
| 21 | this.connectionService.monitor().subscribe(isConnected => { | 21 | this.connectionService.monitor().subscribe(isConnected => { |
| 22 | this.isConnected = isConnected; | 22 | this.isConnected = isConnected; |
| 23 | if (this.isConnected && this.modalRef) { | 23 | if (this.isConnected && this.modalRef) { |
| 24 | this.modalRef.hide() | 24 | this.modalRef.hide(); |
| 25 | } | 25 | } else { |
| 26 | else { | ||
| 27 | this.modalRef = this.modalService.show(InternetConnectionComponent, { | 26 | this.modalRef = this.modalService.show(InternetConnectionComponent, { |
| 28 | backdrop: false, | 27 | backdrop: false, |
| 29 | ignoreBackdropClick: true, | 28 | ignoreBackdropClick: true, |
| 30 | class: 'modal-dialog-centered' | 29 | class: 'modal-dialog-centered' |
| 31 | }); | 30 | }); |
| 32 | } | 31 | } |
| 33 | }) | 32 | }); |
| 34 | } | 33 | } |
| 35 | } | 34 | } |
| 36 | 35 |