diff --git a/build.cake b/build.cake index e41ca916f..f7847c94c 100644 --- a/build.cake +++ b/build.cake @@ -108,7 +108,7 @@ Task("SetVersionInfo") Task("NPM") .Does(() => { -var settings = new NpmInstallSettings { + var settings = new NpmInstallSettings { LogLevel = NpmLogLevel.Silent, WorkingDirectory = webProjDir, Production = true @@ -117,9 +117,21 @@ var settings = new NpmInstallSettings { NpmInstall(settings); }); +Task("TSLint") + .IsDependentOn("NPM") + .Does(() => +{ + var settings = new NpmRunScriptSettings { + WorkingDirectory = webProjDir, + ScriptName = "lint" + }; + + NpmRunScript(settings); +}); + Task("Restore") .IsDependentOn("SetVersionInfo") - .IsDependentOn("NPM") + .IsDependentOn("TSLint") .Does(() => { DotNetCoreRestore(projDir); diff --git a/src/.vscode/launch.json b/src/.vscode/launch.json deleted file mode 100644 index 22f4369cd..000000000 --- a/src/.vscode/launch.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - // Use IntelliSense to find out which attributes exist for C# debugging - // Use hover for the description of the existing attributes - // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md - "version": "0.2.0", - "configurations": [ - { - "name": ".NET Core Launch (web)", - "type": "coreclr", - "request": "launch", - "preLaunchTask": "build", - // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceRoot}/Ombi/bin/Debug/netcoreapp2.0/Ombi.dll", - "args": [], - "cwd": "${workspaceRoot}/Ombi", - "stopAtEntry": false, - "internalConsoleOptions": "openOnSessionStart", - "launchBrowser": { - "enabled": true, - "args": "http://localhost:5000", - "windows": { - "command": "cmd.exe", - "args": "/C start http://localhost:5000" - }, - "osx": { - "command": "open" - }, - "linux": { - "command": "xdg-open" - } - }, - "env": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "sourceFileMap": { - "/Views": "${workspaceRoot}/Views" - } - }, - { - "name": ".NET Core Attach", - "type": "coreclr", - "request": "attach", - "processId": "${command:pickProcess}" - } - ] -} \ No newline at end of file diff --git a/src/.vscode/settings.json b/src/.vscode/settings.json deleted file mode 100644 index a3948377f..000000000 --- a/src/.vscode/settings.json +++ /dev/null @@ -1,11 +0,0 @@ -// Place your settings in this file to overwrite default and user settings. -{ - "files.exclude": { - "**/.git": true, - "**/.svn": true, - "**/.hg": true, - "**/.DS_Store": true, - "**/*.js": {"when": "$(basename).ts"}, // Hide JS files when there is a ts file - "**/*.js.map" : true - } -} \ No newline at end of file diff --git a/src/.vscode/tasks.json b/src/.vscode/tasks.json deleted file mode 100644 index b7649bbbf..000000000 --- a/src/.vscode/tasks.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "version": "0.1.0", - "command": "dotnet", - "isShellCommand": true, - "args": [], - "tasks": [ - { - "taskName": "build", - "args": [ - "${workspaceRoot}/Ombi/Ombi.csproj" - ], - "isBuildCommand": true, - "problemMatcher": "$msCompile" - } - ] -} \ No newline at end of file diff --git a/src/.vscode/extensions.json b/src/Ombi/.vscode/extensions.json similarity index 100% rename from src/.vscode/extensions.json rename to src/Ombi/.vscode/extensions.json diff --git a/src/Ombi/.vscode/launch.json b/src/Ombi/.vscode/launch.json index 84b170821..e99135bb9 100644 --- a/src/Ombi/.vscode/launch.json +++ b/src/Ombi/.vscode/launch.json @@ -1,39 +1,46 @@ { - "version": "0.2.0", - "configurations": [ + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md + "version": "0.2.0", + "configurations": [ { - "name":".NET Core Docker Launch (web)", + "name": ".NET Core Launch (web)", "type": "coreclr", "request": "launch", - "preLaunchTask": "composeForDebug", - "cwd": "/app", - "program": "/app/Ombi.dll", - "sourceFileMap": { - "/app": "${workspaceRoot}" - }, - + "preLaunchTask": "build", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceRoot}/bin/Debug/netcoreapp2.0/Ombi.dll", + "args": [], + "cwd": "${workspaceRoot}", + "stopAtEntry": false, + "internalConsoleOptions": "openOnSessionStart", "launchBrowser": { "enabled": true, - "args": "${auto-detect-url}", + "args": "http://localhost:5000", "windows": { "command": "cmd.exe", - "args": "/C start ${auto-detect-url}" + "args": "/C start http://localhost:5000" }, "osx": { "command": "open" + }, + "linux": { + "command": "xdg-open" } }, - - "pipeTransport": { - "pipeProgram": "/bin/bash", - "pipeCwd": "${workspaceRoot}", - "pipeArgs": [ "-c", "./dockerTask.sh startDebugging" ], - "windows": { - "pipeProgram": "${env.windir}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", - "pipeCwd": "${workspaceRoot}", - "pipeArgs": [ ".\\dockerTask.ps1", "-StartDebugging" ] - } + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "sourceFileMap": { + "/Views": "${workspaceRoot}/Views" } + }, + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach", + "processId": "${command:pickProcess}" } ] } \ No newline at end of file diff --git a/src/Ombi/.vscode/settings.json b/src/Ombi/.vscode/settings.json index 741a1d169..1b0443192 100644 --- a/src/Ombi/.vscode/settings.json +++ b/src/Ombi/.vscode/settings.json @@ -1,5 +1,15 @@ { "files.associations": { "dockerfile.*": "dockerfile" + }, + "typescript.tsdk": "node_modules\\typescript\\lib", + "files.exclude": { + "**/*.js": { + "when": "$(basename).ts" + }, + "**/*.js.map": true, + "node_modules": true, + "obj": true, + "bin": true } } \ No newline at end of file diff --git a/src/Ombi/.vscode/tasks.json b/src/Ombi/.vscode/tasks.json index 2c4b21350..e45c7577c 100644 --- a/src/Ombi/.vscode/tasks.json +++ b/src/Ombi/.vscode/tasks.json @@ -1,66 +1,22 @@ { - // See https://go.microsoft.com/fwlink/?LinkId=733558 - // for the documentation about the tasks.json format "version": "0.1.0", - "windows": { - "command": "powershell", - "options": { - "cwd": "${workspaceRoot}" + "command": "dotnet", + "isShellCommand": true, + "args": [], + "tasks": [ + { + "taskName": "build", + "args": [ + "${workspaceRoot}/Ombi.csproj" + ], + "isBuildCommand": true, + "problemMatcher": "$msCompile" }, - "tasks": [ - { - "taskName": "build", - "suppressTaskName": true, - "args": ["-ExecutionPolicy", "RemoteSigned", ".\\dockerTask.ps1", "-Build", "-Environment", "debug" ], - "isBuildCommand": true, - "showOutput": "always", - "echoCommand": true - }, - { - "taskName": "compose", - "suppressTaskName": true, - "args": ["-ExecutionPolicy", "RemoteSigned", ".\\dockerTask.ps1", "-Compose", "-Environment", "debug" ], - "isBuildCommand": false, - "showOutput": "always", - "echoCommand": true - }, - { - "taskName": "composeForDebug", - "suppressTaskName": true, - "args": ["-ExecutionPolicy", "RemoteSigned", ".\\dockerTask.ps1", "-ComposeForDebug", "-Environment", "debug" ], - "isBuildCommand": false, - "showOutput": "always", - "echoCommand": true - } - ] - }, - "osx": { - "command": "/bin/bash", - "options": { - "cwd": "${workspaceRoot}" - }, - "tasks": [ - { - "taskName": "build", - "suppressTaskName": true, - "args": [ "-c", "./dockerTask.sh build debug" ], - "isBuildCommand": true, - "showOutput": "always" - }, - { - "taskName": "compose", - "suppressTaskName": true, - "args": [ "-c", "./dockerTask.sh compose debug" ], - "isBuildCommand": false, - "showOutput": "always" - }, - { - "taskName": "composeForDebug", - "suppressTaskName": true, - "args": [ "-c", "./dockerTask.sh composeForDebug debug" ], - "isBuildCommand": false, - "showOutput": "always" - } - ] - } + { + "taskName": "lint", + "command": "npm", + "isShellCommand": true, + "args": ["run", "lint"] + } + ] } \ No newline at end of file diff --git a/src/Ombi/ClientApp/app/app.component.ts b/src/Ombi/ClientApp/app/app.component.ts index 5d701e4c5..be3970ab6 100644 --- a/src/Ombi/ClientApp/app/app.component.ts +++ b/src/Ombi/ClientApp/app/app.component.ts @@ -1,28 +1,28 @@ -import { Component, OnInit } from '@angular/core'; -import { Router } from '@angular/router'; -import { NotificationService } from './services/notification.service'; -import { SettingsService } from './services/settings.service'; -import { AuthService } from './auth/auth.service'; -import { ILocalUser } from './auth/IUserLogin'; - -import { ICustomizationSettings } from './interfaces/ISettings'; +import { Component, OnInit } from "@angular/core"; +import { Router } from "@angular/router"; +import { AuthService } from "./auth/auth.service"; +import { ILocalUser } from "./auth/IUserLogin"; +import { NotificationService } from "./services"; +import { SettingsService } from "./services"; +import { ICustomizationSettings } from "./interfaces"; @Component({ - selector: 'ombi', - templateUrl: './app.component.html', - styleUrls: ['./app.component.scss'] + selector: "ombi", + templateUrl: "./app.component.html", + styleUrls: ["./app.component.scss"], }) export class AppComponent implements OnInit { - constructor(public notificationService: NotificationService, public authService: AuthService, private router: Router, private settingsService: SettingsService) { } + public customizationSettings: ICustomizationSettings; + public user: ILocalUser; + public showNav: boolean; - customizationSettings: ICustomizationSettings; - user: ILocalUser; + constructor(public notificationService: NotificationService, public authService: AuthService, private router: Router, private settingsService: SettingsService) { } - ngOnInit(): void { + public ngOnInit() { this.user = this.authService.claims(); - + this.settingsService.getCustomization().subscribe(x => this.customizationSettings = x); this.router.events.subscribe(() => { @@ -31,14 +31,12 @@ export class AppComponent implements OnInit { }); } - hasRole(role: string): boolean { + public hasRole(role: string): boolean { return this.user.roles.some(r => r === role); } - logOut() { + public logOut() { this.authService.logout(); this.router.navigate(["login"]); } - - showNav: boolean; -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/app.module.ts b/src/Ombi/ClientApp/app/app.module.ts index ddd873731..2945e9647 100644 --- a/src/Ombi/ClientApp/app/app.module.ts +++ b/src/Ombi/ClientApp/app/app.module.ts @@ -1,57 +1,56 @@ -import { NgModule } from '@angular/core'; -import { BrowserModule } from '@angular/platform-browser'; -import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; -import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { MdButtonModule, MdCardModule, MdInputModule, MdTabsModule } from '@angular/material'; -import { RouterModule, Routes } from '@angular/router'; -import { HttpModule } from '@angular/http'; +import { NgModule } from "@angular/core"; +import { FormsModule, ReactiveFormsModule } from "@angular/forms"; +import { HttpModule } from "@angular/http"; +import { MdButtonModule, MdCardModule, MdInputModule, MdTabsModule } from "@angular/material"; +import { BrowserModule } from "@angular/platform-browser"; +import { BrowserAnimationsModule } from "@angular/platform-browser/animations"; +import { RouterModule, Routes } from "@angular/router"; // Third Party -import { ButtonModule, DialogModule, CaptchaModule,DataTableModule, SharedModule } from 'primeng/primeng'; -import { GrowlModule } from 'primeng/components/growl/growl'; //import { DragulaModule, DragulaService } from 'ng2-dragula/ng2-dragula'; -import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { NgbModule } from "@ng-bootstrap/ng-bootstrap"; +import { GrowlModule } from "primeng/components/growl/growl"; +import { ButtonModule, CaptchaModule, DataTableModule,DialogModule, SharedModule } from "primeng/primeng"; // Components -import { AppComponent } from './app.component'; +import { AppComponent } from "./app.component"; -import { LoginComponent } from './login/login.component'; -import { ResetPasswordComponent } from './login/resetpassword.component'; -import { TokenResetPasswordComponent } from './login/tokenresetpassword.component'; -import { LandingPageComponent } from './landingpage/landingpage.component'; -import { PageNotFoundComponent } from './errors/not-found.component'; - -// Services -import { RequestService } from './services/request.service'; -import { NotificationService } from './services/notification.service'; -import { SettingsService } from './services/settings.service'; -import { AuthService } from './auth/auth.service'; -import { AuthGuard } from './auth/auth.guard'; -import { AuthModule } from './auth/auth.module'; -import { IdentityService } from './services/identity.service'; -import { StatusService } from './services/status.service'; -import { ImageService } from './services/image.service'; -import { LandingPageService } from './services/landingpage.service'; +import { PageNotFoundComponent } from "./errors/not-found.component"; +import { LandingPageComponent } from "./landingpage/landingpage.component"; +import { LoginComponent } from "./login/login.component"; +import { ResetPasswordComponent } from "./login/resetpassword.component"; +import { TokenResetPasswordComponent } from "./login/tokenresetpassword.component"; +// Services +import { AuthGuard } from "./auth/auth.guard"; +import { AuthModule } from "./auth/auth.module"; +import { AuthService } from "./auth/auth.service"; +import { IdentityService } from "./services"; +import { ImageService } from "./services"; +import { LandingPageService } from "./services"; +import { NotificationService } from "./services"; +import { RequestService } from "./services"; +import { SettingsService } from "./services"; +import { StatusService } from "./services"; // Modules -import { SettingsModule } from './settings/settings.module'; -import { WizardModule } from './wizard/wizard.module'; -import { SearchModule } from './search/search.module'; -import { UserManagementModule } from './usermanagement/usermanagement.module'; -import { RequestsModule } from './requests/requests.module'; +import { RequestsModule } from "./requests/requests.module"; +import { SearchModule } from "./search/search.module"; +import { SettingsModule } from "./settings/settings.module"; +import { UserManagementModule } from "./usermanagement/usermanagement.module"; +import { WizardModule } from "./wizard/wizard.module"; //import { PipeModule } from './pipes/pipe.module'; const routes: Routes = [ - { path: '*', component: PageNotFoundComponent }, - { path: '', redirectTo: '/search', pathMatch: 'full' }, - + { path: "*", component: PageNotFoundComponent }, + { path: "", redirectTo: "/search", pathMatch: "full" }, + //{ path: 'requests-grid', component: RequestGridComponent }, - { path: 'login', component: LoginComponent }, - { path: 'login/:landing', component: LoginComponent }, - { path: 'reset', component: ResetPasswordComponent }, - { path: 'token', component: TokenResetPasswordComponent }, - { path: 'landingpage', component: LandingPageComponent } + { path: "login", component: LoginComponent }, + { path: "login/:landing", component: LoginComponent }, + { path: "reset", component: ResetPasswordComponent }, + { path: "token", component: TokenResetPasswordComponent }, + { path: "landingpage", component: LandingPageComponent }, ]; @NgModule({ @@ -101,6 +100,6 @@ const routes: Routes = [ ImageService, //DragulaService ], - bootstrap: [AppComponent] + bootstrap: [AppComponent], }) export class AppModule { } diff --git a/src/Ombi/ClientApp/app/auth/IUserLogin.ts b/src/Ombi/ClientApp/app/auth/IUserLogin.ts index 86296bc66..af152a6b1 100644 --- a/src/Ombi/ClientApp/app/auth/IUserLogin.ts +++ b/src/Ombi/ClientApp/app/auth/IUserLogin.ts @@ -1,10 +1,10 @@ export interface IUserLogin { - username: string, - password: string, - rememberMe:boolean, + username: string; + password: string; + rememberMe: boolean; } export interface ILocalUser { - roles: string[], - name: string -} \ No newline at end of file + roles: string[]; + name: string; +} diff --git a/src/Ombi/ClientApp/app/auth/auth.guard.ts b/src/Ombi/ClientApp/app/auth/auth.guard.ts index 29d59fd6c..166d94a99 100644 --- a/src/Ombi/ClientApp/app/auth/auth.guard.ts +++ b/src/Ombi/ClientApp/app/auth/auth.guard.ts @@ -1,20 +1,20 @@ - -import { Injectable } from '@angular/core'; -import { Router } from '@angular/router'; -import { CanActivate } from '@angular/router'; -import { AuthService } from './auth.service'; + +import { Injectable } from "@angular/core"; +import { Router } from "@angular/router"; +import { CanActivate } from "@angular/router"; +import { AuthService } from "./auth.service"; @Injectable() export class AuthGuard implements CanActivate { constructor(private auth: AuthService, private router: Router) { } - canActivate() { + public canActivate() { if (this.auth.loggedIn()) { return true; } else { - this.router.navigate(['login']); + this.router.navigate(["login"]); return false; } } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/auth/auth.module.ts b/src/Ombi/ClientApp/app/auth/auth.module.ts index c97cb10df..2c58b2f99 100644 --- a/src/Ombi/ClientApp/app/auth/auth.module.ts +++ b/src/Ombi/ClientApp/app/auth/auth.module.ts @@ -1,12 +1,12 @@ -import { NgModule } from '@angular/core'; -import { Http, RequestOptions } from '@angular/http'; -import { AuthHttp, AuthConfig } from 'angular2-jwt'; +import { NgModule } from "@angular/core"; +import { Http, RequestOptions } from "@angular/http"; +import { AuthConfig, AuthHttp } from "angular2-jwt"; export function authHttpServiceFactory(http: Http, options: RequestOptions) { return new AuthHttp(new AuthConfig({ - tokenName: 'id_token', - tokenGetter: (() => localStorage.getItem('id_token')!), - globalHeaders: [{ 'Content-Type': 'application/json' }], + tokenName: "id_token", + tokenGetter: (() => localStorage.getItem("id_token")!), + globalHeaders: [{ "Content-Type": "application/json" }], }), http, options); } @@ -15,8 +15,8 @@ export function authHttpServiceFactory(http: Http, options: RequestOptions) { { provide: AuthHttp, useFactory: authHttpServiceFactory, - deps: [Http, RequestOptions] - } - ] + deps: [Http, RequestOptions], + }, + ], }) -export class AuthModule {} \ No newline at end of file +export class AuthModule {} diff --git a/src/Ombi/ClientApp/app/auth/auth.service.ts b/src/Ombi/ClientApp/app/auth/auth.service.ts index 4c9c4f88e..89f38cf4c 100644 --- a/src/Ombi/ClientApp/app/auth/auth.service.ts +++ b/src/Ombi/ClientApp/app/auth/auth.service.ts @@ -1,43 +1,42 @@ -import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Rx'; -import { tokenNotExpired, JwtHelper } from 'angular2-jwt'; -import { Http, Headers } from '@angular/http'; +import { Injectable } from "@angular/core"; +import { Headers, Http } from "@angular/http"; +import { JwtHelper, tokenNotExpired } from "angular2-jwt"; +import { Observable } from "rxjs/Rx"; -import { ServiceHelpers } from '../services/service.helpers'; -import { IUserLogin, ILocalUser } from './IUserLogin'; +import { ServiceHelpers } from "../services"; +import { ILocalUser, IUserLogin } from "./IUserLogin"; @Injectable() export class AuthService extends ServiceHelpers { + public jwtHelper: JwtHelper = new JwtHelper(); + constructor(http: Http) { - super(http, '/api/v1/token'); + super(http, "/api/v1/token"); } - jwtHelper: JwtHelper = new JwtHelper(); - - login(login: IUserLogin): Observable { + public login(login: IUserLogin): Observable { this.headers = new Headers(); - this.headers.append('Content-Type', 'application/json'); + this.headers.append("Content-Type", "application/json"); return this.http.post(`${this.url}/`, JSON.stringify(login), { headers: this.headers }) .map(this.extractData); } - loggedIn() { - return tokenNotExpired('id_token'); + public loggedIn() { + return tokenNotExpired("id_token"); } - claims(): ILocalUser { + public claims(): ILocalUser { if (this.loggedIn()) { - var token = localStorage.getItem('id_token'); + const token = localStorage.getItem("id_token"); if (!token) { - throw "Invalid token"; + throw new Error("Invalid token"); } - var json = this.jwtHelper.decodeToken(token); - var roles = json["role"]; - var name = json["sub"]; - + const json = this.jwtHelper.decodeToken(token); + const roles = json.role; + const name = json.sub; - var u = { name: name, roles: [] as string[] }; + const u = { name, roles: [] as string[] }; if (roles instanceof Array) { u.roles = roles; @@ -49,13 +48,11 @@ export class AuthService extends ServiceHelpers { return {}; } - - hasRole(role: string): boolean { + public hasRole(role: string): boolean { return this.claims().roles.some(r => r.toUpperCase() === role.toUpperCase()); } - logout() { - localStorage.removeItem('id_token'); + public logout() { + localStorage.removeItem("id_token"); } } - diff --git a/src/Ombi/ClientApp/app/errors/not-found.component.ts b/src/Ombi/ClientApp/app/errors/not-found.component.ts index 39b2354ab..f102d0449 100644 --- a/src/Ombi/ClientApp/app/errors/not-found.component.ts +++ b/src/Ombi/ClientApp/app/errors/not-found.component.ts @@ -1,6 +1,6 @@ -import { Component } from '@angular/core'; +import { Component } from "@angular/core"; @Component({ - template: '

Page not found

' + template: "

Page not found

", }) -export class PageNotFoundComponent { } \ No newline at end of file +export class PageNotFoundComponent { } diff --git a/src/Ombi/ClientApp/app/interfaces/ICommon.ts b/src/Ombi/ClientApp/app/interfaces/ICommon.ts new file mode 100644 index 000000000..4b2f92fd9 --- /dev/null +++ b/src/Ombi/ClientApp/app/interfaces/ICommon.ts @@ -0,0 +1,18 @@ +export interface ISettings { + id: number; +} + +export interface ICutoff { + id: number; + name: string; +} + +export interface IItem { + allowed: boolean; + quality: IQuality; +} + +export interface IQuality { + id: number; + name: string; +} diff --git a/src/Ombi/ClientApp/app/interfaces/IImages.ts b/src/Ombi/ClientApp/app/interfaces/IImages.ts index 7b0eb2e05..0c73df490 100644 --- a/src/Ombi/ClientApp/app/interfaces/IImages.ts +++ b/src/Ombi/ClientApp/app/interfaces/IImages.ts @@ -1,3 +1,3 @@ export interface IImages { - url: string -} \ No newline at end of file + url: string; +} diff --git a/src/Ombi/ClientApp/app/interfaces/IMediaServerStatus.ts b/src/Ombi/ClientApp/app/interfaces/IMediaServerStatus.ts index b8f4e3d20..829d761fa 100644 --- a/src/Ombi/ClientApp/app/interfaces/IMediaServerStatus.ts +++ b/src/Ombi/ClientApp/app/interfaces/IMediaServerStatus.ts @@ -1,8 +1,8 @@ export interface IMediaServerStatus { - serversAvailable: number, - serversUnavailable: number, - partiallyDown: boolean, - completelyDown: boolean, - fullyAvailable: boolean, - totalServers:number -} \ No newline at end of file + serversAvailable: number; + serversUnavailable: number; + partiallyDown: boolean; + completelyDown: boolean; + fullyAvailable: boolean; + totalServers: number; +} diff --git a/src/Ombi/ClientApp/app/interfaces/INotifcationSettings.ts b/src/Ombi/ClientApp/app/interfaces/INotifcationSettings.ts deleted file mode 100644 index 513d65735..000000000 --- a/src/Ombi/ClientApp/app/interfaces/INotifcationSettings.ts +++ /dev/null @@ -1,81 +0,0 @@ -export interface ISettings { - id: number, -} - -export interface INotificationSettings extends ISettings { - enabled: boolean, -} - -export interface IEmailNotificationSettings extends INotificationSettings { - host: string, - password: string, - port: number, - senderAddress: string, - senderName:string, - username: string, - authentication: boolean, - adminEmail: string, - notificationTemplates: INotificationTemplates[], -} - -export interface INotificationTemplates { - subject: string, - message: string, - notificationType: NotificationType, - notificationAgent: NotificationAgent, - enabled:boolean, -} - -export enum NotificationAgent { - Email, - Discord, - Pushbullet, - Pushover, - Telegram, -} - -export enum NotificationType { - NewRequest, - Issue, - RequestAvailable, - RequestApproved, - AdminNote, - Test, - RequestDeclined, - ItemAddedToFaultQueue -} - -export interface IDiscordNotifcationSettings extends INotificationSettings { - webhookUrl: string, - username: string, - notificationTemplates: INotificationTemplates[], -} - -export interface ISlackNotificationSettings extends INotificationSettings { - webhookUrl: string, - username: string, - channel: string, - iconEmoji: string, - iconUrl:string - notificationTemplates: INotificationTemplates[], -} - -export interface IPushbulletNotificationSettings extends INotificationSettings { - accessToken: string, - notificationTemplates: INotificationTemplates[], - channelTag: string; -} - -export interface IPushoverNotificationSettings extends INotificationSettings { - accessToken: string, - notificationTemplates: INotificationTemplates[], - userToken: string; -} - -export interface IMattermostNotifcationSettings extends INotificationSettings { - webhookUrl: string, - username: string, - channel: string, - iconUrl:string, - notificationTemplates: INotificationTemplates[], -} diff --git a/src/Ombi/ClientApp/app/interfaces/INotificationSettings.ts b/src/Ombi/ClientApp/app/interfaces/INotificationSettings.ts new file mode 100644 index 000000000..598dd0b05 --- /dev/null +++ b/src/Ombi/ClientApp/app/interfaces/INotificationSettings.ts @@ -0,0 +1,79 @@ +import { ISettings } from "./ICommon"; + +export interface INotificationSettings extends ISettings { + enabled: boolean; +} + +export interface IEmailNotificationSettings extends INotificationSettings { + host: string; + password: string; + port: number; + senderAddress: string; + senderName: string; + username: string; + authentication: boolean; + adminEmail: string; + notificationTemplates: INotificationTemplates[]; +} + +export interface INotificationTemplates { + subject: string; + message: string; + notificationType: NotificationType; + notificationAgent: NotificationAgent; + enabled: boolean; +} + +export enum NotificationAgent { + Email, + Discord, + Pushbullet, + Pushover, + Telegram, +} + +export enum NotificationType { + NewRequest, + Issue, + RequestAvailable, + RequestApproved, + AdminNote, + Test, + RequestDeclined, + ItemAddedToFaultQueue, +} + +export interface IDiscordNotifcationSettings extends INotificationSettings { + webhookUrl: string; + username: string; + notificationTemplates: INotificationTemplates[]; +} + +export interface ISlackNotificationSettings extends INotificationSettings { + webhookUrl: string; + username: string; + channel: string; + iconEmoji: string; + iconUrl: string; + notificationTemplates: INotificationTemplates[]; +} + +export interface IPushbulletNotificationSettings extends INotificationSettings { + accessToken: string; + notificationTemplates: INotificationTemplates[]; + channelTag: string; +} + +export interface IPushoverNotificationSettings extends INotificationSettings { + accessToken: string; + notificationTemplates: INotificationTemplates[]; + userToken: string; +} + +export interface IMattermostNotifcationSettings extends INotificationSettings { + webhookUrl: string; + username: string; + channel: string; + iconUrl: string; + notificationTemplates: INotificationTemplates[]; +} diff --git a/src/Ombi/ClientApp/app/interfaces/IPlex.ts b/src/Ombi/ClientApp/app/interfaces/IPlex.ts index b92b02f05..286ca994b 100644 --- a/src/Ombi/ClientApp/app/interfaces/IPlex.ts +++ b/src/Ombi/ClientApp/app/interfaces/IPlex.ts @@ -1,13 +1,13 @@ export interface IPlexAuthentication { - user: IPlexUser + user: IPlexUser; } export interface IPlexUser { - email: string, - uuid: string, - username: string, - title: string, - authentication_token: string, + email: string; + uuid: string; + username: string; + title: string; + authentication_token: string; } export interface IPlexLibraries { @@ -19,27 +19,27 @@ export interface IMediaContainer { } export interface IDirectory { - key: string, - title: string, + key: string; + title: string; } export interface IPlexServerViewModel { - success: boolean, - message: string, + success: boolean; + message: string; servers: IPlexServerResponse; } export interface IPlexServerResponse { - accessToken: string, - address: string, - createdAt: string, - home: string, - host: string, - localAddresses: string, - machineIdentifier: string, - name: string, - owned: string, - ownerId: string, - port: string, - scheme: string, -} \ No newline at end of file + accessToken: string; + address: string; + createdAt: string; + home: string; + host: string; + localAddresses: string; + machineIdentifier: string; + name: string; + owned: string; + ownerId: string; + port: string; + scheme: string; +} diff --git a/src/Ombi/ClientApp/app/interfaces/IRadarr.ts b/src/Ombi/ClientApp/app/interfaces/IRadarr.ts index c2824f04b..1e8030fbd 100644 --- a/src/Ombi/ClientApp/app/interfaces/IRadarr.ts +++ b/src/Ombi/ClientApp/app/interfaces/IRadarr.ts @@ -1,32 +1,19 @@ -export interface IRadarrRootFolder { - id: number, - path: string, - freespace:number, +import { ICutoff, IItem } from "./ICommon"; + +export interface IRadarrRootFolder { + id: number; + path: string; + freespace: number; } export interface IRadarrProfile { - name: string, - id: number, - cutoff: ICutoff, - items:IItem[], + name: string; + id: number; + cutoff: ICutoff; + items: IItem[]; } export interface IMinimumAvailability { - value: string, - name:string, -} - -export interface ICutoff { - id: number, - name:string, + value: string; + name: string; } - -export interface IItem { - allowed: boolean, - quality:IQuality, -} - -export interface IQuality { - id: number, - name:string, -} \ No newline at end of file diff --git a/src/Ombi/ClientApp/app/interfaces/IRequestEngineResult.ts b/src/Ombi/ClientApp/app/interfaces/IRequestEngineResult.ts index 0ed7e7b6d..68bbfbf7a 100644 --- a/src/Ombi/ClientApp/app/interfaces/IRequestEngineResult.ts +++ b/src/Ombi/ClientApp/app/interfaces/IRequestEngineResult.ts @@ -1,5 +1,5 @@ export interface IRequestEngineResult { - requestAdded: boolean, - message: string, - errorMessage: string, -} \ No newline at end of file + requestAdded: boolean; + message: string; + errorMessage: string; +} diff --git a/src/Ombi/ClientApp/app/interfaces/IRequestModel.ts b/src/Ombi/ClientApp/app/interfaces/IRequestModel.ts index c34c24b8c..ff1adf130 100644 --- a/src/Ombi/ClientApp/app/interfaces/IRequestModel.ts +++ b/src/Ombi/ClientApp/app/interfaces/IRequestModel.ts @@ -1,145 +1,140 @@ -import { IUser } from './IUser'; +import { IUser } from "./IUser"; export interface IMediaBase { - imdbId: string, - id: number, - providerId: number, - title: string, - overview: string, - posterPath: string, - releaseDate: Date, - status: string, - requestedDate: Date, - approved: boolean, - type: RequestType, - requested: boolean, - available: boolean, - otherMessage: string, - adminNote: string, - requestedUser: string, - issueId: number, - denied: boolean, - deniedReason: string, - released: boolean -} - -export interface IMovieRequestModel extends IMediaBase { - -} + imdbId: string; + id: number; + providerId: number; + title: string; + overview: string; + posterPath: string; + releaseDate: Date; + status: string; + requestedDate: Date; + approved: boolean; + type: RequestType; + requested: boolean; + available: boolean; + otherMessage: string; + adminNote: string; + requestedUser: string; + issueId: number; + denied: boolean; + deniedReason: string; + released: boolean; +} + +//export interface IMovieRequestModel extends IMediaBase { } export interface ITvRequestModel extends IMediaBase { - imdbId: string, - tvDbId: string, - childRequests: IChildTvRequest[] - rootFolderSelected: number, - firstAired: string, + imdbId: string; + tvDbId: string; + childRequests: IChildTvRequest[]; + rootFolderSelected: number; + firstAired: string; } export interface IRequestCountModel { - pending: number, - approved: number, - available: number + pending: number; + approved: number; + available: number; } export interface IChildTvRequest extends IMediaBase { - requestAll: boolean, - seasonRequests: ISeasonRequests[], + requestAll: boolean; + seasonRequests: ISeasonRequests[]; } export interface ISeasonRequests { - seasonNumber: number, - episodes: IEpisodesRequested[], + seasonNumber: number; + episodes: IEpisodesRequested[]; } export interface IEpisodesRequested { - episodeNumber: number, - title: string, - airDate: Date, - url: string, - requested: boolean, - status: string, - available: boolean + episodeNumber: number; + title: string; + airDate: Date; + url: string; + requested: boolean; + status: string; + available: boolean; } - export enum RequestType { movie = 1, - tvShow = 2 + tvShow = 2, } export interface IRequestsPageScroll { - count: number, - position: number + count: number; + position: number; } export interface IRequestGrid { - available: T[], - new: T[], - approved: T[] + available: T[]; + new: T[]; + approved: T[]; } - // NEW WORLD export interface IMovieRequests extends IFullBaseRequest { - theMovieDbId: number, + theMovieDbId: number; } export interface IFullBaseRequest extends IBaseRequest { - imdbId: string, - overview: string, - title: string, - posterPath: string, - releaseDate: Date, - status: string, - released: boolean, + imdbId: string; + overview: string; + title: string; + posterPath: string; + releaseDate: Date; + status: string; + released: boolean; } export interface IBaseRequest { - id: number, - approved: boolean, - requestedDate: Date, - available: boolean, - requestedUserId: number, - issueId: number, - denied: boolean, - deniedReason: string, - requestType: RequestType, - requestedUser: IUser, - canApprove:boolean, + id: number; + approved: boolean; + requestedDate: Date; + available: boolean; + requestedUserId: number; + issueId: number; + denied: boolean; + deniedReason: string; + requestType: RequestType; + requestedUser: IUser; + canApprove: boolean; } export interface ITvRequests { - id: number, - imdbId: string, - rootFolder: number, - overview: string, - title: string, - posterPath: string, - releaseDate: Date, - status: string, - childRequests: IChildRequests[] + id: number; + imdbId: string; + rootFolder: number; + overview: string; + title: string; + posterPath: string; + releaseDate: Date; + status: string; + childRequests: IChildRequests[]; } export interface IChildRequests extends IBaseRequest { - seasonRequests: INewSeasonRequests[] + seasonRequests: INewSeasonRequests[]; } export interface INewSeasonRequests { - id: number, - seasonNumber: number, - episodes: IEpisodesRequests[] + id: number; + seasonNumber: number; + episodes: IEpisodesRequests[]; } export interface IEpisodesRequests { - id: number, - episodeNumber: number, - title: string, - airDate: Date, - url: string, - available: boolean, - requested: boolean, - approved: boolean, + id: number; + episodeNumber: number; + title: string; + airDate: Date; + url: string; + available: boolean; + requested: boolean; + approved: boolean; } - diff --git a/src/Ombi/ClientApp/app/interfaces/ISearchMovieResult.ts b/src/Ombi/ClientApp/app/interfaces/ISearchMovieResult.ts index e4488fd4b..23547add3 100644 --- a/src/Ombi/ClientApp/app/interfaces/ISearchMovieResult.ts +++ b/src/Ombi/ClientApp/app/interfaces/ISearchMovieResult.ts @@ -1,25 +1,25 @@ export interface ISearchMovieResult { - backdropPath: string, - adult: boolean, - overview: string, - releaseDate: Date, - genreIds: number[], - id: number, - originalTitle: string, - originalLanguage: string, - title: string, - posterPath: string, - popularity: number, - voteCount: number, - video: boolean, - voteAverage: number, - alreadyInCp: boolean, - trailer: string, - homepage: string, - imdbId: string, - approved: boolean, - requested: boolean, - available: boolean, - plexUrl: string, - quality:string -} \ No newline at end of file + backdropPath: string; + adult: boolean; + overview: string; + releaseDate: Date; + genreIds: number[]; + id: number; + originalTitle: string; + originalLanguage: string; + title: string; + posterPath: string; + popularity: number; + voteCount: number; + video: boolean; + voteAverage: number; + alreadyInCp: boolean; + trailer: string; + homepage: string; + imdbId: string; + approved: boolean; + requested: boolean; + available: boolean; + plexUrl: string; + quality: string; +} diff --git a/src/Ombi/ClientApp/app/interfaces/ISearchTvResult.ts b/src/Ombi/ClientApp/app/interfaces/ISearchTvResult.ts index a4dff155a..e4895da1d 100644 --- a/src/Ombi/ClientApp/app/interfaces/ISearchTvResult.ts +++ b/src/Ombi/ClientApp/app/interfaces/ISearchTvResult.ts @@ -1,32 +1,32 @@ import { ISeasonRequests } from "./IRequestModel"; export interface ISearchTvResult { - id: number, - title: string, // used in the request - aliases: string[], - banner: string, - seriesId: number, - status: string, - firstAired: string, - network: string, - networkId: string, - runtime: string, - genre: string[], - overview: string, - lastUpdated: number, - airsDayOfWeek: string, - airsTime: string, - rating: string, - imdbId: string, - siteRating: number, - trailer: string, - homepage:string, - seasonsRequests: ISeasonRequests[], - requestAll:boolean, - approved: boolean, - requested: boolean, - available: boolean, - plexUrl: string, - firstSeason: boolean, - latestSeason:boolean, + id: number; + title: string; // used in the request + aliases: string[]; + banner: string; + seriesId: number; + status: string; + firstAired: string; + network: string; + networkId: string; + runtime: string; + genre: string[]; + overview: string; + lastUpdated: number; + airsDayOfWeek: string; + airsTime: string; + rating: string; + imdbId: string; + siteRating: number; + trailer: string; + homepage: string; + seasonsRequests: ISeasonRequests[]; + requestAll: boolean; + approved: boolean; + requested: boolean; + available: boolean; + plexUrl: string; + firstSeason: boolean; + latestSeason: boolean; } diff --git a/src/Ombi/ClientApp/app/interfaces/ISettings.ts b/src/Ombi/ClientApp/app/interfaces/ISettings.ts index 89399e1c8..4a4bf2ce5 100644 --- a/src/Ombi/ClientApp/app/interfaces/ISettings.ts +++ b/src/Ombi/ClientApp/app/interfaces/ISettings.ts @@ -1,101 +1,99 @@ -export interface ISettings { - id: number -} +import { ISettings } from "./ICommon"; export interface IExternalSettings extends ISettings { - ssl: boolean, - subDir: string, - ip: string, - port: number, + ssl: boolean; + subDir: string; + ip: string; + port: number; } export interface IOmbiSettings extends ISettings { - port: number, - //baseUrl:string, - collectAnalyticData: boolean, - wizard: boolean, - apiKey: string, - externalUrl: string, - allowExternalUsersToAuthenticate:boolean, + port: number; + //baseUrl:string, + collectAnalyticData: boolean; + wizard: boolean; + apiKey: string; + externalUrl: string; + allowExternalUsersToAuthenticate: boolean; } export interface IEmbySettings extends ISettings { - enable: boolean, - servers: IEmbyServer[] + enable: boolean; + servers: IEmbyServer[]; } export interface IEmbyServer extends IExternalSettings { - name:string, - apiKey: string, - administratorId: string, - enableEpisodeSearching: boolean, + name: string; + apiKey: string; + administratorId: string; + enableEpisodeSearching: boolean; } export interface IPlexSettings extends ISettings { - enable: boolean, - servers: IPlexServer[] + enable: boolean; + servers: IPlexServer[]; } export interface IPlexServer extends IExternalSettings { - name: string, - enableEpisodeSearching: boolean, - plexAuthToken: string, - machineIdentifier: string, - plexSelectedLibraries: IPlexLibraries[], + name: string; + enableEpisodeSearching: boolean; + plexAuthToken: string; + machineIdentifier: string; + plexSelectedLibraries: IPlexLibrariesSettings[]; } -export interface IPlexLibraries { - key: string, - title: string, - enabled: boolean, +export interface IPlexLibrariesSettings { + key: string; + title: string; + enabled: boolean; } export interface ISonarrSettings extends IExternalSettings { - apiKey: string, - enabled: boolean, - qualityProfile: string, - seasonFolders: boolean, - rootPath: string, - fullRootPath: string, - addOnly:boolean, + apiKey: string; + enabled: boolean; + qualityProfile: string; + seasonFolders: boolean; + rootPath: string; + fullRootPath: string; + addOnly: boolean; } export interface IRadarrSettings extends IExternalSettings { - enabled: boolean, - apiKey: string, - defaultQualityProfile: string, - defaultRootPath: string, - fullRootPath: string, - addOnly: boolean, - minimumAvailability:string, + enabled: boolean; + apiKey: string; + defaultQualityProfile: string; + defaultRootPath: string; + fullRootPath: string; + addOnly: boolean; + minimumAvailability: string; } export interface ILandingPageSettings extends ISettings { - enabled: boolean, - - noticeEnabled: boolean, - noticeText: string, - - timeLimit: boolean, - startDateTime: Date, - endDateTime: Date, - expired:boolean, + enabled: boolean; + + noticeEnabled: boolean; + noticeText: string; + + timeLimit: boolean; + startDateTime: Date; + endDateTime: Date; + expired: boolean; } export interface ICustomizationSettings extends ISettings { - applicationName: string, - logo: string, + applicationName: string; + logo: string; } export interface IAuthenticationSettings extends ISettings { - allowExternalUsersToAuthenticate: boolean, + allowExternalUsersToAuthenticate: boolean; // Password - requiredDigit: boolean, - requiredLength: number, - requiredLowercase: boolean, - requireNonAlphanumeric: boolean, - requireUppercase:boolean, -} \ No newline at end of file + requiredDigit: boolean; + requiredLength: number; + requiredLowercase: boolean; + requireNonAlphanumeric: boolean; + requireUppercase: boolean; +} diff --git a/src/Ombi/ClientApp/app/interfaces/ISonarr.ts b/src/Ombi/ClientApp/app/interfaces/ISonarr.ts index f4702683b..681f2c2d7 100644 --- a/src/Ombi/ClientApp/app/interfaces/ISonarr.ts +++ b/src/Ombi/ClientApp/app/interfaces/ISonarr.ts @@ -1,27 +1,14 @@ -export interface ISonarrRootFolder { - id: number, - path: string, - freespace:number, -} - -export interface ISonarrProfile { - name: string, - id: number, - cutoff: ICutoff, - items:IItem[], -} +import { ICutoff, IItem } from "./ICommon"; -export interface ICutoff { - id: number, - name:string, +export interface ISonarrRootFolder { + id: number; + path: string; + freespace: number; } -export interface IItem { - allowed: boolean, - quality:IQuality, +export interface ISonarrProfile { + name: string; + id: number; + cutoff: ICutoff; + items: IItem[]; } - -export interface IQuality { - id: number, - name:string, -} \ No newline at end of file diff --git a/src/Ombi/ClientApp/app/interfaces/IUser.ts b/src/Ombi/ClientApp/app/interfaces/IUser.ts index dcb9898d0..4e8fd40b0 100644 --- a/src/Ombi/ClientApp/app/interfaces/IUser.ts +++ b/src/Ombi/ClientApp/app/interfaces/IUser.ts @@ -1,40 +1,39 @@ export interface IUser { - id: string, - username: string, - alias: string, - claims: ICheckbox[], - emailAddress: string, - password: string, - userType: UserType, - isSetup:boolean, + id: string; + username: string; + alias: string; + claims: ICheckbox[]; + emailAddress: string; + password: string; + userType: UserType; + isSetup: boolean; // FOR UI - checked: boolean, + checked: boolean; } export enum UserType { LocalUser = 1, PlexUser = 2, - EmbyUser = 3 + EmbyUser = 3, } - export interface ICheckbox { - value: string, - enabled: boolean, + value: string; + enabled: boolean; } export interface IIdentityResult { - errors: string[], - successful: boolean, + errors: string[]; + successful: boolean; } export interface IUpdateLocalUser extends IUser { - currentPassword: string, - confirmNewPassword: string + currentPassword: string; + confirmNewPassword: string; } -export interface IResetPasswordToken{ - email:string, - token:string, - password:string -} \ No newline at end of file +export interface IResetPasswordToken { + email: string; + token: string; + password: string; +} diff --git a/src/Ombi/ClientApp/app/interfaces/index.ts b/src/Ombi/ClientApp/app/interfaces/index.ts new file mode 100644 index 000000000..791a20b19 --- /dev/null +++ b/src/Ombi/ClientApp/app/interfaces/index.ts @@ -0,0 +1,13 @@ +export * from "./ICommon"; +export * from "./IImages"; +export * from "./IMediaServerStatus"; +export * from "./INotificationSettings"; +export * from "./IPlex"; +export * from "./IRadarr"; +export * from "./IRequestEngineResult"; +export * from "./IRequestModel"; +export * from "./ISearchMovieResult"; +export * from "./ISearchTvResult"; +export * from "./ISettings"; +export * from "./ISonarr"; +export * from "./IUser"; diff --git a/src/Ombi/ClientApp/app/landingpage/landingpage.component.ts b/src/Ombi/ClientApp/app/landingpage/landingpage.component.ts index 8ffb98712..bfa96fb9e 100644 --- a/src/Ombi/ClientApp/app/landingpage/landingpage.component.ts +++ b/src/Ombi/ClientApp/app/landingpage/landingpage.component.ts @@ -1,36 +1,34 @@ -import { Component, OnInit } from '@angular/core'; -import { SettingsService } from '../services/settings.service'; -import { LandingPageService } from '../services/landingpage.service'; -import { ILandingPageSettings, ICustomizationSettings } from '../interfaces/ISettings'; -import { IMediaServerStatus } from '../interfaces/IMediaServerStatus'; +import { Component, OnInit } from "@angular/core"; +import { IMediaServerStatus } from "../interfaces"; +import { ICustomizationSettings, ILandingPageSettings } from "../interfaces"; +import { LandingPageService } from "../services"; +import { SettingsService } from "../services"; -import { DomSanitizer } from '@angular/platform-browser'; -import { ImageService } from '../services/image.service'; +import { DomSanitizer } from "@angular/platform-browser"; +import { ImageService } from "../services"; @Component({ - - templateUrl: './landingpage.component.html', - styleUrls: ['./landingpage.component.scss'] + templateUrl: "./landingpage.component.html", + styleUrls: ["./landingpage.component.scss"], }) export class LandingPageComponent implements OnInit { - constructor(private settingsService: SettingsService, - private images: ImageService, private sanitizer: DomSanitizer, private landingPageService: LandingPageService) { } - - customizationSettings : ICustomizationSettings; - landingPageSettings: ILandingPageSettings; - background: any; + public customizationSettings: ICustomizationSettings; + public landingPageSettings: ILandingPageSettings; + public background: any; + public mediaServerStatus: IMediaServerStatus; - mediaServerStatus: IMediaServerStatus; + constructor(private settingsService: SettingsService, + private images: ImageService, private sanitizer: DomSanitizer, private landingPageService: LandingPageService) { } - ngOnInit(): void { + public ngOnInit() { this.settingsService.getCustomization().subscribe(x => this.customizationSettings = x); this.settingsService.getLandingPage().subscribe(x => this.landingPageSettings = x); 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.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.landingPageService.getServerStatus().subscribe(x => this.mediaServerStatus = x); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/login/login.component.ts b/src/Ombi/ClientApp/app/login/login.component.ts index dca609978..c904fc4e1 100644 --- a/src/Ombi/ClientApp/app/login/login.component.ts +++ b/src/Ombi/ClientApp/app/login/login.component.ts @@ -1,80 +1,76 @@ -import { Component, OnInit } from '@angular/core'; -import { Router, ActivatedRoute } from '@angular/router'; -import { FormGroup, Validators, FormBuilder } from '@angular/forms'; +import { Component, OnInit } from "@angular/core"; +import { FormBuilder, FormGroup, Validators } from "@angular/forms"; +import { ActivatedRoute, Router } from "@angular/router"; -import { AuthService } from '../auth/auth.service'; -import { StatusService } from '../services/status.service'; -import { NotificationService } from '../services/notification.service'; -import { SettingsService } from '../services/settings.service'; -import { ICustomizationSettings } from '../interfaces/ISettings'; - -import { DomSanitizer } from '@angular/platform-browser'; -import { ImageService } from '../services/image.service'; +import { AuthService } from "../auth/auth.service"; +import { ICustomizationSettings } from "../interfaces"; +import { NotificationService } from "../services"; +import { SettingsService } from "../services"; +import { StatusService } from "../services"; +import { DomSanitizer } from "@angular/platform-browser"; +import { ImageService } from "../services"; @Component({ - templateUrl: './login.component.html', - styleUrls: ['./login.component.scss'] + templateUrl: "./login.component.html", + styleUrls: ["./login.component.scss"], }) export class LoginComponent implements OnInit { + public form: FormGroup; + public customizationSettings: ICustomizationSettings; + public background: any; + public landingFlag: boolean; constructor(private authService: AuthService, private router: Router, private notify: NotificationService, private status: StatusService, - private fb: FormBuilder, private settingsService: SettingsService, private images: ImageService, private sanitizer: DomSanitizer, - private route: ActivatedRoute) { + private fb: FormBuilder, private settingsService: SettingsService, private images: ImageService, private sanitizer: DomSanitizer, + private route: ActivatedRoute) { this.form = this.fb.group({ username: ["", [Validators.required]], password: ["", [Validators.required]], - rememberMe: [false] + rememberMe: [false], }); this.status.getWizardStatus().subscribe(x => { if (!x.result) { - this.router.navigate(['Wizard']); + this.router.navigate(["Wizard"]); } }); this.route.params .subscribe(params => { - this.landingFlag = params['landing']; + this.landingFlag = params.landing; }); } - - form: FormGroup; - customizationSettings : ICustomizationSettings; - background: any; - landingFlag: boolean; - ngOnInit(): void { + public ngOnInit() { this.settingsService.getLandingPage().subscribe(x => { if (x.enabled && !this.landingFlag) { - this.router.navigate(['landingpage']); + this.router.navigate(["landingpage"]); } }); this.settingsService.getCustomization().subscribe(x => this.customizationSettings = x); 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.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 + ")"); }); } - - onSubmit(form: FormGroup): void { + public onSubmit(form: FormGroup) { if (form.invalid) { this.notify.error("Validation", "Please check your entered values"); return; } - var value = form.value; + const value = form.value; this.authService.login({ password: value.password, username: value.username, rememberMe:value.rememberMe }) .subscribe(x => { localStorage.setItem("id_token", x.access_token); if (this.authService.loggedIn()) { - this.router.navigate(['search']); + this.router.navigate(["search"]); } else { this.notify.error("Could not log in", "Incorrect username or password"); } - }, err => this.notify.error("Could not log in", "Incorrect username or password")); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/login/resetpassword.component.ts b/src/Ombi/ClientApp/app/login/resetpassword.component.ts index 5ef90f61f..be7b16b18 100644 --- a/src/Ombi/ClientApp/app/login/resetpassword.component.ts +++ b/src/Ombi/ClientApp/app/login/resetpassword.component.ts @@ -1,37 +1,35 @@ -import { Component, OnInit } from '@angular/core'; -import { FormGroup, Validators, FormBuilder } from '@angular/forms'; +import { Component, OnInit } from "@angular/core"; +import { FormBuilder, FormGroup, Validators } from "@angular/forms"; -import { IdentityService } from '../services/identity.service'; -import { NotificationService } from '../services/notification.service'; -import { SettingsService } from '../services/settings.service'; -import { ICustomizationSettings } from '../interfaces/ISettings'; +import { ICustomizationSettings } from "../interfaces"; +import { IdentityService } from "../services"; +import { NotificationService } from "../services"; +import { SettingsService } from "../services"; @Component({ - templateUrl: './resetpassword.component.html', - styleUrls: ['./login.component.scss'] + templateUrl: "./resetpassword.component.html", + styleUrls: ["./login.component.scss"], }) export class ResetPasswordComponent implements OnInit { + public form: FormGroup; + public customizationSettings: ICustomizationSettings; constructor(private identityService: IdentityService, private notify: NotificationService, - private fb: FormBuilder, private settingsService: SettingsService) { + private fb: FormBuilder, private settingsService: SettingsService) { this.form = this.fb.group({ email: ["", [Validators.required]], }); } - form: FormGroup; - customizationSettings: ICustomizationSettings; - - ngOnInit(): void { + public ngOnInit() { this.settingsService.getCustomization().subscribe(x => this.customizationSettings = x); } - - onSubmit(form: FormGroup): void { + public onSubmit(form: FormGroup) { if (form.invalid) { this.notify.error("Validation", "Email address is required"); - return + return; } this.identityService.submitResetPassword(form.value.email).subscribe(x => { x.errors.forEach((val) => { @@ -39,4 +37,4 @@ export class ResetPasswordComponent implements OnInit { }); }); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/login/tokenresetpassword.component.ts b/src/Ombi/ClientApp/app/login/tokenresetpassword.component.ts index 232457b3c..68714c795 100644 --- a/src/Ombi/ClientApp/app/login/tokenresetpassword.component.ts +++ b/src/Ombi/ClientApp/app/login/tokenresetpassword.component.ts @@ -1,53 +1,51 @@ -import { Component, OnInit } from '@angular/core'; -import { Router } from '@angular/router'; -import { ActivatedRoute, Params } from '@angular/router'; -import { FormGroup, Validators, FormBuilder } from '@angular/forms'; +import { Component, OnInit } from "@angular/core"; +import { FormBuilder, FormGroup, Validators } from "@angular/forms"; +import { Router } from "@angular/router"; +import { ActivatedRoute, Params } from "@angular/router"; -import { IdentityService } from '../services/identity.service'; -import { NotificationService } from '../services/notification.service'; -import { SettingsService } from '../services/settings.service'; -import { ICustomizationSettings } from '../interfaces/ISettings'; -import { IResetPasswordToken } from '../interfaces/IUser'; +import { ICustomizationSettings } from "../interfaces"; +import { IResetPasswordToken } from "../interfaces"; +import { IdentityService } from "../services"; +import { NotificationService } from "../services"; +import { SettingsService } from "../services"; @Component({ - templateUrl: './tokenresetpassword.component.html', - styleUrls: ['./login.component.scss'] + templateUrl: "./tokenresetpassword.component.html", + styleUrls: ["./login.component.scss"], }) export class TokenResetPasswordComponent implements OnInit { + + public form: FormGroup; + public customizationSettings: ICustomizationSettings; + constructor(private identityService: IdentityService, private router: Router, private route: ActivatedRoute, private notify: NotificationService, - private fb: FormBuilder, private settingsService: SettingsService) { + private fb: FormBuilder, private settingsService: SettingsService) { this.route.queryParams - .subscribe((params:Params) => { - debugger; + .subscribe((params: Params) => { this.form = this.fb.group({ email: ["", [Validators.required]], password: ["", [Validators.required]], confirmPassword: ["", [Validators.required]], - token: [params['token']] + token: [params.token], }); }); } - form: FormGroup; - customizationSettings: ICustomizationSettings; - - - ngOnInit() : void { + public ngOnInit() { this.settingsService.getCustomization().subscribe(x => this.customizationSettings = x); } - - onSubmit(form: FormGroup): void { + public onSubmit(form: FormGroup) { if (form.invalid) { this.notify.error("Validation", "Email address is required"); - return + return; } - var token = form.value as IResetPasswordToken; + const token = form.value as IResetPasswordToken; this.identityService.resetPassword(token).subscribe(x => { if (x.successful) { - this.notify.success("Success", `Your Password has been reset`) - this.router.navigate(['login']); + this.notify.success("Success", `Your Password has been reset`); + this.router.navigate(["login"]); } else { x.errors.forEach((val) => { this.notify.error("Error", val); @@ -56,4 +54,4 @@ export class TokenResetPasswordComponent implements OnInit { }); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/pipes/HumanizePipe.ts b/src/Ombi/ClientApp/app/pipes/HumanizePipe.ts index 5c04028d1..fc2ae60be 100644 --- a/src/Ombi/ClientApp/app/pipes/HumanizePipe.ts +++ b/src/Ombi/ClientApp/app/pipes/HumanizePipe.ts @@ -1,15 +1,15 @@ -import { Pipe, PipeTransform } from '@angular/core'; +import { Pipe, PipeTransform } from "@angular/core"; @Pipe({ - name: 'humanize' + name: "humanize", }) export class HumanizePipe implements PipeTransform { - transform(value: string) { - if ((typeof value) !== 'string') { + public transform(value: string) { + if ((typeof value) !== "string") { return value; } - value = value.split(/(?=[A-Z])/).join(' '); + value = value.split(/(?=[A-Z])/).join(" "); value = value[0].toUpperCase() + value.slice(1); return value; } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/pipes/pipe.module.ts b/src/Ombi/ClientApp/app/pipes/pipe.module.ts index 291d1e8e5..08134909a 100644 --- a/src/Ombi/ClientApp/app/pipes/pipe.module.ts +++ b/src/Ombi/ClientApp/app/pipes/pipe.module.ts @@ -1,5 +1,5 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; -import { HumanizePipe } from './HumanizePipe'; +import { ModuleWithProviders, NgModule } from "@angular/core"; +import { HumanizePipe } from "./HumanizePipe"; @NgModule({ imports: [], @@ -8,10 +8,10 @@ import { HumanizePipe } from './HumanizePipe'; }) export class PipeModule { - static forRoot() : ModuleWithProviders { + public static forRoot(): ModuleWithProviders { return { ngModule: PipeModule, providers: [], }; } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/request-grid/request-card.component.ts b/src/Ombi/ClientApp/app/request-grid/request-card.component.ts index bad3cb87c..d430e3aa0 100644 --- a/src/Ombi/ClientApp/app/request-grid/request-card.component.ts +++ b/src/Ombi/ClientApp/app/request-grid/request-card.component.ts @@ -1,11 +1,11 @@ -import { Component, Input } from '@angular/core'; +import { Component, Input } from "@angular/core"; -import { IMediaBase } from '../interfaces/IRequestModel'; +import { IMediaBase } from "../interfaces"; @Component({ - selector: 'request-card', - templateUrl: './request-card.component.html' + selector: "request-card", + templateUrl: "./request-card.component.html", }) export class RequestCardComponent { - @Input() request: IMediaBase; + @Input() public request: IMediaBase; } diff --git a/src/Ombi/ClientApp/app/request-grid/request-grid.component.ts b/src/Ombi/ClientApp/app/request-grid/request-grid.component.ts index d9849ed1d..142bbf5a1 100644 --- a/src/Ombi/ClientApp/app/request-grid/request-grid.component.ts +++ b/src/Ombi/ClientApp/app/request-grid/request-grid.component.ts @@ -1,7 +1,7 @@ //import { Component, OnInit } from '@angular/core'; //import { DragulaService } from 'ng2-dragula/ng2-dragula'; -//import { RequestService } from '../services/request.service'; -//import { ITvRequests, IMovieRequests, IRequestGrid } from '../interfaces/IRequestModel'; +//import { RequestService } from '../services"; +//import { ITvRequests, IMovieRequests, IRequestGrid } from '../interfaces"; //@Component({ // templateUrl: './request-grid.component.html' @@ -13,8 +13,7 @@ // }); // } - -// ngOnInit(): void { +// ngOnInit() { // this.requestService.getMovieGrid().subscribe(x => { // this.movieRequests = x; // }); @@ -23,8 +22,7 @@ // }); // } - // movieRequests: IRequestGrid; // tvRequests: IRequestGrid; -//} \ No newline at end of file +//} diff --git a/src/Ombi/ClientApp/app/requests/movierequests.component.ts b/src/Ombi/ClientApp/app/requests/movierequests.component.ts index d83767233..604841e53 100644 --- a/src/Ombi/ClientApp/app/requests/movierequests.component.ts +++ b/src/Ombi/ClientApp/app/requests/movierequests.component.ts @@ -1,27 +1,38 @@ -import { Component, OnInit, OnDestroy } from '@angular/core'; -import { Subject } from 'rxjs/Subject'; -import 'rxjs/add/operator/debounceTime'; -import 'rxjs/add/operator/distinctUntilChanged'; -import 'rxjs/add/operator/map'; -import 'rxjs/add/operator/takeUntil'; +import { Component, OnDestroy, OnInit } from "@angular/core"; +import "rxjs/add/operator/debounceTime"; +import "rxjs/add/operator/distinctUntilChanged"; +import "rxjs/add/operator/map"; +import "rxjs/add/operator/takeUntil"; +import { Subject } from "rxjs/Subject"; +import "rxjs/add/operator/debounceTime"; +import "rxjs/add/operator/distinctUntilChanged"; +import "rxjs/add/operator/map"; -import 'rxjs/add/operator/debounceTime'; -import 'rxjs/add/operator/distinctUntilChanged'; -import 'rxjs/add/operator/map'; +import { AuthService } from "../auth/auth.service"; +import { RequestService } from "../services"; -import { RequestService } from '../services/request.service'; -import { AuthService } from '../auth/auth.service'; - -import { IMovieRequests } from '../interfaces/IRequestModel'; +import { IMovieRequests } from "../interfaces"; @Component({ - selector: 'movie-requests', - templateUrl: './movierequests.component.html' + selector: "movie-requests", + templateUrl: "./movierequests.component.html", }) export class MovieRequestsComponent implements OnInit, OnDestroy { + public movieRequests: IMovieRequests[]; + + public searchChanged: Subject = new Subject(); + public searchText: string; + + public isAdmin: boolean; + + private currentlyLoaded: number; + private amountToLoad: number; + + private subscriptions = new Subject(); + constructor(private requestService: RequestService, - private auth:AuthService) { + private auth: AuthService) { this.searchChanged .debounceTime(600) // Wait Xms afterthe last event before emitting last event .distinctUntilChanged() // only emit if value is different from previous value @@ -38,60 +49,50 @@ export class MovieRequestsComponent implements OnInit, OnDestroy { }); } - movieRequests: IMovieRequests[]; - - searchChanged: Subject = new Subject(); - searchText: string; - - isAdmin: boolean; - - private currentlyLoaded: number; - private amountToLoad: number; - - - private subscriptions = new Subject(); - - ngOnInit() { + public ngOnInit() { this.amountToLoad = 5; this.currentlyLoaded = 5; this.loadInit(); this.isAdmin = this.auth.hasRole("admin"); } - - - loadMore() { + public loadMore() { this.loadRequests(this.amountToLoad, this.currentlyLoaded); } - search(text: any) { + public search(text: any) { this.searchChanged.next(text.target.value); } - removeRequest(request: IMovieRequests) { + public removeRequest(request: IMovieRequests) { this.requestService.removeMovieRequest(request); this.removeRequestFromUi(request); this.loadRequests(1, this.currentlyLoaded); } - changeAvailability(request: IMovieRequests, available: boolean) { + public changeAvailability(request: IMovieRequests, available: boolean) { request.available = available; this.updateRequest(request); } - approve(request: IMovieRequests) { + public approve(request: IMovieRequests) { request.approved = true; request.denied = false; this.updateRequest(request); } - deny(request: IMovieRequests) { + public deny(request: IMovieRequests) { request.approved = false; request.denied = true; this.updateRequest(request); } + public ngOnDestroy() { + this.subscriptions.next(); + this.subscriptions.complete(); + } + private loadRequests(amountToLoad: number, currentlyLoaded: number) { this.requestService.getMovieRequests(amountToLoad, currentlyLoaded + 1) .takeUntil(this.subscriptions) @@ -119,14 +120,9 @@ export class MovieRequestsComponent implements OnInit, OnDestroy { } private removeRequestFromUi(key: IMovieRequests) { - var index = this.movieRequests.indexOf(key, 0); + const index = this.movieRequests.indexOf(key, 0); if (index > -1) { this.movieRequests.splice(index, 1); } } - - ngOnDestroy(): void { - this.subscriptions.next(); - this.subscriptions.complete(); - } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/requests/request.component.ts b/src/Ombi/ClientApp/app/requests/request.component.ts index bd6d5bbae..ab4150443 100644 --- a/src/Ombi/ClientApp/app/requests/request.component.ts +++ b/src/Ombi/ClientApp/app/requests/request.component.ts @@ -1,16 +1,16 @@ -import { Component } from '@angular/core'; +import { Component } from "@angular/core"; @Component({ - templateUrl: './request.component.html' + templateUrl: "./request.component.html", }) export class RequestComponent { - showMovie = true; - showTv = false; + public showMovie = true; + public showTv = false; - selectTab() { + public selectTab() { this.showMovie = !this.showMovie; this.showTv = !this.showTv; } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/requests/requests.module.ts b/src/Ombi/ClientApp/app/requests/requests.module.ts index b250602e4..eb5d0e212 100644 --- a/src/Ombi/ClientApp/app/requests/requests.module.ts +++ b/src/Ombi/ClientApp/app/requests/requests.module.ts @@ -1,29 +1,29 @@ -import { NgModule, } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; -import { RouterModule, Routes } from '@angular/router'; +import { CommonModule } from "@angular/common"; +import { NgModule } from "@angular/core"; +import { FormsModule } from "@angular/forms"; +import { RouterModule, Routes } from "@angular/router"; -import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { NgbModule } from "@ng-bootstrap/ng-bootstrap"; -import { InfiniteScrollModule } from 'ngx-infinite-scroll'; +import { InfiniteScrollModule } from "ngx-infinite-scroll"; -import { ButtonModule, DialogModule } from 'primeng/primeng'; +import { ButtonModule, DialogModule } from "primeng/primeng"; +import { MovieRequestsComponent } from "./movierequests.component"; // Request -import { RequestComponent } from './request.component'; -import { MovieRequestsComponent } from './movierequests.component'; -import { TvRequestsComponent } from './tvrequests.component'; -import { TvRequestChildrenComponent } from './tvrequest-children.component'; +import { RequestComponent } from "./request.component"; +import { TvRequestChildrenComponent } from "./tvrequest-children.component"; +import { TvRequestsComponent } from "./tvrequests.component"; -import { TreeTableModule } from 'primeng/primeng'; +import { TreeTableModule } from "primeng/primeng"; -import { IdentityService } from '../services/identity.service'; -import { RequestService } from '../services/request.service'; +import { IdentityService } from "../services"; +import { RequestService } from "../services"; -import { AuthGuard } from '../auth/auth.guard'; +import { AuthGuard } from "../auth/auth.guard"; const routes: Routes = [ - { path: 'requests', component: RequestComponent, canActivate: [AuthGuard] }, - { path: 'requests/:id', component: TvRequestChildrenComponent, canActivate: [AuthGuard] }, + { path: "requests", component: RequestComponent, canActivate: [AuthGuard] }, + { path: "requests/:id", component: TvRequestChildrenComponent, canActivate: [AuthGuard] }, ]; @NgModule({ @@ -35,7 +35,7 @@ const routes: Routes = [ InfiniteScrollModule, ButtonModule, DialogModule, - TreeTableModule + TreeTableModule, ], declarations: [ RequestComponent, @@ -44,12 +44,12 @@ const routes: Routes = [ TvRequestChildrenComponent, ], exports: [ - RouterModule + RouterModule, ], providers: [ IdentityService, - RequestService + RequestService, ], }) -export class RequestsModule { } \ No newline at end of file +export class RequestsModule { } diff --git a/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts index 067ac56c1..d6ca8d432 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts +++ b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts @@ -1,17 +1,15 @@ -import { Component, Input } from '@angular/core'; -import { RequestService } from '../services/request.service'; -import { IChildRequests, IEpisodesRequests } from '../interfaces/IRequestModel'; +import { Component, Input } from "@angular/core"; +import { IChildRequests, IEpisodesRequests } from "../interfaces"; +import { RequestService } from "../services"; @Component({ - selector:'tvrequests-children', - templateUrl: './tvrequest-children.component.html' + selector:"tvrequests-children", + templateUrl: "./tvrequest-children.component.html", }) export class TvRequestChildrenComponent { - constructor(private requestService: RequestService ) { - } - - @Input() childRequests: IChildRequests[]; - @Input() isAdmin: boolean; + @Input() public childRequests: IChildRequests[]; + @Input() public isAdmin: boolean; + constructor(private requestService: RequestService ) { } public removeRequest(request: IChildRequests) { this.requestService.deleteChild(request) .subscribe(); @@ -23,7 +21,6 @@ export class TvRequestChildrenComponent { } public deny(request: IChildRequests) { - debugger; request.approved = false; request.denied = true; @@ -37,7 +34,6 @@ export class TvRequestChildrenComponent { } public approve(request: IChildRequests) { - debugger; request.approved = true; request.denied = false; this.requestService.updateChild(request) @@ -62,9 +58,9 @@ export class TvRequestChildrenComponent { } private removeRequestFromUi(key: IChildRequests) { - var index = this.childRequests.indexOf(key, 0); + const index = this.childRequests.indexOf(key, 0); if (index > -1) { this.childRequests.splice(index, 1); } } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts index 8d525109d..eed66b1cc 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts +++ b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts @@ -1,32 +1,44 @@ -import { Component, OnInit, OnDestroy, ViewEncapsulation } from '@angular/core'; -import { Subject } from 'rxjs/Subject'; -import 'rxjs/add/operator/debounceTime'; -import 'rxjs/add/operator/distinctUntilChanged'; -import 'rxjs/add/operator/map'; +import { Component, OnDestroy, OnInit, ViewEncapsulation } from "@angular/core"; +import "rxjs/add/operator/debounceTime"; +import "rxjs/add/operator/distinctUntilChanged"; +import "rxjs/add/operator/map"; import "rxjs/add/operator/takeUntil"; +import { Subject } from "rxjs/Subject"; -import 'rxjs/add/operator/debounceTime'; -import 'rxjs/add/operator/distinctUntilChanged'; -import 'rxjs/add/operator/map'; +import "rxjs/add/operator/debounceTime"; +import "rxjs/add/operator/distinctUntilChanged"; +import "rxjs/add/operator/map"; -import { RequestService } from '../services/request.service'; -import { AuthService } from '../auth/auth.service'; +import { AuthService } from "../auth/auth.service"; +import { RequestService } from "../services"; -import { ITvRequests, IChildRequests, INewSeasonRequests, IEpisodesRequests } from '../interfaces/IRequestModel'; -import { TreeNode, } from "primeng/primeng"; +import { TreeNode } from "primeng/primeng"; +import { IChildRequests, IEpisodesRequests, INewSeasonRequests, ITvRequests } from "../interfaces"; @Component({ - selector: 'tv-requests', - templateUrl: './tvrequests.component.html', - styleUrls: ['./tvrequests.component.scss'], + selector: "tv-requests", + templateUrl: "./tvrequests.component.html", + styleUrls: ["./tvrequests.component.scss"], //Was required to turn off encapsulation since CSS only should be overridden for this component //However when encapsulation is on angular injects prefixes to all classes so css selectors //Stop working - encapsulation: ViewEncapsulation.None + encapsulation: ViewEncapsulation.None, }) export class TvRequestsComponent implements OnInit, OnDestroy { + + public tvRequests: TreeNode[]; + public searchChanged = new Subject(); + public searchText: string; + public isAdmin: boolean; + public showChildDialogue = false; // This is for the child modal popup + public selectedSeason: ITvRequests; + + private currentlyLoaded: number; + private amountToLoad: number; + private subscriptions = new Subject(); + constructor(private requestService: RequestService, - private auth: AuthService) { + private auth: AuthService) { this.searchChanged .debounceTime(600) // Wait Xms afterthe last event before emitting last event .distinctUntilChanged() // only emit if value is different from previous value @@ -42,22 +54,20 @@ export class TvRequestsComponent implements OnInit, OnDestroy { .subscribe(m => this.tvRequests = this.transformData(m)); }); } - openClosestTab(el: any): void { - var rowclass = "undefined"; + public openClosestTab(el: any) { + const rowclass = "undefined"; el = el.toElement; - while (el.className != rowclass) { + while (el.className !== rowclass) { // Increment the loop to the parent node until we find the row we need el = el.parentNode; - if (!el) { - } } // At this point, the while loop has stopped and `el` represents the element that has // the class you specified // Then we loop through the children to find the caret which we want to click - var caretright = "ui-treetable-toggler fa fa-fw ui-clickable fa-caret-right"; - var caretdown = "ui-treetable-toggler fa fa-fw ui-clickable fa-caret-down"; - for (var value of el.children) { + const caretright = "ui-treetable-toggler fa fa-fw ui-clickable fa-caret-right"; + const caretdown = "ui-treetable-toggler fa fa-fw ui-clickable fa-caret-down"; + for (const value of el.children) { // the caret from the ui has 2 class selectors depending on if expanded or not // we search for both since we want to still toggle the clicking if (value.className === caretright || value.className === caretdown) { @@ -66,47 +76,33 @@ export class TvRequestsComponent implements OnInit, OnDestroy { //Break from loop since we no longer need to continue looking break; } - }; + } } - transformData(data: ITvRequests[]): TreeNode[] { - var temp: TreeNode[] = []; + public transformData(data: ITvRequests[]): TreeNode[] { + const temp: TreeNode[] = []; data.forEach((value) => { temp.push({ - "data": value, - "children": [{ - "data": this.fixEpisodeSort(value.childRequests), leaf: true + data: value, + children: [{ + data: this.fixEpisodeSort(value.childRequests), leaf: true, }], - leaf: false + leaf: false, }); - }, this) + }, this); return temp; } - private subscriptions = new Subject(); - - tvRequests: TreeNode[]; - searchChanged = new Subject(); - searchText: string; - - isAdmin: boolean; - - private currentlyLoaded: number; - private amountToLoad: number; - - public showChildDialogue = false; // This is for the child modal popup - public selectedSeason: ITvRequests; - - fixEpisodeSort(items: IChildRequests[]) { - items.forEach(function (value) { - value.seasonRequests.forEach(function (requests: INewSeasonRequests) { - requests.episodes.sort(function (a: IEpisodesRequests, b: IEpisodesRequests) { + public fixEpisodeSort(items: IChildRequests[]) { + items.forEach((value) => { + value.seasonRequests.forEach((requests: INewSeasonRequests) => { + requests.episodes.sort((a: IEpisodesRequests, b: IEpisodesRequests) => { return a.episodeNumber - b.episodeNumber; - }) - }) - }) + }); + }); + }); return items; } - ngOnInit() { + public ngOnInit() { this.amountToLoad = 1000; this.currentlyLoaded = 5; this.tvRequests = []; @@ -197,6 +193,11 @@ export class TvRequestsComponent implements OnInit, OnDestroy { return "white"; } + public ngOnDestroy() { + this.subscriptions.next(); + this.subscriptions.complete(); + } + //private updateRequest(request: ITvRequests) { // this.requestService.updateTvRequest(request) // .takeUntil(this.subscriptions) @@ -217,14 +218,9 @@ export class TvRequestsComponent implements OnInit, OnDestroy { } private removeRequestFromUi(key: ITvRequests) { - var index = this.tvRequests.findIndex(x => x.data === key); + const index = this.tvRequests.findIndex(x => x.data === key); if (index > -1) { this.tvRequests.splice(index, 1); } } - - ngOnDestroy(): void { - this.subscriptions.next(); - this.subscriptions.complete(); - } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/search/moviesearch.component.ts b/src/Ombi/ClientApp/app/search/moviesearch.component.ts index b3eb40e91..aa9ed558f 100644 --- a/src/Ombi/ClientApp/app/search/moviesearch.component.ts +++ b/src/Ombi/ClientApp/app/search/moviesearch.component.ts @@ -1,33 +1,33 @@ -import { Component, OnInit, OnDestroy } from '@angular/core'; -import { Subject } from 'rxjs/Subject'; -import 'rxjs/add/operator/debounceTime'; -import 'rxjs/add/operator/distinctUntilChanged'; -import 'rxjs/add/operator/map'; +import { Component, OnDestroy, OnInit } from "@angular/core"; +import "rxjs/add/operator/debounceTime"; +import "rxjs/add/operator/distinctUntilChanged"; +import "rxjs/add/operator/map"; import "rxjs/add/operator/takeUntil"; +import { Subject } from "rxjs/Subject"; -import { SearchService } from '../services/search.service'; -import { AuthService } from '../auth/auth.service'; -import { RequestService } from '../services/request.service'; -import { NotificationService } from '../services/notification.service'; +import { AuthService } from "../auth/auth.service"; +import { NotificationService } from "../services"; +import { RequestService } from "../services"; +import { SearchService } from "../services"; -import { ISearchMovieResult } from '../interfaces/ISearchMovieResult'; -import { IRequestEngineResult } from '../interfaces/IRequestEngineResult'; +import { IRequestEngineResult } from "../interfaces"; +import { ISearchMovieResult } from "../interfaces"; @Component({ - selector: 'movie-search', - templateUrl: './moviesearch.component.html', + selector: "movie-search", + templateUrl: "./moviesearch.component.html", }) export class MovieSearchComponent implements OnInit, OnDestroy { - searchText: string; + public searchText: string; + public searchChanged: Subject = new Subject(); + public movieResults: ISearchMovieResult[]; + public result: IRequestEngineResult; + public searchApplied = false; private subscriptions = new Subject(); - searchChanged: Subject = new Subject(); - movieResults: ISearchMovieResult[]; - result: IRequestEngineResult; - searchApplied = false; constructor(private searchService: SearchService, private requestService: RequestService, - private notificationService: NotificationService, private authService : AuthService) { + private notificationService: NotificationService, private authService: AuthService) { this.searchChanged .debounceTime(600) // Wait Xms afterthe last event before emitting last event @@ -51,21 +51,21 @@ export class MovieSearchComponent implements OnInit, OnDestroy { }); } - ngOnInit(): void { + public ngOnInit() { this.searchText = ""; this.movieResults = []; this.result = { message: "", requestAdded: false, - errorMessage: "" - } + errorMessage: "", + }; } - search(text: any) { + public search(text: any) { this.searchChanged.next(text.target.value); } - request(searchResult: ISearchMovieResult) { + public request(searchResult: ISearchMovieResult) { searchResult.requested = true; if (this.authService.hasRole("admin") || this.authService.hasRole("AutoApproveMovie")) { searchResult.approved = true; @@ -87,7 +87,7 @@ export class MovieSearchComponent implements OnInit, OnDestroy { }); } - popularMovies() { + public popularMovies() { this.clearResults(); this.searchService.popularMovies() .takeUntil(this.subscriptions) @@ -96,7 +96,7 @@ export class MovieSearchComponent implements OnInit, OnDestroy { this.getExtaInfo(); }); } - nowPlayingMovies() { + public nowPlayingMovies() { this.clearResults(); this.searchService.nowPlayingMovies() .takeUntil(this.subscriptions) @@ -105,7 +105,7 @@ export class MovieSearchComponent implements OnInit, OnDestroy { this.getExtaInfo(); }); } - topRatedMovies() { + public topRatedMovies() { this.clearResults(); this.searchService.topRatedMovies() .takeUntil(this.subscriptions) @@ -114,7 +114,7 @@ export class MovieSearchComponent implements OnInit, OnDestroy { this.getExtaInfo(); }); } - upcomingMovies() { + public upcomingMovies() { this.clearResults(); this.searchService.upcomignMovies() .takeUntil(this.subscriptions) @@ -124,6 +124,11 @@ export class MovieSearchComponent implements OnInit, OnDestroy { }); } + public ngOnDestroy() { + this.subscriptions.next(); + this.subscriptions.complete(); + } + private getExtaInfo() { this.movieResults.forEach((val, index) => { @@ -134,7 +139,7 @@ export class MovieSearchComponent implements OnInit, OnDestroy { } private updateItem(key: ISearchMovieResult, updated: ISearchMovieResult) { - var index = this.movieResults.indexOf(key, 0); + const index = this.movieResults.indexOf(key, 0); if (index > -1) { this.movieResults[index] = updated; } @@ -143,10 +148,4 @@ export class MovieSearchComponent implements OnInit, OnDestroy { this.movieResults = []; this.searchApplied = false; } - - ngOnDestroy(): void { - this.subscriptions.next(); - this.subscriptions.complete(); - } - -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/search/search.component.ts b/src/Ombi/ClientApp/app/search/search.component.ts index fc853876b..8f3a2d5e5 100644 --- a/src/Ombi/ClientApp/app/search/search.component.ts +++ b/src/Ombi/ClientApp/app/search/search.component.ts @@ -1,21 +1,18 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit } from "@angular/core"; @Component({ - templateUrl: './search.component.html', + templateUrl: "./search.component.html", }) export class SearchComponent implements OnInit { - ngOnInit(): void { + public showTv: boolean; + public showMovie: boolean; + + public ngOnInit() { this.showMovie = true; this.showTv = false; } - showTv : boolean; - showMovie: boolean; - - - selectTab() { + public selectTab() { this.showMovie = !this.showMovie; - this.showTv = !this.showTv; + this.showTv = !this.showTv; } - - -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/search/search.module.ts b/src/Ombi/ClientApp/app/search/search.module.ts index 3742aad78..90813be21 100644 --- a/src/Ombi/ClientApp/app/search/search.module.ts +++ b/src/Ombi/ClientApp/app/search/search.module.ts @@ -1,25 +1,25 @@ -import { NgModule, } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; -import { RouterModule, Routes } from '@angular/router'; +import { CommonModule } from "@angular/common"; +import { NgModule } from "@angular/core"; +import { FormsModule } from "@angular/forms"; +import { RouterModule, Routes } from "@angular/router"; -import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { NgbModule } from "@ng-bootstrap/ng-bootstrap"; -import { SearchComponent } from './search.component'; -import { MovieSearchComponent } from './moviesearch.component'; -import { TvSearchComponent } from './tvsearch.component'; -import { SeriesInformationComponent } from './seriesinformation.component'; +import { MovieSearchComponent } from "./moviesearch.component"; +import { SearchComponent } from "./search.component"; +import { SeriesInformationComponent } from "./seriesinformation.component"; +import { TvSearchComponent } from "./tvsearch.component"; -import { TreeTableModule } from 'primeng/primeng'; +import { TreeTableModule } from "primeng/primeng"; -import { SearchService } from '../services/search.service'; -import { RequestService } from '../services/request.service'; +import { RequestService } from "../services"; +import { SearchService } from "../services"; -import { AuthGuard } from '../auth/auth.guard'; +import { AuthGuard } from "../auth/auth.guard"; const routes: Routes = [ - { path: 'search', component: SearchComponent, canActivate: [AuthGuard] }, - { path: 'search/show/:id', component: SeriesInformationComponent, canActivate: [AuthGuard] }, + { path: "search", component: SearchComponent, canActivate: [AuthGuard] }, + { path: "search/show/:id", component: SeriesInformationComponent, canActivate: [AuthGuard] }, ]; @NgModule({ @@ -28,7 +28,7 @@ const routes: Routes = [ FormsModule, RouterModule.forChild(routes), NgbModule.forRoot(), - TreeTableModule + TreeTableModule, ], declarations: [ SearchComponent, @@ -37,11 +37,11 @@ const routes: Routes = [ SeriesInformationComponent, ], exports: [ - RouterModule + RouterModule, ], providers: [ SearchService, - RequestService + RequestService, ], }) -export class SearchModule { } \ No newline at end of file +export class SearchModule { } diff --git a/src/Ombi/ClientApp/app/search/seriesinformation.component.ts b/src/Ombi/ClientApp/app/search/seriesinformation.component.ts index c4c8de00f..34124acd9 100644 --- a/src/Ombi/ClientApp/app/search/seriesinformation.component.ts +++ b/src/Ombi/ClientApp/app/search/seriesinformation.component.ts @@ -1,37 +1,34 @@ -import { Component, OnInit, OnDestroy, Input} from '@angular/core'; +import { Component, Input, OnDestroy, OnInit} from "@angular/core"; //import { ActivatedRoute } from '@angular/router'; -import { Subject } from 'rxjs/Subject'; +import { Subject } from "rxjs/Subject"; import "rxjs/add/operator/takeUntil"; -import { SearchService } from '../services/search.service'; -import { RequestService } from '../services/request.service'; -import { NotificationService } from '../services/notification.service'; +import { NotificationService } from "../services"; +import { RequestService } from "../services"; +import { SearchService } from "../services"; -import { ISearchTvResult } from '../interfaces/ISearchTvResult'; -import { IRequestEngineResult } from '../interfaces/IRequestEngineResult'; -import { IEpisodesRequests } from "../interfaces/IRequestModel"; +import { IRequestEngineResult } from "../interfaces"; +import { IEpisodesRequests } from "../interfaces"; +import { ISearchTvResult } from "../interfaces"; @Component({ - selector: 'seriesinformation', - templateUrl: './seriesinformation.component.html', - styleUrls: ['./seriesinformation.component.scss'] + selector: "seriesinformation", + templateUrl: "./seriesinformation.component.html", + styleUrls: ["./seriesinformation.component.scss"], }) export class SeriesInformationComponent implements OnInit, OnDestroy { - constructor(private searchService: SearchService, private requestService: RequestService, private notificationService: NotificationService) { - } - - private subscriptions = new Subject(); - - public result : IRequestEngineResult; - @Input() private seriesId: number; + public result: IRequestEngineResult; public series: ISearchTvResult; + public requestedEpisodes: IEpisodesRequests[] = []; - requestedEpisodes: IEpisodesRequests[] = []; + @Input() private seriesId: number; + private subscriptions = new Subject(); + constructor(private searchService: SearchService, private requestService: RequestService, private notificationService: NotificationService) { } - ngOnInit(): void { + public ngOnInit() { this.searchService.getShowInformation(this.seriesId) .takeUntil(this.subscriptions) .subscribe(x => { @@ -41,7 +38,7 @@ export class SeriesInformationComponent implements OnInit, OnDestroy { public submitRequests() { this.series.requested = true; - + this.requestService.requestTv(this.series) .takeUntil(this.subscriptions) .subscribe(x => { @@ -63,9 +60,8 @@ export class SeriesInformationComponent implements OnInit, OnDestroy { episode.requested = false; } - - ngOnDestroy(): void { + public ngOnDestroy() { this.subscriptions.next(); this.subscriptions.complete(); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/search/tvsearch.component.ts b/src/Ombi/ClientApp/app/search/tvsearch.component.ts index f5b526f6a..f8d2cc65f 100644 --- a/src/Ombi/ClientApp/app/search/tvsearch.component.ts +++ b/src/Ombi/ClientApp/app/search/tvsearch.component.ts @@ -1,32 +1,33 @@ -import { Component, OnInit, OnDestroy } from '@angular/core'; -import { Router } from '@angular/router'; -import { Subject } from 'rxjs/Subject'; +import { Component, OnDestroy, OnInit } from "@angular/core"; +import { Router } from "@angular/router"; +import { Subject } from "rxjs/Subject"; -import { SearchService } from '../services/search.service'; -import { AuthService } from '../auth/auth.service'; -import { RequestService } from '../services/request.service'; -import { NotificationService } from '../services/notification.service'; +import { AuthService } from "../auth/auth.service"; +import { NotificationService } from "../services"; +import { RequestService } from "../services"; +import { SearchService } from "../services"; -import { ISearchTvResult } from '../interfaces/ISearchTvResult'; -import { IRequestEngineResult } from '../interfaces/IRequestEngineResult'; -import { TreeNode } from 'primeng/primeng'; +import { TreeNode } from "primeng/primeng"; +import { IRequestEngineResult } from "../interfaces"; +import { ISearchTvResult } from "../interfaces"; @Component({ - selector: 'tv-search', - templateUrl: './tvsearch.component.html', - styleUrls: ['./../requests/tvrequests.component.scss'], + selector: "tv-search", + templateUrl: "./tvsearch.component.html", + styleUrls: ["./../requests/tvrequests.component.scss"], }) export class TvSearchComponent implements OnInit, OnDestroy { + public searchText: string; + public searchChanged = new Subject(); + public tvResults: TreeNode[]; + public result: IRequestEngineResult; + public searchApplied = false; + private subscriptions = new Subject(); - searchText: string; - searchChanged = new Subject(); - tvResults: TreeNode[]; - result: IRequestEngineResult; - searchApplied = false; constructor(private searchService: SearchService, private requestService: RequestService, - private notificationService: NotificationService, private route: Router, private authService: AuthService) { + private notificationService: NotificationService, private route: Router, private authService: AuthService) { this.searchChanged .debounceTime(600) // Wait Xms afterthe last event before emitting last event @@ -46,22 +47,20 @@ export class TvSearchComponent implements OnInit, OnDestroy { }); }); } - openClosestTab(el: any): void { - let rowclass = "undefined"; + public openClosestTab(el: any) { + const rowclass = "undefined"; el = el.toElement; - while (el.className != rowclass) { + while (el.className !== rowclass) { // Increment the loop to the parent node until we find the row we need el = el.parentNode; - if (!el) { - } } // At this point, the while loop has stopped and `el` represents the element that has // the class you specified // Then we loop through the children to find the caret which we want to click - let caretright = "ui-treetable-toggler fa fa-fw ui-clickable fa-caret-right"; - let caretdown = "ui-treetable-toggler fa fa-fw ui-clickable fa-caret-down"; - for (let value of el.children) { + const caretright = "ui-treetable-toggler fa fa-fw ui-clickable fa-caret-right"; + const caretdown = "ui-treetable-toggler fa fa-fw ui-clickable fa-caret-down"; + for (const value of el.children) { // the caret from the ui has 2 class selectors depending on if expanded or not // we search for both since we want to still toggle the clicking if (value.className === caretright || value.className === caretdown) { @@ -70,25 +69,24 @@ export class TvSearchComponent implements OnInit, OnDestroy { //Break from loop since we no longer need to continue looking break; } - }; + } } - - ngOnInit(): void { + + public ngOnInit() { this.searchText = ""; this.tvResults = []; this.result = { message: "", requestAdded: false, - errorMessage:"" - } + errorMessage:"", + }; } - search(text: any) { + public search(text: any) { this.searchChanged.next(text.target.value); } - - popularShows() { + public popularShows() { this.clearResults(); this.searchService.popularTv() .takeUntil(this.subscriptions) @@ -98,7 +96,7 @@ export class TvSearchComponent implements OnInit, OnDestroy { }); } - trendingShows() { + public trendingShows() { this.clearResults(); this.searchService.trendingTv() .takeUntil(this.subscriptions) @@ -108,7 +106,7 @@ export class TvSearchComponent implements OnInit, OnDestroy { }); } - mostWatchedShows() { + public mostWatchedShows() { this.clearResults(); this.searchService.mostWatchedTv() .takeUntil(this.subscriptions) @@ -118,7 +116,7 @@ export class TvSearchComponent implements OnInit, OnDestroy { }); } - anticipatedShows() { + public anticipatedShows() { this.clearResults(); this.searchService.anticipatedTv() .takeUntil(this.subscriptions) @@ -128,7 +126,7 @@ export class TvSearchComponent implements OnInit, OnDestroy { }); } - getExtraInfo() { + public getExtraInfo() { this.tvResults.forEach((val, index) => { this.searchService.getShowInformationTreeNode(val.data.id) .takeUntil(this.subscriptions) @@ -138,7 +136,7 @@ export class TvSearchComponent implements OnInit, OnDestroy { }); } - request(searchResult: ISearchTvResult) { + public request(searchResult: ISearchTvResult) { searchResult.requested = true; if (this.authService.hasRole("admin") || this.authService.hasRole("AutoApproveMovie")) { searchResult.approved = true; @@ -156,40 +154,39 @@ export class TvSearchComponent implements OnInit, OnDestroy { }); } - allSeasons(searchResult: ISearchTvResult) { + public allSeasons(searchResult: ISearchTvResult) { searchResult.requestAll = true; this.request(searchResult); } - firstSeason(searchResult: ISearchTvResult) { + public firstSeason(searchResult: ISearchTvResult) { searchResult.firstSeason = true; this.request(searchResult); } - latestSeason(searchResult: ISearchTvResult) { + public latestSeason(searchResult: ISearchTvResult) { searchResult.latestSeason = true; this.request(searchResult); } - selectSeason(searchResult: ISearchTvResult) { - this.route.navigate(['/search/show', searchResult.id]); + public selectSeason(searchResult: ISearchTvResult) { + this.route.navigate(["/search/show", searchResult.id]); + } + + public ngOnDestroy() { + this.subscriptions.next(); + this.subscriptions.complete(); } private updateItem(key: TreeNode, updated: TreeNode) { - let item = this.tvResults.filter((val) => { - return val.data == key; - }); - item[0].data = updated.data; + const index = this.tvResults.indexOf(key, 0); + if (index > -1) { + this.tvResults[index] = updated; + } } private clearResults() { this.tvResults = []; this.searchApplied = false; } - - ngOnDestroy(): void { - this.subscriptions.next(); - this.subscriptions.complete(); - } - -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/services/applications/emby.service.ts b/src/Ombi/ClientApp/app/services/applications/emby.service.ts index 71a24003f..785352cc0 100644 --- a/src/Ombi/ClientApp/app/services/applications/emby.service.ts +++ b/src/Ombi/ClientApp/app/services/applications/emby.service.ts @@ -1,20 +1,19 @@ -import { Injectable } from '@angular/core'; -import { Http } from '@angular/http'; -import { Observable } from 'rxjs/Rx'; +import { Injectable } from "@angular/core"; +import { Http } from "@angular/http"; +import { Observable } from "rxjs/Rx"; -import { ServiceHelpers } from '../service.helpers'; - -import { IEmbySettings } from '../../interfaces/ISettings' +import { ServiceHelpers } from "../service.helpers"; +import { IEmbySettings } from "../../interfaces"; @Injectable() export class EmbyService extends ServiceHelpers { constructor(http: Http) { - super(http, '/api/v1/Emby/'); + super(http, "/api/v1/Emby/"); } - logIn(settings: IEmbySettings): Observable { + public logIn(settings: IEmbySettings): Observable { return this.http.post(`${this.url}`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); } - -} \ No newline at end of file + +} diff --git a/src/Ombi/ClientApp/app/services/applications/index.ts b/src/Ombi/ClientApp/app/services/applications/index.ts new file mode 100644 index 000000000..0026bc158 --- /dev/null +++ b/src/Ombi/ClientApp/app/services/applications/index.ts @@ -0,0 +1,5 @@ +export * from "./emby.service"; +export * from "./plex.service"; +export * from "./radarr.service"; +export * from "./sonarr.service"; +export * from "./tester.service"; diff --git a/src/Ombi/ClientApp/app/services/applications/plex.service.ts b/src/Ombi/ClientApp/app/services/applications/plex.service.ts index 51e61dd2c..de71f6ccb 100644 --- a/src/Ombi/ClientApp/app/services/applications/plex.service.ts +++ b/src/Ombi/ClientApp/app/services/applications/plex.service.ts @@ -1,31 +1,30 @@ -import { Injectable } from '@angular/core'; -import { Http } from '@angular/http' +import { Injectable } from "@angular/core"; +import { Http } from "@angular/http"; -import { AuthHttp } from 'angular2-jwt';; -import { Observable } from 'rxjs/Rx'; +import { AuthHttp } from "angular2-jwt"; +import { Observable } from "rxjs/Rx"; -import { ServiceAuthHelpers } from '../service.helpers'; - -import { IPlexAuthentication, IPlexLibraries, IPlexServerViewModel } from '../../interfaces/IPlex'; -import { IPlexServer } from '../../interfaces/ISettings'; +import { ServiceAuthHelpers } from "../service.helpers"; +import { IPlexAuthentication, IPlexLibraries, IPlexServerViewModel } from "../../interfaces"; +import { IPlexServer } from "../../interfaces"; @Injectable() export class PlexService extends ServiceAuthHelpers { constructor(http: AuthHttp, private regularHttp: Http) { - super(http, '/api/v1/Plex/'); + super(http, "/api/v1/Plex/"); } - logIn(login: string, password: string): Observable { - return this.regularHttp.post(`${this.url}`, JSON.stringify({ login: login, password: password }), { headers: this.headers }).map(this.extractData); + public logIn(login: string, password: string): Observable { + return this.regularHttp.post(`${this.url}`, JSON.stringify({ login, password }), { headers: this.headers }).map(this.extractData); } - getServers(login: string, password: string): Observable { - return this.http.post(`${this.url}servers`, JSON.stringify({ login: login, password: password }), { headers: this.headers }).map(this.extractData); + public getServers(login: string, password: string): Observable { + return this.http.post(`${this.url}servers`, JSON.stringify({ login, password }), { headers: this.headers }).map(this.extractData); } - getLibraries(plexSettings: IPlexServer): Observable { + public getLibraries(plexSettings: IPlexServer): Observable { return this.http.post(`${this.url}Libraries`, JSON.stringify(plexSettings), { headers: this.headers }).map(this.extractData).catch(this.handleError); } - -} \ No newline at end of file + +} diff --git a/src/Ombi/ClientApp/app/services/applications/radarr.service.ts b/src/Ombi/ClientApp/app/services/applications/radarr.service.ts index 73149c658..a5d5bc248 100644 --- a/src/Ombi/ClientApp/app/services/applications/radarr.service.ts +++ b/src/Ombi/ClientApp/app/services/applications/radarr.service.ts @@ -1,21 +1,21 @@ -import { Injectable } from '@angular/core'; -import { AuthHttp } from 'angular2-jwt'; -import { Observable } from 'rxjs/Rx'; +import { Injectable } from "@angular/core"; +import { AuthHttp } from "angular2-jwt"; +import { Observable } from "rxjs/Rx"; -import { ServiceAuthHelpers } from '../service.helpers'; -import { IRadarrSettings } from '../../interfaces/ISettings'; -import { IRadarrProfile, IRadarrRootFolder } from '../../interfaces/IRadarr'; +import { IRadarrProfile, IRadarrRootFolder } from "../../interfaces"; +import { IRadarrSettings } from "../../interfaces"; +import { ServiceAuthHelpers } from "../service.helpers"; @Injectable() export class RadarrService extends ServiceAuthHelpers { constructor(http: AuthHttp) { - super(http, '/api/v1/Radarr'); + super(http, "/api/v1/Radarr"); } - getRootFolders(settings: IRadarrSettings): Observable { + public getRootFolders(settings: IRadarrSettings): Observable { return this.http.post(`${this.url}/RootFolders/`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); } - getQualityProfiles(settings: IRadarrSettings): Observable { + public getQualityProfiles(settings: IRadarrSettings): Observable { return this.http.post(`${this.url}/Profiles/`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/services/applications/sonarr.service.ts b/src/Ombi/ClientApp/app/services/applications/sonarr.service.ts index 71acc3733..57a6e2440 100644 --- a/src/Ombi/ClientApp/app/services/applications/sonarr.service.ts +++ b/src/Ombi/ClientApp/app/services/applications/sonarr.service.ts @@ -1,21 +1,21 @@ -import { Injectable } from '@angular/core'; -import { AuthHttp } from 'angular2-jwt'; -import { Observable } from 'rxjs/Rx'; +import { Injectable } from "@angular/core"; +import { AuthHttp } from "angular2-jwt"; +import { Observable } from "rxjs/Rx"; -import { ServiceAuthHelpers } from '../service.helpers'; -import { ISonarrSettings } from '../../interfaces/ISettings'; -import { ISonarrRootFolder, ISonarrProfile } from '../../interfaces/ISonarr'; +import { ISonarrSettings } from "../../interfaces"; +import { ISonarrProfile, ISonarrRootFolder } from "../../interfaces"; +import { ServiceAuthHelpers } from "../service.helpers"; @Injectable() export class SonarrService extends ServiceAuthHelpers { constructor(http: AuthHttp) { - super(http, '/api/v1/Sonarr'); + super(http, "/api/v1/Sonarr"); } - getRootFolders(settings: ISonarrSettings): Observable { + public getRootFolders(settings: ISonarrSettings): Observable { return this.http.post(`${this.url}/RootFolders/`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); } - getQualityProfiles(settings: ISonarrSettings): Observable { + public getQualityProfiles(settings: ISonarrSettings): Observable { return this.http.post(`${this.url}/Profiles/`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/services/applications/tester.service.ts b/src/Ombi/ClientApp/app/services/applications/tester.service.ts index ae92fccc3..ef38b4ecf 100644 --- a/src/Ombi/ClientApp/app/services/applications/tester.service.ts +++ b/src/Ombi/ClientApp/app/services/applications/tester.service.ts @@ -1,63 +1,60 @@ -import { Injectable } from '@angular/core'; -import { AuthHttp } from 'angular2-jwt'; -import { Observable } from 'rxjs/Rx'; +import { Injectable } from "@angular/core"; +import { AuthHttp } from "angular2-jwt"; +import { Observable } from "rxjs/Rx"; -import { ServiceAuthHelpers } from '../service.helpers'; +import { ServiceAuthHelpers } from "../service.helpers"; import { IDiscordNotifcationSettings, IEmailNotificationSettings, - IPushbulletNotificationSettings, - ISlackNotificationSettings, - IPushoverNotificationSettings, - IMattermostNotifcationSettings -} from '../../interfaces/INotifcationSettings' - -import { IEmbyServer, + IMattermostNotifcationSettings, IPlexServer, + IPushbulletNotificationSettings, + IPushoverNotificationSettings, IRadarrSettings, - ISonarrSettings -} from '../../interfaces/ISettings'; + ISlackNotificationSettings, + ISonarrSettings, +} from "../../interfaces"; @Injectable() export class TesterService extends ServiceAuthHelpers { constructor(http: AuthHttp) { - super(http, '/api/v1/tester/'); + super(http, "/api/v1/tester/"); } - discordTest(settings: IDiscordNotifcationSettings): Observable { + public discordTest(settings: IDiscordNotifcationSettings): Observable { return this.http.post(`${this.url}discord`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); } - pushbulletTest(settings: IPushbulletNotificationSettings): Observable { + public pushbulletTest(settings: IPushbulletNotificationSettings): Observable { return this.http.post(`${this.url}pushbullet`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); } - pushoverTest(settings: IPushoverNotificationSettings): Observable { + public pushoverTest(settings: IPushoverNotificationSettings): Observable { return this.http.post(`${this.url}pushover`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); } - mattermostTest(settings: IMattermostNotifcationSettings): Observable { + public mattermostTest(settings: IMattermostNotifcationSettings): Observable { return this.http.post(`${this.url}mattermost`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); } - slackTest(settings: ISlackNotificationSettings): Observable { + public slackTest(settings: ISlackNotificationSettings): Observable { return this.http.post(`${this.url}slack`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); } - emailTest(settings: IEmailNotificationSettings): Observable { + public emailTest(settings: IEmailNotificationSettings): Observable { return this.http.post(`${this.url}email`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); } - plexTest(settings: IPlexServer): Observable { + public plexTest(settings: IPlexServer): Observable { return this.http.post(`${this.url}plex`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); } - embyTest(settings: IEmbyServer): Observable { + public embyTest(settings: IEmbyServer): Observable { return this.http.post(`${this.url}emby`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); } - radarrTest(settings: IRadarrSettings): Observable { + public radarrTest(settings: IRadarrSettings): Observable { return this.http.post(`${this.url}radarr`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); } - sonarrTest(settings: ISonarrSettings): Observable { + public sonarrTest(settings: ISonarrSettings): Observable { return this.http.post(`${this.url}sonarr`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); - } -} \ No newline at end of file + } +} diff --git a/src/Ombi/ClientApp/app/services/helpers/index.ts b/src/Ombi/ClientApp/app/services/helpers/index.ts new file mode 100644 index 000000000..9d664630d --- /dev/null +++ b/src/Ombi/ClientApp/app/services/helpers/index.ts @@ -0,0 +1 @@ +export * from "./validation.service"; diff --git a/src/Ombi/ClientApp/app/services/helpers/validation.service.ts b/src/Ombi/ClientApp/app/services/helpers/validation.service.ts index b8613e59d..7b8deec89 100644 --- a/src/Ombi/ClientApp/app/services/helpers/validation.service.ts +++ b/src/Ombi/ClientApp/app/services/helpers/validation.service.ts @@ -1,5 +1,5 @@ -import { Injectable } from '@angular/core'; -import { FormGroup, Validators, ValidatorFn } from '@angular/forms'; +import { Injectable } from "@angular/core"; +import { FormGroup, ValidatorFn, Validators } from "@angular/forms"; @Injectable() export class ValidationService { @@ -9,7 +9,7 @@ export class ValidationService { * @param form * @param name */ - public disableValidation(form: FormGroup, name: string): void { + public disableValidation(form: FormGroup, name: string) { form.controls[name].clearValidators(); form.controls[name].updateValueAndValidity(); } @@ -20,7 +20,7 @@ export class ValidationService { * @param name */ public enableValidation(form: FormGroup, name: string): void; - public enableValidation(form: FormGroup, name: string, validators?: ValidatorFn[]): void { + public enableValidation(form: FormGroup, name: string, validators?: ValidatorFn[]) { if (validators) { // If we provide some use them form.controls[name].setValidators(validators); @@ -31,4 +31,4 @@ export class ValidationService { form.controls[name].updateValueAndValidity(); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/services/identity.service.ts b/src/Ombi/ClientApp/app/services/identity.service.ts index 534add969..81ea5ac29 100644 --- a/src/Ombi/ClientApp/app/services/identity.service.ts +++ b/src/Ombi/ClientApp/app/services/identity.service.ts @@ -1,62 +1,61 @@ -import { Injectable } from '@angular/core'; -import { AuthHttp } from 'angular2-jwt'; -import { Http } from '@angular/http'; -import { Observable } from 'rxjs/Rx'; - -import { ServiceAuthHelpers } from './service.helpers'; -import { IUser, IUpdateLocalUser, ICheckbox, IIdentityResult, IResetPasswordToken } from '../interfaces/IUser'; +import { Injectable } from "@angular/core"; +import { Http } from "@angular/http"; +import { AuthHttp } from "angular2-jwt"; +import { Observable } from "rxjs/Rx"; +import { ICheckbox, IIdentityResult, IResetPasswordToken, IUpdateLocalUser, IUser } from "../interfaces"; +import { ServiceAuthHelpers } from "./service.helpers"; @Injectable() export class IdentityService extends ServiceAuthHelpers { constructor(http: AuthHttp, private regularHttp: Http) { - super(http, '/api/v1/Identity/'); + super(http, "/api/v1/Identity/"); } - createWizardUser(username: string, password: string): Observable { - return this.regularHttp.post(`${this.url}Wizard/`, JSON.stringify({ username: username, password: password }), { headers: this.headers }).map(this.extractData); + public createWizardUser(username: string, password: string): Observable { + return this.regularHttp.post(`${this.url}Wizard/`, JSON.stringify({ username, password }), { headers: this.headers }).map(this.extractData); } - getUser(): Observable { + public getUser(): Observable { return this.http.get(this.url).map(this.extractData); } - getUserById(id: string): Observable { + public getUserById(id: string): Observable { return this.http.get(`${this.url}User/${id}`).map(this.extractData); } - getUsers(): Observable { + public getUsers(): Observable { return this.http.get(`${this.url}Users`).map(this.extractData); } - getAllAvailableClaims(): Observable { + public getAllAvailableClaims(): Observable { return this.http.get(`${this.url}Claims`).map(this.extractData); } - createUser(user: IUser): Observable { + public createUser(user: IUser): Observable { return this.http.post(this.url, JSON.stringify(user), { headers: this.headers }).map(this.extractData); } - updateUser(user: IUser): Observable { + public updateUser(user: IUser): Observable { return this.http.put(this.url, JSON.stringify(user), { headers: this.headers }).map(this.extractData); - } - updateLocalUser(user: IUpdateLocalUser): Observable { - return this.http.put(this.url + 'local', JSON.stringify(user), { headers: this.headers }).map(this.extractData); - } - - deleteUser(user: IUser): Observable { + } + public updateLocalUser(user: IUpdateLocalUser): Observable { + return this.http.put(this.url + "local", JSON.stringify(user), { headers: this.headers }).map(this.extractData); + } + + public deleteUser(user: IUser): Observable { return this.http.delete(`${this.url}/${user.id}`, { headers: this.headers }).map(this.extractData); } - submitResetPassword(email:string): Observable{ - return this.regularHttp.post(this.url + 'reset', JSON.stringify({email:email}), { headers: this.headers }).map(this.extractData); + public submitResetPassword(email: string): Observable { + return this.regularHttp.post(this.url + "reset", JSON.stringify({email}), { headers: this.headers }).map(this.extractData); } - resetPassword(token: IResetPasswordToken):Observable{ - return this.regularHttp.post(this.url + 'resetpassword', JSON.stringify(token), { headers: this.headers }).map(this.extractData); + public resetPassword(token: IResetPasswordToken): Observable { + return this.regularHttp.post(this.url + "resetpassword", JSON.stringify(token), { headers: this.headers }).map(this.extractData); } - hasRole(role: string): boolean { - var roles = localStorage.getItem("roles") as string[] | null; + public hasRole(role: string): boolean { + const roles = localStorage.getItem("roles") as string[] | null; if (roles) { if (roles.indexOf(role) > -1) { return true; @@ -65,4 +64,4 @@ export class IdentityService extends ServiceAuthHelpers { } return false; } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/services/image.service.ts b/src/Ombi/ClientApp/app/services/image.service.ts index 50c987aee..7ffe3873e 100644 --- a/src/Ombi/ClientApp/app/services/image.service.ts +++ b/src/Ombi/ClientApp/app/services/image.service.ts @@ -1,17 +1,17 @@ -import { Injectable } from '@angular/core'; -import { Http } from '@angular/http'; -import { Observable } from 'rxjs/Rx'; +import { Injectable } from "@angular/core"; +import { Http } from "@angular/http"; +import { Observable } from "rxjs/Rx"; -import { ServiceHelpers } from './service.helpers'; -import { IImages } from '../interfaces/IImages'; +import { IImages } from "../interfaces"; +import { ServiceHelpers } from "./service.helpers"; @Injectable() -export class ImageService extends ServiceHelpers { - constructor(public http : Http) { - super(http, '/api/v1/Images/'); +export class ImageService extends ServiceHelpers { + constructor(public http: Http) { + super(http, "/api/v1/Images/"); } - getRandomBackground(): Observable { + public getRandomBackground(): Observable { return this.http.get(`${this.url}background/`, { headers: this.headers }).map(this.extractData); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/services/index.ts b/src/Ombi/ClientApp/app/services/index.ts new file mode 100644 index 000000000..95b9020cc --- /dev/null +++ b/src/Ombi/ClientApp/app/services/index.ts @@ -0,0 +1,11 @@ +export * from "./applications"; +export * from "./helpers"; +export * from "./identity.service"; +export * from "./image.service"; +export * from "./landingpage.service"; +export * from "./notification.service"; +export * from "./request.service"; +export * from "./search.service"; +export * from "./service.helpers"; +export * from "./settings.service"; +export * from "./status.service"; diff --git a/src/Ombi/ClientApp/app/services/landingpage.service.ts b/src/Ombi/ClientApp/app/services/landingpage.service.ts index 7dacc6778..c8a393e53 100644 --- a/src/Ombi/ClientApp/app/services/landingpage.service.ts +++ b/src/Ombi/ClientApp/app/services/landingpage.service.ts @@ -1,17 +1,17 @@ -import { Injectable } from '@angular/core'; -import { Http } from '@angular/http'; -import { Observable } from 'rxjs/Rx'; +import { Injectable } from "@angular/core"; +import { Http } from "@angular/http"; +import { Observable } from "rxjs/Rx"; -import { ServiceHelpers } from './service.helpers'; -import { IMediaServerStatus } from '../interfaces/IMediaServerStatus'; +import { IMediaServerStatus } from "../interfaces"; +import { ServiceHelpers } from "./service.helpers"; @Injectable() -export class LandingPageService extends ServiceHelpers { - constructor(public http : Http) { - super(http, '/api/v1/LandingPage/'); +export class LandingPageService extends ServiceHelpers { + constructor(public http: Http) { + super(http, "/api/v1/LandingPage/"); } - getServerStatus(): Observable { + public getServerStatus(): Observable { return this.http.get(`${this.url}`, { headers: this.headers }).map(this.extractData); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/services/notification.service.ts b/src/Ombi/ClientApp/app/services/notification.service.ts index ab1cb7417..38ccf3091 100644 --- a/src/Ombi/ClientApp/app/services/notification.service.ts +++ b/src/Ombi/ClientApp/app/services/notification.service.ts @@ -1,9 +1,9 @@ -import { Injectable } from '@angular/core'; -import { Message } from 'primeng/components/common/api'; +import { Injectable } from "@angular/core"; +import { Message } from "primeng/components/common/api"; @Injectable() export class NotificationService { - messages: Message[] = []; + public messages: Message[] = []; public addMessage(message: Message) { this.clearMessages(); this.messages.push(message); @@ -11,22 +11,22 @@ export class NotificationService { } public success(title: string, body: string) { - this.addMessage({ severity: 'success', detail: body, summary: title }); + this.addMessage({ severity: "success", detail: body, summary: title }); } public info(title: string, body: string) { - this.addMessage({ severity: 'info', detail: body, summary: title }); + this.addMessage({ severity: "info", detail: body, summary: title }); } public warning(title: string, body: string) { - this.addMessage({ severity: 'warning', detail: body, summary: title }); + this.addMessage({ severity: "warning", detail: body, summary: title }); } public error(title: string, body: string) { - this.addMessage({ severity: 'error', detail: body, summary: title }); + this.addMessage({ severity: "error", detail: body, summary: title }); } public clearMessages() { this.messages = []; } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/services/request.service.ts b/src/Ombi/ClientApp/app/services/request.service.ts index 8eba064b7..13714f757 100644 --- a/src/Ombi/ClientApp/app/services/request.service.ts +++ b/src/Ombi/ClientApp/app/services/request.service.ts @@ -1,81 +1,81 @@ -import { Injectable } from '@angular/core'; -import { Http } from '@angular/http'; -import { AuthHttp } from 'angular2-jwt'; -import { Observable } from 'rxjs/Rx'; +import { Injectable } from "@angular/core"; +import { Http } from "@angular/http"; +import { AuthHttp } from "angular2-jwt"; +import { Observable } from "rxjs/Rx"; -import { ServiceAuthHelpers } from './service.helpers'; -import { IRequestEngineResult } from '../interfaces/IRequestEngineResult'; -import { ISearchMovieResult } from '../interfaces/ISearchMovieResult'; -import { ISearchTvResult } from '../interfaces/ISearchTvResult'; -import { IMovieRequests, ITvRequests, IRequestCountModel, IRequestGrid, IChildRequests } from '../interfaces/IRequestModel'; +import { IRequestEngineResult } from "../interfaces"; +import { IChildRequests, IMovieRequests, IRequestCountModel, IRequestGrid, ITvRequests } from "../interfaces"; +import { ISearchMovieResult } from "../interfaces"; +import { ISearchTvResult } from "../interfaces"; +import { ServiceAuthHelpers } from "./service.helpers"; @Injectable() export class RequestService extends ServiceAuthHelpers { - constructor(http: AuthHttp, private basicHttp : Http) { - super(http, '/api/v1/Request/'); + constructor(http: AuthHttp, private basicHttp: Http) { + super(http, "/api/v1/Request/"); } - requestMovie(movie: ISearchMovieResult): Observable { + public requestMovie(movie: ISearchMovieResult): Observable { return this.http.post(`${this.url}Movie/`, JSON.stringify(movie), { headers: this.headers }).map(this.extractData); } - requestTv(tv: ISearchTvResult): Observable { + public requestTv(tv: ISearchTvResult): Observable { return this.http.post(`${this.url}TV/`, JSON.stringify(tv), { headers: this.headers }).map(this.extractData); } - getMovieRequests(count: number, position: number): Observable { + public getMovieRequests(count: number, position: number): Observable { return this.http.get(`${this.url}movie/${count}/${position}`).map(this.extractData); } - searchMovieRequests(search: string): Observable { + public searchMovieRequests(search: string): Observable { return this.http.get(`${this.url}movie/search/${search}`).map(this.extractData); } - removeMovieRequest(request: IMovieRequests) { + public removeMovieRequest(request: IMovieRequests) { this.http.delete(`${this.url}movie/${request.id}`).map(this.extractData).subscribe(); } - updateMovieRequest(request: IMovieRequests): Observable { + public updateMovieRequest(request: IMovieRequests): Observable { return this.http.put(`${this.url}movie/`, JSON.stringify(request), { headers: this.headers }).map(this.extractData); } - getTvRequests(count: number, position: number): Observable { + public getTvRequests(count: number, position: number): Observable { return this.http.get(`${this.url}tv/${count}/${position}`).map(this.extractData) .catch(this.handleError); - } - - getChildRequests(requestId: number): Observable { + } + + public getChildRequests(requestId: number): Observable { return this.http.get(`${this.url}tv/${requestId}/child`).map(this.extractData) .catch(this.handleError); } - searchTvRequests(search: string): Observable { + public searchTvRequests(search: string): Observable { return this.http.get(`${this.url}tv/search/${search}`).map(this.extractData); } - removeTvRequest(request: ITvRequests) { + public removeTvRequest(request: ITvRequests) { this.http.delete(`${this.url}tv/${request.id}`).map(this.extractData).subscribe(); } - updateTvRequest(request: ITvRequests): Observable { + public updateTvRequest(request: ITvRequests): Observable { return this.http.put(`${this.url}tv/`, JSON.stringify(request), { headers: this.headers }).map(this.extractData); } - updateChild(child: IChildRequests): Observable { + public updateChild(child: IChildRequests): Observable { return this.http.put(`${this.url}tv/child`, JSON.stringify(child), { headers: this.headers }).map(this.extractData); } - deleteChild(child: IChildRequests): Observable { + public deleteChild(child: IChildRequests): Observable { return this.http.delete(`${this.url}tv/child/${child.id}`, { headers: this.headers }).map(this.extractData); } - getRequestsCount(): Observable { + public getRequestsCount(): Observable { return this.basicHttp.get(`${this.url}count`).map(this.extractData); } - getMovieGrid(): Observable> { + public getMovieGrid(): Observable> { return this.http.get(`${this.url}movie/grid`).map(this.extractData); } - getTvGrid(): Observable> { + public getTvGrid(): Observable> { return this.http.get(`${this.url}tv/grid`).map(this.extractData); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/services/search.service.ts b/src/Ombi/ClientApp/app/services/search.service.ts index bb0627bf8..855ceebbb 100644 --- a/src/Ombi/ClientApp/app/services/search.service.ts +++ b/src/Ombi/ClientApp/app/services/search.service.ts @@ -1,11 +1,11 @@ -import { Injectable } from '@angular/core'; -import { AuthHttp } from 'angular2-jwt'; -import { Observable } from 'rxjs/Rx'; +import { Injectable } from "@angular/core"; +import { AuthHttp } from "angular2-jwt"; +import { Observable } from "rxjs/Rx"; -import { ServiceAuthHelpers } from './service.helpers'; -import { ISearchMovieResult } from '../interfaces/ISearchMovieResult'; -import { ISearchTvResult } from '../interfaces/ISearchTvResult'; import { TreeNode } from "primeng/primeng"; +import { ISearchMovieResult } from "../interfaces"; +import { ISearchTvResult } from "../interfaces"; +import { ServiceAuthHelpers } from "./service.helpers"; @Injectable() export class SearchService extends ServiceAuthHelpers { @@ -14,52 +14,53 @@ export class SearchService extends ServiceAuthHelpers { } // Movies - searchMovie(searchTerm: string): Observable { + public searchMovie(searchTerm: string): Observable { return this.http.get(`${this.url}/Movie/` + searchTerm).map(this.extractData); } - popularMovies(): Observable { + public popularMovies(): Observable { return this.http.get(`${this.url}/Movie/Popular`).map(this.extractData); } - upcomignMovies(): Observable { + public upcomignMovies(): Observable { return this.http.get(`${this.url}/Movie/upcoming`).map(this.extractData); } - nowPlayingMovies(): Observable { + public nowPlayingMovies(): Observable { return this.http.get(`${this.url}/Movie/nowplaying`).map(this.extractData); } - topRatedMovies(): Observable { + public topRatedMovies(): Observable { return this.http.get(`${this.url}/Movie/toprated`).map(this.extractData); } - getMovieInformation(theMovieDbId: number): Observable { + public getMovieInformation(theMovieDbId: number): Observable { return this.http.get(`${this.url}/Movie/info/${theMovieDbId}`).map(this.extractData); } // TV - searchTv(searchTerm: string): Observable { + public searchTv(searchTerm: string): Observable { return this.http.get(`${this.url}/Tv/` + searchTerm).map(this.extractData); } - searchTvTreeNode(searchTerm: string): Observable { + + public searchTvTreeNode(searchTerm: string): Observable { return this.http.get(`${this.url}/Tv/${searchTerm}/tree`).map(this.extractData); } - getShowInformationTreeNode(theTvDbId: number): Observable { + public getShowInformationTreeNode(theTvDbId: number): Observable { return this.http.get(`${this.url}/Tv/info/${theTvDbId}/Tree`).map(this.extractData); } - getShowInformation(theTvDbId: number): Observable { + public getShowInformation(theTvDbId: number): Observable { return this.http.get(`${this.url}/Tv/info/${theTvDbId}`).map(this.extractData); } - popularTv(): Observable { + public popularTv(): Observable { return this.http.get(`${this.url}/Tv/popular`).map(this.extractData); } - mostWatchedTv(): Observable { + public mostWatchedTv(): Observable { return this.http.get(`${this.url}/Tv/mostwatched`).map(this.extractData); } - anticipatedTv(): Observable { + public anticipatedTv(): Observable { return this.http.get(`${this.url}/Tv/anticipated`).map(this.extractData); } - trendingTv(): Observable { + public trendingTv(): Observable { return this.http.get(`${this.url}/Tv/trending`).map(this.extractData); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/services/service.helpers.ts b/src/Ombi/ClientApp/app/services/service.helpers.ts index c6a8f579c..8a8019651 100644 --- a/src/Ombi/ClientApp/app/services/service.helpers.ts +++ b/src/Ombi/ClientApp/app/services/service.helpers.ts @@ -1,20 +1,19 @@ -import { Headers, Response, Http } from '@angular/http'; -import { Observable } from 'rxjs/Observable'; +import { Headers, Http, Response } from "@angular/http"; +import { Observable } from "rxjs/Observable"; - -import { AuthHttp } from 'angular2-jwt'; +import { AuthHttp } from "angular2-jwt"; export class ServiceHelpers { + protected headers: Headers; + constructor(protected http: Http, protected url: string) { this.headers = new Headers(); - this.headers.append('Content-Type', 'application/json; charset=utf-8'); + this.headers.append("Content-Type", "application/json; charset=utf-8"); } - protected headers: Headers; - protected extractData(res: Response) { - let body = res.json(); + const body = res.json(); //console.log('extractData', body || {}); return body || {}; } @@ -22,25 +21,23 @@ export class ServiceHelpers { protected handleError(error: any) { // In a real world app, we might use a remote logging infrastructure // We'd also dig deeper into the error to get a better message - let errMsg = (error.message) ? error.message : - error.status ? `${error.status} - ${error.statusText}` : 'Server error'; + const errMsg = (error.message) ? error.message : + error.status ? `${error.status} - ${error.statusText}` : "Server error"; return Observable.throw(errMsg); } - - } export class ServiceAuthHelpers { + protected headers: Headers; + constructor(protected http: AuthHttp, protected url: string) { this.headers = new Headers(); - this.headers.append('Content-Type', 'application/json; charset=utf-8'); + this.headers.append("Content-Type", "application/json; charset=utf-8"); } - protected headers: Headers; - protected extractData(res: Response) { - let body = res.json(); + const body = res.json(); //console.log('extractData', body || {}); return body || {}; } @@ -48,10 +45,8 @@ export class ServiceAuthHelpers { protected handleError(error: any) { // In a real world app, we might use a remote logging infrastructure // We'd also dig deeper into the error to get a better message - let errMsg = (error.message) ? error.message : - error.status ? `${error.status} - ${error.statusText}` : 'Server error'; + const errMsg = (error.message) ? error.message : + error.status ? `${error.status} - ${error.statusText}` : "Server error"; return Observable.throw(errMsg); } - - -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/services/settings.service.ts b/src/Ombi/ClientApp/app/services/settings.service.ts index ef75a43f7..d1523468e 100644 --- a/src/Ombi/ClientApp/app/services/settings.service.ts +++ b/src/Ombi/ClientApp/app/services/settings.service.ts @@ -1,171 +1,169 @@ -import { Injectable } from '@angular/core'; -import { AuthHttp } from 'angular2-jwt'; -import { Http } from '@angular/http'; -import { Observable } from 'rxjs/Rx'; +import { Injectable } from "@angular/core"; +import { Http } from "@angular/http"; +import { AuthHttp } from "angular2-jwt"; +import { Observable } from "rxjs/Rx"; -import { ServiceAuthHelpers } from './service.helpers'; import { - IOmbiSettings, - IEmbySettings, - IPlexSettings, - ISonarrSettings, - ILandingPageSettings, + IAuthenticationSettings, ICustomizationSettings, - IRadarrSettings, - IAuthenticationSettings -} from '../interfaces/ISettings'; -import { - IEmailNotificationSettings, IDiscordNotifcationSettings, + IEmailNotificationSettings, + IEmbySettings, + ILandingPageSettings, + IMattermostNotifcationSettings, + IOmbiSettings, + IPlexSettings, IPushbulletNotificationSettings, - ISlackNotificationSettings, IPushoverNotificationSettings, - IMattermostNotifcationSettings -} from '../interfaces/INotifcationSettings'; + IRadarrSettings, + ISlackNotificationSettings, + ISonarrSettings, +} from "../interfaces"; + +import { ServiceAuthHelpers } from "./service.helpers"; @Injectable() export class SettingsService extends ServiceAuthHelpers { constructor(public httpAuth: AuthHttp, private nonAuthHttp: Http) { - super(httpAuth, '/api/v1/Settings'); + super(httpAuth, "/api/v1/Settings"); } - getOmbi(): Observable { - return this.httpAuth.get(`${this.url}/Ombi/`).map(this.extractData).catch(this.handleError) + public getOmbi(): Observable { + return this.httpAuth.get(`${this.url}/Ombi/`).map(this.extractData).catch(this.handleError); } - saveOmbi(settings: IOmbiSettings): Observable { + public saveOmbi(settings: IOmbiSettings): Observable { return this.httpAuth.post(`${this.url}/Ombi/`, JSON.stringify(settings), { headers: this.headers }) .map(this.extractData).catch(this.handleError); } - resetOmbiApi(): Observable { + public resetOmbiApi(): Observable { return this.httpAuth.post(`${this.url}/Ombi/resetApi`, { headers: this.headers }).map(this.extractData) .catch(this.handleError); } - getEmby(): Observable { + public getEmby(): Observable { return this.httpAuth.get(`${this.url}/Emby/`).map(this.extractData).catch(this.handleError); } - saveEmby(settings: IEmbySettings): Observable { + public saveEmby(settings: IEmbySettings): Observable { return this.httpAuth.post(`${this.url}/Emby/`, JSON.stringify(settings), { headers: this.headers }) .map(this.extractData).catch(this.handleError); } - getPlex(): Observable { + public getPlex(): Observable { return this.httpAuth.get(`${this.url}/Plex/`).map(this.extractData).catch(this.handleError); } - savePlex(settings: IPlexSettings): Observable { + public savePlex(settings: IPlexSettings): Observable { return this.httpAuth.post(`${this.url}/Plex/`, JSON.stringify(settings), { headers: this.headers }) .map(this.extractData).catch(this.handleError); } - getSonarr(): Observable { + public getSonarr(): Observable { return this.httpAuth.get(`${this.url}/Sonarr`).map(this.extractData) .catch(this.handleError); } - saveSonarr(settings: ISonarrSettings): Observable { + public saveSonarr(settings: ISonarrSettings): Observable { return this.httpAuth.post(`${this.url}/Sonarr`, JSON.stringify(settings), { headers: this.headers }) .map(this.extractData).catch(this.handleError); } - getRadarr(): Observable { + public getRadarr(): Observable { return this.httpAuth.get(`${this.url}/Radarr`).map(this.extractData) .catch(this.handleError); } - saveRadarr(settings: IRadarrSettings): Observable { + public saveRadarr(settings: IRadarrSettings): Observable { return this.httpAuth.post(`${this.url}/Radarr`, JSON.stringify(settings), { headers: this.headers }) .map(this.extractData).catch(this.handleError); } - - getAuthentication(): Observable { + public getAuthentication(): Observable { return this.httpAuth.get(`${this.url}/Authentication`).map(this.extractData) .catch(this.handleError); } - saveAuthentication(settings: IAuthenticationSettings): Observable { + public saveAuthentication(settings: IAuthenticationSettings): Observable { return this.httpAuth.post(`${this.url}/Authentication`, JSON.stringify(settings), { headers: this.headers }) .map(this.extractData).catch(this.handleError); } // Using http since we need it not to be authenticated to get the landing page settings - getLandingPage(): Observable { + public getLandingPage(): Observable { return this.nonAuthHttp.get(`${this.url}/LandingPage`).map(this.extractData).catch(this.handleError); } - saveLandingPage(settings: ILandingPageSettings): Observable { + public saveLandingPage(settings: ILandingPageSettings): Observable { return this.httpAuth.post(`${this.url}/LandingPage`, JSON.stringify(settings), { headers: this.headers }) .map(this.extractData).catch(this.handleError); } // Using http since we need it not to be authenticated to get the customization settings - getCustomization(): Observable { - return this.nonAuthHttp.get(`${this.url}/customization`).map(this.extractData).catch(this.handleError) + public getCustomization(): Observable { + return this.nonAuthHttp.get(`${this.url}/customization`).map(this.extractData).catch(this.handleError); } - saveCustomization(settings: ICustomizationSettings): Observable { + public saveCustomization(settings: ICustomizationSettings): Observable { return this.httpAuth.post(`${this.url}/customization`, JSON.stringify(settings), { headers: this.headers }) .map(this.extractData).catch(this.handleError); } - getEmailNotificationSettings(): Observable { - return this.httpAuth.get(`${this.url}/notifications/email`).map(this.extractData).catch(this.handleError) + public getEmailNotificationSettings(): Observable { + return this.httpAuth.get(`${this.url}/notifications/email`).map(this.extractData).catch(this.handleError); } - saveEmailNotificationSettings(settings: IEmailNotificationSettings): Observable { + public saveEmailNotificationSettings(settings: IEmailNotificationSettings): Observable { return this.httpAuth .post(`${this.url}/notifications/email`, JSON.stringify(settings), { headers: this.headers }) .map(this.extractData).catch(this.handleError); } - getDiscordNotificationSettings(): Observable { - return this.httpAuth.get(`${this.url}/notifications/discord`).map(this.extractData).catch(this.handleError) + public getDiscordNotificationSettings(): Observable { + return this.httpAuth.get(`${this.url}/notifications/discord`).map(this.extractData).catch(this.handleError); } - getMattermostNotificationSettings(): Observable { - return this.httpAuth.get(`${this.url}/notifications/mattermost`).map(this.extractData).catch(this.handleError) + public getMattermostNotificationSettings(): Observable { + return this.httpAuth.get(`${this.url}/notifications/mattermost`).map(this.extractData).catch(this.handleError); } - saveDiscordNotificationSettings(settings: IDiscordNotifcationSettings): Observable { + public saveDiscordNotificationSettings(settings: IDiscordNotifcationSettings): Observable { return this.httpAuth .post(`${this.url}/notifications/discord`, JSON.stringify(settings), { headers: this.headers }) .map(this.extractData).catch(this.handleError); } - saveMattermostNotificationSettings(settings: IMattermostNotifcationSettings): Observable { + public saveMattermostNotificationSettings(settings: IMattermostNotifcationSettings): Observable { return this.httpAuth .post(`${this.url}/notifications/mattermost`, JSON.stringify(settings), { headers: this.headers }) .map(this.extractData).catch(this.handleError); } - getPushbulletNotificationSettings(): Observable { - return this.httpAuth.get(`${this.url}/notifications/pushbullet`).map(this.extractData).catch(this.handleError) + public getPushbulletNotificationSettings(): Observable { + return this.httpAuth.get(`${this.url}/notifications/pushbullet`).map(this.extractData).catch(this.handleError); } - getPushoverNotificationSettings(): Observable { - return this.httpAuth.get(`${this.url}/notifications/pushover`).map(this.extractData).catch(this.handleError) + public getPushoverNotificationSettings(): Observable { + return this.httpAuth.get(`${this.url}/notifications/pushover`).map(this.extractData).catch(this.handleError); } - savePushbulletNotificationSettings(settings: IPushbulletNotificationSettings): Observable { + public savePushbulletNotificationSettings(settings: IPushbulletNotificationSettings): Observable { return this.httpAuth .post(`${this.url}/notifications/pushbullet`, JSON.stringify(settings), { headers: this.headers }) .map(this.extractData).catch(this.handleError); } - savePushoverNotificationSettings(settings: IPushoverNotificationSettings): Observable { + public savePushoverNotificationSettings(settings: IPushoverNotificationSettings): Observable { return this.httpAuth .post(`${this.url}/notifications/pushover`, JSON.stringify(settings), { headers: this.headers }) .map(this.extractData).catch(this.handleError); } - getSlackNotificationSettings(): Observable { - return this.httpAuth.get(`${this.url}/notifications/slack`).map(this.extractData).catch(this.handleError) + public getSlackNotificationSettings(): Observable { + return this.httpAuth.get(`${this.url}/notifications/slack`).map(this.extractData).catch(this.handleError); } - saveSlackNotificationSettings(settings: ISlackNotificationSettings): Observable { + public saveSlackNotificationSettings(settings: ISlackNotificationSettings): Observable { return this.httpAuth .post(`${this.url}/notifications/slack`, JSON.stringify(settings), { headers: this.headers }) .map(this.extractData).catch(this.handleError); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/services/status.service.ts b/src/Ombi/ClientApp/app/services/status.service.ts index 71079e016..ee4d80b29 100644 --- a/src/Ombi/ClientApp/app/services/status.service.ts +++ b/src/Ombi/ClientApp/app/services/status.service.ts @@ -1,16 +1,15 @@ -import { Injectable } from '@angular/core'; -import { Http } from '@angular/http'; -import { Observable } from 'rxjs/Rx'; - -import { ServiceHelpers } from './service.helpers'; +import { Injectable } from "@angular/core"; +import { Http } from "@angular/http"; +import { Observable } from "rxjs/Rx"; +import { ServiceHelpers } from "./service.helpers"; @Injectable() export class StatusService extends ServiceHelpers { - constructor(http : Http) { - super(http, '/api/v1/status/'); + constructor(http: Http) { + super(http, "/api/v1/status/"); } - getWizardStatus(): Observable { + public getWizardStatus(): Observable { return this.http.get(`${this.url}Wizard/`, { headers: this.headers }).map(this.extractData); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/settings/customization/customization.component.ts b/src/Ombi/ClientApp/app/settings/customization/customization.component.ts index 9af4a3c78..5f3c94f31 100644 --- a/src/Ombi/ClientApp/app/settings/customization/customization.component.ts +++ b/src/Ombi/ClientApp/app/settings/customization/customization.component.ts @@ -1,25 +1,24 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit } from "@angular/core"; -import { ICustomizationSettings } from '../../interfaces/ISettings' -import { SettingsService } from '../../services/settings.service'; -import { NotificationService } from "../../services/notification.service"; +import { ICustomizationSettings } from "../../interfaces"; +import { NotificationService } from "../../services"; +import { SettingsService } from "../../services"; @Component({ - - templateUrl: './customization.component.html', + templateUrl: "./customization.component.html", }) export class CustomizationComponent implements OnInit { - constructor(private settingsService: SettingsService, private notificationService: NotificationService) { } + public settings: ICustomizationSettings; - settings: ICustomizationSettings; + constructor(private settingsService: SettingsService, private notificationService: NotificationService) { } - ngOnInit(): void { + public ngOnInit() { this.settingsService.getCustomization().subscribe(x => this.settings = x); } - save() { + public save() { this.settingsService.saveCustomization(this.settings).subscribe(x => { if (x) { this.notificationService.success("Settings Saved", "Successfully saved Ombi settings"); @@ -28,4 +27,4 @@ export class CustomizationComponent implements OnInit { } }); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/settings/emby/emby.component.ts b/src/Ombi/ClientApp/app/settings/emby/emby.component.ts index dfa9f98e9..d1c84a4aa 100644 --- a/src/Ombi/ClientApp/app/settings/emby/emby.component.ts +++ b/src/Ombi/ClientApp/app/settings/emby/emby.component.ts @@ -1,29 +1,29 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit } from "@angular/core"; -import { IEmbySettings, IEmbyServer } from '../../interfaces/ISettings' -import { SettingsService } from '../../services/settings.service'; -import { NotificationService } from "../../services/notification.service"; -import { TesterService } from '../../services/applications/tester.service'; +import { IEmbyServer, IEmbySettings } from "../../interfaces"; +import { TesterService } from "../../services"; +import { NotificationService } from "../../services"; +import { SettingsService } from "../../services"; @Component({ - templateUrl: './emby.component.html' + templateUrl: "./emby.component.html", }) export class EmbyComponent implements OnInit { - constructor(private settingsService: SettingsService, - private notificationService: NotificationService, - private testerService : TesterService) { } + public settings: IEmbySettings; - settings: IEmbySettings; + constructor(private settingsService: SettingsService, + private notificationService: NotificationService, + private testerService: TesterService) { } - ngOnInit(): void { + public ngOnInit() { this.settingsService.getEmby().subscribe(x => this.settings = x); } - addTab() { + public addTab() { if (this.settings.servers == null) { this.settings.servers = []; - } + } this.settings.servers.push({ name: "New*", id: Math.floor(Math.random() * (99999 - 0 + 1) + 1), @@ -33,11 +33,11 @@ export class EmbyComponent implements OnInit { ip: "", port: 0, ssl: false, - subDir: "" + subDir: "", } as IEmbyServer); } - test(server: IEmbyServer) { + public test(server: IEmbyServer) { this.testerService.embyTest(server).subscribe(x => { if (x) { this.notificationService.success("Connected", `Successfully connected to the Emby server ${server.name}!`); @@ -47,15 +47,14 @@ export class EmbyComponent implements OnInit { }); } - removeServer(server: IEmbyServer) { - var index = this.settings.servers.indexOf(server, 0); + public removeServer(server: IEmbyServer) { + const index = this.settings.servers.indexOf(server, 0); if (index > -1) { this.settings.servers.splice(index, 1); } } - - save() { + public save() { this.settingsService.saveEmby(this.settings).subscribe(x => { if (x) { this.notificationService.success("Settings Saved", "Successfully saved Emby settings"); @@ -64,4 +63,4 @@ export class EmbyComponent implements OnInit { } }); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/settings/landingpage/landingpage.component.ts b/src/Ombi/ClientApp/app/settings/landingpage/landingpage.component.ts index b450b98d0..37d6cd1b6 100644 --- a/src/Ombi/ClientApp/app/settings/landingpage/landingpage.component.ts +++ b/src/Ombi/ClientApp/app/settings/landingpage/landingpage.component.ts @@ -1,26 +1,25 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit } from "@angular/core"; -import { ILandingPageSettings } from '../../interfaces/ISettings' -import { SettingsService } from '../../services/settings.service'; -import { NotificationService } from "../../services/notification.service"; +import { ILandingPageSettings } from "../../interfaces"; +import { NotificationService } from "../../services"; +import { SettingsService } from "../../services"; @Component({ - - templateUrl: './landingpage.component.html', + templateUrl: "./landingpage.component.html", }) export class LandingPageComponent implements OnInit { - constructor(private settingsService: SettingsService, private notificationService: NotificationService) { } + public settings: ILandingPageSettings; - settings: ILandingPageSettings; + constructor(private settingsService: SettingsService, private notificationService: NotificationService) { } - ngOnInit(): void { + public ngOnInit() { this.settingsService.getLandingPage().subscribe(x => { - this.settings = x + this.settings = x; }); } - save() { + public save() { this.settingsService.saveLandingPage(this.settings).subscribe(x => { if (x) { this.notificationService.success("Settings Saved", "Successfully saved the Landing Page settings"); @@ -29,4 +28,4 @@ export class LandingPageComponent implements OnInit { } }); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/settings/notifications/discord.component.ts b/src/Ombi/ClientApp/app/settings/notifications/discord.component.ts index b2f148a10..766b2eebc 100644 --- a/src/Ombi/ClientApp/app/settings/notifications/discord.component.ts +++ b/src/Ombi/ClientApp/app/settings/notifications/discord.component.ts @@ -1,26 +1,26 @@ -import { Component, OnInit } from '@angular/core'; -import { FormGroup, Validators, FormBuilder } from '@angular/forms'; +import { Component, OnInit } from "@angular/core"; +import { FormBuilder, FormGroup, Validators } from "@angular/forms"; -import { INotificationTemplates, IDiscordNotifcationSettings, NotificationType } from '../../interfaces/INotifcationSettings'; -import { SettingsService } from '../../services/settings.service'; -import { NotificationService } from "../../services/notification.service"; -import { TesterService } from "../../services/applications/tester.service"; +import { IDiscordNotifcationSettings, INotificationTemplates, NotificationType } from "../../interfaces"; +import { TesterService } from "../../services"; +import { NotificationService } from "../../services"; +import { SettingsService } from "../../services"; @Component({ - templateUrl: './discord.component.html', + templateUrl: "./discord.component.html", }) export class DiscordComponent implements OnInit { - constructor(private settingsService: SettingsService, - private notificationService: NotificationService, - private fb: FormBuilder, - private testerService : TesterService) { } - NotificationType = NotificationType; - templates: INotificationTemplates[]; + public NotificationType = NotificationType; + public templates: INotificationTemplates[]; + public form: FormGroup; - form: FormGroup; + constructor(private settingsService: SettingsService, + private notificationService: NotificationService, + private fb: FormBuilder, + private testerService: TesterService) { } - ngOnInit(): void { + public ngOnInit() { this.settingsService.getDiscordNotificationSettings().subscribe(x => { this.templates = x.notificationTemplates; @@ -33,13 +33,13 @@ export class DiscordComponent implements OnInit { }); } - onSubmit(form: FormGroup) { + public onSubmit(form: FormGroup) { if (form.invalid) { this.notificationService.error("Validation", "Please check your entered values"); - return + return; } - var settings = form.value; + const settings = form.value; settings.notificationTemplates = this.templates; this.settingsService.saveDiscordNotificationSettings(settings).subscribe(x => { @@ -52,10 +52,10 @@ export class DiscordComponent implements OnInit { } - test(form: FormGroup) { + public test(form: FormGroup) { if (form.invalid) { this.notificationService.error("Validation", "Please check your entered values"); - return + return; } this.testerService.discordTest(form.value).subscribe(x => { @@ -64,7 +64,7 @@ export class DiscordComponent implements OnInit { } else { this.notificationService.success("Error", "There was an error when sending the Discord message. Please check your settings"); } - }) + }); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/settings/notifications/emailnotification.component.ts b/src/Ombi/ClientApp/app/settings/notifications/emailnotification.component.ts index b94a3b028..762b6981d 100644 --- a/src/Ombi/ClientApp/app/settings/notifications/emailnotification.component.ts +++ b/src/Ombi/ClientApp/app/settings/notifications/emailnotification.component.ts @@ -1,28 +1,27 @@ -import { Component, OnInit } from '@angular/core'; -import { FormGroup, Validators, FormBuilder } from '@angular/forms'; +import { Component, OnInit } from "@angular/core"; +import { FormBuilder, FormGroup, Validators } from "@angular/forms"; -import { INotificationTemplates, IEmailNotificationSettings, NotificationType } from '../../interfaces/INotifcationSettings'; -import { SettingsService } from '../../services/settings.service'; -import { NotificationService } from "../../services/notification.service"; -import { TesterService } from "../../services/applications/tester.service"; -import { ValidationService } from "../../services/helpers/validation.service"; +import { IEmailNotificationSettings, INotificationTemplates, NotificationType } from "../../interfaces"; +import { TesterService } from "../../services"; +import { ValidationService } from "../../services"; +import { NotificationService } from "../../services"; +import { SettingsService } from "../../services"; @Component({ - templateUrl: './emailnotification.component.html', + templateUrl: "./emailnotification.component.html", }) export class EmailNotificationComponent implements OnInit { - constructor(private settingsService: SettingsService, - private notificationService: NotificationService, - private fb: FormBuilder, - private validationService: ValidationService, - private testerService: TesterService) { } - - NotificationType = NotificationType; - templates: INotificationTemplates[]; + public NotificationType = NotificationType; + public templates: INotificationTemplates[]; + public emailForm: FormGroup; - emailForm: FormGroup; + constructor(private settingsService: SettingsService, + private notificationService: NotificationService, + private fb: FormBuilder, + private validationService: ValidationService, + private testerService: TesterService) { } - ngOnInit(): void { + public ngOnInit() { this.settingsService.getEmailNotificationSettings().subscribe(x => { this.templates = x.notificationTemplates; @@ -39,21 +38,21 @@ export class EmailNotificationComponent implements OnInit { }); if (x.authentication) { - this.validationService.enableValidation(this.emailForm, 'username'); - this.validationService.enableValidation(this.emailForm, 'password'); + this.validationService.enableValidation(this.emailForm, "username"); + this.validationService.enableValidation(this.emailForm, "password"); } this.subscribeToAuthChanges(); }); } - onSubmit(form: FormGroup) { + public onSubmit(form: FormGroup) { if (form.invalid) { this.notificationService.error("Validation", "Please check your entered values"); - return + return; } - var settings = form.value; + const settings = form.value; settings.notificationTemplates = this.templates; this.settingsService.saveEmailNotificationSettings(settings).subscribe(x => { @@ -66,10 +65,10 @@ export class EmailNotificationComponent implements OnInit { } - test(form: FormGroup) { + public test(form: FormGroup) { if (form.invalid) { this.notificationService.error("Validation", "Please check your entered values"); - return + return; } this.testerService.emailTest(form.value).subscribe(x => { @@ -78,7 +77,7 @@ export class EmailNotificationComponent implements OnInit { } else { this.notificationService.success("Error", "There was an error when sending the Email message, please check your settings."); } - }) + }); } private subscribeToAuthChanges() { @@ -88,12 +87,12 @@ export class EmailNotificationComponent implements OnInit { changes$.subscribe((auth: boolean) => { if (auth) { - this.validationService.enableValidation(this.emailForm, 'username'); - this.validationService.enableValidation(this.emailForm, 'password'); + this.validationService.enableValidation(this.emailForm, "username"); + this.validationService.enableValidation(this.emailForm, "password"); } else { - this.validationService.disableValidation(this.emailForm, 'username'); - this.validationService.disableValidation(this.emailForm, 'password'); + this.validationService.disableValidation(this.emailForm, "username"); + this.validationService.disableValidation(this.emailForm, "password"); } }); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/settings/notifications/mattermost.component.ts b/src/Ombi/ClientApp/app/settings/notifications/mattermost.component.ts index 30072057a..bc8b3ea38 100644 --- a/src/Ombi/ClientApp/app/settings/notifications/mattermost.component.ts +++ b/src/Ombi/ClientApp/app/settings/notifications/mattermost.component.ts @@ -1,26 +1,26 @@ -import { Component, OnInit } from '@angular/core'; -import { FormGroup, Validators, FormBuilder } from '@angular/forms'; +import { Component, OnInit } from "@angular/core"; +import { FormBuilder, FormGroup, Validators } from "@angular/forms"; -import { INotificationTemplates, IMattermostNotifcationSettings, NotificationType } from '../../interfaces/INotifcationSettings'; -import { SettingsService } from '../../services/settings.service'; -import { NotificationService } from "../../services/notification.service"; -import { TesterService } from "../../services/applications/tester.service"; +import { IMattermostNotifcationSettings, INotificationTemplates, NotificationType } from "../../interfaces"; +import { TesterService } from "../../services"; +import { NotificationService } from "../../services"; +import { SettingsService } from "../../services"; @Component({ - templateUrl: './mattermost.component.html' + templateUrl: "./mattermost.component.html", }) export class MattermostComponent implements OnInit { - constructor(private settingsService: SettingsService, - private notificationService: NotificationService, - private fb: FormBuilder, - private testerService : TesterService) { } - NotificationType = NotificationType; - templates: INotificationTemplates[]; + public NotificationType = NotificationType; + public templates: INotificationTemplates[]; + public form: FormGroup; - form: FormGroup; + constructor(private settingsService: SettingsService, + private notificationService: NotificationService, + private fb: FormBuilder, + private testerService: TesterService) { } - ngOnInit(): void { + public ngOnInit() { this.settingsService.getMattermostNotificationSettings().subscribe(x => { this.templates = x.notificationTemplates; @@ -29,19 +29,19 @@ export class MattermostComponent implements OnInit { username: [x.username], webhookUrl: [x.webhookUrl, [Validators.required]], channel: [x.channel], - iconUrl:[x.iconUrl] + iconUrl:[x.iconUrl], }); }); } - onSubmit(form: FormGroup) { + public onSubmit(form: FormGroup) { if (form.invalid) { this.notificationService.error("Validation", "Please check your entered values"); return; } - var settings = form.value; + const settings = form.value; settings.notificationTemplates = this.templates; this.settingsService.saveMattermostNotificationSettings(settings).subscribe(x => { @@ -54,7 +54,7 @@ export class MattermostComponent implements OnInit { } - test(form: FormGroup) { + public test(form: FormGroup) { if (form.invalid) { this.notificationService.error("Validation", "Please check your entered values"); return; @@ -66,7 +66,7 @@ export class MattermostComponent implements OnInit { } else { this.notificationService.success("Error", "There was an error when sending the Mattermost message. Please check your settings"); } - }) + }); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/settings/notifications/notificationtemplate.component.ts b/src/Ombi/ClientApp/app/settings/notifications/notificationtemplate.component.ts index 8dabb5a49..cfa366f0b 100644 --- a/src/Ombi/ClientApp/app/settings/notifications/notificationtemplate.component.ts +++ b/src/Ombi/ClientApp/app/settings/notifications/notificationtemplate.component.ts @@ -1,16 +1,16 @@ -import { Component, Input } from '@angular/core'; +import { Component, Input } from "@angular/core"; -import { INotificationTemplates, NotificationType } from '../../interfaces/INotifcationSettings'; +import { INotificationTemplates, NotificationType } from "../../interfaces"; @Component({ - selector:'notification-templates', - templateUrl: './notificationtemplate.component.html', + selector:"notification-templates", + templateUrl: "./notificationtemplate.component.html", }) export class NotificationTemplate { - @Input() templates: INotificationTemplates[]; - NotificationType = NotificationType; + @Input() public templates: INotificationTemplates[]; + public NotificationType = NotificationType; - helpText = ` + public helpText = ` {RequestedUser} : The User who requested the content
{RequestedDate} : The Date the media was requested
{Title} : The title of the request e.g. Lion King
@@ -26,4 +26,4 @@ export class NotificationTemplate { {ShortTime} : 16:02
`; -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/settings/notifications/pushbullet.component.ts b/src/Ombi/ClientApp/app/settings/notifications/pushbullet.component.ts index 7e09865c1..6168f8a4f 100644 --- a/src/Ombi/ClientApp/app/settings/notifications/pushbullet.component.ts +++ b/src/Ombi/ClientApp/app/settings/notifications/pushbullet.component.ts @@ -1,26 +1,25 @@ -import { Component, OnInit } from '@angular/core'; -import { FormGroup, Validators, FormBuilder } from '@angular/forms'; +import { Component, OnInit } from "@angular/core"; +import { FormBuilder, FormGroup, Validators } from "@angular/forms"; -import { INotificationTemplates, IPushbulletNotificationSettings, NotificationType } from '../../interfaces/INotifcationSettings'; -import { SettingsService } from '../../services/settings.service'; -import { NotificationService } from "../../services/notification.service"; -import { TesterService } from "../../services/applications/tester.service"; +import { INotificationTemplates, IPushbulletNotificationSettings, NotificationType } from "../../interfaces"; +import { TesterService } from "../../services"; +import { NotificationService } from "../../services"; +import { SettingsService } from "../../services"; @Component({ - templateUrl: './pushbullet.component.html', + templateUrl: "./pushbullet.component.html", }) export class PushbulletComponent implements OnInit { - constructor(private settingsService: SettingsService, - private notificationService: NotificationService, - private fb: FormBuilder, - private testerService : TesterService) { } - - NotificationType = NotificationType; - templates: INotificationTemplates[]; + public NotificationType = NotificationType; + public templates: INotificationTemplates[]; + public form: FormGroup; - form: FormGroup; + constructor(private settingsService: SettingsService, + private notificationService: NotificationService, + private fb: FormBuilder, + private testerService: TesterService) { } - ngOnInit(): void { + public ngOnInit() { this.settingsService.getPushbulletNotificationSettings().subscribe(x => { this.templates = x.notificationTemplates; @@ -32,13 +31,13 @@ export class PushbulletComponent implements OnInit { }); } - onSubmit(form: FormGroup) { + public onSubmit(form: FormGroup) { if (form.invalid) { this.notificationService.error("Validation", "Please check your entered values"); - return + return; } - var settings = form.value; + const settings = form.value; settings.notificationTemplates = this.templates; this.settingsService.savePushbulletNotificationSettings(settings).subscribe(x => { @@ -51,10 +50,10 @@ export class PushbulletComponent implements OnInit { } - test(form: FormGroup) { + public test(form: FormGroup) { if (form.invalid) { this.notificationService.error("Validation", "Please check your entered values"); - return + return; } this.testerService.pushbulletTest(form.value).subscribe(x => { @@ -63,7 +62,7 @@ export class PushbulletComponent implements OnInit { } else { this.notificationService.success("Error", "There was an error when sending the Pushbullet message. Please check your settings"); } - }) + }); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/settings/notifications/pushover.component.ts b/src/Ombi/ClientApp/app/settings/notifications/pushover.component.ts index f33fceda0..8851577ee 100644 --- a/src/Ombi/ClientApp/app/settings/notifications/pushover.component.ts +++ b/src/Ombi/ClientApp/app/settings/notifications/pushover.component.ts @@ -1,26 +1,25 @@ -import { Component, OnInit } from '@angular/core'; -import { FormGroup, Validators, FormBuilder } from '@angular/forms'; +import { Component, OnInit } from "@angular/core"; +import { FormBuilder, FormGroup, Validators } from "@angular/forms"; -import { INotificationTemplates, IPushoverNotificationSettings, NotificationType } from '../../interfaces/INotifcationSettings'; -import { SettingsService } from '../../services/settings.service'; -import { NotificationService } from "../../services/notification.service"; -import { TesterService } from "../../services/applications/tester.service"; +import { INotificationTemplates, IPushoverNotificationSettings, NotificationType } from "../../interfaces"; +import { TesterService } from "../../services"; +import { NotificationService } from "../../services"; +import { SettingsService } from "../../services"; @Component({ - templateUrl: './pushover.component.html', + templateUrl: "./pushover.component.html", }) export class PushoverComponent implements OnInit { - constructor(private settingsService: SettingsService, - private notificationService: NotificationService, - private fb: FormBuilder, - private testerService : TesterService) { } - - NotificationType = NotificationType; - templates: INotificationTemplates[]; + public NotificationType = NotificationType; + public templates: INotificationTemplates[]; + public form: FormGroup; - form: FormGroup; + constructor(private settingsService: SettingsService, + private notificationService: NotificationService, + private fb: FormBuilder, + private testerService: TesterService) { } - ngOnInit(): void { + public ngOnInit() { this.settingsService.getPushoverNotificationSettings().subscribe(x => { this.templates = x.notificationTemplates; @@ -32,13 +31,13 @@ export class PushoverComponent implements OnInit { }); } - onSubmit(form: FormGroup) { + public onSubmit(form: FormGroup) { if (form.invalid) { this.notificationService.error("Validation", "Please check your entered values"); return; } - var settings = form.value; + const settings = form.value; settings.notificationTemplates = this.templates; this.settingsService.savePushoverNotificationSettings(settings).subscribe(x => { @@ -51,7 +50,7 @@ export class PushoverComponent implements OnInit { } - test(form: FormGroup) { + public test(form: FormGroup) { if (form.invalid) { this.notificationService.error("Validation", "Please check your entered values"); return; @@ -63,7 +62,7 @@ export class PushoverComponent implements OnInit { } else { this.notificationService.success("Error", "There was an error when sending the Pushbullet message. Please check your settings"); } - }) + }); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/settings/notifications/slack.component.ts b/src/Ombi/ClientApp/app/settings/notifications/slack.component.ts index c182859c2..6261da2bc 100644 --- a/src/Ombi/ClientApp/app/settings/notifications/slack.component.ts +++ b/src/Ombi/ClientApp/app/settings/notifications/slack.component.ts @@ -1,26 +1,25 @@ -import { Component, OnInit } from '@angular/core'; -import { FormGroup, Validators, FormBuilder } from '@angular/forms'; +import { Component, OnInit } from "@angular/core"; +import { FormBuilder, FormGroup, Validators } from "@angular/forms"; -import { INotificationTemplates, ISlackNotificationSettings, NotificationType } from '../../interfaces/INotifcationSettings'; -import { SettingsService } from '../../services/settings.service'; -import { NotificationService } from "../../services/notification.service"; -import { TesterService } from "../../services/applications/tester.service"; +import { INotificationTemplates, ISlackNotificationSettings, NotificationType } from "../../interfaces"; +import { TesterService } from "../../services"; +import { NotificationService } from "../../services"; +import { SettingsService } from "../../services"; @Component({ - templateUrl: './slack.component.html', + templateUrl: "./slack.component.html", }) export class SlackComponent implements OnInit { - constructor(private settingsService: SettingsService, - private notificationService: NotificationService, - private fb: FormBuilder, - private testerService : TesterService) { } - - NotificationType = NotificationType; - templates: INotificationTemplates[]; + public NotificationType = NotificationType; + public templates: INotificationTemplates[]; + public form: FormGroup; - form: FormGroup; + constructor(private settingsService: SettingsService, + private notificationService: NotificationService, + private fb: FormBuilder, + private testerService: TesterService) { } - ngOnInit(): void { + public ngOnInit() { this.settingsService.getSlackNotificationSettings().subscribe(x => { this.templates = x.notificationTemplates; @@ -30,20 +29,19 @@ export class SlackComponent implements OnInit { webhookUrl: [x.webhookUrl, [Validators.required]], iconEmoji: [x.iconEmoji], iconUrl: [x.iconUrl], - channel: [x.channel] + channel: [x.channel], }); }); } - onSubmit(form: FormGroup) { + public onSubmit(form: FormGroup) { if (form.invalid) { this.notificationService.error("Validation", "Please check your entered values"); - return + return; } - - var settings = form.value; + const settings = form.value; if (settings.iconEmoji && settings.iconUrl) { this.notificationService.error("Validation", "You cannot have a Emoji icon and a URL icon"); @@ -61,13 +59,13 @@ export class SlackComponent implements OnInit { } - test(form: FormGroup) { + public test(form: FormGroup) { if (form.invalid) { this.notificationService.error("Validation", "Please check your entered values"); - return + return; } - var settings = form.value; + const settings = form.value; if (settings.iconEmoji && settings.iconUrl) { this.notificationService.error("Validation", "You cannot have a Emoji icon and a URL icon"); @@ -79,7 +77,7 @@ export class SlackComponent implements OnInit { } else { this.notificationService.success("Error", "There was an error when sending the Slack message. Please check your settings"); } - }) + }); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/settings/ombi/ombi.component.ts b/src/Ombi/ClientApp/app/settings/ombi/ombi.component.ts index ebf2d59a2..49075a1dc 100644 --- a/src/Ombi/ClientApp/app/settings/ombi/ombi.component.ts +++ b/src/Ombi/ClientApp/app/settings/ombi/ombi.component.ts @@ -1,46 +1,44 @@ -import { Component, OnInit } from '@angular/core'; -import { FormGroup, FormBuilder } from '@angular/forms'; +import { Component, OnInit } from "@angular/core"; +import { FormBuilder, FormGroup } from "@angular/forms"; -import { SettingsService } from '../../services/settings.service'; -import { NotificationService } from "../../services/notification.service"; +import { NotificationService } from "../../services"; +import { SettingsService } from "../../services"; @Component({ - templateUrl: './ombi.component.html', + templateUrl: "./ombi.component.html", }) export class OmbiComponent implements OnInit { - constructor(private settingsService: SettingsService, - private notificationService: NotificationService, - private fb: FormBuilder) { } + public form: FormGroup; - form: FormGroup; + constructor(private settingsService: SettingsService, + private notificationService: NotificationService, + private fb: FormBuilder) { } - ngOnInit(): void { + public ngOnInit() { this.settingsService.getOmbi().subscribe(x => { this.form = this.fb.group({ port: [x.port], collectAnalyticData: [x.collectAnalyticData], apiKey: [x.apiKey], externalUrl: [x.externalUrl], - allowExternalUsersToAuthenticate: [x.allowExternalUsersToAuthenticate] + allowExternalUsersToAuthenticate: [x.allowExternalUsersToAuthenticate], }); }); } - - refreshApiKey() { + public refreshApiKey() { this.settingsService.resetOmbiApi().subscribe(x => { - this.form.controls["apiKey"].patchValue(x); + this.form.controls.apiKey.patchValue(x); }); } - onSubmit(form: FormGroup) { + public onSubmit(form: FormGroup) { if (form.invalid) { this.notificationService.error("Validation", "Please check your entered values"); return; } - this.settingsService.saveOmbi(form.value).subscribe(x => { if (x) { this.notificationService.success("Settings Saved", "Successfully saved Ombi settings"); @@ -50,7 +48,7 @@ export class OmbiComponent implements OnInit { }); } - successfullyCopied() { + public successfullyCopied() { this.notificationService.success("Copied", "Copied the Api Key to the clipboard!"); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/settings/plex/plex.component.ts b/src/Ombi/ClientApp/app/settings/plex/plex.component.ts index d31a253c3..52136b271 100644 --- a/src/Ombi/ClientApp/app/settings/plex/plex.component.ts +++ b/src/Ombi/ClientApp/app/settings/plex/plex.component.ts @@ -1,63 +1,64 @@ -import { Component, OnInit, OnDestroy } from '@angular/core'; -import { Subject } from 'rxjs/Subject'; +import { Component, OnDestroy, OnInit } from "@angular/core"; import "rxjs/add/operator/takeUntil"; +import { Subject } from "rxjs/Subject"; -import { IPlexSettings, IPlexLibraries, IPlexServer } from '../../interfaces/ISettings'; -import { IPlexServerResponse, IPlexServerViewModel } from '../../interfaces/IPlex' +import { IPlexServerResponse, IPlexServerViewModel } from "../../interfaces"; +import { IPlexLibrariesSettings, IPlexServer, IPlexSettings } from "../../interfaces"; -import { SettingsService } from '../../services/settings.service'; -import { TesterService } from '../../services/applications/tester.service'; -import { PlexService } from '../../services/applications/plex.service'; -import { NotificationService } from "../../services/notification.service"; +import { PlexService } from "../../services"; +import { TesterService } from "../../services"; +import { NotificationService } from "../../services"; +import { SettingsService } from "../../services"; @Component({ - templateUrl: './plex.component.html', + templateUrl: "./plex.component.html", }) export class PlexComponent implements OnInit, OnDestroy { - constructor(private settingsService: SettingsService, - private notificationService: NotificationService, - private plexService: PlexService, - private testerService : TesterService) { } + public settings: IPlexSettings; + public loadedServers: IPlexServerViewModel; // This comes from the api call for the user to select a server + public username: string; + public password: string; + public serversButton = false; - settings: IPlexSettings; - loadedServers: IPlexServerViewModel; // This comes from the api call for the user to select a server private subscriptions = new Subject(); - username: string; - password: string; - serversButton = false; - ngOnInit(): void { + constructor(private settingsService: SettingsService, + private notificationService: NotificationService, + private plexService: PlexService, + private testerService: TesterService) { } + + public ngOnInit() { this.settingsService.getPlex().subscribe(x => { this.settings = x; }); } - requestServers(server: IPlexServer): void { + public requestServers(server: IPlexServer) { this.plexService.getServers(this.username, this.password) .takeUntil(this.subscriptions) .subscribe(x => { if (x.success) { this.loadedServers = x; this.serversButton = true; - this.notificationService.success("Loaded", "Found the servers! Please select one!") + this.notificationService.success("Loaded", "Found the servers! Please select one!"); } else { this.notificationService.warning("Error When Requesting Plex Servers", "Please make sure your username and password are correct"); } }); } - selectServer(selectedServer: IPlexServerResponse, server: IPlexServer) { - server.ip = selectedServer.localAddresses.split(',')[0]; + public selectServer(selectedServer: IPlexServerResponse, server: IPlexServer) { + server.ip = selectedServer.localAddresses.split(",")[0]; server.name = selectedServer.name; server.machineIdentifier = selectedServer.machineIdentifier; server.plexAuthToken = selectedServer.accessToken; server.port = parseInt(selectedServer.port); server.ssl = selectedServer.scheme === "http" ? false : true; - this.notificationService.success("Success", `Selected ${server.name}!`) + this.notificationService.success("Success", `Selected ${server.name}!`); } - testPlex(server: IPlexServer) { + public testPlex(server: IPlexServer) { this.testerService.plexTest(server).subscribe(x => { if (x) { this.notificationService.success("Connected", `Successfully connected to the Plex server ${server.name}!`); @@ -67,42 +68,42 @@ export class PlexComponent implements OnInit, OnDestroy { }); } - addTab() { + public addTab() { if (this.settings.servers == null) { this.settings.servers = []; - } + } this.settings.servers.push({ name: "New*", id: Math.floor(Math.random() * (99999 - 0 + 1) + 1) }); } - removeServer(server: IPlexServer) { - var index = this.settings.servers.indexOf(server, 0); + public removeServer(server: IPlexServer) { + const index = this.settings.servers.indexOf(server, 0); if (index > -1) { this.settings.servers.splice(index, 1); } } - loadLibraries(server: IPlexServer) { + public loadLibraries(server: IPlexServer) { if (server.ip == null) { - this.notificationService.error("Not Configured", "Plex is not yet configured correctly") + this.notificationService.error("Not Configured", "Plex is not yet configured correctly"); return; } this.plexService.getLibraries(server).subscribe(x => { server.plexSelectedLibraries = []; x.mediaContainer.directory.forEach((item, index) => { - var lib: IPlexLibraries = { + const lib: IPlexLibrariesSettings = { key: item.key, title: item.title, - enabled: false + enabled: false, }; server.plexSelectedLibraries.push(lib); }); }, - err => { this.notificationService.error("Error", err) }); + err => { this.notificationService.error("Error", err); }); } - save() { - var filtered = this.settings.servers.filter(x => x.name !== ""); + public save() { + const filtered = this.settings.servers.filter(x => x.name !== ""); this.settings.servers = filtered; this.settingsService.savePlex(this.settings).subscribe(x => { if (x) { @@ -113,8 +114,8 @@ export class PlexComponent implements OnInit, OnDestroy { }); } - ngOnDestroy(): void { + public ngOnDestroy() { this.subscriptions.next(); this.subscriptions.complete(); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/settings/radarr/radarr.component.ts b/src/Ombi/ClientApp/app/settings/radarr/radarr.component.ts index 67a721044..8487cf80a 100644 --- a/src/Ombi/ClientApp/app/settings/radarr/radarr.component.ts +++ b/src/Ombi/ClientApp/app/settings/radarr/radarr.component.ts @@ -1,40 +1,37 @@ -import { Component, OnInit } from '@angular/core'; -import { Subject } from 'rxjs/Subject'; +import { Component, OnInit } from "@angular/core"; +import { FormBuilder, FormGroup, Validators } from "@angular/forms"; import "rxjs/add/operator/takeUntil"; -import { FormGroup, Validators, FormBuilder } from '@angular/forms'; +import { Subject } from "rxjs/Subject"; -import { IRadarrSettings } from '../../interfaces/ISettings'; -import { IRadarrProfile, IRadarrRootFolder, IMinimumAvailability } from '../../interfaces/IRadarr'; -import { SettingsService } from '../../services/settings.service'; -import { RadarrService } from '../../services/applications/radarr.service'; -import { TesterService } from '../../services/applications/tester.service'; -import { NotificationService } from "../../services/notification.service"; +import { IMinimumAvailability, IRadarrProfile, IRadarrRootFolder } from "../../interfaces"; +import { IRadarrSettings } from "../../interfaces"; +import { RadarrService } from "../../services"; +import { TesterService } from "../../services"; +import { NotificationService } from "../../services"; +import { SettingsService } from "../../services"; @Component({ - - templateUrl: './radarr.component.html', + templateUrl: "./radarr.component.html", }) export class RadarrComponent implements OnInit { - constructor(private settingsService: SettingsService, - private radarrService: RadarrService, - private notificationService: NotificationService, - private fb: FormBuilder, - private testerService : TesterService) { } - qualities: IRadarrProfile[]; - rootFolders: IRadarrRootFolder[]; - - minimumAvailabilityOptions: IMinimumAvailability[]; + public qualities: IRadarrProfile[]; + public rootFolders: IRadarrRootFolder[]; + public minimumAvailabilityOptions: IMinimumAvailability[]; + public profilesRunning: boolean; + public rootFoldersRunning: boolean; + public advanced = false; + public form: FormGroup; - profilesRunning: boolean; - rootFoldersRunning: boolean; - - advanced = false; private subscriptions = new Subject(); - form : FormGroup; - ngOnInit(): void { + constructor(private settingsService: SettingsService, + private radarrService: RadarrService, + private notificationService: NotificationService, + private fb: FormBuilder, + private testerService: TesterService) { } + public ngOnInit() { this.settingsService.getRadarr() .takeUntil(this.subscriptions) .subscribe(x => { @@ -49,7 +46,7 @@ export class RadarrComponent implements OnInit { ip: [x.ip, [Validators.required]], port: [x.port, [Validators.required]], addOnly: [x.addOnly], - minimumAvailability: [x.minimumAvailability, [Validators.required]] + minimumAvailability: [x.minimumAvailability, [Validators.required]], }); if (x.defaultQualityProfile) { @@ -69,33 +66,32 @@ export class RadarrComponent implements OnInit { } - - getProfiles(form: FormGroup) { + public getProfiles(form: FormGroup) { this.profilesRunning = true; this.radarrService.getQualityProfiles(form.value).subscribe(x => { this.qualities = x; - + this.profilesRunning = false; this.notificationService.success("Quality Profiles", "Successfully retrevied the Quality Profiles"); }); } - getRootFolders(form: FormGroup) { + public getRootFolders(form: FormGroup) { this.rootFoldersRunning = true; this.radarrService.getRootFolders(form.value).subscribe(x => { this.rootFolders = x; - + this.rootFoldersRunning = false; this.notificationService.success("Settings Saved", "Successfully retrevied the Root Folders"); }); } - test(form: FormGroup) { + public test(form: FormGroup) { if (form.invalid) { this.notificationService.error("Validation", "Please check your entered values"); return; } - var settings = form.value; + const settings = form.value; this.testerService.radarrTest(settings).subscribe(x => { if (x) { this.notificationService.success("Connected", "Successfully connected to Radarr!"); @@ -105,13 +101,13 @@ export class RadarrComponent implements OnInit { }); } -onSubmit(form: FormGroup) { +public onSubmit(form: FormGroup) { if (form.invalid) { this.notificationService.error("Validation", "Please check your entered values"); return; } - var settings = form.value; + const settings = form.value; this.settingsService.saveRadarr(settings).subscribe(x => { if (x) { this.notificationService.success("Settings Saved", "Successfully saved Radarr settings"); @@ -122,8 +118,8 @@ onSubmit(form: FormGroup) { } - ngOnDestroy(): void { + public ngOnDestroy() { this.subscriptions.next(); this.subscriptions.complete(); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/settings/settings.module.ts b/src/Ombi/ClientApp/app/settings/settings.module.ts index ba751c052..e8d851628 100644 --- a/src/Ombi/ClientApp/app/settings/settings.module.ts +++ b/src/Ombi/ClientApp/app/settings/settings.module.ts @@ -1,54 +1,54 @@ -import { NgModule, } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { RouterModule, Routes } from '@angular/router'; -import { NgbModule, NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap'; -import { ClipboardModule } from 'ngx-clipboard/dist'; +import { CommonModule } from "@angular/common"; +import { NgModule } from "@angular/core"; +import { FormsModule, ReactiveFormsModule } from "@angular/forms"; +import { RouterModule, Routes } from "@angular/router"; +import { NgbAccordionModule, NgbModule } from "@ng-bootstrap/ng-bootstrap"; +import { ClipboardModule } from "ngx-clipboard/dist"; -import { AuthService } from '../auth/auth.service'; -import { AuthGuard } from '../auth/auth.guard'; -import { AuthModule } from '../auth/auth.module'; -import { SonarrService } from '../services/applications/sonarr.service'; -import { RadarrService } from '../services/applications/radarr.service'; -import { TesterService } from '../services/applications/tester.service'; -import { ValidationService } from '../services/helpers/validation.service'; +import { AuthGuard } from "../auth/auth.guard"; +import { AuthModule } from "../auth/auth.module"; +import { AuthService } from "../auth/auth.service"; +import { RadarrService } from "../services"; +import { SonarrService } from "../services"; +import { TesterService } from "../services"; +import { ValidationService } from "../services"; -import { OmbiComponent } from './ombi/ombi.component'; -import { PlexComponent } from './plex/plex.component'; -import { EmbyComponent } from './emby/emby.component'; -import { SonarrComponent } from './sonarr/sonarr.component'; -import { RadarrComponent } from './radarr/radarr.component'; -import { LandingPageComponent } from './landingpage/landingpage.component'; -import { CustomizationComponent } from './customization/customization.component'; -import { UserManagementComponent } from './usermanagement/usermanagement.component'; -import { EmailNotificationComponent } from './notifications/emailnotification.component'; -import { DiscordComponent } from './notifications/discord.component'; -import { SlackComponent } from './notifications/slack.component'; -import { PushoverComponent } from './notifications/pushover.component'; -import { PushbulletComponent } from './notifications/pushbullet.component'; -import { MattermostComponent } from './notifications/mattermost.component'; -import { NotificationTemplate } from './notifications/notificationtemplate.component'; -import { PipeModule } from '../pipes/pipe.module'; +import { PipeModule } from "../pipes/pipe.module"; +import { CustomizationComponent } from "./customization/customization.component"; +import { EmbyComponent } from "./emby/emby.component"; +import { LandingPageComponent } from "./landingpage/landingpage.component"; +import { DiscordComponent } from "./notifications/discord.component"; +import { EmailNotificationComponent } from "./notifications/emailnotification.component"; +import { MattermostComponent } from "./notifications/mattermost.component"; +import { NotificationTemplate } from "./notifications/notificationtemplate.component"; +import { PushbulletComponent } from "./notifications/pushbullet.component"; +import { PushoverComponent } from "./notifications/pushover.component"; +import { SlackComponent } from "./notifications/slack.component"; +import { OmbiComponent } from "./ombi/ombi.component"; +import { PlexComponent } from "./plex/plex.component"; +import { RadarrComponent } from "./radarr/radarr.component"; +import { SonarrComponent } from "./sonarr/sonarr.component"; +import { UserManagementComponent } from "./usermanagement/usermanagement.component"; -import { SettingsMenuComponent } from './settingsmenu.component'; +import { SettingsMenuComponent } from "./settingsmenu.component"; -import { MenuModule, InputSwitchModule, InputTextModule, TooltipModule, AutoCompleteModule, CalendarModule } from 'primeng/primeng'; +import { AutoCompleteModule, CalendarModule, InputSwitchModule, InputTextModule, MenuModule, TooltipModule } from "primeng/primeng"; const routes: Routes = [ - { path: 'Settings/Ombi', component: OmbiComponent, canActivate: [AuthGuard] }, - { path: 'Settings/Plex', component: PlexComponent, canActivate: [AuthGuard] }, - { path: 'Settings/Emby', component: EmbyComponent, canActivate: [AuthGuard] }, - { path: 'Settings/Sonarr', component: SonarrComponent, canActivate: [AuthGuard] }, - { path: 'Settings/Radarr', component: RadarrComponent, canActivate: [AuthGuard] }, - { path: 'Settings/LandingPage', component: LandingPageComponent, canActivate: [AuthGuard] }, - { path: 'Settings/Customization', component: CustomizationComponent, canActivate: [AuthGuard] }, - { path: 'Settings/Email', component: EmailNotificationComponent, canActivate: [AuthGuard] }, - { path: 'Settings/Discord', component: DiscordComponent, canActivate: [AuthGuard] }, - { path: 'Settings/Slack', component: SlackComponent, canActivate: [AuthGuard] }, - { path: 'Settings/Pushover', component: PushoverComponent, canActivate: [AuthGuard] }, - { path: 'Settings/Pushbullet', component: PushbulletComponent, canActivate: [AuthGuard] }, - { path: 'Settings/Mattermost', component: MattermostComponent, canActivate: [AuthGuard] }, - { path: 'Settings/UserManagement', component: UserManagementComponent, canActivate: [AuthGuard] }, + { path: "Settings/Ombi", component: OmbiComponent, canActivate: [AuthGuard] }, + { path: "Settings/Plex", component: PlexComponent, canActivate: [AuthGuard] }, + { path: "Settings/Emby", component: EmbyComponent, canActivate: [AuthGuard] }, + { path: "Settings/Sonarr", component: SonarrComponent, canActivate: [AuthGuard] }, + { path: "Settings/Radarr", component: RadarrComponent, canActivate: [AuthGuard] }, + { path: "Settings/LandingPage", component: LandingPageComponent, canActivate: [AuthGuard] }, + { path: "Settings/Customization", component: CustomizationComponent, canActivate: [AuthGuard] }, + { path: "Settings/Email", component: EmailNotificationComponent, canActivate: [AuthGuard] }, + { path: "Settings/Discord", component: DiscordComponent, canActivate: [AuthGuard] }, + { path: "Settings/Slack", component: SlackComponent, canActivate: [AuthGuard] }, + { path: "Settings/Pushover", component: PushoverComponent, canActivate: [AuthGuard] }, + { path: "Settings/Pushbullet", component: PushbulletComponent, canActivate: [AuthGuard] }, + { path: "Settings/Mattermost", component: MattermostComponent, canActivate: [AuthGuard] }, + { path: "Settings/UserManagement", component: UserManagementComponent, canActivate: [AuthGuard] }, ]; @NgModule({ @@ -88,7 +88,7 @@ const routes: Routes = [ UserManagementComponent, ], exports: [ - RouterModule + RouterModule, ], providers: [ SonarrService, @@ -96,8 +96,8 @@ const routes: Routes = [ RadarrService, AuthGuard, ValidationService, - TesterService + TesterService, ], - + }) -export class SettingsModule { } \ No newline at end of file +export class SettingsModule { } diff --git a/src/Ombi/ClientApp/app/settings/settingsmenu.component.ts b/src/Ombi/ClientApp/app/settings/settingsmenu.component.ts index f9aea4a5d..8fb96846b 100644 --- a/src/Ombi/ClientApp/app/settings/settingsmenu.component.ts +++ b/src/Ombi/ClientApp/app/settings/settingsmenu.component.ts @@ -1,8 +1,6 @@ -import { Component } from '@angular/core'; +import { Component } from "@angular/core"; @Component({ - selector: 'settings-menu', - templateUrl: './settingsmenu.component.html' + selector: "settings-menu", + templateUrl: "./settingsmenu.component.html", }) -export class SettingsMenuComponent { - -} \ No newline at end of file +export class SettingsMenuComponent { } diff --git a/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts b/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts index 51483d61a..ecb56f0c8 100644 --- a/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts +++ b/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts @@ -1,47 +1,45 @@ -import { Component, OnInit, OnDestroy } from '@angular/core'; -import { Subject } from 'rxjs/Subject'; +import { Component, OnDestroy, OnInit } from "@angular/core"; +import { FormBuilder, FormGroup, Validators } from "@angular/forms"; import "rxjs/add/operator/takeUntil"; -import { FormGroup, Validators, FormBuilder } from '@angular/forms'; +import { Subject } from "rxjs/Subject"; -import { ISonarrProfile, ISonarrRootFolder } from '../../interfaces/ISonarr' +import { ISonarrProfile, ISonarrRootFolder } from "../../interfaces"; -import { TesterService } from '../../services/applications/tester.service'; -import { ISonarrSettings } from '../../interfaces/ISettings'; -import { SettingsService } from '../../services/settings.service'; -import { SonarrService } from '../../services/applications/sonarr.service'; -import { NotificationService } from "../../services/notification.service"; +import { ISonarrSettings } from "../../interfaces"; +import { SonarrService } from "../../services"; +import { TesterService } from "../../services"; +import { NotificationService } from "../../services"; +import { SettingsService } from "../../services"; @Component({ - - templateUrl: './sonarr.component.html', + templateUrl: "./sonarr.component.html", }) export class SonarrComponent implements OnInit, OnDestroy { - constructor(private settingsService: SettingsService, - private sonarrService: SonarrService, - private notificationService: NotificationService, - private testerService : TesterService, - private fb : FormBuilder) { } - - qualities: ISonarrProfile[]; - rootFolders: ISonarrRootFolder[]; + public qualities: ISonarrProfile[]; + public rootFolders: ISonarrRootFolder[]; + public selectedRootFolder: ISonarrRootFolder; + public selectedQuality: ISonarrProfile; + public profilesRunning: boolean; + public rootFoldersRunning: boolean; + public form: FormGroup; + public advanced = false; - selectedRootFolder: ISonarrRootFolder; - selectedQuality: ISonarrProfile; - - profilesRunning: boolean; - rootFoldersRunning: boolean; private subscriptions = new Subject(); - form : FormGroup; - advanced = false; - ngOnInit(): void { + constructor(private settingsService: SettingsService, + private sonarrService: SonarrService, + private notificationService: NotificationService, + private testerService: TesterService, + private fb: FormBuilder) { } + + public ngOnInit() { this.settingsService.getSonarr() .takeUntil(this.subscriptions) .subscribe(x => { - this.form = this.fb.group({ + this.form = this.fb.group({ enabled: [x.enabled], apiKey: [x.apiKey, [Validators.required]], qualityProfile: [x.qualityProfile, [Validators.required]], @@ -54,19 +52,16 @@ export class SonarrComponent implements OnInit, OnDestroy { seasonFolders: [x.seasonFolders], }); - if (x.qualityProfile) - { + if (x.qualityProfile) { this.getProfiles(this.form); } - if (x.rootPath) - { + if (x.rootPath) { this.getRootFolders(this.form); } }); } - - getProfiles(form:FormGroup) { + public getProfiles(form: FormGroup) { this.profilesRunning = true; this.sonarrService.getQualityProfiles(form.value) .takeUntil(this.subscriptions) @@ -78,7 +73,7 @@ export class SonarrComponent implements OnInit, OnDestroy { }); } - getRootFolders(form:FormGroup) { + public getRootFolders(form: FormGroup) { this.rootFoldersRunning = true; this.sonarrService.getRootFolders(form.value) .takeUntil(this.subscriptions) @@ -90,12 +85,12 @@ export class SonarrComponent implements OnInit, OnDestroy { }); } - test(form: FormGroup) { + public test(form: FormGroup) { if (form.invalid) { this.notificationService.error("Validation", "Please check your entered values"); return; } - var settings = form.value; + const settings = form.value; this.testerService.sonarrTest(settings).subscribe(x => { if (x) { this.notificationService.success("Connected", "Successfully connected to Sonarr!"); @@ -105,11 +100,11 @@ export class SonarrComponent implements OnInit, OnDestroy { }); } - onSubmit(form:FormGroup) { - if (form.invalid) { + public onSubmit(form: FormGroup) { + if (form.invalid) { this.notificationService.error("Validation", "Please check your entered values"); - return; - } + return; + } this.settingsService.saveSonarr(form.value) .takeUntil(this.subscriptions) .subscribe(x => { @@ -121,8 +116,8 @@ export class SonarrComponent implements OnInit, OnDestroy { }); } - ngOnDestroy(): void { + public ngOnDestroy() { this.subscriptions.next(); this.subscriptions.complete(); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/settings/usermanagement/usermanagement.component.ts b/src/Ombi/ClientApp/app/settings/usermanagement/usermanagement.component.ts index 1369a5fbd..277409648 100644 --- a/src/Ombi/ClientApp/app/settings/usermanagement/usermanagement.component.ts +++ b/src/Ombi/ClientApp/app/settings/usermanagement/usermanagement.component.ts @@ -1,9 +1,6 @@ -import { Component } from '@angular/core'; +import { Component } from "@angular/core"; @Component({ - - templateUrl: './usermanagement.component.html', + templateUrl: "./usermanagement.component.html", }) -export class UserManagementComponent { - -} \ No newline at end of file +export class UserManagementComponent { } diff --git a/src/Ombi/ClientApp/app/usermanagement/updatedetails.component.ts b/src/Ombi/ClientApp/app/usermanagement/updatedetails.component.ts index f449b27df..fb597b55e 100644 --- a/src/Ombi/ClientApp/app/usermanagement/updatedetails.component.ts +++ b/src/Ombi/ClientApp/app/usermanagement/updatedetails.component.ts @@ -1,24 +1,24 @@ -import { Component, OnInit } from '@angular/core'; -import { FormGroup, Validators, FormBuilder } from '@angular/forms'; +import { Component, OnInit } from "@angular/core"; +import { FormBuilder, FormGroup, Validators } from "@angular/forms"; -import { IUpdateLocalUser } from '../interfaces/IUser'; -import { IdentityService } from '../services/identity.service'; -import { NotificationService } from '../services/notification.service'; +import { IUpdateLocalUser } from "../interfaces"; +import { IdentityService } from "../services"; +import { NotificationService } from "../services"; @Component({ - templateUrl: './updatedetails.component.html' + templateUrl: "./updatedetails.component.html", }) export class UpdateDetailsComponent implements OnInit { - constructor(private identityService: IdentityService, - private notificationService: NotificationService, - private fb: FormBuilder) { } + public form: FormGroup; - form: FormGroup; + constructor(private identityService: IdentityService, + private notificationService: NotificationService, + private fb: FormBuilder) { } - ngOnInit(): void { + public ngOnInit() { this.identityService.getUser().subscribe(x => { - var localUser = x as IUpdateLocalUser; - this.form = this.fb.group({ + const localUser = x as IUpdateLocalUser; + this.form = this.fb.group({ id:[localUser.id], username: [localUser.username], emailAddress: [localUser.emailAddress, [Validators.email]], @@ -27,27 +27,26 @@ export class UpdateDetailsComponent implements OnInit { password: [localUser.password], }); - }); } - onSubmit(form : FormGroup) { + public onSubmit(form: FormGroup) { if (form.invalid) { this.notificationService.error("Validation", "Please check your entered values"); - return + return; } - if (form.controls["password"].dirty) { + if (form.controls.password.dirty) { if (form.value.password !== form.value.confirmNewPassword) { this.notificationService.error("Error", "Passwords do not match"); return; } } - this.identityService.updateLocalUser(this.form.value).subscribe(x => { + this.identityService.updateLocalUser(this.form.value).subscribe(x => { if (x.successful) { - this.notificationService.success("Updated", `All of your details have now been updated`) + this.notificationService.success("Updated", `All of your details have now been updated`); } else { x.errors.forEach((val) => { this.notificationService.error("Error", val); @@ -57,5 +56,4 @@ export class UpdateDetailsComponent implements OnInit { } - -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/usermanagement/usermanagement-add.component.ts b/src/Ombi/ClientApp/app/usermanagement/usermanagement-add.component.ts index 3ed0c060b..9786e0452 100644 --- a/src/Ombi/ClientApp/app/usermanagement/usermanagement-add.component.ts +++ b/src/Ombi/ClientApp/app/usermanagement/usermanagement-add.component.ts @@ -1,24 +1,23 @@ -import { Component, OnInit } from '@angular/core'; -import { Router } from '@angular/router'; +import { Component, OnInit } from "@angular/core"; +import { Router } from "@angular/router"; -import { IUser, UserType, ICheckbox } from '../interfaces/IUser'; -import { IdentityService } from '../services/identity.service'; -import { NotificationService } from '../services/notification.service'; +import { ICheckbox, IUser, UserType } from "../interfaces"; +import { IdentityService } from "../services"; +import { NotificationService } from "../services"; @Component({ - - templateUrl: './usermanagement-add.component.html' + templateUrl: "./usermanagement-add.component.html", }) export class UserManagementAddComponent implements OnInit { - constructor(private identityService: IdentityService, - private notificationSerivce: NotificationService, - private router: Router) { } + public user: IUser; + public availableClaims: ICheckbox[]; + public confirmPass: ""; - user: IUser; - availableClaims: ICheckbox[]; - confirmPass: ""; + constructor(private identityService: IdentityService, + private notificationSerivce: NotificationService, + private router: Router) { } - ngOnInit(): void { + public ngOnInit() { this.identityService.getAllAvailableClaims().subscribe(x => this.availableClaims = x); this.user = { alias: "", @@ -29,11 +28,11 @@ export class UserManagementAddComponent implements OnInit { username: "", userType: UserType.LocalUser, checked:false, - isSetup:false - } + isSetup:false, + }; } - create(): void { + public create() { this.user.claims = this.availableClaims; if (this.user.password) { @@ -42,7 +41,7 @@ export class UserManagementAddComponent implements OnInit { return; } } - var hasClaims = this.availableClaims.some((item) => { + const hasClaims = this.availableClaims.some((item) => { if (item.enabled) { return true; } return false; @@ -55,14 +54,14 @@ export class UserManagementAddComponent implements OnInit { this.identityService.createUser(this.user).subscribe(x => { if (x.successful) { - this.notificationSerivce.success("Updated", `The user ${this.user.username} has been created successfully`) - this.router.navigate(['usermanagement']); + this.notificationSerivce.success("Updated", `The user ${this.user.username} has been created successfully`); + this.router.navigate(["usermanagement"]); } else { x.errors.forEach((val) => { this.notificationSerivce.error("Error", val); }); } - }) + }); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/usermanagement/usermanagement-edit.component.ts b/src/Ombi/ClientApp/app/usermanagement/usermanagement-edit.component.ts index 40691e87f..715f17569 100644 --- a/src/Ombi/ClientApp/app/usermanagement/usermanagement-edit.component.ts +++ b/src/Ombi/ClientApp/app/usermanagement/usermanagement-edit.component.ts @@ -1,22 +1,25 @@ -import { Component } from '@angular/core'; -import { Router } from '@angular/router'; +import { Component } from "@angular/core"; +import { Router } from "@angular/router"; -import { IUser } from '../interfaces/IUser'; -import { IdentityService } from '../services/identity.service'; -import { NotificationService } from '../services/notification.service'; -import { ActivatedRoute } from '@angular/router'; +import { ActivatedRoute } from "@angular/router"; +import { IUser } from "../interfaces"; +import { IdentityService } from "../services"; +import { NotificationService } from "../services"; @Component({ - templateUrl: './usermanagement-edit.component.html' + templateUrl: "./usermanagement-edit.component.html", }) export class UserManagementEditComponent { + public user: IUser; + public userId: string; + constructor(private identityService: IdentityService, - private route: ActivatedRoute, - private notificationSerivce: NotificationService, - private router: Router) { + private route: ActivatedRoute, + private notificationSerivce: NotificationService, + private router: Router) { this.route.params .subscribe(params => { - this.userId = params['id']; + this.userId = params.id; this.identityService.getUserById(this.userId).subscribe(x => { this.user = x; @@ -24,14 +27,11 @@ export class UserManagementEditComponent { }); } - user: IUser; - userId: string; - - delete(): void { + public delete() { this.identityService.deleteUser(this.user).subscribe(x => { if (x.successful) { - this.notificationSerivce.success("Deleted", `The user ${this.user.username} was deleted`) - this.router.navigate(['usermanagement']); + this.notificationSerivce.success("Deleted", `The user ${this.user.username} was deleted`); + this.router.navigate(["usermanagement"]); } else { x.errors.forEach((val) => { this.notificationSerivce.error("Error", val); @@ -41,11 +41,11 @@ export class UserManagementEditComponent { }); } - resetPassword(): void { + public resetPassword() { this.identityService.submitResetPassword(this.user.emailAddress).subscribe(x => { if (x.successful) { this.notificationSerivce.success("Reset", `Sent reset password email to ${this.user.emailAddress}`); - this.router.navigate(['usermanagement']); + this.router.navigate(["usermanagement"]); } else { x.errors.forEach((val) => { this.notificationSerivce.error("Error", val); @@ -55,8 +55,8 @@ export class UserManagementEditComponent { }); } - update(): void { - var hasClaims = this.user.claims.some((item) => { + public update() { + const hasClaims = this.user.claims.some((item) => { if (item.enabled) { return true; } return false; @@ -69,14 +69,14 @@ export class UserManagementEditComponent { this.identityService.updateUser(this.user).subscribe(x => { if (x.successful) { - this.notificationSerivce.success("Updated", `The user ${this.user.username} has been updated successfully`) - this.router.navigate(['usermanagement']); + this.notificationSerivce.success("Updated", `The user ${this.user.username} has been updated successfully`); + this.router.navigate(["usermanagement"]); } else { x.errors.forEach((val) => { this.notificationSerivce.error("Error", val); }); } - }) + }); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/usermanagement/usermanagement.component.ts b/src/Ombi/ClientApp/app/usermanagement/usermanagement.component.ts index ce797ece3..286c2970a 100644 --- a/src/Ombi/ClientApp/app/usermanagement/usermanagement.component.ts +++ b/src/Ombi/ClientApp/app/usermanagement/usermanagement.component.ts @@ -1,16 +1,19 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit } from "@angular/core"; -import { IUser } from '../interfaces/IUser'; -import { IdentityService } from '../services/identity.service'; +import { IUser } from "../interfaces"; +import { IdentityService } from "../services"; @Component({ - - templateUrl: './usermanagement.component.html' + templateUrl: "./usermanagement.component.html", }) export class UserManagementComponent implements OnInit { + + public users: IUser[]; + public checkAll = false; + constructor(private identityService: IdentityService) { } - ngOnInit(): void { + public ngOnInit() { this.users = []; this.identityService.getUsers().subscribe(x => { this.users = x; @@ -18,17 +21,14 @@ export class UserManagementComponent implements OnInit { } - welcomeEmail(user: IUser): void { - + public welcomeEmail(user: IUser) { + // todo } - users: IUser[]; - checkAll = false; - - checkAllBoxes() { + public checkAllBoxes() { this.checkAll = !this.checkAll; this.users.forEach(user => { user.checked = this.checkAll; }); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/usermanagement/usermanagement.module.ts b/src/Ombi/ClientApp/app/usermanagement/usermanagement.module.ts index 9eeca1ad0..5cfe05ba2 100644 --- a/src/Ombi/ClientApp/app/usermanagement/usermanagement.module.ts +++ b/src/Ombi/ClientApp/app/usermanagement/usermanagement.module.ts @@ -1,26 +1,26 @@ -import { NgModule, } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { RouterModule, Routes } from '@angular/router'; -import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { MultiSelectModule, TooltipModule, } from 'primeng/primeng'; +import { CommonModule } from "@angular/common"; +import { NgModule } from "@angular/core"; +import { FormsModule, ReactiveFormsModule } from "@angular/forms"; +import { RouterModule, Routes } from "@angular/router"; +import { MultiSelectModule, TooltipModule } from "primeng/primeng"; -import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { NgbModule } from "@ng-bootstrap/ng-bootstrap"; -import { UserManagementComponent } from './usermanagement.component'; -import { UserManagementEditComponent } from './usermanagement-edit.component'; -import { UserManagementAddComponent } from './usermanagement-add.component'; -import { UpdateDetailsComponent } from './updatedetails.component'; +import { UpdateDetailsComponent } from "./updatedetails.component"; +import { UserManagementAddComponent } from "./usermanagement-add.component"; +import { UserManagementEditComponent } from "./usermanagement-edit.component"; +import { UserManagementComponent } from "./usermanagement.component"; -import { IdentityService } from '../services/identity.service'; -import { PipeModule } from '../pipes/pipe.module'; +import { PipeModule } from "../pipes/pipe.module"; +import { IdentityService } from "../services"; -import { AuthGuard } from '../auth/auth.guard'; +import { AuthGuard } from "../auth/auth.guard"; const routes: Routes = [ - { path: 'usermanagement', component: UserManagementComponent, canActivate: [AuthGuard] }, - { path: 'usermanagement/add', component: UserManagementAddComponent, canActivate: [AuthGuard] }, - { path: 'usermanagement/edit/:id', component: UserManagementEditComponent, canActivate: [AuthGuard] }, - { path: 'usermanagement/updatedetails', component: UpdateDetailsComponent, canActivate: [AuthGuard] }, + { path: "usermanagement", component: UserManagementComponent, canActivate: [AuthGuard] }, + { path: "usermanagement/add", component: UserManagementAddComponent, canActivate: [AuthGuard] }, + { path: "usermanagement/edit/:id", component: UserManagementEditComponent, canActivate: [AuthGuard] }, + { path: "usermanagement/updatedetails", component: UpdateDetailsComponent, canActivate: [AuthGuard] }, ]; @NgModule({ @@ -42,11 +42,11 @@ const routes: Routes = [ UpdateDetailsComponent, ], exports: [ - RouterModule + RouterModule, ], providers: [ - IdentityService + IdentityService, ], }) -export class UserManagementModule { } \ No newline at end of file +export class UserManagementModule { } diff --git a/src/Ombi/ClientApp/app/wizard/createadmin/createadmin.component.ts b/src/Ombi/ClientApp/app/wizard/createadmin/createadmin.component.ts index 8fec23654..779d17f9c 100644 --- a/src/Ombi/ClientApp/app/wizard/createadmin/createadmin.component.ts +++ b/src/Ombi/ClientApp/app/wizard/createadmin/createadmin.component.ts @@ -1,25 +1,23 @@ -import { Component } from '@angular/core'; -import { Router } from '@angular/router'; +import { Component } from "@angular/core"; +import { Router } from "@angular/router"; -import { IdentityService } from '../../services/identity.service'; -import { SettingsService } from '../../services/settings.service'; -import { AuthService } from '../../auth/auth.service'; -import { NotificationService } from '../../services/notification.service'; +import { AuthService } from "../../auth/auth.service"; +import { IdentityService } from "../../services"; +import { NotificationService } from "../../services"; +import { SettingsService } from "../../services"; @Component({ - - templateUrl: './createadmin.component.html', + templateUrl: "./createadmin.component.html", }) export class CreateAdminComponent { - constructor(private identityService: IdentityService, private notificationService: NotificationService, - private router: Router, private auth: AuthService, private settings: SettingsService) { } - + public username: string; + public password: string; - username: string; - password: string; + constructor(private identityService: IdentityService, private notificationService: NotificationService, + private router: Router, private auth: AuthService, private settings: SettingsService) { } - createUser() { + public createUser() { this.identityService.createWizardUser(this.username, this.password).subscribe(x => { if (x) { // Log me in. @@ -32,8 +30,8 @@ export class CreateAdminComponent { ombi.wizard = true; this.settings.saveOmbi(ombi).subscribe(x => { - - this.router.navigate(['search']); + + this.router.navigate(["search"]); }); }); @@ -45,4 +43,4 @@ export class CreateAdminComponent { } }); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/wizard/emby/emby.component.ts b/src/Ombi/ClientApp/app/wizard/emby/emby.component.ts index 63db265df..3e74bfbca 100644 --- a/src/Ombi/ClientApp/app/wizard/emby/emby.component.ts +++ b/src/Ombi/ClientApp/app/wizard/emby/emby.component.ts @@ -1,28 +1,29 @@ -import { Component, OnInit } from '@angular/core'; -import { Router } from '@angular/router'; +import { Component, OnInit } from "@angular/core"; +import { Router } from "@angular/router"; -import { EmbyService } from '../../services/applications/emby.service'; -import { NotificationService } from '../../services/notification.service'; +import { EmbyService } from "../../services"; +import { NotificationService } from "../../services"; -import { IEmbySettings } from '../../interfaces/ISettings'; +import { IEmbySettings } from "../../interfaces"; @Component({ - - templateUrl: './emby.component.html', + templateUrl: "./emby.component.html", }) export class EmbyComponent implements OnInit { + private embySettings: IEmbySettings; + constructor(private embyService: EmbyService, - private router: Router, - private notificationService: NotificationService) { + private router: Router, + private notificationService: NotificationService) { } - ngOnInit(): void { + public ngOnInit() { this.embySettings = { servers: [], id:0, enable: true, - } + }; this.embySettings.servers.push({ ip: "", administratorId: "", @@ -34,19 +35,16 @@ export class EmbyComponent implements OnInit { ssl: false, subDir: "", - }) + }); } - private embySettings: IEmbySettings; - - - save() { + public save() { this.embyService.logIn(this.embySettings).subscribe(x => { if (x == null || !x.servers[0].apiKey) { this.notificationService.error("Could Not Authenticate", "Username or password was incorrect. Could not authenticate with Emby."); return; } - this.router.navigate(['Wizard/CreateAdmin']); + this.router.navigate(["Wizard/CreateAdmin"]); }); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/wizard/mediaserver/mediaserver.component.ts b/src/Ombi/ClientApp/app/wizard/mediaserver/mediaserver.component.ts index e6842c457..5e2c7ff94 100644 --- a/src/Ombi/ClientApp/app/wizard/mediaserver/mediaserver.component.ts +++ b/src/Ombi/ClientApp/app/wizard/mediaserver/mediaserver.component.ts @@ -1,24 +1,21 @@ -import { Component } from '@angular/core'; -import { Router } from '@angular/router'; - +import { Component } from "@angular/core"; +import { Router } from "@angular/router"; @Component({ - templateUrl: './mediaserver.component.html', + templateUrl: "./mediaserver.component.html", }) export class MediaServerComponent { - constructor(private router: Router) { - - } + constructor(private router: Router) { } - plex() { - this.router.navigate(['Wizard/Plex']); + public plex() { + this.router.navigate(["Wizard/Plex"]); } - emby() { - this.router.navigate(['Wizard/Emby']); + public emby() { + this.router.navigate(["Wizard/Emby"]); } - skip() { - this.router.navigate(['Wizard/CreateAdmin']); + public skip() { + this.router.navigate(["Wizard/CreateAdmin"]); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/wizard/plex/plex.component.ts b/src/Ombi/ClientApp/app/wizard/plex/plex.component.ts index 2f71a94b6..ba4740c22 100644 --- a/src/Ombi/ClientApp/app/wizard/plex/plex.component.ts +++ b/src/Ombi/ClientApp/app/wizard/plex/plex.component.ts @@ -1,25 +1,24 @@ -import { Component } from '@angular/core'; -import { Router } from '@angular/router'; +import { Component } from "@angular/core"; +import { Router } from "@angular/router"; -import { PlexService } from '../../services/applications/plex.service'; -import { NotificationService } from '../../services/notification.service'; +import { PlexService } from "../../services"; +import { NotificationService } from "../../services"; -import { IPlexAuthentication } from '../../interfaces/IPlex'; +import { IPlexAuthentication } from "../../interfaces"; @Component({ - - templateUrl: './plex.component.html', + templateUrl: "./plex.component.html", }) export class PlexComponent { - constructor(private plexService: PlexService, private router: Router, private notificationService: NotificationService) { } + public login: string; + public password: string; private authenticationResult: IPlexAuthentication; - login: string; - password: string; + constructor(private plexService: PlexService, private router: Router, private notificationService: NotificationService) { } - requestAuthToken() { + public requestAuthToken() { this.plexService.logIn(this.login, this.password).subscribe(x => { if (x.user == null) { this.notificationService.error("Could Not Authenticate", "Username or password was incorrect. Could not authenticate with Plex."); @@ -27,7 +26,7 @@ export class PlexComponent { } this.authenticationResult = x; - this.router.navigate(['Wizard/CreateAdmin']); + this.router.navigate(["Wizard/CreateAdmin"]); }); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/wizard/welcome/welcome.component.ts b/src/Ombi/ClientApp/app/wizard/welcome/welcome.component.ts index 888384325..c01c6886a 100644 --- a/src/Ombi/ClientApp/app/wizard/welcome/welcome.component.ts +++ b/src/Ombi/ClientApp/app/wizard/welcome/welcome.component.ts @@ -1,17 +1,13 @@ -import { Component } from '@angular/core'; -import { Router } from '@angular/router'; - +import { Component } from "@angular/core"; +import { Router } from "@angular/router"; @Component({ - - templateUrl: './welcome.component.html', + templateUrl: "./welcome.component.html", }) export class WelcomeComponent { - constructor(private router: Router) { - - } + constructor(private router: Router) { } - next() { - this.router.navigate(['Wizard/MediaServer']); + public next() { + this.router.navigate(["Wizard/MediaServer"]); } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/wizard/wizard.module.ts b/src/Ombi/ClientApp/app/wizard/wizard.module.ts index 4033c0401..ebda265aa 100644 --- a/src/Ombi/ClientApp/app/wizard/wizard.module.ts +++ b/src/Ombi/ClientApp/app/wizard/wizard.module.ts @@ -1,47 +1,47 @@ -import { NgModule, } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; -import { RouterModule, Routes } from '@angular/router'; +import { CommonModule } from "@angular/common"; +import { NgModule } from "@angular/core"; +import { FormsModule } from "@angular/forms"; +import { RouterModule, Routes } from "@angular/router"; -import { WelcomeComponent } from './welcome/welcome.component'; -import { MediaServerComponent } from './mediaserver/mediaserver.component'; -import { PlexComponent } from './plex/plex.component'; -import { CreateAdminComponent } from './createadmin/createadmin.component'; -import { EmbyComponent } from './emby/emby.component'; +import { CreateAdminComponent } from "./createadmin/createadmin.component"; +import { EmbyComponent } from "./emby/emby.component"; +import { MediaServerComponent } from "./mediaserver/mediaserver.component"; +import { PlexComponent } from "./plex/plex.component"; +import { WelcomeComponent } from "./welcome/welcome.component"; -import { PlexService } from '../services/applications/plex.service'; -import { EmbyService } from '../services/applications/emby.service'; -import { IdentityService } from '../services/identity.service'; +import { EmbyService } from "../services"; +import { PlexService } from "../services"; +import { IdentityService } from "../services"; const routes: Routes = [ - { path: 'Wizard', component: WelcomeComponent}, - { path: 'Wizard/MediaServer', component: MediaServerComponent}, - { path: 'Wizard/Plex', component: PlexComponent}, - { path: 'Wizard/Emby', component: EmbyComponent}, - { path: 'Wizard/CreateAdmin', component: CreateAdminComponent}, + { path: "Wizard", component: WelcomeComponent}, + { path: "Wizard/MediaServer", component: MediaServerComponent}, + { path: "Wizard/Plex", component: PlexComponent}, + { path: "Wizard/Emby", component: EmbyComponent}, + { path: "Wizard/CreateAdmin", component: CreateAdminComponent}, ]; @NgModule({ imports: [ CommonModule, FormsModule, - RouterModule.forChild(routes) + RouterModule.forChild(routes), ], declarations: [ WelcomeComponent, MediaServerComponent, PlexComponent, CreateAdminComponent, - EmbyComponent + EmbyComponent, ], exports: [ - RouterModule + RouterModule, ], providers: [ PlexService, IdentityService, - EmbyService + EmbyService, ], - + }) -export class WizardModule { } \ No newline at end of file +export class WizardModule { } diff --git a/src/Ombi/ClientApp/imports.ts b/src/Ombi/ClientApp/imports.ts index 10e6875e0..bfa7be280 100644 --- a/src/Ombi/ClientApp/imports.ts +++ b/src/Ombi/ClientApp/imports.ts @@ -1,2 +1,2 @@ -import 'rxjs/add/operator/map'; -import 'rxjs/add/operator/catch'; \ No newline at end of file +import "rxjs/add/operator/catch"; +import "rxjs/add/operator/map"; diff --git a/src/Ombi/ClientApp/main.ts b/src/Ombi/ClientApp/main.ts index b35ca6066..97abd1eff 100644 --- a/src/Ombi/ClientApp/main.ts +++ b/src/Ombi/ClientApp/main.ts @@ -1,20 +1,20 @@ +import "bootstrap/dist/js/bootstrap"; +import "pace-progress"; +import "./imports"; +import "./polyfills"; import "./styles/base.scss"; import "./styles/Themes/plex.scss"; -import './polyfills'; -import './imports'; -import 'bootstrap/dist/js/bootstrap'; -import 'pace-progress'; -import { enableProdMode } from '@angular/core'; -import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; -import { AppModule } from './app/app.module'; +import { enableProdMode } from "@angular/core"; +import { platformBrowserDynamic } from "@angular/platform-browser-dynamic"; +import { AppModule } from "./app/app.module"; -if (module['hot']) { - module['hot'].accept(); - module['hot'].dispose(() => { +if (module.hot) { + module.hot.accept(); + module.hot.dispose(() => { // Before restarting the app, we create a new root element and dispose the old one - const oldRootElem = document.querySelector('ombi'); - const newRootElem = document.createElement('ombi'); + const oldRootElem = document.querySelector("ombi"); + const newRootElem = document.createElement("ombi"); if (oldRootElem && oldRootElem.parentNode) { oldRootElem.parentNode.insertBefore(newRootElem, oldRootElem); oldRootElem.parentNode.removeChild(oldRootElem); @@ -25,4 +25,4 @@ if (module['hot']) { enableProdMode(); } -const modulePromise = platformBrowserDynamic().bootstrapModule(AppModule); \ No newline at end of file +const modulePromise = platformBrowserDynamic().bootstrapModule(AppModule); diff --git a/src/Ombi/ClientApp/polyfills.ts b/src/Ombi/ClientApp/polyfills.ts index e38e593b0..a8e8f7d9b 100644 --- a/src/Ombi/ClientApp/polyfills.ts +++ b/src/Ombi/ClientApp/polyfills.ts @@ -1,11 +1,12 @@ -import 'core-js/es6/string'; -import 'core-js/es6/array'; -import 'core-js/es6/object'; +import "core-js/es6/array"; +import "core-js/es6/object"; +import "core-js/es6/string"; -import 'core-js/es7/reflect'; -import 'zone.js/dist/zone'; +import "core-js/es7/reflect"; +import "zone.js/dist/zone"; -if (module['hot']) { - Error['stackTraceLimit'] = Infinity; - require('zone.js/dist/long-stack-trace-zone'); -} \ No newline at end of file +if (module.hot) { + Error.stackTraceLimit = Infinity; + // tslint:disable:no-var-requires + require("zone.js/dist/long-stack-trace-zone"); +} diff --git a/src/Ombi/Ombi.csproj b/src/Ombi/Ombi.csproj index f606c96dc..75cd657ee 100644 --- a/src/Ombi/Ombi.csproj +++ b/src/Ombi/Ombi.csproj @@ -32,10 +32,10 @@ - + - + diff --git a/src/Ombi/package-lock.json b/src/Ombi/package-lock.json index 58ac2ee07..3f1ffa300 100644 --- a/src/Ombi/package-lock.json +++ b/src/Ombi/package-lock.json @@ -1729,6 +1729,11 @@ "integrity": "sha1-gGZJMmzqp8qjMG112YXqJ0i6kTw=", "dev": true }, + "diff": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", + "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==" + }, "diffie-hellman": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.2.tgz", @@ -10287,6 +10292,43 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.7.1.tgz", "integrity": "sha1-vIAEFkaRkjp5/oN4u+s9ogF1OOw=" }, + "tslint": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.7.0.tgz", + "integrity": "sha1-wl4NDJL6EgHCvDDoROCOaCtPNVI=", + "requires": { + "babel-code-frame": "6.26.0", + "colors": "1.1.2", + "commander": "2.11.0", + "diff": "3.3.1", + "glob": "7.1.2", + "minimatch": "3.0.4", + "resolve": "1.4.0", + "semver": "5.4.1", + "tslib": "1.7.1", + "tsutils": "2.8.2" + }, + "dependencies": { + "semver": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", + "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==" + } + } + }, + "tslint-language-service": { + "version": "0.9.6", + "resolved": "https://registry.npmjs.org/tslint-language-service/-/tslint-language-service-0.9.6.tgz", + "integrity": "sha1-iCuwcEz4OXszLdwK9xaMfyLyeeo=" + }, + "tsutils": { + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.8.2.tgz", + "integrity": "sha1-LBSGukMSYIRbCsb5Aq/Z1wio6mo=", + "requires": { + "tslib": "1.7.1" + } + }, "tty-browserify": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", diff --git a/src/Ombi/package.json b/src/Ombi/package.json index 9379525cf..f0a3defa8 100644 --- a/src/Ombi/package.json +++ b/src/Ombi/package.json @@ -4,7 +4,8 @@ "version": "1.0.0", "scripts": { "vendor": "gulp vendor", - "publish": "gulp publish" + "publish": "gulp publish", + "lint": "tslint ClientApp/**/*.ts" }, "dependencies": { "@angular/animations": "4.4.1", @@ -58,7 +59,9 @@ "sass-loader": "^6.0.6", "style-loader": "^0.18.2", "to-string-loader": "1.1.5", - "typescript": "2.5.2", + "tslint": "^5.7.0", + "tslint-language-service": "^0.9.6", + "typescript": "^2.5.2", "uglify-es": "^3.1.0", "uglifyjs-webpack-plugin": "^1.0.0-beta.2", "url-loader": "0.5.9", diff --git a/src/Ombi/tsconfig.json b/src/Ombi/tsconfig.json index ec6c52b77..4dd1e2751 100644 --- a/src/Ombi/tsconfig.json +++ b/src/Ombi/tsconfig.json @@ -1,7 +1,10 @@ { "compilerOptions": { "target": "es5", - "lib": [ "es6", "dom" ], + "lib": [ + "es6", + "dom" + ], "moduleResolution": "node", "sourceMap": true, "strictNullChecks": true, @@ -13,7 +16,18 @@ "alwaysStrict": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, - "skipLibCheck": true + "skipLibCheck": true, + "plugins": [ + { + "name": "tslint-language-service", + "alwaysShowRuleFailuresAsWarnings": false, + "ignoreDefinitionFiles": true, + "disableNoUnusedVariableRule": true + } + ] }, - "exclude": [ "bin", "node_modules" ] + "exclude": [ + "bin", + "node_modules" + ] } \ No newline at end of file diff --git a/src/Ombi/tslint.json b/src/Ombi/tslint.json new file mode 100644 index 000000000..746e08bcd --- /dev/null +++ b/src/Ombi/tslint.json @@ -0,0 +1,34 @@ +{ + "$schema": "http://json.schemastore.org/tslint", + "extends": "tslint:recommended", + "rules": { + "object-literal-sort-keys": false, + "no-console": [ + false + ], + "max-line-length": [ + true, + 200 + ], + "arrow-parens": false, + "radix": false, + "no-angle-bracket-type-assertion": false, + "indent": [ + false + ], + "whitespace": [ + false + ], + "no-unused-expression": [ + true, + "allow-new" + ], + "max-classes-per-file": [ + false + ], + "no-shadowed-variable": false, + "comment-format": [ + false + ] + } +} \ No newline at end of file