From 35bf1f0f778eb7b51b6ff286edc5ca70c48aabeb Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 27 Apr 2018 22:40:10 -0400 Subject: [PATCH] save on destroy --- src/app/tabs/settings.component.html | 334 +++++++++++++-------------- src/app/tabs/settings.component.ts | 17 +- 2 files changed, 171 insertions(+), 180 deletions(-) diff --git a/src/app/tabs/settings.component.html b/src/app/tabs/settings.component.html index f925b6d6..2de04307 100644 --- a/src/app/tabs/settings.component.html +++ b/src/app/tabs/settings.component.html @@ -1,210 +1,204 @@ -
-
-
-
-
{{'directory' | i18n}}
-
+
+
+
+
{{'directory' | i18n}}
+
+
+ + +
+
- - + +
-
-
- - -
-
- - -
-
- - -
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
- - -
+
+ + +
+
+ + +
+
+
+ +
-
-
- - -
-
- - -
-
- - +
+
+ +
-
+
+
+ + +
+
+
- - + +
- - + +
-
- - -
-
- - -
-
- - -
-
-
-
{{'sync' | i18n}}
-
-
- - +
+
+
+
{{'sync' | i18n}}
+
+
+ + +
+
+
+ +
+
+
+
+ + +
+
+
+ + +
+
+ + +
+
+
- - + +
+
+
+ + +
+
+ + +
+
+
+ +
+
+ + +
+
+
+
+ + +
- - + +
-
-
- - -
-
- - -
+
+ +
-
-
- - -
-
-
-
- - -
-
- - -
+ +
+
+
+
+ + +
+
+
-
- - -
+ +
-
+
- - + +
-
-
- - -
-
- - -
-
- - -
+
+ +
-
- -
-
- - -
-
-
- - -
-
-
- - -
-
- - -
-
- - -
+ +
- - +
diff --git a/src/app/tabs/settings.component.ts b/src/app/tabs/settings.component.ts index 9364dd7c..8be06be2 100644 --- a/src/app/tabs/settings.component.ts +++ b/src/app/tabs/settings.component.ts @@ -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';