2018-04-13 06:06:48 +02:00
|
|
|
import { Component } from "@angular/core";
|
|
|
|
import { ActivatedRoute, Router } from "@angular/router";
|
2021-10-14 23:58:59 +02:00
|
|
|
import { first } from "rxjs/operators";
|
|
|
|
|
2022-06-14 17:10:53 +02:00
|
|
|
import { FolderAddEditComponent as BaseFolderAddEditComponent } from "@bitwarden/angular/components/folder-add-edit.component";
|
|
|
|
import { FolderService } from "@bitwarden/common/abstractions/folder.service";
|
|
|
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|
|
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
|
|
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
2018-04-13 06:06:48 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: "app-folder-add-edit",
|
|
|
|
templateUrl: "folder-add-edit.component.html",
|
|
|
|
})
|
|
|
|
export class FolderAddEditComponent extends BaseFolderAddEditComponent {
|
|
|
|
constructor(
|
|
|
|
folderService: FolderService,
|
|
|
|
i18nService: I18nService,
|
2018-04-13 19:18:43 +02:00
|
|
|
platformUtilsService: PlatformUtilsService,
|
|
|
|
private router: Router,
|
2021-10-21 11:10:46 +02:00
|
|
|
private route: ActivatedRoute,
|
|
|
|
logService: LogService
|
|
|
|
) {
|
|
|
|
super(folderService, i18nService, platformUtilsService, logService);
|
2021-12-21 15:43:35 +01:00
|
|
|
}
|
|
|
|
|
2018-04-13 06:06:48 +02:00
|
|
|
async ngOnInit() {
|
2021-10-14 23:58:59 +02:00
|
|
|
this.route.queryParams.pipe(first()).subscribe(async (params) => {
|
2018-04-13 06:06:48 +02:00
|
|
|
if (params.folderId) {
|
|
|
|
this.folderId = params.folderId;
|
2021-12-21 15:43:35 +01:00
|
|
|
}
|
2019-03-06 20:31:50 +01:00
|
|
|
await this.init();
|
2021-12-21 15:43:35 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-04-13 06:06:48 +02:00
|
|
|
async submit(): Promise<boolean> {
|
|
|
|
if (await super.submit()) {
|
2018-04-13 19:18:43 +02:00
|
|
|
this.router.navigate(["/folders"]);
|
2018-04-13 06:06:48 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
async delete(): Promise<boolean> {
|
|
|
|
const confirmed = await super.delete();
|
|
|
|
if (confirmed) {
|
2018-04-13 19:18:43 +02:00
|
|
|
this.router.navigate(["/folders"]);
|
2018-04-13 06:06:48 +02:00
|
|
|
}
|
|
|
|
return confirmed;
|
2021-12-21 15:43:35 +01:00
|
|
|
}
|
2018-04-13 06:06:48 +02:00
|
|
|
}
|