mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-26 17:08:33 +01:00
convert action buttons component to ts
This commit is contained in:
parent
b3c671cca0
commit
97f65b19c8
@ -59,7 +59,6 @@ require('./directives/formDirective.js');
|
||||
require('./directives/stopClickDirective.js');
|
||||
require('./directives/stopPropDirective.js');
|
||||
require('./directives/fallbackSrcDirective.js');
|
||||
require('./components/actionButtonsComponent.js');
|
||||
require('./services/backgroundService.js');
|
||||
require('./services/authService.js');
|
||||
require('./services/validationService.js');
|
||||
|
49
src/popup/app/components/action-buttons.component.ts
Normal file
49
src/popup/app/components/action-buttons.component.ts
Normal file
@ -0,0 +1,49 @@
|
||||
import * as template from './action-buttons.component.html';
|
||||
|
||||
class ActionButtonsController implements ng.IController {
|
||||
onView: Function;
|
||||
|
||||
cipher: any;
|
||||
showView: boolean;
|
||||
i18n: any;
|
||||
constants: any;
|
||||
|
||||
constructor(private i18nService: any, private $analytics: any, private constantsService: any, private toastr: any,
|
||||
private $timeout: any, private $window: any, private utilsService: any) {
|
||||
this.i18n = i18nService;
|
||||
this.constants = constantsService;
|
||||
}
|
||||
|
||||
launch() {
|
||||
const self = this;
|
||||
this.$timeout(() => {
|
||||
if (self.cipher.login.uri.startsWith('http://') || self.cipher.login.uri.startsWith('https://')) {
|
||||
self.$analytics.eventTrack('Launched Website From Listing');
|
||||
chrome.tabs.create({ url: self.cipher.login.uri });
|
||||
if (self.utilsService.inPopup(self.$window)) {
|
||||
self.$window.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
clipboardError(e: any) {
|
||||
this.toastr.info(this.i18nService.browserNotSupportClipboard);
|
||||
}
|
||||
|
||||
clipboardSuccess(e: any, type: string, aType: string) {
|
||||
e.clearSelection();
|
||||
this.$analytics.eventTrack('Copied ' + aType);
|
||||
this.toastr.info(type + this.i18nService.valueCopied);
|
||||
}
|
||||
}
|
||||
|
||||
export const ActionButtonsComponent = {
|
||||
bindings: {
|
||||
cipher: '<',
|
||||
showView: '<',
|
||||
onView: '&',
|
||||
},
|
||||
controller: ActionButtonsController,
|
||||
template,
|
||||
};
|
@ -1,4 +1,5 @@
|
||||
import * as angular from 'angular';
|
||||
import { ActionButtonsComponent } from './action-buttons.component';
|
||||
import { CipherItemsComponent } from './cipher-items.component';
|
||||
import { IconComponent } from './icon.component';
|
||||
|
||||
@ -6,4 +7,5 @@ export default angular
|
||||
.module('bit.components', [])
|
||||
.component('cipherItems', CipherItemsComponent)
|
||||
.component('icon', IconComponent)
|
||||
.component('actionButtons', ActionButtonsComponent)
|
||||
.name;
|
||||
|
@ -1,9 +1,6 @@
|
||||
import * as template from './icon.component.html';
|
||||
|
||||
class IconController implements ng.IController {
|
||||
onSelected: Function;
|
||||
onView: Function;
|
||||
|
||||
cipher: any;
|
||||
icon: string;
|
||||
image: string;
|
||||
|
Loading…
Reference in New Issue
Block a user