1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-01-10 19:38:11 +01:00

[PM-15541] Hide ssh key filter behind feature flag (#12239)

* Hide ssh key filter behind feature flag

* Hide ssh keys in web client by featureflag

* Fix build
This commit is contained in:
Bernd Schoolmann 2024-12-04 17:04:08 +01:00 committed by GitHub
parent 80a898bd8c
commit 811b97cef5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 35 additions and 5 deletions

View File

@ -118,6 +118,7 @@
type="button" type="button"
class="box-content-row" class="box-content-row"
appStopClick appStopClick
*ngIf="isSshKeysEnabled"
(click)="selectType(cipherType.SshKey)" (click)="selectType(cipherType.SshKey)"
> >
<div class="row-main"> <div class="row-main">

View File

@ -7,7 +7,9 @@ import { first, switchMap, takeUntil } from "rxjs/operators";
import { CollectionView } from "@bitwarden/admin-console/common"; import { CollectionView } from "@bitwarden/admin-console/common";
import { VaultFilter } from "@bitwarden/angular/vault/vault-filter/models/vault-filter.model"; import { VaultFilter } from "@bitwarden/angular/vault/vault-filter/models/vault-filter.model";
import { SearchService } from "@bitwarden/common/abstractions/search.service"; import { SearchService } from "@bitwarden/common/abstractions/search.service";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import { BroadcasterService } from "@bitwarden/common/platform/abstractions/broadcaster.service"; import { BroadcasterService } from "@bitwarden/common/platform/abstractions/broadcaster.service";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { SyncService } from "@bitwarden/common/platform/sync"; import { SyncService } from "@bitwarden/common/platform/sync";
@ -62,6 +64,8 @@ export class VaultFilterComponent implements OnInit, OnDestroy {
selectedOrganization: string = null; selectedOrganization: string = null;
showCollections = true; showCollections = true;
isSshKeysEnabled = false;
private loadedTimeout: number; private loadedTimeout: number;
private selectedTimeout: number; private selectedTimeout: number;
private preventSelected = false; private preventSelected = false;
@ -95,6 +99,7 @@ export class VaultFilterComponent implements OnInit, OnDestroy {
private location: Location, private location: Location,
private vaultFilterService: VaultFilterService, private vaultFilterService: VaultFilterService,
private vaultBrowserStateService: VaultBrowserStateService, private vaultBrowserStateService: VaultBrowserStateService,
private configService: ConfigService,
) { ) {
this.noFolderListSize = 100; this.noFolderListSize = 100;
} }
@ -166,6 +171,8 @@ export class VaultFilterComponent implements OnInit, OnDestroy {
.subscribe((isSearchable) => { .subscribe((isSearchable) => {
this.isSearchable = isSearchable; this.isSearchable = isSearchable;
}); });
this.isSshKeysEnabled = await this.configService.getFeatureFlag(FeatureFlag.SSHKeyVaultItem);
} }
ngOnDestroy() { ngOnDestroy() {

View File

@ -82,6 +82,7 @@
<li <li
class="filter-option" class="filter-option"
[ngClass]="{ active: activeFilter.cipherType === cipherTypeEnum.SshKey }" [ngClass]="{ active: activeFilter.cipherType === cipherTypeEnum.SshKey }"
*ngIf="isSshKeysEnabled"
> >
<span class="filter-buttons"> <span class="filter-buttons">
<button <button

View File

@ -1,9 +1,21 @@
import { Component } from "@angular/core"; import { Component, OnInit } from "@angular/core";
import { TypeFilterComponent as BaseTypeFilterComponent } from "@bitwarden/angular/vault/vault-filter/components/type-filter.component"; import { TypeFilterComponent as BaseTypeFilterComponent } from "@bitwarden/angular/vault/vault-filter/components/type-filter.component";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
@Component({ @Component({
selector: "app-type-filter", selector: "app-type-filter",
templateUrl: "type-filter.component.html", templateUrl: "type-filter.component.html",
}) })
export class TypeFilterComponent extends BaseTypeFilterComponent {} export class TypeFilterComponent extends BaseTypeFilterComponent implements OnInit {
isSshKeysEnabled = false;
constructor(private configService: ConfigService) {
super();
}
async ngOnInit(): Promise<void> {
this.isSshKeysEnabled = await this.configService.getFeatureFlag(FeatureFlag.SSHKeyVaultItem);
}
}

View File

@ -6,6 +6,8 @@ import { PolicyService } from "@bitwarden/common/admin-console/abstractions/poli
import { PolicyType } from "@bitwarden/common/admin-console/enums"; import { PolicyType } from "@bitwarden/common/admin-console/enums";
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
import { BillingApiServiceAbstraction } from "@bitwarden/common/billing/abstractions/billing-api.service.abstraction"; import { BillingApiServiceAbstraction } from "@bitwarden/common/billing/abstractions/billing-api.service.abstraction";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { CipherType } from "@bitwarden/common/vault/enums"; import { CipherType } from "@bitwarden/common/vault/enums";
@ -94,6 +96,7 @@ export class VaultFilterComponent implements OnInit, OnDestroy {
protected platformUtilsService: PlatformUtilsService, protected platformUtilsService: PlatformUtilsService,
protected billingApiService: BillingApiServiceAbstraction, protected billingApiService: BillingApiServiceAbstraction,
protected dialogService: DialogService, protected dialogService: DialogService,
protected configService: ConfigService,
) {} ) {}
async ngOnInit(): Promise<void> { async ngOnInit(): Promise<void> {
@ -258,13 +261,16 @@ export class VaultFilterComponent implements OnInit, OnDestroy {
type: CipherType.SecureNote, type: CipherType.SecureNote,
icon: "bwi-sticky-note", icon: "bwi-sticky-note",
}, },
{ ];
if (await this.configService.getFeatureFlag(FeatureFlag.SSHKeyVaultItem)) {
allTypeFilters.push({
id: "sshKey", id: "sshKey",
name: this.i18nService.t("typeSshKey"), name: this.i18nService.t("typeSshKey"),
type: CipherType.SshKey, type: CipherType.SshKey,
icon: "bwi-key", icon: "bwi-key",
}, });
]; }
const typeFilterSection: VaultFilterSection = { const typeFilterSection: VaultFilterSection = {
data$: this.vaultFilterService.buildTypeTree( data$: this.vaultFilterService.buildTypeTree(

View File

@ -4,6 +4,7 @@ import { firstValueFrom, Subject } from "rxjs";
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction"; import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
import { BillingApiServiceAbstraction } from "@bitwarden/common/billing/abstractions/billing-api.service.abstraction"; import { BillingApiServiceAbstraction } from "@bitwarden/common/billing/abstractions/billing-api.service.abstraction";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { TreeNode } from "@bitwarden/common/vault/models/domain/tree-node"; import { TreeNode } from "@bitwarden/common/vault/models/domain/tree-node";
@ -42,6 +43,7 @@ export class VaultFilterComponent
protected platformUtilsService: PlatformUtilsService, protected platformUtilsService: PlatformUtilsService,
protected billingApiService: BillingApiServiceAbstraction, protected billingApiService: BillingApiServiceAbstraction,
protected dialogService: DialogService, protected dialogService: DialogService,
protected configService: ConfigService,
) { ) {
super( super(
vaultFilterService, vaultFilterService,
@ -50,6 +52,7 @@ export class VaultFilterComponent
platformUtilsService, platformUtilsService,
billingApiService, billingApiService,
dialogService, dialogService,
configService,
); );
} }