Merge pull request #3781 from tidusjar/feautre/rework-user-management

sorted it
pull/3782/head
Jamie 4 years ago committed by GitHub
commit 11bb435382
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -114,5 +114,6 @@ export enum INotificationAgent {
Mattermost = 6, Mattermost = 6,
Mobile = 7, Mobile = 7,
Gotify = 8, Gotify = 8,
WhatsApp = 9 Webhook = 9,
WhatsApp = 10
} }

@ -1,9 +1,7 @@
 <div class="small-middle-container" *ngIf="!edit || edit && user">
<div class="small-middle-container" *ngIf="!edit || edit && user"> <div class="row">
<div class="col-md-3 col-sm-12">
<mat-horizontal-stepper #stepper> <label class="control-label"><h3>User Details</h3></label>
<mat-step>
<ng-template matStepLabel>User Details</ng-template>
<div> <div>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Username" [(ngModel)]="user.userName" required> <input matInput placeholder="Username" [(ngModel)]="user.userName" required>
@ -11,12 +9,13 @@
</div> </div>
<div> <div>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Alias" [(ngModel)]="user.alias" matTooltip="This is used as a display value instead of the users username, so think of it as a more friendly username"> <input matInput placeholder="Alias" [(ngModel)]="user.alias"
matTooltip="This is used as a display value instead of the users username, so think of it as a more friendly username">
</mat-form-field> </mat-form-field>
</div> </div>
<div> <div>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Email Address" type="email" [(ngModel)]="user.emailAddress" required> <input matInput placeholder="Email Address" type="email" [(ngModel)]="user.emailAddress">
</mat-form-field> </mat-form-field>
</div> </div>
<div> <div>
@ -29,35 +28,12 @@
<input matInput placeholder="Confirm Password" type="password" [(ngModel)]="confirmPass" required> <input matInput placeholder="Confirm Password" type="password" [(ngModel)]="confirmPass" required>
</mat-form-field> </mat-form-field>
</div> </div>
<div>
<button mat-button matStepperNext>Next</button>
</div>
</mat-step>
<mat-step>
<ng-template matStepLabel>Choose the Roles</ng-template>
<div *ngIf="!edit">
<div *ngFor="let c of availableClaims">
<mat-checkbox [(ngModel)]="c.enabled">{{c.value | humanize}}</mat-checkbox>
</div>
</div>
<div *ngIf="edit">
<div *ngFor="let c of user.claims">
<mat-checkbox [(ngModel)]="c.enabled">{{c.value | humanize}}</mat-checkbox>
</div>
</div>
<div>
<button mat-button matStepperPrevious>Back</button>
<button mat-button matStepperNext>Next</button>
</div> </div>
</mat-step>
<mat-step>
<ng-template matStepLabel>Set Request Limits</ng-template>
<div class="col-md-3 col-sm-12">
<label class="control-label"><h3>Request Limits</h3></label>
<div> <div>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Movie Request Limit" [(ngModel)]="user.movieRequestLimit"> <input matInput placeholder="Movie Request Limit" [(ngModel)]="user.movieRequestLimit">
@ -73,31 +49,7 @@
<input matInput placeholder="Music Request Limit" [(ngModel)]="user.musicRequestLimit"> <input matInput placeholder="Music Request Limit" [(ngModel)]="user.musicRequestLimit">
</mat-form-field> </mat-form-field>
</div> </div>
<label class="control-label"><h3>Quality & Root Path Preferences</h3></label>
<div>
<button mat-button matStepperPrevious>Back</button>
<button mat-button matStepperNext>Next</button>
</div>
</mat-step>
<mat-step>
<ng-template matStepLabel>Notification Preferences</ng-template>
<div *ngFor="let pref of notificationPreferences">
<div>
<mat-form-field>
<input matInput placeholder="{{NotificationAgent[pref.agent] | humanize}}" [(ngModel)]="pref.value">
</mat-form-field>
</div>
</div>
<div>
<button mat-button matStepperPrevious>Back</button>
<button mat-button matStepperNext>Next</button>
</div>
</mat-step>
<mat-step *ngIf="user.userQualityProfiles && (sonarrQualities || sonarrRootFolders || radarrQualities || radarrRootFolders)">
<ng-template matStepLabel>Quality & Root Path Preferences</ng-template>
<mat-form-field *ngIf="sonarrQualities"> <mat-form-field *ngIf="sonarrQualities">
<mat-label>Sonarr Quality Profile</mat-label> <mat-label>Sonarr Quality Profile</mat-label>
<mat-select [(ngModel)]="user.userQualityProfiles.sonarrQualityProfile"> <mat-select [(ngModel)]="user.userQualityProfiles.sonarrQualityProfile">
@ -151,25 +103,58 @@
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
</div>
<div class="col-md-2 col-sm-12">
<label class="control-label"><h3>Roles</h3></label>
<div *ngIf="!edit">
<div *ngFor="let c of availableClaims">
<mat-slide-toggle [(ngModel)]="c.enabled">{{c.value | humanize}}</mat-slide-toggle>
</div>
</div>
<div *ngIf="edit">
<div *ngFor="let c of user.claims">
<mat-slide-toggle [(ngModel)]="c.enabled">{{c.value | humanize}}</mat-slide-toggle>
</div>
</div>
</div>
<div class="col-md-3 col-sm-12">
<label class="control-label"><h3>Notification Preferences</h3></label>
<div *ngFor="let pref of notificationPreferences">
<div> <div>
<button mat-button matStepperPrevious>Back</button> <mat-form-field>
<button mat-button matStepperNext>Next</button> <input matInput placeholder="{{NotificationAgent[pref.agent] | humanize}}" [(ngModel)]="pref.value">
</mat-form-field>
</div>
</div>
</div> </div>
</mat-step>
<mat-step>
<ng-template matStepLabel>Actions</ng-template>
</div>
<div class="row">
<div class="col-md-3 col-sm-12">
<button *ngIf="!edit" type="button" mat-raised-button color="accent" data-test="createuserbtn" (click)="create()">Create</button> <button *ngIf="!edit" type="button" mat-raised-button color="accent" data-test="createuserbtn" (click)="create()">Create</button>
<div *ngIf="edit"> <div *ngIf="edit">
<button type="button" data-test="updatebtn" mat-raised-button color="warn" class="btn btn-primary-outline" (click)="update()">Update</button> <button type="button" data-test="updatebtn" mat-raised-button color="accent" class="btn btn-primary-outline" (click)="update()">Update</button>
<button type="button" data-test="deletebtn" mat-raised-button color="warn" class="btn btn-danger-outline" (click)="delete()">Delete</button> <button type="button" data-test="deletebtn" mat-raised-button color="warn" class="btn btn-danger-outline" (click)="delete()">Delete</button>
<button type="button" style="float:right;" mat-raised-button color="primary" class="btn btn-info-outline" (click)="resetPassword()" pTooltip="You need your SMTP settings setup">Send <button type="button" style="float:right;" mat-raised-button color="primary" class="btn btn-info-outline" (click)="resetPassword()" pTooltip="You need your SMTP settings setup">Send
Reset Password Link</button> Reset Password Link</button>
</div> </div>
</mat-step>
</mat-horizontal-stepper> </div>
<div class="col-md-1 offset-md-8 col-sm-12">
<button type="button" mat-raised-button color="warn" (click)="back()">Back</button>
</div>
</div>
</div> </div>

