From 6dd21fe9e9534683e0b8e31cef886a32231da129 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 11 Jul 2018 15:44:40 -0400 Subject: [PATCH] wire up search and view events query params --- .../manage/collections.component.ts | 3 ++ .../organizations/manage/groups.component.ts | 3 ++ .../organizations/manage/people.component.ts | 10 +++++++ .../organizations/vault/vault.component.ts | 29 ++++++++++++------- src/app/services/event.service.ts | 3 +- 5 files changed, 36 insertions(+), 12 deletions(-) diff --git a/src/app/organizations/manage/collections.component.ts b/src/app/organizations/manage/collections.component.ts index 737bd18914..2f1a8323cf 100644 --- a/src/app/organizations/manage/collections.component.ts +++ b/src/app/organizations/manage/collections.component.ts @@ -48,6 +48,9 @@ export class CollectionsComponent implements OnInit { this.route.parent.parent.params.subscribe(async (params) => { this.organizationId = params.organizationId; await this.load(); + this.route.queryParams.subscribe(async (qParams) => { + this.searchText = qParams.search; + }); }); } diff --git a/src/app/organizations/manage/groups.component.ts b/src/app/organizations/manage/groups.component.ts index 8babd3c625..fda699fd9e 100644 --- a/src/app/organizations/manage/groups.component.ts +++ b/src/app/organizations/manage/groups.component.ts @@ -56,6 +56,9 @@ export class GroupsComponent implements OnInit { return; } await this.load(); + this.route.queryParams.subscribe(async (qParams) => { + this.searchText = qParams.search; + }); }); } diff --git a/src/app/organizations/manage/people.component.ts b/src/app/organizations/manage/people.component.ts index c4580afa01..57eaaaacb1 100644 --- a/src/app/organizations/manage/people.component.ts +++ b/src/app/organizations/manage/people.component.ts @@ -64,6 +64,16 @@ export class PeopleComponent implements OnInit { this.accessEvents = organization.useEvents; this.accessGroups = organization.useGroups; await this.load(); + + this.route.queryParams.subscribe(async (qParams) => { + this.searchText = qParams.search; + if (qParams.viewEvents != null) { + const user = this.users.filter((u) => u.id === qParams.viewEvents); + if (user.length > 0) { + this.events(user[0]); + } + } + }); }); } diff --git a/src/app/organizations/vault/vault.component.ts b/src/app/organizations/vault/vault.component.ts index 3cb7d11413..ddeb4696d9 100644 --- a/src/app/organizations/vault/vault.component.ts +++ b/src/app/organizations/vault/vault.component.ts @@ -67,19 +67,26 @@ export class VaultComponent implements OnInit { if (qParams == null) { this.groupingsComponent.selectedAll = true; await this.ciphersComponent.load(); - return; + } else { + if (qParams.type) { + const t = parseInt(qParams.type, null); + this.groupingsComponent.selectedType = t; + await this.filterCipherType(t, true); + } else if (qParams.collectionId) { + this.groupingsComponent.selectedCollectionId = qParams.collectionId; + await this.filterCollection(qParams.collectionId, true); + } else { + this.groupingsComponent.selectedAll = true; + await this.ciphersComponent.load(); + } } - if (qParams.type) { - const t = parseInt(qParams.type, null); - this.groupingsComponent.selectedType = t; - await this.filterCipherType(t, true); - } else if (qParams.collectionId) { - this.groupingsComponent.selectedCollectionId = qParams.collectionId; - await this.filterCollection(qParams.collectionId, true); - } else { - this.groupingsComponent.selectedAll = true; - await this.ciphersComponent.load(); + this.ciphersComponent.searchText = this.groupingsComponent.searchText = qParams.search; + if (qParams.viewEvents != null) { + const cipher = this.ciphersComponent.ciphers.filter((c) => c.id === qParams.viewEvents); + if (cipher.length > 0) { + this.viewEvents(cipher[0]); + } } }); }); diff --git a/src/app/services/event.service.ts b/src/app/services/event.service.ts index 7c7fa1f180..a3c5e3fe2c 100644 --- a/src/app/services/event.service.ts +++ b/src/app/services/event.service.ts @@ -205,7 +205,8 @@ export class EventService { private formatOrgUserId(ev: EventResponse) { const shortId = this.getShortId(ev.organizationUserId); const a = this.makeAnchor(shortId); - a.setAttribute('href', '#/organizations/' + ev.organizationId + '/manage/people?search=' + shortId); + a.setAttribute('href', '#/organizations/' + ev.organizationId + '/manage/people?search=' + shortId + + '&viewEvents=' + ev.organizationUserId); return a.outerHTML; }