Skip to content

Commit

Permalink
feat(request-limits): ✨ Added the new request limit options to the bu…
Browse files Browse the repository at this point in the history
…lk edit
  • Loading branch information
tidusjar committed Oct 20, 2021
1 parent b6fa61b commit 03bc23a
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</div>
<div class="col-6">
<mat-label>Movie Request Limit Type</mat-label>
<mat-select [(value)]="user.movieRequestLimitType">
<mat-select id="movieRequestLimitType" [(value)]="user.movieRequestLimitType">
<mat-option *ngFor="let value of requestLimitTypes" [value]="value">
{{RequestLimitType[value]}}
</mat-option>
Expand All @@ -65,7 +65,7 @@
</div>
<div class="col-6">
<mat-label>Episode Request Limit Type</mat-label>
<mat-select [(value)]="user.episodeRequestLimitType">
<mat-select id="episodeRequestLimitType" [(value)]="user.episodeRequestLimitType">
<mat-option *ngFor="let value of requestLimitTypes" [value]="value">
{{RequestLimitType[value]}}
</mat-option>
Expand All @@ -80,7 +80,7 @@
</div>
<div class="col-6">
<mat-label>Music Request Limit Type</mat-label>
<mat-select [(value)]="user.musicRequestLimitType">
<mat-select id="musicRequestLimitType" [(value)]="user.musicRequestLimitType">
<mat-option *ngFor="let value of requestLimitTypes" [value]="value">
{{RequestLimitType[value]}}
</mat-option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@



<p-sidebar [(visible)]="showBulkEdit" position="right" [modal]="false">
<p-sidebar [(visible)]="showBulkEdit" position="right" [modal]="false" [style]="{width:'40em'}">
<div>
<div *ngFor="let c of availableClaims">
<div class="form-group">
Expand All @@ -129,19 +129,52 @@
</div>
</div>
</div>

<div class="row">
<div class="col-6">
<mat-form-field appearance="outline" class="full">
<mat-label>Movie Request Limit</mat-label>
<input matInput id="movieRequestLimit" name="movieRequestLimit" [(ngModel)]="bulkMovieLimit">
</mat-form-field>
</mat-form-field></div>
<div class="col-6">
<mat-label>Movie Request Limit Type</mat-label>
<mat-select id="movieRequestLimitType" [(value)]="movieRequestLimitType">
<mat-option *ngFor="let value of requestLimitTypes" [value]="value">
{{RequestLimitType[value]}}
</mat-option>
</mat-select>
</div></div>
<div class="row">
<div class="col-6">
<mat-form-field appearance="outline" class="full">
<mat-label>Episode Request Limit</mat-label>
<input matInput id="episodeRequestLimit" name="episodeRequestLimit" [(ngModel)]="bulkEpisodeLimit">
</mat-form-field>
</div>
<div class="col-6">
<mat-label>Episode Request Limit Type</mat-label>
<mat-select id="episodeRequestLimitType" [(value)]="episodeRequestLimitType">
<mat-option *ngFor="let value of requestLimitTypes" [value]="value">
{{RequestLimitType[value]}}
</mat-option>
</mat-select>
</div>
</div>
<div class="row">
<div class="col-6">
<mat-form-field appearance="outline" class="full">
<mat-label>Music Request Limit</mat-label>
<input matInput id="musicRequestLimit" name="musicRequestLimit" [(ngModel)]="bulkMusicLimit">
</mat-form-field>
</div>
<div class="col-6">
<mat-label>Music Request Limit Type</mat-label>
<mat-select id="musicRequestLimitType" [(value)]="musicRequestLimitType">
<mat-option *ngFor="let value of requestLimitTypes" [value]="value">
{{RequestLimitType[value]}}
</mat-option>
</mat-select>
</div>
</div>
<mat-form-field appearance="outline" class="full">
<mat-label [translate]="'UserPreferences.StreamingCountry'"></mat-label>
<mat-select [(value)]="bulkStreaming">
Expand All @@ -152,7 +185,7 @@
</mat-form-field>


<button type="button" mat-raised-button (click)="bulkUpdate()">Update Users</button>
<button type="button" mat-raised-button color="primary" (click)="bulkUpdate()">Update Users</button>
</p-sidebar>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,8 @@

table {
width: 100%;
}

::ng-deep .p-sidebar {
background: $background-dark !important;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AfterViewInit, Component, OnInit, ViewChild } from "@angular/core";
import { ICheckbox, ICustomizationSettings, IEmailNotificationSettings, IUser } from "../interfaces";
import { ICheckbox, ICustomizationSettings, IEmailNotificationSettings, IUser, RequestLimitType } from "../interfaces";
import { IdentityService, NotificationService, SettingsService } from "../services";

import { CustomizationFacade } from "../state/customization";
Expand Down Expand Up @@ -32,6 +32,12 @@ export class UserManagementComponent implements OnInit {
public plexEnabled: boolean;

public countries: string[];
public requestLimitTypes: RequestLimitType[] = [RequestLimitType.Day, RequestLimitType.Week, RequestLimitType.Month];
public RequestLimitType = RequestLimitType;

public musicRequestLimitType: RequestLimitType;
public episodeRequestLimitType: RequestLimitType;
public movieRequestLimitType: RequestLimitType;

constructor(private identityService: IdentityService,
private settingsService: SettingsService,
Expand Down Expand Up @@ -95,6 +101,15 @@ export class UserManagementComponent implements OnInit {
if (this.bulkStreaming) {
x.streamingCountry = this.bulkStreaming;
}
if (this.musicRequestLimitType) {
x.musicRequestLimitType = this.musicRequestLimitType;
}
if (this.episodeRequestLimitType) {
x.episodeRequestLimitType = this.episodeRequestLimitType;
}
if (this.movieRequestLimitType) {
x.movieRequestLimitType = this.movieRequestLimitType;
}
this.identityService.updateUser(x).subscribe(y => {
if (!y.successful) {
this.notificationService.error(`Could not update user ${x.userName}. Reason ${y.errors[0]}`);
Expand All @@ -108,6 +123,9 @@ export class UserManagementComponent implements OnInit {
this.bulkEpisodeLimit = undefined;
this.bulkMusicLimit = undefined;
this.bulkStreaming = undefined;
this.movieRequestLimitType = undefined;
this.episodeRequestLimitType = undefined;
this.musicRequestLimitType = undefined;
}

public isAllSelected() {
Expand Down

0 comments on commit 03bc23a

Please sign in to comment.