Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update user follow to filter by team #662

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,14 @@ export class UserFollowPageComponent implements OnInit, OnDestroy {
ngOnInit() {
const userId = this.routerQuery.getParams('userId');
const viewId = this.routerQuery.getParams('viewId');
const teamId = this.routerQuery.getQueryParams('teamId');

this.signalrRService.startConnection().then(() => {
this.signalrRService.joinUser(userId, viewId).then((vmUser: VmUser) => {
this.vmUser = vmUser;
});
this.signalrRService
.joinUser(userId, viewId, teamId)
.then((vmUser: VmUser) => {
this.vmUser = vmUser;
});
});

this.userQuery
Expand Down
15 changes: 10 additions & 5 deletions src/app/services/signalr/signalr.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { ComnAuthService } from '@cmusei/crucible-common';
import * as signalR from '@microsoft/signalr';
import { BehaviorSubject, Observable } from 'rxjs';
import { BASE_PATH, VmUser } from '../../generated/vm-api';
import { UserQuery } from '../../state/user/user.query';
import { UserService } from '../../state/user/user.service';
import { VsphereService } from '../../state/vsphere/vsphere.service';

Expand All @@ -22,6 +21,7 @@ export class SignalRService {

private userId: string;
private viewId: string;
private teamId: string;
private vmId: string;
private activeVmId: string;

Expand Down Expand Up @@ -76,8 +76,8 @@ export class SignalRService {
}

private joinGroups() {
if (this.userId && this.viewId) {
this.joinUser(this.userId, this.viewId);
if (this.userId && this.viewId && this.teamId) {
this.joinUser(this.userId, this.viewId, this.teamId);
}

if (this.activeVmId) {
Expand All @@ -89,13 +89,18 @@ export class SignalRService {
}
}

public joinUser(userId: string, viewId: string): Promise<VmUser> {
public joinUser(
userId: string,
viewId: string,
teamId: string,
): Promise<VmUser> {
this.userId = userId;
this.viewId = viewId;
this.teamId = teamId;

return this.startConnection().then(() => {
return this.hubConnection
.invoke('JoinUser', userId, viewId)
.invoke('JoinUser', userId, viewId, teamId)
.then((vmUser: VmUser) => {
const user = { id: vmUser.userId, name: vmUser.username };
this.userService.add(user);
Expand Down
Loading