pull/3776/head
tidusjar 4 years ago
parent eb760abb53
commit 4351dd5f09

@ -67,8 +67,8 @@ export class AuthService extends ServiceHelpers {
public hasRole(role: string): boolean { public hasRole(role: string): boolean {
const claims = this.claims(); const claims = this.claims();
if (claims && claims.roles && role) { if (claims && claims.roles && role && claims.roles.length > 0) {
return claims.roles.some(r => r.toUpperCase() === role.toUpperCase()); return claims.roles.some(r => r != undefined && r.toUpperCase() === role.toUpperCase());
} }
return false; return false;
} }

@ -12,14 +12,14 @@
<mat-form-field class="dark full-width" appearance="outline"> <mat-form-field class="dark full-width" appearance="outline">
<mat-label>{{'Login.UsernamePlaceholder' | translate}}</mat-label> <mat-label>{{'Login.UsernamePlaceholder' | translate}}</mat-label>
<input type="text" matInput formControlName="username" /> <input id="username-field" type="text" matInput formControlName="username" />
<mat-error *ngIf="form.get('username').hasError('required')"> <mat-error id="username-error" *ngIf="form.get('username').hasError('required')">
{{'Login.UsernamePlaceholder' | translate}} is <strong>required</strong></mat-error> {{'Login.UsernamePlaceholder' | translate}} is <strong>required</strong></mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field class="full-width" appearance="outline"> <mat-form-field class="full-width" appearance="outline">
<mat-label>{{'Login.PasswordPlaceholder' | translate}}</mat-label> <mat-label>{{'Login.PasswordPlaceholder' | translate}}</mat-label>
<input color="black" type="password" matInput formControlName="password" /> <input id="password-field" color="black" type="password" matInput formControlName="password" />
</mat-form-field> </mat-form-field>
<mat-checkbox formControlName="rememberMe">{{'Login.RememberMe' | translate}}</mat-checkbox> <mat-checkbox formControlName="rememberMe">{{'Login.RememberMe' | translate}}</mat-checkbox>

@ -21,7 +21,7 @@
</div> </div>
</span> </span>
<a class="bottom-nav-link" mat-list-item [routerLinkActive]="getTheme()" aria-label="Toggle sidenav" (click)="logOut();"> <a id="nav-logout" class="bottom-nav-link" mat-list-item [routerLinkActive]="getTheme()" aria-label="Toggle sidenav" (click)="logOut();">
<mat-icon aria-label="Side nav toggle icon">exit_to_app</mat-icon> <mat-icon aria-label="Side nav toggle icon">exit_to_app</mat-icon>
{{ 'NavigationBar.Logout' | translate }} {{ 'NavigationBar.Logout' | translate }}
</a> </a>

@ -2,12 +2,11 @@
aria-label="Search" [ngbTypeahead]="searchModel" [resultFormatter]="formatter" [inputFormatter]="formatter" [resultTemplate]="template" (selectItem)="selected($event)"> aria-label="Search" [ngbTypeahead]="searchModel" [resultFormatter]="formatter" [inputFormatter]="formatter" [resultTemplate]="template" (selectItem)="selected($event)">
<ng-template #template let-result="result"> <ng-template #template let-result="result">
</ng-template> --> </ng-template> -->
<form [formGroup]='searchForm'> <form [formGroup]='searchForm'>
<mat-form-field floatLabel="never" style="width: 100%;"> <mat-form-field floatLabel="never" style="width: 100%;">
<input matInput placeholder="{{'NavigationBar.Search' | translate}}" [matAutocomplete]="auto" formControlName='input'> <input id="nav-search" matInput placeholder="{{'NavigationBar.Search' | translate}}" [matAutocomplete]="auto" formControlName='input'>
</mat-form-field> </mat-form-field>
<mat-autocomplete #auto="matAutocomplete" (optionSelected)="selected($event)" [displayWith]="displayFn"> <mat-autocomplete #auto="matAutocomplete" (optionSelected)="selected($event)" [displayWith]="displayFn">

@ -61,7 +61,7 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<div class="md-form-field" style="display:inline;margin-left:20px;"> <div class="md-form-field" style="display:inline;margin-left:20px;">
<button mat-raised-button (click)="getProfiles(form)" color="primary">Load Profiles <span <button mat-raised-button type="button" (click)="getProfiles(form)" color="primary">Load Profiles <span
*ngIf="profilesRunning" class="fa fa-spinner fa-spin"></span></button> *ngIf="profilesRunning" class="fa fa-spinner fa-spin"></span></button>
</div> </div>
</div> </div>
@ -76,7 +76,7 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<div class="md-form-field" style="display:inline;margin-left:20px;"> <div class="md-form-field" style="display:inline;margin-left:20px;">
<button mat-raised-button (click)="getRootFolders(form)" color="primary">Load Root Folders <span <button mat-raised-button type="button" (click)="getRootFolders(form)" color="primary">Load Root Folders <span
*ngIf="rootFoldersRunning" class="fa fa-spinner fa-spin"></span></button> *ngIf="rootFoldersRunning" class="fa fa-spinner fa-spin"></span></button>
</div> </div>
</div> </div>
@ -91,7 +91,7 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<div class="md-form-field" style="display:inline;margin-left:20px;"> <div class="md-form-field" style="display:inline;margin-left:20px;">
<button mat-raised-button (click)="getMetadataProfiles(form)" color="primary">Load Metadata <span <button mat-raised-button type="button" (click)="getMetadataProfiles(form)" color="primary">Load Metadata <span
*ngIf="metadataRunning" class="fa fa-spinner fa-spin"></span></button></div> *ngIf="metadataRunning" class="fa fa-spinner fa-spin"></span></button></div>
</div> </div>

@ -35,7 +35,7 @@ export class LidarrComponent implements OnInit {
this.form = this.fb.group({ this.form = this.fb.group({
enabled: [x.enabled], enabled: [x.enabled],
apiKey: [x.apiKey, [Validators.required]], apiKey: [x.apiKey, [Validators.required]],
defaultQualityProfile: [x.defaultQualityProfile, [Validators.required]], defaultQualityProfile: [+x.defaultQualityProfile, [Validators.required]],
defaultRootPath: [x.defaultRootPath, [Validators.required]], defaultRootPath: [x.defaultRootPath, [Validators.required]],
ssl: [x.ssl], ssl: [x.ssl],
subDir: [x.subDir], subDir: [x.subDir],
@ -45,6 +45,15 @@ export class LidarrComponent implements OnInit {
metadataProfileId: [x.metadataProfileId, [Validators.required]], metadataProfileId: [x.metadataProfileId, [Validators.required]],
addOnly: [x.addOnly], addOnly: [x.addOnly],
}); });
this.qualities = [];
this.qualities.push({ name: "Please Select", id: -1 });
this.rootFolders = [];
this.rootFolders.push({ path: "Please Select", id: -1 });
this.metadataProfiles = [];
this.metadataProfiles.push({ name: "Please Select", id: -1 });
if (x.defaultQualityProfile) { if (x.defaultQualityProfile) {
this.getProfiles(this.form); this.getProfiles(this.form);
@ -56,15 +65,6 @@ export class LidarrComponent implements OnInit {
this.getMetadataProfiles(this.form); this.getMetadataProfiles(this.form);
} }
}); });
this.qualities = [];
this.qualities.push({ name: "Please Select", id: -1 });
this.rootFolders = [];
this.rootFolders.push({ path: "Please Select", id: -1 });
this.metadataProfiles = [];
this.metadataProfiles.push({ name: "Please Select", id: -1 });
} }
public getProfiles(form: FormGroup) { public getProfiles(form: FormGroup) {

Loading…
Cancel
Save