2018-01-16 21:58:17 +01:00
|
|
|
import {
|
|
|
|
Component,
|
2018-02-02 18:31:21 +01:00
|
|
|
ComponentFactoryResolver,
|
|
|
|
ViewChild,
|
|
|
|
ViewContainerRef,
|
2018-01-16 21:58:17 +01:00
|
|
|
} from '@angular/core';
|
2018-01-23 22:58:32 +01:00
|
|
|
import { Router } from '@angular/router';
|
|
|
|
|
2018-01-30 23:52:56 +01:00
|
|
|
import { ToasterService } from 'angular2-toaster';
|
2018-02-08 16:37:54 +01:00
|
|
|
import { Angulartics2 } from 'angulartics2';
|
2018-01-30 23:52:56 +01:00
|
|
|
|
2018-02-08 16:37:54 +01:00
|
|
|
import { EnvironmentComponent } from './environment.component';
|
2018-02-02 18:31:21 +01:00
|
|
|
|
2018-01-23 05:37:36 +01:00
|
|
|
import { AuthService } from 'jslib/abstractions/auth.service';
|
2018-01-30 23:52:56 +01:00
|
|
|
import { I18nService } from 'jslib/abstractions/i18n.service';
|
2018-02-08 16:48:50 +01:00
|
|
|
import { SyncService } from 'jslib/abstractions/sync.service';
|
2018-01-23 05:37:36 +01:00
|
|
|
|
2018-04-04 15:19:39 +02:00
|
|
|
import { LoginComponent as BaseLoginComponent } from 'jslib/angular/components/login.component';
|
2018-04-25 05:23:10 +02:00
|
|
|
import { ModalComponent } from 'jslib/angular/components/modal.component';
|
2018-04-04 15:19:39 +02:00
|
|
|
|
2018-01-16 21:58:17 +01:00
|
|
|
@Component({
|
|
|
|
selector: 'app-login',
|
2018-04-06 18:25:22 +02:00
|
|
|
templateUrl: 'login.component.html',
|
2018-01-16 21:58:17 +01:00
|
|
|
})
|
2018-04-04 15:19:39 +02:00
|
|
|
export class LoginComponent extends BaseLoginComponent {
|
2018-02-02 18:31:21 +01:00
|
|
|
@ViewChild('environment', { read: ViewContainerRef }) environmentModal: ViewContainerRef;
|
|
|
|
|
2018-04-04 15:19:39 +02:00
|
|
|
constructor(authService: AuthService, router: Router,
|
|
|
|
analytics: Angulartics2, toasterService: ToasterService,
|
|
|
|
i18nService: I18nService, syncService: SyncService,
|
|
|
|
private componentFactoryResolver: ComponentFactoryResolver) {
|
|
|
|
super(authService, router, analytics, toasterService, i18nService, syncService);
|
2018-01-23 22:58:32 +01:00
|
|
|
}
|
2018-02-02 18:31:21 +01:00
|
|
|
|
|
|
|
settings() {
|
|
|
|
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
|
|
|
const modal = this.environmentModal.createComponent(factory).instance;
|
|
|
|
const childComponent = modal.show<EnvironmentComponent>(EnvironmentComponent,
|
|
|
|
this.environmentModal);
|
|
|
|
|
|
|
|
childComponent.onSaved.subscribe(() => {
|
|
|
|
modal.close();
|
|
|
|
});
|
|
|
|
}
|
2018-01-16 21:58:17 +01:00
|
|
|
}
|