2018-07-06 05:38:36 +02:00
|
|
|
import { Component } from '@angular/core';
|
|
|
|
import {
|
|
|
|
ActivatedRoute,
|
|
|
|
Router,
|
|
|
|
} from '@angular/router';
|
|
|
|
|
2021-06-07 20:13:58 +02:00
|
|
|
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
|
|
|
import { ImportService } from 'jslib-common/abstractions/import.service';
|
2021-10-20 18:30:04 +02:00
|
|
|
import { LogService } from 'jslib-common/abstractions/log.service';
|
2021-06-07 20:13:58 +02:00
|
|
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
2021-09-07 23:19:49 +02:00
|
|
|
import { PolicyService } from 'jslib-common/abstractions/policy.service';
|
2021-06-07 20:13:58 +02:00
|
|
|
import { UserService } from 'jslib-common/abstractions/user.service';
|
2018-07-06 05:38:36 +02:00
|
|
|
|
|
|
|
import { ImportComponent as BaseImportComponent } from '../../tools/import.component';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-org-import',
|
|
|
|
templateUrl: '../../tools/import.component.html',
|
|
|
|
})
|
|
|
|
export class ImportComponent extends BaseImportComponent {
|
2021-02-11 23:13:29 +01:00
|
|
|
organizationName: string;
|
|
|
|
|
2021-12-07 20:41:45 +01:00
|
|
|
constructor(i18nService: I18nService,
|
2021-04-14 23:43:40 +02:00
|
|
|
importService: ImportService, router: Router, private route: ActivatedRoute,
|
2021-09-07 23:19:49 +02:00
|
|
|
platformUtilsService: PlatformUtilsService, policyService: PolicyService,
|
2021-10-20 18:30:04 +02:00
|
|
|
private userService: UserService, logService: LogService) {
|
2021-12-07 20:41:45 +01:00
|
|
|
super(i18nService, importService, router, platformUtilsService, policyService, logService);
|
2018-07-06 05:38:36 +02:00
|
|
|
}
|
|
|
|
|
2021-02-11 23:13:29 +01:00
|
|
|
async ngOnInit() {
|
2021-02-03 18:41:33 +01:00
|
|
|
this.route.parent.parent.params.subscribe(async params => {
|
2018-07-06 05:38:36 +02:00
|
|
|
this.organizationId = params.organizationId;
|
2018-07-06 05:44:58 +02:00
|
|
|
this.successNavigate = ['organizations', this.organizationId, 'vault'];
|
2021-09-07 23:19:49 +02:00
|
|
|
await super.ngOnInit();
|
|
|
|
this.importBlockedByPolicy = false;
|
2018-07-06 05:38:36 +02:00
|
|
|
});
|
2021-02-11 23:13:29 +01:00
|
|
|
const organization = await this.userService.getOrganization(this.organizationId);
|
|
|
|
this.organizationName = organization.name;
|
|
|
|
}
|
|
|
|
|
|
|
|
async submit() {
|
|
|
|
const confirmed = await this.platformUtilsService.showDialog(
|
|
|
|
this.i18nService.t('importWarning', this.organizationName),
|
|
|
|
this.i18nService.t('warning'), this.i18nService.t('yes'), this.i18nService.t('no'), 'warning');
|
|
|
|
if (!confirmed) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
super.submit();
|
2018-07-06 05:38:36 +02:00
|
|
|
}
|
|
|
|
}
|