From 4c99acef75a47fd77c87535b3da25643c8768a09 Mon Sep 17 00:00:00 2001 From: TidusJar Date: Fri, 27 Jul 2018 16:20:44 +0100 Subject: [PATCH] linting !wip --- src/Ombi/ClientApp/app/app.component.ts | 14 ++-- src/Ombi/ClientApp/app/auth/auth.service.ts | 10 +-- .../ClientApp/app/auth/cookie.component.ts | 2 +- .../app/interfaces/IRecentlyAdded.ts | 2 +- .../app/issues/issueDetails.component.ts | 14 ++-- .../ClientApp/app/issues/issues.component.ts | 5 +- .../app/issues/issuestable.component.ts | 4 +- .../ClientApp/app/login/login.component.ts | 30 ++++---- .../app/login/loginoauth.component.ts | 8 +- .../app/login/resetpassword.component.ts | 2 +- .../recentlyAdded/recentlyAdded.component.ts | 24 +++--- .../requests/tvrequest-children.component.ts | 10 +-- .../app/search/moviesearch.component.ts | 2 +- .../app/search/moviesearchgrid.component.ts | 1 - .../services/applications/plextv.service.ts | 7 +- .../app/services/identity.service.ts | 2 +- .../customization/customization.component.ts | 16 ++-- .../usermanagement.component.ts | 34 ++++----- .../app/wizard/emby/emby.component.ts | 6 +- .../app/wizard/plex/plex.component.ts | 38 +++++----- .../app/wizard/plex/plexoauth.component.ts | 73 +++++++++---------- src/Ombi/tslint.json | 14 ++-- 22 files changed, 155 insertions(+), 163 deletions(-) diff --git a/src/Ombi/ClientApp/app/app.component.ts b/src/Ombi/ClientApp/app/app.component.ts index 182f49226..16d8b21d6 100644 --- a/src/Ombi/ClientApp/app/app.component.ts +++ b/src/Ombi/ClientApp/app/app.component.ts @@ -33,17 +33,17 @@ export class AppComponent implements OnInit { private readonly jobService: JobService, public readonly translate: TranslateService, private readonly identityService: IdentityService, - private readonly platformLocation: PlatformLocation) { + private readonly platformLocation: PlatformLocation) { - const base = this.platformLocation.getBaseHrefFromDOM(); + const base = this.platformLocation.getBaseHrefFromDOM(); if (base.length > 1) { __webpack_public_path__ = base + "/dist/"; } - - this.translate.addLangs(["en", "de", "fr","da","es","it","nl","sv","no"]); + + this.translate.addLangs(["en", "de", "fr", "da", "es", "it", "nl", "sv", "no"]); // this language will be used as a fallback when a translation isn't found in the current language this.translate.setDefaultLang("en"); - + // See if we can match the supported langs with the current browser lang const browserLang: string = translate.getBrowserLang(); this.translate.use(browserLang.match(/en|fr|da|de|es|it|nl|sv|no/) ? browserLang : "en"); @@ -88,8 +88,8 @@ export class AppComponent implements OnInit { public openMobileApp(event: any) { event.preventDefault(); - if(!this.customizationSettings.applicationUrl) { - this.notificationService.warning("Mobile","Please ask your admin to setup the Application URL!"); + if (!this.customizationSettings.applicationUrl) { + this.notificationService.warning("Mobile", "Please ask your admin to setup the Application URL!"); return; } diff --git a/src/Ombi/ClientApp/app/auth/auth.service.ts b/src/Ombi/ClientApp/app/auth/auth.service.ts index f22b4d4ad..2115b2516 100644 --- a/src/Ombi/ClientApp/app/auth/auth.service.ts +++ b/src/Ombi/ClientApp/app/auth/auth.service.ts @@ -26,13 +26,13 @@ export class AuthService extends ServiceHelpers { return this.http.post(`${this.url}/requirePassword`, JSON.stringify(login), {headers: this.headers}); } - public loggedIn() { + public loggedIn() { const token: string = this.jwtHelperService.tokenGetter(); - + if (!token) { return false; } - + const tokenExpired: boolean = this.jwtHelperService.isTokenExpired(token); return !tokenExpired; } @@ -53,9 +53,9 @@ export class AuthService extends ServiceHelpers { } else { u.roles.push(roles); } - return u; + return u; } - return {}; + return { }; } public hasRole(role: string): boolean { diff --git a/src/Ombi/ClientApp/app/auth/cookie.component.ts b/src/Ombi/ClientApp/app/auth/cookie.component.ts index eed8721f7..21b61b37e 100644 --- a/src/Ombi/ClientApp/app/auth/cookie.component.ts +++ b/src/Ombi/ClientApp/app/auth/cookie.component.ts @@ -11,7 +11,7 @@ export class CookieComponent implements OnInit { public ngOnInit() { const cookie = this.cookieService.getAll(); - if(cookie.Auth) { + if (cookie.Auth) { const jwtVal = cookie.Auth; localStorage.setItem("id_token", jwtVal); this.router.navigate(["search"]); diff --git a/src/Ombi/ClientApp/app/interfaces/IRecentlyAdded.ts b/src/Ombi/ClientApp/app/interfaces/IRecentlyAdded.ts index e3b62b333..fc358eb0d 100644 --- a/src/Ombi/ClientApp/app/interfaces/IRecentlyAdded.ts +++ b/src/Ombi/ClientApp/app/interfaces/IRecentlyAdded.ts @@ -20,7 +20,7 @@ export interface IRecentlyAddedTvShows extends IRecentlyAddedMovies { export interface IRecentlyAddedRangeModel { from: Date; - to: Date; + to: Date; } export enum RecentlyAddedType { diff --git a/src/Ombi/ClientApp/app/issues/issueDetails.component.ts b/src/Ombi/ClientApp/app/issues/issueDetails.component.ts index a00f4e89b..109823067 100644 --- a/src/Ombi/ClientApp/app/issues/issueDetails.component.ts +++ b/src/Ombi/ClientApp/app/issues/issueDetails.component.ts @@ -37,10 +37,10 @@ export class IssueDetailsComponent implements OnInit { private notificationService: NotificationService, private imageService: ImageService, private sanitizer: DomSanitizer, - private readonly platformLocation: PlatformLocation) { + private readonly platformLocation: PlatformLocation) { this.route.params .subscribe((params: any) => { - this.issueId = parseInt(params.id); + this.issueId = parseInt(params.id); }); this.isAdmin = this.authService.hasRole("Admin") || this.authService.hasRole("PowerUser"); @@ -53,8 +53,8 @@ export class IssueDetailsComponent implements OnInit { this.defaultPoster = "../../../images/"; } } - - public ngOnInit() { + + public ngOnInit() { this.issueService.getIssue(this.issueId).subscribe(x => { this.issue = { comments: x.comments, @@ -63,8 +63,8 @@ export class IssueDetailsComponent implements OnInit { issueCategoryId: x.issueCategoryId, subject: x.subject, description: x.description, - status:x.status, - resolvedDate:x.resolvedDate, + status: x.status, + resolvedDate: x.resolvedDate, title: x.title, requestType: x.requestType, requestId: x.requestId, @@ -117,7 +117,7 @@ export class IssueDetailsComponent implements OnInit { } else { this.imageService.getTvBackground(Number(issue.providerId)).subscribe(x => { - if(x) { + if (x) { this.backgroundPath = this.sanitizer.bypassSecurityTrustStyle ("url(" + x + ")"); } diff --git a/src/Ombi/ClientApp/app/issues/issues.component.ts b/src/Ombi/ClientApp/app/issues/issues.component.ts index 904c75a0e..55e4fe9be 100644 --- a/src/Ombi/ClientApp/app/issues/issues.component.ts +++ b/src/Ombi/ClientApp/app/issues/issues.component.ts @@ -22,8 +22,8 @@ export class IssuesComponent implements OnInit { constructor(private issueService: IssuesService) { } - public ngOnInit() { - this.getPending(); + public ngOnInit() { + this.getPending(); this.getInProg(); this.getResolved(); this.issueService.getIssuesCount().subscribe(x => this.count = x); @@ -61,5 +61,4 @@ export class IssuesComponent implements OnInit { this.resolvedIssues = x; }); } - } diff --git a/src/Ombi/ClientApp/app/issues/issuestable.component.ts b/src/Ombi/ClientApp/app/issues/issuestable.component.ts index f03dd9a6d..5df8a35bd 100644 --- a/src/Ombi/ClientApp/app/issues/issuestable.component.ts +++ b/src/Ombi/ClientApp/app/issues/issuestable.component.ts @@ -11,7 +11,7 @@ export class IssuesTableComponent { @Input() public issues: IIssues[]; @Input() public totalRecords: number; - @Output() public changePage = new EventEmitter(); + @Output() public changePage = new EventEmitter(); public IssueStatus = IssueStatus; @@ -47,7 +47,7 @@ export class IssuesTableComponent { //event.rows = Number of rows to display in new page //event.page = Index of the new page //event.pageCount = Total number of pages - + this.changePage.emit(event); } diff --git a/src/Ombi/ClientApp/app/login/login.component.ts b/src/Ombi/ClientApp/app/login/login.component.ts index 7a2a605ce..349c1600e 100644 --- a/src/Ombi/ClientApp/app/login/login.component.ts +++ b/src/Ombi/ClientApp/app/login/login.component.ts @@ -30,9 +30,9 @@ export class LoginComponent implements OnDestroy, OnInit { public landingFlag: boolean; public baseUrl: string; public loginWithOmbi: boolean; - + public get appName(): string { - if(this.customizationSettings.applicationName) { + if (this.customizationSettings.applicationName) { return this.customizationSettings.applicationName; } else { return "Ombi"; @@ -41,7 +41,7 @@ export class LoginComponent implements OnDestroy, OnInit { private timer: any; private clientId: string; - + private errorBody: string; private errorValidation: string; @@ -72,7 +72,7 @@ export class LoginComponent implements OnDestroy, OnInit { } }); - if(authService.loggedIn()) { + if (authService.loggedIn()) { this.router.navigate(["search"]); } } @@ -103,9 +103,9 @@ export class LoginComponent implements OnDestroy, OnInit { return; } const value = form.value; - const user = { password: value.password, username: value.username, rememberMe: value.rememberMe, usePlexOAuth: false, plexTvPin: { id: 0, code: ""} }; + const user = { password: value.password, username: value.username, rememberMe: value.rememberMe, usePlexOAuth: false, plexTvPin: { id: 0, code: "" } }; this.authService.requiresPassword(user).subscribe(x => { - if(x && this.authenticationSettings.allowNoPassword) { + if (x && this.authenticationSettings.allowNoPassword) { // Looks like this user requires a password this.authenticationSettings.allowNoPassword = false; return; @@ -125,9 +125,9 @@ export class LoginComponent implements OnDestroy, OnInit { } public oauth() { - this.plexTv.GetPin(this.clientId, this.appName).subscribe(pin => { + this.plexTv.GetPin(this.clientId, this.appName).subscribe((pin: any) => { - this.authService.login({usePlexOAuth: true, password:"",rememberMe:true,username:"", plexTvPin: pin}).subscribe(x => { + this.authService.login({ usePlexOAuth: true, password: "", rememberMe: true, username: "", plexTvPin: pin }).subscribe(x => { if (window.frameElement) { // in frame window.open(x.url, "_blank"); @@ -144,12 +144,12 @@ export class LoginComponent implements OnDestroy, OnInit { } private cycleBackground() { - this.images.getRandomBackground().subscribe(x => { - this.background = ""; - }); - this.images.getRandomBackground().subscribe(x => { - this.background = this.sanitizer - .bypassSecurityTrustStyle("linear-gradient(-10deg, transparent 20%, rgba(0,0,0,0.7) 20.0%, rgba(0,0,0,0.7) 80.0%, transparent 80%), url(" + x.url + ")"); - }); + this.images.getRandomBackground().subscribe(x => { + this.background = ""; + }); + this.images.getRandomBackground().subscribe(x => { + this.background = this.sanitizer + .bypassSecurityTrustStyle("linear-gradient(-10deg, transparent 20%, rgba(0,0,0,0.7) 20.0%, rgba(0,0,0,0.7) 80.0%, transparent 80%), url(" + x.url + ")"); + }); } } diff --git a/src/Ombi/ClientApp/app/login/loginoauth.component.ts b/src/Ombi/ClientApp/app/login/loginoauth.component.ts index 21b591399..18f90be5f 100644 --- a/src/Ombi/ClientApp/app/login/loginoauth.component.ts +++ b/src/Ombi/ClientApp/app/login/loginoauth.component.ts @@ -16,7 +16,6 @@ export class LoginOAuthComponent implements OnInit { this.route.params .subscribe((params: any) => { this.pin = params.pin; - }); } @@ -26,21 +25,20 @@ export class LoginOAuthComponent implements OnInit { public auth() { this.authService.oAuth(this.pin).subscribe(x => { - if(x.access_token) { + if (x.access_token) { localStorage.setItem("id_token", x.access_token); if (this.authService.loggedIn()) { this.router.navigate(["search"]); return; - } + } } - if(x.errorMessage) { + if (x.errorMessage) { this.error = x.errorMessage; } }, err => { this.notify.error(err.statusText); - this.router.navigate(["login"]); }); } diff --git a/src/Ombi/ClientApp/app/login/resetpassword.component.ts b/src/Ombi/ClientApp/app/login/resetpassword.component.ts index 3a2f7d94a..2203b95b9 100644 --- a/src/Ombi/ClientApp/app/login/resetpassword.component.ts +++ b/src/Ombi/ClientApp/app/login/resetpassword.component.ts @@ -4,7 +4,7 @@ import { FormBuilder, FormGroup, Validators } from "@angular/forms"; import { DomSanitizer } from "@angular/platform-browser"; import { ICustomizationSettings } from "../interfaces"; -import { IdentityService, ImageService,NotificationService, SettingsService } from "../services"; +import { IdentityService, ImageService, NotificationService, SettingsService } from "../services"; @Component({ templateUrl: "./resetpassword.component.html", diff --git a/src/Ombi/ClientApp/app/recentlyAdded/recentlyAdded.component.ts b/src/Ombi/ClientApp/app/recentlyAdded/recentlyAdded.component.ts index bd34c9851..303e530e1 100644 --- a/src/Ombi/ClientApp/app/recentlyAdded/recentlyAdded.component.ts +++ b/src/Ombi/ClientApp/app/recentlyAdded/recentlyAdded.component.ts @@ -41,13 +41,13 @@ export class RecentlyAddedComponent implements OnInit { public range: Date[]; public groupTv: boolean = false; - + // https://github.com/sheikalthaf/ngu-carousel public carouselTile: NguCarouselConfig; - + constructor(private recentlyAddedService: RecentlyAddedService, private imageService: ImageService) {} - + public ngOnInit() { this.getMovies(); this.getShows(); @@ -67,10 +67,10 @@ export class RecentlyAddedComponent implements OnInit { } public close() { - if(this.range.length < 2) { + if (this.range.length < 2) { return; } - if(!this.range[1]) { + if (!this.range[1]) { // If we do not have a second date then just set it to now this.range[1] = new Date(); } @@ -82,13 +82,13 @@ export class RecentlyAddedComponent implements OnInit { } private getShows() { - if(this.groupTv) { + if (this.groupTv) { this.recentlyAddedService.getRecentlyAddedTvGrouped().subscribe(x => { this.tv = x; - + this.tv.forEach((t) => { this.imageService.getTvPoster(t.tvDbId).subscribe(p => { - if(p) { + if (p) { t.posterPath = p; } }); @@ -97,10 +97,10 @@ export class RecentlyAddedComponent implements OnInit { } else { this.recentlyAddedService.getRecentlyAddedTv().subscribe(x => { this.tv = x; - + this.tv.forEach((t) => { this.imageService.getTvPoster(t.tvDbId).subscribe(p => { - if(p) { + if (p) { t.posterPath = p; } }); @@ -114,11 +114,11 @@ export class RecentlyAddedComponent implements OnInit { this.movies = x; this.movies.forEach((movie) => { - if(movie.theMovieDbId) { + if (movie.theMovieDbId) { this.imageService.getMoviePoster(movie.theMovieDbId).subscribe(p => { movie.posterPath = p; }); - } else if(movie.imdbId) { + } else if (movie.imdbId) { this.imageService.getMoviePoster(movie.imdbId).subscribe(p => { movie.posterPath = p; }); diff --git a/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts index 4a10dc937..19e941e9d 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts +++ b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts @@ -4,7 +4,7 @@ import { IChildRequests } from "../interfaces"; import { NotificationService, RequestService } from "../services"; @Component({ - selector:"tvrequests-children", + selector: "tvrequests-children", templateUrl: "./tvrequest-children.component.html", }) export class TvRequestChildrenComponent { @@ -21,17 +21,17 @@ export class TvRequestChildrenComponent { .subscribe(x => { this.removeRequestFromUi(request); this.requestDeleted.emit(request.id); - }); + }); } public changeAvailability(request: IChildRequests, available: boolean) { request.available = available; - request.seasonRequests.forEach((season)=> { - season.episodes.forEach((ep)=> { + request.seasonRequests.forEach((season) => { + season.episodes.forEach((ep) => { ep.available = available; }); }); - if(available) { + if (available) { this.requestService.markTvAvailable({ id: request.id }).subscribe(x => { if (x.result) { this.notificationService.success( diff --git a/src/Ombi/ClientApp/app/search/moviesearch.component.ts b/src/Ombi/ClientApp/app/search/moviesearch.component.ts index 9bb074b34..775a2c6c4 100644 --- a/src/Ombi/ClientApp/app/search/moviesearch.component.ts +++ b/src/Ombi/ClientApp/app/search/moviesearch.component.ts @@ -68,7 +68,7 @@ export class MovieSearchComponent implements OnInit { message: "", result: false, errorMessage: "", - }; + }; this.popularMovies(); } diff --git a/src/Ombi/ClientApp/app/search/moviesearchgrid.component.ts b/src/Ombi/ClientApp/app/search/moviesearchgrid.component.ts index 00a782096..5bde79f6e 100644 --- a/src/Ombi/ClientApp/app/search/moviesearchgrid.component.ts +++ b/src/Ombi/ClientApp/app/search/moviesearchgrid.component.ts @@ -155,7 +155,6 @@ export class MovieSearchGridComponent implements OnInit { this.movieResultGrid.push(container); container = { movies: [] }; } else { - container.movies.push(movie); } }); diff --git a/src/Ombi/ClientApp/app/services/applications/plextv.service.ts b/src/Ombi/ClientApp/app/services/applications/plextv.service.ts index 58a756007..03a49e90c 100644 --- a/src/Ombi/ClientApp/app/services/applications/plextv.service.ts +++ b/src/Ombi/ClientApp/app/services/applications/plextv.service.ts @@ -2,19 +2,18 @@ import { HttpClient, HttpHeaders } from "@angular/common/http"; import { Injectable } from "@angular/core"; -import { Observable } from "rxjs/Rx"; +import { Observable } from "rxjs"; import { IPlexPin } from "../../interfaces"; @Injectable() export class PlexTvService { - + constructor(private http: HttpClient, public platformLocation: PlatformLocation) { - } public GetPin(clientId: string, applicationName: string): Observable { - const headers = new HttpHeaders({"Content-Type":"application/json", + const headers = new HttpHeaders({"Content-Type": "application/json", "X-Plex-Client-Identifier": clientId, "X-Plex-Product": applicationName, "X-Plex-Version": "3", diff --git a/src/Ombi/ClientApp/app/services/identity.service.ts b/src/Ombi/ClientApp/app/services/identity.service.ts index 736a9856d..16ea58fb2 100644 --- a/src/Ombi/ClientApp/app/services/identity.service.ts +++ b/src/Ombi/ClientApp/app/services/identity.service.ts @@ -19,7 +19,7 @@ export class IdentityService extends ServiceHelpers { public getUser(): Observable { return this.http.get(this.url, {headers: this.headers}); } - + public getAccessToken(): Observable { return this.http.get(`${this.url}accesstoken`, {headers: this.headers}); } diff --git a/src/Ombi/ClientApp/app/settings/customization/customization.component.ts b/src/Ombi/ClientApp/app/settings/customization/customization.component.ts index 77e9a16bd..098a6f5cc 100644 --- a/src/Ombi/ClientApp/app/settings/customization/customization.component.ts +++ b/src/Ombi/ClientApp/app/settings/customization/customization.component.ts @@ -25,13 +25,13 @@ export class CustomizationComponent implements OnInit { return item.fullName === this.settings.presetThemeName; })[0]; - if(existingTheme) { + if (existingTheme) { const index = this.themes.indexOf(existingTheme, 0); if (index > -1) { this.themes.splice(index, 1); } } - if(x.hasPresetTheme) { + if (x.hasPresetTheme) { this.themes.unshift({displayName: x.presetThemeDisplayName, fullName: x.presetThemeName, url: existingTheme.url, version: x.presetThemeVersion}); this.themes.unshift({displayName: "None", fullName: "None", url: "", version: ""}); } else { @@ -45,8 +45,8 @@ export class CustomizationComponent implements OnInit { public save() { this.settingsService.verifyUrl(this.settings.applicationUrl).subscribe(x => { - if(this.settings.applicationUrl) { - if(!x) { + if (this.settings.applicationUrl) { + if (!x) { this.notificationService.error(`The URL "${this.settings.applicationUrl}" is not valid. Please format it correctly e.g. http://www.google.com/`); return; } @@ -64,16 +64,16 @@ export class CustomizationComponent implements OnInit { } public dropDownChange(event: any): void { - const selectedThemeFullName = event.target.value; + const selectedThemeFullName = event.target.value; const selectedTheme = this.themes.filter((val) => { return val.fullName === selectedThemeFullName; })[0]; - if(selectedTheme.fullName === this.settings.presetThemeName) { + if (selectedTheme.fullName === this.settings.presetThemeName) { return; } - - if(selectedTheme.fullName === "None" || selectedTheme.fullName === "-1") { + + if (selectedTheme.fullName === "None" || selectedTheme.fullName === "-1") { this.settings.presetThemeName = ""; this.settings.presetThemeContent = ""; return; diff --git a/src/Ombi/ClientApp/app/usermanagement/usermanagement.component.ts b/src/Ombi/ClientApp/app/usermanagement/usermanagement.component.ts index 1e1109ea4..f77967c9d 100644 --- a/src/Ombi/ClientApp/app/usermanagement/usermanagement.component.ts +++ b/src/Ombi/ClientApp/app/usermanagement/usermanagement.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from "@angular/core"; -import { ICheckbox, ICustomizationSettings, IEmailNotificationSettings,IUser } from "../interfaces"; +import { ICheckbox, ICustomizationSettings, IEmailNotificationSettings, IUser } from "../interfaces"; import { IdentityService, NotificationService, SettingsService } from "../services"; @Component({ @@ -10,7 +10,7 @@ export class UserManagementComponent implements OnInit { public users: IUser[]; public checkAll = false; - public emailSettings: IEmailNotificationSettings; + public emailSettings: IEmailNotificationSettings; public customizationSettings: ICustomizationSettings; public order: string = "userName"; @@ -21,9 +21,9 @@ export class UserManagementComponent implements OnInit { public bulkMovieLimit?: number; public bulkEpisodeLimit?: number; - constructor(private readonly identityService: IdentityService, - private readonly settingsService: SettingsService, - private readonly notificationService: NotificationService) { } + constructor(private identityService: IdentityService, + private settingsService: SettingsService, + private notificationService: NotificationService) { } public ngOnInit() { this.users = []; @@ -37,7 +37,7 @@ export class UserManagementComponent implements OnInit { } public welcomeEmail(user: IUser) { - if(!user.emailAddress) { + if (!user.emailAddress) { this.notificationService.error("The user needs an email address."); return; } @@ -45,13 +45,13 @@ export class UserManagementComponent implements OnInit { this.notificationService.error("Email Notifications are not setup, cannot send welcome email"); return; } - if(!this.emailSettings.notificationTemplates.some(x => { + if (!this.emailSettings.notificationTemplates.some(x => { return x.enabled && x.notificationType === 8; })) { this.notificationService.error("The Welcome Email template is not enabled in the Email Setings"); return; } - this.identityService.sendWelcomeEmail(user).subscribe(); + this.identityService.sendWelcomeEmail(user).subscribe(); this.notificationService.success(`Sent a welcome email to ${user.emailAddress}`); } @@ -74,31 +74,31 @@ export class UserManagementComponent implements OnInit { }); this.users.forEach(x => { - if(!x.checked) { + if (!x.checked) { return; } - if(anyRoles) { + if (anyRoles) { x.claims = this.availableClaims; } - if(this.bulkEpisodeLimit) { + if (this.bulkEpisodeLimit) { x.episodeRequestLimit = this.bulkEpisodeLimit; } - if(this.bulkMovieLimit) { + if (this.bulkMovieLimit) { x.movieRequestLimit = this.bulkMovieLimit; } this.identityService.updateUser(x).subscribe(y => { - if(!y.successful) { + if (!y.successful) { this.notificationService.error(`Could not update user ${x.userName}. Reason ${y.errors[0]}`); } }); }); - + this.notificationService.success(`Updated users`); this.showBulkEdit = false; this.bulkMovieLimit = undefined; this.bulkEpisodeLimit = undefined; } - + public setOrder(value: string, el: any) { el = el.toElement || el.relatedTarget || el.target || el.srcElement; @@ -115,7 +115,7 @@ export class UserManagementComponent implements OnInit { previousFilter.className = ""; el.className = "active"; } - + this.order = value; - } + } } diff --git a/src/Ombi/ClientApp/app/wizard/emby/emby.component.ts b/src/Ombi/ClientApp/app/wizard/emby/emby.component.ts index bb5d19e75..cbb0df38b 100644 --- a/src/Ombi/ClientApp/app/wizard/emby/emby.component.ts +++ b/src/Ombi/ClientApp/app/wizard/emby/emby.component.ts @@ -14,14 +14,14 @@ export class EmbyComponent implements OnInit { public embySettings: IEmbySettings; constructor(private embyService: EmbyService, - private router: Router, - private notificationService: NotificationService) { + private router: Router, + private notificationService: NotificationService) { } public ngOnInit() { this.embySettings = { servers: [], - id:0, + id: 0, enable: true, }; this.embySettings.servers.push({ diff --git a/src/Ombi/ClientApp/app/wizard/plex/plex.component.ts b/src/Ombi/ClientApp/app/wizard/plex/plex.component.ts index 81b5db0b4..dfb852d45 100644 --- a/src/Ombi/ClientApp/app/wizard/plex/plex.component.ts +++ b/src/Ombi/ClientApp/app/wizard/plex/plex.component.ts @@ -15,9 +15,9 @@ export class PlexComponent implements OnInit { private clientId: string; constructor(private plexService: PlexService, private router: Router, - private notificationService: NotificationService, - private identityService: IdentityService, private plexTv: PlexTvService, - private settingsService: SettingsService) { } + private notificationService: NotificationService, + private identityService: IdentityService, private plexTv: PlexTvService, + private settingsService: SettingsService) { } public ngOnInit(): void { this.settingsService.getClientId().subscribe(x => this.clientId = x); @@ -29,27 +29,27 @@ export class PlexComponent implements OnInit { this.notificationService.error("Username or password was incorrect. Could not authenticate with Plex."); return; } - + this.identityService.createWizardUser({ - username: "", - password: "", - usePlexAdminAccount: true, - }).subscribe(y => { - if (y) { - this.router.navigate(["login"]); - } else { - this.notificationService.error("Could not get the Plex Admin Information"); - return; - } - }); - }, + username: "", + password: "", + usePlexAdminAccount: true, + }).subscribe(y => { + if (y) { + this.router.navigate(["login"]); + } else { + this.notificationService.error("Could not get the Plex Admin Information"); + return; + } + }); + } ); } public oauth() { - this.plexTv.GetPin(this.clientId, "Ombi").subscribe(pin => { - this.plexService.oAuth({wizard: true, pin}).subscribe(x => { - if(x.url) { + this.plexTv.GetPin(this.clientId, "Ombi").subscribe((pin: any) => { + this.plexService.oAuth({ wizard: true, pin }).subscribe(x => { + if (x.url) { window.location.href = x.url; } }); diff --git a/src/Ombi/ClientApp/app/wizard/plex/plexoauth.component.ts b/src/Ombi/ClientApp/app/wizard/plex/plexoauth.component.ts index 25517541c..75ed2630c 100644 --- a/src/Ombi/ClientApp/app/wizard/plex/plexoauth.component.ts +++ b/src/Ombi/ClientApp/app/wizard/plex/plexoauth.component.ts @@ -11,57 +11,54 @@ export class PlexOAuthComponent implements OnInit { public pinId: number; constructor(private route: ActivatedRoute, - private plexOauth: PlexOAuthService, - private identityService: IdentityService, - private settings: SettingsService, - private router: Router, - private auth: AuthService) { + private plexOauth: PlexOAuthService, + private identityService: IdentityService, + private settings: SettingsService, + private router: Router, + private auth: AuthService) { this.route.params .subscribe((params: any) => { this.pinId = params.pin; }); } - + public ngOnInit(): void { this.plexOauth.oAuth(this.pinId).subscribe(x => { - if(!x.accessToken) { + if (!x.accessToken) { return; // RETURN } - + this.identityService.createWizardUser({ - username: "", - password: "", - usePlexAdminAccount: true, - }).subscribe(u => { - if (u) { - this.auth.oAuth(this.pinId).subscribe(c => { - localStorage.setItem("id_token", c.access_token); - - // Mark that we have done the settings now - this.settings.getOmbi().subscribe(ombi => { - ombi.wizard = true; - - this.settings.saveOmbi(ombi).subscribe(s => { - this.settings.getUserManagementSettings().subscribe(usr => { - - usr.importPlexAdmin = true; - this.settings.saveUserManagementSettings(usr).subscribe(saved => { - this.router.navigate(["login"]); - }); - }); - - }); - }); - }); - } else { - //this.notificationService.error("Could not get the Plex Admin Information"); - return; - } + username: "", + password: "", + usePlexAdminAccount: true, + }).subscribe(u => { + if (u) { + this.auth.oAuth(this.pinId).subscribe(c => { + localStorage.setItem("id_token", c.access_token); + + // Mark that we have done the settings now + this.settings.getOmbi().subscribe(ombi => { + ombi.wizard = true; + + this.settings.saveOmbi(ombi).subscribe(s => { + this.settings.getUserManagementSettings().subscribe(usr => { + + usr.importPlexAdmin = true; + this.settings.saveUserManagementSettings(usr).subscribe(saved => { + this.router.navigate(["login"]); + }); + }); + }); + }); }); - + } else { + //this.notificationService.error("Could not get the Plex Admin Information"); + return; + } + }); }); } - } diff --git a/src/Ombi/tslint.json b/src/Ombi/tslint.json index 73a2ee413..4187aedf5 100644 --- a/src/Ombi/tslint.json +++ b/src/Ombi/tslint.json @@ -8,7 +8,7 @@ ], "max-line-length": [ true, - 200 + 250 ], "arrow-parens": false, "radix": false, @@ -16,22 +16,22 @@ "indent": [ false ], - "whitespace": [ - false - ], "no-unused-expression": [ true, "allow-new" ], - "no-trailing-whitespace": [ - false - ], "max-classes-per-file": [ false ], "no-shadowed-variable": false, "comment-format": [ false + ], + "no-namespace": [ + false + ], + "no-internal-module": [ + false ] } } \ No newline at end of file