From 6779adb0643e9683c50207432000a4d57a50931c Mon Sep 17 00:00:00 2001 From: Matt Gibson Date: Mon, 7 Feb 2022 15:15:22 -0500 Subject: [PATCH] Handle password protected import export (#1448) This updates requirements without implementing any way for the UI to interact with the new feature --- jslib | 2 +- src/app/tools/import.component.ts | 34 +++++++++++++++---------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/jslib b/jslib index 9caea70ea2..6c08b40847 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 9caea70ea2dbfdb591ef08a3d33def7f591f1276 +Subproject commit 6c08b408470709afb1f6f5bc9d0e0d06d02fa1f5 diff --git a/src/app/tools/import.component.ts b/src/app/tools/import.component.ts index 1bc7211de9..d7ebd8d4eb 100644 --- a/src/app/tools/import.component.ts +++ b/src/app/tools/import.component.ts @@ -8,6 +8,7 @@ import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.se import { PolicyService } from "jslib-common/abstractions/policy.service"; import { PolicyType } from "jslib-common/enums/policyType"; +import { ImportType } from "jslib-common/services/import.service"; import Swal, { SweetAlertIcon } from "sweetalert2"; @@ -18,7 +19,7 @@ import Swal, { SweetAlertIcon } from "sweetalert2"; export class ImportComponent implements OnInit { featuredImportOptions: ImportOption[]; importOptions: ImportOption[]; - format: string = null; + format: ImportType = null; fileContents: string; formPromise: Promise; loading: boolean = false; @@ -38,21 +39,6 @@ export class ImportComponent implements OnInit { async ngOnInit() { this.setImportOptions(); - this.importOptions.sort((a, b) => { - if (a.name == null && b.name != null) { - return -1; - } - if (a.name != null && b.name == null) { - return 1; - } - if (a.name == null && b.name == null) { - return 0; - } - - return this.i18nService.collator - ? this.i18nService.collator.compare(a.name, b.name) - : a.name.localeCompare(b.name); - }); this.importBlockedByPolicy = await this.policyService.policyAppliesToUser( PolicyType.PersonalOwnership @@ -158,7 +144,21 @@ export class ImportComponent implements OnInit { }, ...this.importService.featuredImportOptions, ]; - this.importOptions = this.importService.regularImportOptions; + this.importOptions = [...this.importService.regularImportOptions].sort((a, b) => { + if (a.name == null && b.name != null) { + return -1; + } + if (a.name != null && b.name == null) { + return 1; + } + if (a.name == null && b.name == null) { + return 0; + } + + return this.i18nService.collator + ? this.i18nService.collator.compare(a.name, b.name) + : a.name.localeCompare(b.name); + }); } private async error(error: Error) {