mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 14:23:32 +00:00
convert action buttons component to ts
This commit is contained in:
@@ -59,7 +59,6 @@ require('./directives/formDirective.js');
|
|||||||
require('./directives/stopClickDirective.js');
|
require('./directives/stopClickDirective.js');
|
||||||
require('./directives/stopPropDirective.js');
|
require('./directives/stopPropDirective.js');
|
||||||
require('./directives/fallbackSrcDirective.js');
|
require('./directives/fallbackSrcDirective.js');
|
||||||
require('./components/actionButtonsComponent.js');
|
|
||||||
require('./services/backgroundService.js');
|
require('./services/backgroundService.js');
|
||||||
require('./services/authService.js');
|
require('./services/authService.js');
|
||||||
require('./services/validationService.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 * as angular from 'angular';
|
||||||
|
import { ActionButtonsComponent } from './action-buttons.component';
|
||||||
import { CipherItemsComponent } from './cipher-items.component';
|
import { CipherItemsComponent } from './cipher-items.component';
|
||||||
import { IconComponent } from './icon.component';
|
import { IconComponent } from './icon.component';
|
||||||
|
|
||||||
@@ -6,4 +7,5 @@ export default angular
|
|||||||
.module('bit.components', [])
|
.module('bit.components', [])
|
||||||
.component('cipherItems', CipherItemsComponent)
|
.component('cipherItems', CipherItemsComponent)
|
||||||
.component('icon', IconComponent)
|
.component('icon', IconComponent)
|
||||||
|
.component('actionButtons', ActionButtonsComponent)
|
||||||
.name;
|
.name;
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
import * as template from './icon.component.html';
|
import * as template from './icon.component.html';
|
||||||
|
|
||||||
class IconController implements ng.IController {
|
class IconController implements ng.IController {
|
||||||
onSelected: Function;
|
|
||||||
onView: Function;
|
|
||||||
|
|
||||||
cipher: any;
|
cipher: any;
|
||||||
icon: string;
|
icon: string;
|
||||||
image: string;
|
image: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user