mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-28 12:45:45 +01:00
deleted most of the send component
This commit is contained in:
parent
2b9bae6807
commit
8479e57fa5
@ -37,7 +37,6 @@ export class SendComponent extends BaseSendComponent implements OnInit {
|
|||||||
sendId: string;
|
sendId: string;
|
||||||
modal: ModalComponent = null;
|
modal: ModalComponent = null;
|
||||||
action: Action = Action.None;
|
action: Action = Action.None;
|
||||||
selectedSend: SendView;
|
|
||||||
|
|
||||||
constructor(sendService: SendService, i18nService: I18nService,
|
constructor(sendService: SendService, i18nService: I18nService,
|
||||||
platformUtilsService: PlatformUtilsService, environmentService: EnvironmentService,
|
platformUtilsService: PlatformUtilsService, environmentService: EnvironmentService,
|
||||||
@ -47,40 +46,9 @@ export class SendComponent extends BaseSendComponent implements OnInit {
|
|||||||
environmentService, broadcasterService, ngZone, searchService);
|
environmentService, broadcasterService, ngZone, searchService);
|
||||||
}
|
}
|
||||||
|
|
||||||
async load(filter: (send: SendView) => boolean = null) {
|
|
||||||
this.loading = true;
|
|
||||||
this.sends = await this.sendService.getAllDecrypted();
|
|
||||||
|
|
||||||
this.route.queryParams.subscribe(async (params) => {
|
|
||||||
this.sendId = params.sendId;
|
|
||||||
if (this.sendId != null) {
|
|
||||||
this.selectedSend = this.sends.find((s) => s.id === params.sendId);
|
|
||||||
params.action === 'edit' ?
|
|
||||||
this.action = Action.Edit :
|
|
||||||
this.action = Action.View;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (params.action === 'add') {
|
|
||||||
this.action = Action.Add;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.selectAll();
|
|
||||||
});
|
|
||||||
|
|
||||||
this.loading = false;
|
|
||||||
this.loaded = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
addSend() {
|
addSend() {
|
||||||
if (this.action === Action.Add) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.action = Action.Add;
|
this.action = Action.Add;
|
||||||
this.sendId = null;
|
this.sendId = null;
|
||||||
this.go();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
editSend(send: SendView) {
|
editSend(send: SendView) {
|
||||||
@ -90,20 +58,9 @@ export class SendComponent extends BaseSendComponent implements OnInit {
|
|||||||
selectSend(send: SendView) {
|
selectSend(send: SendView) {
|
||||||
this.action = Action.View;
|
this.action = Action.View;
|
||||||
this.sendId = send.id;
|
this.sendId = send.id;
|
||||||
this.go();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private go(queryParams: any = null) {
|
get selectedSend() {
|
||||||
if (queryParams == null) {
|
return this.sends.find((s) => s.id === this.sendId);
|
||||||
queryParams = {
|
|
||||||
id: this.sendId,
|
|
||||||
action: this.action,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
this.router.navigate([], {
|
|
||||||
relativeTo: this.route,
|
|
||||||
queryParams: queryParams,
|
|
||||||
replaceUrl: true,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user