feat(request-limits): Added the new request limit options to the bulk edit

pull/4365/head
tidusjar 3 years ago
parent b6fa61b33d
commit 03bc23a74e

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

@ -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">
@ -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">
@ -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>

@ -87,4 +87,8 @@
table {
width: 100%;
}
::ng-deep .p-sidebar {
background: $background-dark !important;
}

@ -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";
@ -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,
@ -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]}`);
@ -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() {

Loading…
Cancel
Save