1
0
mirror of https://github.com/bitwarden/directory-connector synced 2025-12-18 01:03:22 +00:00

save on destroy

This commit is contained in:
Kyle Spearrin
2018-04-27 22:40:10 -04:00
parent 87039fa784
commit 35bf1f0f77
2 changed files with 171 additions and 180 deletions

View File

@@ -1,14 +1,9 @@
import {
Component,
ComponentFactoryResolver,
OnDestroy,
OnInit,
ViewChild,
ViewContainerRef,
} from '@angular/core';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { ConfigurationService } from '../../services/configuration.service';
@@ -24,7 +19,7 @@ import { SyncConfiguration } from '../../models/syncConfiguration';
selector: 'app-settings',
templateUrl: 'settings.component.html',
})
export class SettingsComponent implements OnInit {
export class SettingsComponent implements OnInit, OnDestroy {
directory: DirectoryType;
directoryType = DirectoryType;
ldap = new LdapConfiguration();
@@ -33,9 +28,7 @@ export class SettingsComponent implements OnInit {
sync = new SyncConfiguration();
directoryOptions: any[];
constructor(analytics: Angulartics2, toasterService: ToasterService,
i18nService: I18nService, private componentFactoryResolver: ComponentFactoryResolver,
private configurationService: ConfigurationService) {
constructor(private i18nService: I18nService, private configurationService: ConfigurationService) {
this.directoryOptions = [
{ name: i18nService.t('select'), value: null },
{ name: 'Active Directory / LDAP', value: DirectoryType.Ldap },
@@ -55,6 +48,10 @@ export class SettingsComponent implements OnInit {
this.sync = (await this.configurationService.getSync()) || this.sync;
}
async ngOnDestroy() {
await this.submit();
}
async submit() {
if (this.ldap.ad) {
this.sync.creationDateAttribute = 'whenCreated';