1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-12 14:56:58 +01:00
bitwarden-browser/src/app/send/send.component.ts

67 lines
1.9 KiB
TypeScript
Raw Normal View History

2021-02-03 22:24:49 +01:00
import {
Component,
NgZone,
OnInit,
} from '@angular/core';
import {
ActivatedRoute ,
Router,
} from '@angular/router';
import { EnvironmentService } from 'jslib/abstractions/environment.service';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { SearchService } from 'jslib/abstractions/search.service';
import { SendService } from 'jslib/abstractions/send.service';
import { ModalComponent } from 'jslib/angular/components/modal.component';
import { SendComponent as BaseSendComponent } from 'jslib/angular/components/send/send.component';
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
import { SendView } from 'jslib/models/view/sendView';
enum Action {
None = '',
Add = 'add',
Edit = 'edit',
View = 'view',
}
@Component({
selector: 'app-send',
templateUrl: 'send.component.html',
})
export class SendComponent extends BaseSendComponent implements OnInit {
sendId: string;
modal: ModalComponent = null;
action: Action = Action.None;
constructor(sendService: SendService, i18nService: I18nService,
platformUtilsService: PlatformUtilsService, environmentService: EnvironmentService,
broadcasterService: BroadcasterService, ngZone: NgZone,
private router: Router, private route: ActivatedRoute, searchService: SearchService) {
super(sendService, i18nService, platformUtilsService,
environmentService, broadcasterService, ngZone, searchService);
}
addSend() {
this.action = Action.Add;
this.sendId = null;
}
editSend(send: SendView) {
2021-02-04 05:12:23 +01:00
return;
}
selectSend(send: SendView) {
this.action = Action.View;
2021-02-03 22:24:49 +01:00
this.sendId = send.id;
}
2021-02-04 05:19:42 +01:00
get selectedSend() {
return this.sends.find((s) => s.id === this.sendId);
2021-02-03 22:24:49 +01:00
}
}