Add a "launch site" button directly to the list of ciphers (#384)

* Add a button to launch the primary uri for a site straight from the list.

* Take cues from the add-edit component on properly checking if we can launch.

* Move the launch button to the dropdown menu.

* Take LoginView as launch parameter instead of LoginUriView.
This commit is contained in:
Shawn Beachy 2019-04-26 09:07:57 -04:00 committed by Kyle Spearrin
parent 96cc9c681c
commit 1060775cad
2 changed files with 16 additions and 1 deletions

View File

@ -34,6 +34,11 @@
<i class="fa fa-fw fa-clipboard"></i> <i class="fa fa-fw fa-clipboard"></i>
{{'copyPassword' | i18n}} {{'copyPassword' | i18n}}
</a> </a>
<a class="dropdown-item" href="#" appStopClick
*ngIf="c.type === cipherType.Login && c.login.canLaunch" (click)="launch(c.login)">
<i class="fa fa-fw fa-share"></i>
{{'launch' | i18n}}
</a>
<a class="dropdown-item" href="#" appStopClick (click)="attachments(c)"> <a class="dropdown-item" href="#" appStopClick (click)="attachments(c)">
<i class="fa fa-fw fa-paperclip"></i> <i class="fa fa-fw fa-paperclip"></i>
{{'attachments' | i18n}} {{'attachments' | i18n}}

View File

@ -19,6 +19,7 @@ import { CiphersComponent as BaseCiphersComponent } from 'jslib/angular/componen
import { CipherType } from 'jslib/enums/cipherType'; import { CipherType } from 'jslib/enums/cipherType';
import { CipherView } from 'jslib/models/view/cipherView'; import { CipherView } from 'jslib/models/view/cipherView';
import { LoginView } from 'jslib/models/view/loginView';
const MaxCheckedCount = 500; const MaxCheckedCount = 500;
@ -50,6 +51,15 @@ export class CiphersComponent extends BaseCiphersComponent implements OnDestroy
(c as any).checked = select == null ? !(c as any).checked : select; (c as any).checked = select == null ? !(c as any).checked : select;
} }
launch(view: LoginView) {
if (!view.canLaunch) {
return;
}
this.platformUtilsService.eventTrack('Launched Login URI');
this.platformUtilsService.launchUri(view.launchUri);
}
selectAll(select: boolean) { selectAll(select: boolean) {
if (select) { if (select) {
this.selectAll(false); this.selectAll(false);