From d6995cdbf9114a157253ba06837426f060ea48b3 Mon Sep 17 00:00:00 2001 From: Robyn MacCallum Date: Wed, 13 Apr 2022 15:13:36 -0400 Subject: [PATCH] draft for filters work --- bitwarden_license/src/app/app.module.ts | 2 + package-lock.json | 15 ++ .../vault/groupings.component.ts | 65 ------ .../vault-filter/vault-filter.component.ts | 18 ++ .../organizations/vault/vault.component.html | 26 ++- .../organizations/vault/vault.component.ts | 140 ++++++------- src/app/oss.module.ts | 6 +- src/app/settings/user-billing.component.ts | 4 +- src/app/vault/groupings.component.html | 173 ---------------- src/app/vault/groupings.component.ts | 29 --- .../collection-filter.component.html | 55 +++++ .../components/collection-filter.component.ts | 9 + .../components/folder-filter.component.html | 71 +++++++ .../components/folder-filter.component.ts | 9 + .../organization-filter.component.html | 175 ++++++++++++++++ .../organization-filter.component.ts | 11 + .../organization-options.component.html | 41 ++++ .../organization-options.component.ts | 180 +++++++++++++++++ .../components/status-filter.component.html | 19 ++ .../components/status-filter.component.ts | 9 + .../components/type-filter.component.html | 38 ++++ .../components/type-filter.component.ts | 9 + .../vault-filter/vault-filter.component.html | 73 +++++++ .../vault-filter/vault-filter.component.ts | 27 +++ .../vault/vault-filter/vault-filter.module.ts | 50 +++++ .../vault-filter/vault-filter.service.ts | 3 + src/app/vault/vault.component.html | 26 +-- src/app/vault/vault.component.ts | 190 +++++++++--------- src/locales/en/messages.json | 3 + src/scss/cards.scss | 4 + src/scss/pages.scss | 42 ++++ 31 files changed, 1050 insertions(+), 472 deletions(-) delete mode 100644 src/app/organizations/vault/groupings.component.ts create mode 100644 src/app/organizations/vault/vault-filter/vault-filter.component.ts delete mode 100644 src/app/vault/groupings.component.html delete mode 100644 src/app/vault/groupings.component.ts create mode 100644 src/app/vault/vault-filter/components/collection-filter.component.html create mode 100644 src/app/vault/vault-filter/components/collection-filter.component.ts create mode 100644 src/app/vault/vault-filter/components/folder-filter.component.html create mode 100644 src/app/vault/vault-filter/components/folder-filter.component.ts create mode 100644 src/app/vault/vault-filter/components/organization-filter.component.html create mode 100644 src/app/vault/vault-filter/components/organization-filter.component.ts create mode 100644 src/app/vault/vault-filter/components/organization-options.component.html create mode 100644 src/app/vault/vault-filter/components/organization-options.component.ts create mode 100644 src/app/vault/vault-filter/components/status-filter.component.html create mode 100644 src/app/vault/vault-filter/components/status-filter.component.ts create mode 100644 src/app/vault/vault-filter/components/type-filter.component.html create mode 100644 src/app/vault/vault-filter/components/type-filter.component.ts create mode 100644 src/app/vault/vault-filter/vault-filter.component.html create mode 100644 src/app/vault/vault-filter/vault-filter.component.ts create mode 100644 src/app/vault/vault-filter/vault-filter.module.ts create mode 100644 src/app/vault/vault-filter/vault-filter.service.ts diff --git a/bitwarden_license/src/app/app.module.ts b/bitwarden_license/src/app/app.module.ts index 781e3f45..f9e59bda 100644 --- a/bitwarden_license/src/app/app.module.ts +++ b/bitwarden_license/src/app/app.module.ts @@ -9,6 +9,7 @@ import { JslibModule } from "jslib-angular/jslib.module"; import { OssRoutingModule } from "src/app/oss-routing.module"; import { ServicesModule } from "src/app/services/services.module"; +import { VaultFilterModule } from "src/app/vault/vault-filter/vault-filter.module"; import { WildcardRoutingModule } from "src/app/wildcard-routing.module"; import { AppRoutingModule } from "./app-routing.module"; @@ -20,6 +21,7 @@ import { MaximumVaultTimeoutPolicyComponent } from "./policies/maximum-vault-tim @NgModule({ imports: [ JslibModule, + VaultFilterModule, BrowserAnimationsModule, FormsModule, ReactiveFormsModule, diff --git a/package-lock.json b/package-lock.json index c978d8c0..73f638e6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -139,6 +139,14 @@ "typescript": "4.3.5" } }, + "jslib/common/node_modules/node-forge": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", + "integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==", + "engines": { + "node": ">= 6.13.0" + } + }, "node_modules/@ampproject/remapping": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.1.2.tgz", @@ -9657,6 +9665,13 @@ "tldjs": "^2.3.1", "typescript": "4.3.5", "zxcvbn": "^4.4.2" + }, + "dependencies": { + "node-forge": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", + "integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==" + } } }, "@braintree/asset-loader": { diff --git a/src/app/organizations/vault/groupings.component.ts b/src/app/organizations/vault/groupings.component.ts deleted file mode 100644 index b39f5e9a..00000000 --- a/src/app/organizations/vault/groupings.component.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { Component } from "@angular/core"; - -import { ApiService } from "jslib-common/abstractions/api.service"; -import { CollectionService } from "jslib-common/abstractions/collection.service"; -import { FolderService } from "jslib-common/abstractions/folder.service"; -import { I18nService } from "jslib-common/abstractions/i18n.service"; -import { StateService } from "jslib-common/abstractions/state.service"; -import { CollectionData } from "jslib-common/models/data/collectionData"; -import { Collection } from "jslib-common/models/domain/collection"; -import { Organization } from "jslib-common/models/domain/organization"; -import { CollectionDetailsResponse } from "jslib-common/models/response/collectionResponse"; -import { CollectionView } from "jslib-common/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 { - organization: Organization; - - constructor( - collectionService: CollectionService, - folderService: FolderService, - stateService: StateService, - private apiService: ApiService, - private i18nService: I18nService - ) { - super(collectionService, folderService, stateService); - } - - async loadCollections() { - if (!this.organization.canEditAnyCollection) { - await super.loadCollections(this.organization.id); - return; - } - - const collections = await this.apiService.getCollections(this.organization.id); - if (collections != null && collections.data != null && collections.data.length) { - const collectionDomains = collections.data.map( - (r) => new Collection(new CollectionData(r as CollectionDetailsResponse)) - ); - this.collections = await this.collectionService.decryptMany(collectionDomains); - } else { - this.collections = []; - } - - const unassignedCollection = new CollectionView(); - unassignedCollection.name = this.i18nService.t("unassigned"); - unassignedCollection.id = "unassigned"; - unassignedCollection.organizationId = this.organization.id; - unassignedCollection.readOnly = true; - this.collections.push(unassignedCollection); - this.nestedCollections = await this.collectionService.getAllNested(this.collections); - } - - async collapse(grouping: CollectionView) { - await super.collapse(grouping, "org_"); - } - - isCollapsed(grouping: CollectionView) { - return super.isCollapsed(grouping, "org_"); - } -} diff --git a/src/app/organizations/vault/vault-filter/vault-filter.component.ts b/src/app/organizations/vault/vault-filter/vault-filter.component.ts new file mode 100644 index 00000000..87012759 --- /dev/null +++ b/src/app/organizations/vault/vault-filter/vault-filter.component.ts @@ -0,0 +1,18 @@ +import { Component } from "@angular/core"; + +import { VaultFilterService } from "jslib-angular/modules/vault-filter/vault-filter.service"; +import { Organization } from "jslib-common/models/domain/organization"; + +import { VaultFilterComponent as BaseVaultFilterComponent } from "../../../vault/vault-filter/vault-filter.component"; + +@Component({ + selector: "app-org-vault-filter", + templateUrl: "../../../vault/vault-filter/vault-filter.component.html", +}) +export class VaultFilterComponent extends BaseVaultFilterComponent { + organization: Organization; + + constructor(vaultFilterService: VaultFilterService) { + super(vaultFilterService); + } +} diff --git a/src/app/organizations/vault/vault.component.html b/src/app/organizations/vault/vault.component.html index d2db40ce..a187d3ba 100644 --- a/src/app/organizations/vault/vault.component.html +++ b/src/app/organizations/vault/vault.component.html @@ -1,17 +1,21 @@
- - +
+
+
+ +
+
+