linting !wip

pull/2411/head
TidusJar 6 years ago
parent 9bc95d9ebb
commit 4c99acef75

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

@ -26,13 +26,13 @@ export class AuthService extends ServiceHelpers {
return this.http.post<boolean>(`${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 <ILocalUser>u;
return <ILocalUser> u;
}
return <ILocalUser>{};
return <ILocalUser> { };
}
public hasRole(role: string): boolean {

@ -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"]);

@ -20,7 +20,7 @@ export interface IRecentlyAddedTvShows extends IRecentlyAddedMovies {
export interface IRecentlyAddedRangeModel {
from: Date;
to: Date;
to: Date;
}
export enum RecentlyAddedType {

@ -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 + ")");
}

@ -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;
});
}
}

@ -11,7 +11,7 @@ export class IssuesTableComponent {
@Input() public issues: IIssues[];
@Input() public totalRecords: number;
@Output() public changePage = new EventEmitter<IPagenator>();
@Output() public changePage = new EventEmitter<IPagenator>();
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);
}

@ -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 + ")");
});
}
}

@ -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"]);
});
}

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

@ -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;
});

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

@ -68,7 +68,7 @@ export class MovieSearchComponent implements OnInit {
message: "",
result: false,
errorMessage: "",
};
};
this.popularMovies();
}

@ -155,7 +155,6 @@ export class MovieSearchGridComponent implements OnInit {
this.movieResultGrid.push(container);
container = <ISearchMovieResultContainer>{ movies: [] };
} else {
container.movies.push(movie);
}
});

@ -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<IPlexPin> {
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",

@ -19,7 +19,7 @@ export class IdentityService extends ServiceHelpers {
public getUser(): Observable<IUser> {
return this.http.get<IUser>(this.url, {headers: this.headers});
}
public getAccessToken(): Observable<string> {
return this.http.get<string>(`${this.url}accesstoken`, {headers: this.headers});
}

@ -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 = <string>event.target.value;
const selectedThemeFullName = <string> 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;

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

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

@ -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;
}
});

@ -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;
}
});
});
}
}

@ -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
]
}
}
Loading…
Cancel
Save