@ -1,8 +1,9 @@
import { Component, OnInit } from "@angular/core"; import { Location } from "@angular/common";
import { Component, OnInit } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router"; import { ActivatedRoute, Router } from "@angular/router";
import { ICheckbox, INotificationAgent, INotificationPreferences, IRadarrProfile, IRadarrRootFolder, ISonarrProfile, ISonarrRootFolder, IUser, UserType } from "../interfaces"; import { ICheckbox, INotificationAgent, INotificationPreferences, IRadarrProfile, IRadarrRootFolder, ISonarrProfile, ISonarrRootFolder, IUser, UserType } from "../interfaces";
import { IdentityService, NotificationService, RadarrService, SonarrService, MessageService } from "../services"; import { IdentityService, RadarrService, SonarrService, MessageService } from "../services";
@Component({ @Component({
templateUrl: "./usermanagement-user.component.html", templateUrl: "./usermanagement-user.component.html",
@ -29,7 +30,8 @@ export class UserManagementUserComponent implements OnInit {
private router: Router, private router: Router,
private route: ActivatedRoute, private route: ActivatedRoute,
private sonarrService: SonarrService, private sonarrService: SonarrService,
private radarrService: RadarrService) { private radarrService: RadarrService,
private location: Location) {
this.route.params.subscribe((params: any) => { this.route.params.subscribe((params: any) => {
if(params.id) { if(params.id) {
@ -171,4 +173,8 @@ export class UserManagementUserComponent implements OnInit {
}); });
} }
public back() {
this.location.back();
}
} }

@ -933,7 +933,8 @@ namespace Ombi.Controllers.V1
private readonly List<NotificationAgent> _excludedAgents = new List<NotificationAgent> private readonly List<NotificationAgent> _excludedAgents = new List<NotificationAgent>
{ {
NotificationAgent.Email, NotificationAgent.Email,
NotificationAgent.Mobile NotificationAgent.Mobile,
NotificationAgent.Webhook
}; };
private async Task<List<UserNotificationPreferences>> GetPreferences(OmbiUser user) private async Task<List<UserNotificationPreferences>> GetPreferences(OmbiUser user)
{ {

Loading…
Cancel
Save