-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #365 from fujaba/feat/assignment-members
Assignment Members
- Loading branch information
Showing
47 changed files
with
1,243 additions
and
882 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
frontend/src/app/assignment/modules/assignment/member.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import {HttpClient} from '@angular/common/http'; | ||
import {Injectable} from '@angular/core'; | ||
import {Observable} from 'rxjs'; | ||
import {tap} from 'rxjs/operators'; | ||
import {Member} from "../../../user/member"; | ||
import {environment} from "../../../../environments/environment"; | ||
|
||
@Injectable() | ||
export class MemberService { | ||
constructor( | ||
private http: HttpClient, | ||
) { | ||
} | ||
|
||
findAll(id: string): Observable<Member[]> { | ||
return this.http.get<Member[]>(`${environment.assignmentsApiUrl}/assignments/${id}/members`); | ||
} | ||
|
||
update(member: Member): Observable<Member> { | ||
const {_user, parent, user, ...rest} = member; | ||
return this.http.put<Member>(`${environment.assignmentsApiUrl}/assignments/${parent}/members/${user}`, rest).pipe( | ||
tap(newMember => newMember._user = _user), | ||
); | ||
} | ||
|
||
delete({parent, user}: Member): Observable<Member> { | ||
return this.http.delete<Member>(`${environment.assignmentsApiUrl}/assignments/${parent}/members/${user}`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
frontend/src/app/user/member-list/member-list.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<ul class="list-group"> | ||
<li *ngFor="let member of members; let index = index" class="list-group-item d-flex align-items-center"> | ||
<div class="me-auto"> | ||
{{ member._user | ||
? member._user.firstName + ' ' + member._user.lastName + ' (' + member._user.username + ')' | ||
: 'Loading...' }} | ||
<span class="text-muted">• {{ member.role || (member.user === owner ? 'Owner' : 'Collaborator') }}</span> | ||
</div> | ||
<button | ||
*ngIf="member.user !== owner && deleted.observed" | ||
type="button" class="btn btn-sm btn-danger bi-person-x" | ||
ngbTooltip="Remove Collaborator" | ||
(click)="delete(member)" | ||
></button> | ||
</li> | ||
</ul> |
Empty file.
Oops, something went wrong.