wire up search and view events query params

This commit is contained in:
Kyle Spearrin 2018-07-11 15:44:40 -04:00
parent 98d3b42728
commit 6dd21fe9e9
5 changed files with 36 additions and 12 deletions

View File

@ -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;
});
});
}

View File

@ -56,6 +56,9 @@ export class GroupsComponent implements OnInit {
return;
}
await this.load();
this.route.queryParams.subscribe(async (qParams) => {
this.searchText = qParams.search;
});
});
}

View File

@ -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]);
}
}
});
});
}

View File

@ -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]);
}
}
});
});

View File

@ -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;
}