inherit local base for groupings and ciphers
This commit is contained in:
parent
f578ebe4ef
commit
f089b5e3d1
|
@ -1,9 +1,4 @@
|
|||
import {
|
||||
Component,
|
||||
EventEmitter,
|
||||
Input,
|
||||
Output,
|
||||
} from '@angular/core';
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
import { ToasterService } from 'angular2-toaster';
|
||||
import { Angulartics2 } from 'angulartics2';
|
||||
|
@ -13,31 +8,24 @@ import { CipherService } from 'jslib/abstractions/cipher.service';
|
|||
import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
||||
|
||||
import { CiphersComponent as BaseCiphersComponent } from 'jslib/angular/components/ciphers.component';
|
||||
|
||||
import { CipherType } from 'jslib/enums/cipherType';
|
||||
|
||||
import { CipherData } from 'jslib/models/data/cipherData';
|
||||
import { Cipher } from 'jslib/models/domain/cipher';
|
||||
import { Organization } from 'jslib/models/domain/organization';
|
||||
import { CipherView } from 'jslib/models/view/cipherView';
|
||||
|
||||
import { CiphersComponent as BaseCiphersComponent } from '../vault/ciphers.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-org-vault-ciphers',
|
||||
templateUrl: '../vault/ciphers.component.html',
|
||||
})
|
||||
export class CiphersComponent extends BaseCiphersComponent {
|
||||
@Input() showAddNew = true;
|
||||
@Output() onAttachmentsClicked = new EventEmitter<CipherView>();
|
||||
@Output() onCollectionsClicked = new EventEmitter<CipherView>();
|
||||
|
||||
organization: Organization;
|
||||
cipherType = CipherType;
|
||||
|
||||
constructor(cipherService: CipherService, private analytics: Angulartics2,
|
||||
private toasterService: ToasterService, private i18nService: I18nService,
|
||||
private platformUtilsService: PlatformUtilsService, private apiService: ApiService) {
|
||||
super(cipherService);
|
||||
constructor(cipherService: CipherService, analytics: Angulartics2,
|
||||
toasterService: ToasterService, i18nService: I18nService,
|
||||
platformUtilsService: PlatformUtilsService, private apiService: ApiService) {
|
||||
super(cipherService, analytics, toasterService, i18nService, platformUtilsService);
|
||||
}
|
||||
|
||||
async load(filter: (cipher: CipherView) => boolean = null) {
|
||||
|
@ -76,37 +64,4 @@ export class CiphersComponent extends BaseCiphersComponent {
|
|||
checkCipher(c: CipherView) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
attachments(c: CipherView) {
|
||||
this.onAttachmentsClicked.emit(c);
|
||||
}
|
||||
|
||||
collections(c: CipherView) {
|
||||
this.onCollectionsClicked.emit(c);
|
||||
}
|
||||
|
||||
async delete(c: CipherView): Promise<boolean> {
|
||||
const confirmed = await this.platformUtilsService.showDialog(
|
||||
this.i18nService.t('deleteItemConfirmation'), this.i18nService.t('deleteItem'),
|
||||
this.i18nService.t('yes'), this.i18nService.t('no'), 'warning');
|
||||
if (!confirmed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
await this.cipherService.deleteWithServer(c.id);
|
||||
this.analytics.eventTrack.next({ action: 'Deleted Cipher' });
|
||||
this.toasterService.popAsync('success', null, this.i18nService.t('deletedItem'));
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
copy(value: string, typeI18nKey: string, aType: string) {
|
||||
if (value == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.analytics.eventTrack.next({ action: 'Copied ' + aType.toLowerCase() + ' from listing.' });
|
||||
this.platformUtilsService.copyToClipboard(value, { doc: window.document });
|
||||
this.toasterService.popAsync('info', null,
|
||||
this.i18nService.t('valueCopied', this.i18nService.t(typeI18nKey)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,42 +1,29 @@
|
|||
import {
|
||||
Component,
|
||||
EventEmitter,
|
||||
Input,
|
||||
Output,
|
||||
} from '@angular/core';
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
import { ApiService } from 'jslib/abstractions/api.service';
|
||||
import { CollectionService } from 'jslib/abstractions/collection.service';
|
||||
import { FolderService } from 'jslib/abstractions/folder.service';
|
||||
import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||
|
||||
import { GroupingsComponent as BaseGroupingsComponent } from 'jslib/angular/components/groupings.component';
|
||||
|
||||
import { CollectionData } from 'jslib/models/data/collectionData';
|
||||
import { Collection } from 'jslib/models/domain/collection';
|
||||
import { Organization } from 'jslib/models/domain/organization';
|
||||
import { CollectionView } from 'jslib/models/view/collectionView';
|
||||
|
||||
import { GroupingsComponent as BaseGroupingsComponent } from '../vault/groupings.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-org-vault-groupings',
|
||||
templateUrl: '../vault/groupings.component.html',
|
||||
})
|
||||
export class GroupingsComponent extends BaseGroupingsComponent {
|
||||
@Output() onSearchTextChanged = new EventEmitter<string>();
|
||||
|
||||
organization: Organization;
|
||||
searchText: string = '';
|
||||
searchPlaceholder: string = null;
|
||||
|
||||
constructor(collectionService: CollectionService, folderService: FolderService,
|
||||
private apiService: ApiService, private i18nService: I18nService) {
|
||||
super(collectionService, folderService);
|
||||
}
|
||||
|
||||
searchTextChanged() {
|
||||
this.onSearchTextChanged.emit(this.searchText);
|
||||
}
|
||||
|
||||
async loadCollections() {
|
||||
if (this.organization.isAdmin) {
|
||||
const collections = await this.apiService.getCollections(this.organization.id);
|
||||
|
|
|
@ -32,9 +32,9 @@ export class CiphersComponent extends BaseCiphersComponent {
|
|||
|
||||
cipherType = CipherType;
|
||||
|
||||
constructor(cipherService: CipherService, private analytics: Angulartics2,
|
||||
private toasterService: ToasterService, private i18nService: I18nService,
|
||||
private platformUtilsService: PlatformUtilsService) {
|
||||
constructor(cipherService: CipherService, protected analytics: Angulartics2,
|
||||
protected toasterService: ToasterService, protected i18nService: I18nService,
|
||||
protected platformUtilsService: PlatformUtilsService) {
|
||||
super(cipherService);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import { GroupingsComponent as BaseGroupingsComponent } from 'jslib/angular/comp
|
|||
})
|
||||
export class GroupingsComponent extends BaseGroupingsComponent {
|
||||
@Output() onSearchTextChanged = new EventEmitter<string>();
|
||||
|
||||
searchText: string = '';
|
||||
searchPlaceholder: string = null;
|
||||
|
||||
|
|
Loading…
Reference in New Issue