mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-30 03:28:28 -07:00
Add linting and indexes for interfaces/services (#1510)
* Add linting and indexes for interfaces/services * Fix linting * Set correct directory for linting in cake
This commit is contained in:
parent
9b33ee7ca9
commit
6ce4f0200d
102 changed files with 1908 additions and 1982 deletions
16
build.cake
16
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);
|
||||
|
|
46
src/.vscode/launch.json
vendored
46
src/.vscode/launch.json
vendored
|
@ -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}"
|
||||
}
|
||||
]
|
||||
}
|
11
src/.vscode/settings.json
vendored
11
src/.vscode/settings.json
vendored
|
@ -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
|
||||
}
|
||||
}
|
16
src/.vscode/tasks.json
vendored
16
src/.vscode/tasks.json
vendored
|
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
47
src/Ombi/.vscode/launch.json
vendored
47
src/Ombi/.vscode/launch.json
vendored
|
@ -1,39 +1,46 @@
|
|||
{
|
||||
// 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}"
|
||||
}
|
||||
]
|
||||
}
|
10
src/Ombi/.vscode/settings.json
vendored
10
src/Ombi/.vscode/settings.json
vendored
|
@ -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
|
||||
}
|
||||
}
|
66
src/Ombi/.vscode/tasks.json
vendored
66
src/Ombi/.vscode/tasks.json
vendored
|
@ -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",
|
||||
"suppressTaskName": true,
|
||||
"args": ["-ExecutionPolicy", "RemoteSigned", ".\\dockerTask.ps1", "-Build", "-Environment", "debug" ],
|
||||
"args": [
|
||||
"${workspaceRoot}/Ombi.csproj"
|
||||
],
|
||||
"isBuildCommand": true,
|
||||
"showOutput": "always",
|
||||
"echoCommand": true
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"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
|
||||
"taskName": "lint",
|
||||
"command": "npm",
|
||||
"isShellCommand": true,
|
||||
"args": ["run", "lint"]
|
||||
}
|
||||
]
|
||||
},
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -1,26 +1,26 @@
|
|||
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 {
|
||||
|
||||
public customizationSettings: ICustomizationSettings;
|
||||
public user: ILocalUser;
|
||||
public showNav: boolean;
|
||||
|
||||
constructor(public notificationService: NotificationService, public authService: AuthService, private router: Router, private settingsService: SettingsService) { }
|
||||
|
||||
customizationSettings: ICustomizationSettings;
|
||||
user: ILocalUser;
|
||||
|
||||
ngOnInit(): void {
|
||||
public ngOnInit() {
|
||||
this.user = this.authService.claims();
|
||||
|
||||
this.settingsService.getCustomization().subscribe(x => this.customizationSettings = x);
|
||||
|
@ -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;
|
||||
}
|
|
@ -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';
|
||||
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 { 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 { 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 { }
|
||||
|
|
|
@ -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
|
||||
roles: string[];
|
||||
name: string;
|
||||
}
|
|
@ -1,19 +1,19 @@
|
|||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {}
|
|
@ -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<any> {
|
||||
public login(login: IUserLogin): Observable<any> {
|
||||
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 <ILocalUser>{};
|
||||
}
|
||||
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Component } from '@angular/core';
|
||||
import { Component } from "@angular/core";
|
||||
|
||||
@Component({
|
||||
template: '<h2>Page not found</h2>'
|
||||
template: "<h2>Page not found</h2>",
|
||||
})
|
||||
export class PageNotFoundComponent { }
|
18
src/Ombi/ClientApp/app/interfaces/ICommon.ts
Normal file
18
src/Ombi/ClientApp/app/interfaces/ICommon.ts
Normal file
|
@ -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;
|
||||
}
|
|
@ -1,3 +1,3 @@
|
|||
export interface IImages {
|
||||
url: string
|
||||
url: string;
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
export interface IMediaServerStatus {
|
||||
serversAvailable: number,
|
||||
serversUnavailable: number,
|
||||
partiallyDown: boolean,
|
||||
completelyDown: boolean,
|
||||
fullyAvailable: boolean,
|
||||
totalServers:number
|
||||
serversAvailable: number;
|
||||
serversUnavailable: number;
|
||||
partiallyDown: boolean;
|
||||
completelyDown: boolean;
|
||||
fullyAvailable: boolean;
|
||||
totalServers: number;
|
||||
}
|
|
@ -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[],
|
||||
}
|
79
src/Ombi/ClientApp/app/interfaces/INotificationSettings.ts
Normal file
79
src/Ombi/ClientApp/app/interfaces/INotificationSettings.ts
Normal file
|
@ -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[];
|
||||
}
|
|
@ -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,
|
||||
accessToken: string;
|
||||
address: string;
|
||||
createdAt: string;
|
||||
home: string;
|
||||
host: string;
|
||||
localAddresses: string;
|
||||
machineIdentifier: string;
|
||||
name: string;
|
||||
owned: string;
|
||||
ownerId: string;
|
||||
port: string;
|
||||
scheme: string;
|
||||
}
|
|
@ -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,
|
||||
}
|
||||
|
||||
export interface IItem {
|
||||
allowed: boolean,
|
||||
quality:IQuality,
|
||||
}
|
||||
|
||||
export interface IQuality {
|
||||
id: number,
|
||||
name:string,
|
||||
value: string;
|
||||
name: string;
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
export interface IRequestEngineResult {
|
||||
requestAdded: boolean,
|
||||
message: string,
|
||||
errorMessage: string,
|
||||
requestAdded: boolean;
|
||||
message: string;
|
||||
errorMessage: string;
|
||||
}
|
|
@ -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
|
||||
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 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<T> {
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
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;
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
port: number;
|
||||
//baseUrl:string,
|
||||
collectAnalyticData: boolean,
|
||||
wizard: boolean,
|
||||
apiKey: string,
|
||||
externalUrl: string,
|
||||
allowExternalUsersToAuthenticate:boolean,
|
||||
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,
|
||||
enabled: boolean;
|
||||
|
||||
noticeEnabled: boolean,
|
||||
noticeText: string,
|
||||
noticeEnabled: boolean;
|
||||
noticeText: string;
|
||||
|
||||
timeLimit: boolean,
|
||||
startDateTime: Date,
|
||||
endDateTime: Date,
|
||||
expired:boolean,
|
||||
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,
|
||||
requiredDigit: boolean;
|
||||
requiredLength: number;
|
||||
requiredLowercase: boolean;
|
||||
requireNonAlphanumeric: boolean;
|
||||
requireUppercase: boolean;
|
||||
}
|
|
@ -1,27 +1,14 @@
|
|||
export interface ISonarrRootFolder {
|
||||
id: number,
|
||||
path: string,
|
||||
freespace:number,
|
||||
import { ICutoff, IItem } from "./ICommon";
|
||||
|
||||
export interface ISonarrRootFolder {
|
||||
id: number;
|
||||
path: string;
|
||||
freespace: number;
|
||||
}
|
||||
|
||||
export interface ISonarrProfile {
|
||||
name: string,
|
||||
id: number,
|
||||
cutoff: ICutoff,
|
||||
items:IItem[],
|
||||
}
|
||||
|
||||
export interface ICutoff {
|
||||
id: number,
|
||||
name:string,
|
||||
}
|
||||
|
||||
export interface IItem {
|
||||
allowed: boolean,
|
||||
quality:IQuality,
|
||||
}
|
||||
|
||||
export interface IQuality {
|
||||
id: number,
|
||||
name:string,
|
||||
name: string;
|
||||
id: number;
|
||||
cutoff: ICutoff;
|
||||
items: IItem[];
|
||||
}
|
|
@ -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
|
||||
export interface IResetPasswordToken {
|
||||
email: string;
|
||||
token: string;
|
||||
password: string;
|
||||
}
|
13
src/Ombi/ClientApp/app/interfaces/index.ts
Normal file
13
src/Ombi/ClientApp/app/interfaces/index.ts
Normal file
|
@ -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";
|
|
@ -1,33 +1,31 @@
|
|||
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 {
|
||||
|
||||
public customizationSettings: ICustomizationSettings;
|
||||
public landingPageSettings: ILandingPageSettings;
|
||||
public background: any;
|
||||
public mediaServerStatus: IMediaServerStatus;
|
||||
|
||||
constructor(private settingsService: SettingsService,
|
||||
private images: ImageService, private sanitizer: DomSanitizer, private landingPageService: LandingPageService) { }
|
||||
|
||||
customizationSettings : ICustomizationSettings;
|
||||
landingPageSettings: ILandingPageSettings;
|
||||
background: any;
|
||||
|
||||
mediaServerStatus: IMediaServerStatus;
|
||||
|
||||
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 + ")");
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -1,23 +1,26 @@
|
|||
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,
|
||||
|
@ -25,56 +28,49 @@ export class LoginComponent implements OnInit {
|
|||
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"));
|
||||
}
|
||||
}
|
|
@ -1,17 +1,19 @@
|
|||
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) {
|
||||
|
@ -20,18 +22,14 @@ export class ResetPasswordComponent implements OnInit {
|
|||
});
|
||||
}
|
||||
|
||||
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) => {
|
||||
|
|
|
@ -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) {
|
||||
|
||||
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);
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -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,7 +8,7 @@ import { HumanizePipe } from './HumanizePipe';
|
|||
})
|
||||
export class PipeModule {
|
||||
|
||||
static forRoot() : ModuleWithProviders {
|
||||
public static forRoot(): ModuleWithProviders {
|
||||
return {
|
||||
ngModule: PipeModule,
|
||||
providers: [],
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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,7 +22,6 @@
|
|||
// });
|
||||
// }
|
||||
|
||||
|
||||
// movieRequests: IRequestGrid<IMovieRequests>;
|
||||
// tvRequests: IRequestGrid<ITvRequests>;
|
||||
|
||||
|
|
|
@ -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<string> = new Subject<string>();
|
||||
public searchText: string;
|
||||
|
||||
public isAdmin: boolean;
|
||||
|
||||
private currentlyLoaded: number;
|
||||
private amountToLoad: number;
|
||||
|
||||
private subscriptions = new Subject<void>();
|
||||
|
||||
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<string> = new Subject<string>();
|
||||
searchText: string;
|
||||
|
||||
isAdmin: boolean;
|
||||
|
||||
private currentlyLoaded: number;
|
||||
private amountToLoad: number;
|
||||
|
||||
|
||||
private subscriptions = new Subject<void>();
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
|
@ -1,14 +1,14 @@
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -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,11 +44,11 @@ const routes: Routes = [
|
|||
TvRequestChildrenComponent,
|
||||
],
|
||||
exports: [
|
||||
RouterModule
|
||||
RouterModule,
|
||||
],
|
||||
providers: [
|
||||
IdentityService,
|
||||
RequestService
|
||||
RequestService,
|
||||
],
|
||||
|
||||
})
|
||||
|
|
|
@ -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,7 +58,7 @@ 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);
|
||||
}
|
||||
|
|
|
@ -1,30 +1,42 @@
|
|||
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<string>();
|
||||
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<void>();
|
||||
|
||||
constructor(private requestService: RequestService,
|
||||
private auth: AuthService) {
|
||||
this.searchChanged
|
||||
|
@ -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 <TreeNode[]>temp;
|
||||
}
|
||||
private subscriptions = new Subject<void>();
|
||||
|
||||
tvRequests: TreeNode[];
|
||||
|
||||
searchChanged = new Subject<string>();
|
||||
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();
|
||||
}
|
||||
}
|
|
@ -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<string> = new Subject<string>();
|
||||
public movieResults: ISearchMovieResult[];
|
||||
public result: IRequestEngineResult;
|
||||
public searchApplied = false;
|
||||
private subscriptions = new Subject<void>();
|
||||
searchChanged: Subject<string> = new Subject<string>();
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -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 { }
|
|
@ -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) {
|
||||
}
|
||||
public result: IRequestEngineResult;
|
||||
public series: ISearchTvResult;
|
||||
public requestedEpisodes: IEpisodesRequests[] = [];
|
||||
|
||||
@Input() private seriesId: number;
|
||||
private subscriptions = new Subject<void>();
|
||||
|
||||
public result : IRequestEngineResult;
|
||||
@Input() private seriesId: number;
|
||||
public series: ISearchTvResult;
|
||||
constructor(private searchService: SearchService, private requestService: RequestService, private notificationService: NotificationService) { }
|
||||
|
||||
requestedEpisodes: IEpisodesRequests[] = [];
|
||||
|
||||
|
||||
ngOnInit(): void {
|
||||
public ngOnInit() {
|
||||
this.searchService.getShowInformation(this.seriesId)
|
||||
.takeUntil(this.subscriptions)
|
||||
.subscribe(x => {
|
||||
|
@ -63,8 +60,7 @@ export class SeriesInformationComponent implements OnInit, OnDestroy {
|
|||
episode.requested = false;
|
||||
}
|
||||
|
||||
|
||||
ngOnDestroy(): void {
|
||||
public ngOnDestroy() {
|
||||
this.subscriptions.next();
|
||||
this.subscriptions.complete();
|
||||
}
|
||||
|
|
|
@ -1,29 +1,30 @@
|
|||
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<string>();
|
||||
public tvResults: TreeNode[];
|
||||
public result: IRequestEngineResult;
|
||||
public searchApplied = false;
|
||||
|
||||
private subscriptions = new Subject<void>();
|
||||
searchText: string;
|
||||
searchChanged = new Subject<string>();
|
||||
tvResults: TreeNode[];
|
||||
result: IRequestEngineResult;
|
||||
searchApplied = false;
|
||||
|
||||
constructor(private searchService: SearchService, private requestService: RequestService,
|
||||
private notificationService: NotificationService, private route: Router, private authService: AuthService) {
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,19 +1,18 @@
|
|||
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<IEmbySettings> {
|
||||
public logIn(settings: IEmbySettings): Observable<IEmbySettings> {
|
||||
return this.http.post(`${this.url}`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
|
||||
|
|
5
src/Ombi/ClientApp/app/services/applications/index.ts
Normal file
5
src/Ombi/ClientApp/app/services/applications/index.ts
Normal file
|
@ -0,0 +1,5 @@
|
|||
export * from "./emby.service";
|
||||
export * from "./plex.service";
|
||||
export * from "./radarr.service";
|
||||
export * from "./sonarr.service";
|
||||
export * from "./tester.service";
|
|
@ -1,30 +1,29 @@
|
|||
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<IPlexAuthentication> {
|
||||
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<IPlexAuthentication> {
|
||||
return this.regularHttp.post(`${this.url}`, JSON.stringify({ login, password }), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
|
||||
getServers(login: string, password: string): Observable<IPlexServerViewModel> {
|
||||
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<IPlexServerViewModel> {
|
||||
return this.http.post(`${this.url}servers`, JSON.stringify({ login, password }), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
|
||||
getLibraries(plexSettings: IPlexServer): Observable<IPlexLibraries> {
|
||||
public getLibraries(plexSettings: IPlexServer): Observable<IPlexLibraries> {
|
||||
return this.http.post(`${this.url}Libraries`, JSON.stringify(plexSettings), { headers: this.headers }).map(this.extractData).catch(this.handleError);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<IRadarrRootFolder[]> {
|
||||
public getRootFolders(settings: IRadarrSettings): Observable<IRadarrRootFolder[]> {
|
||||
return this.http.post(`${this.url}/RootFolders/`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
getQualityProfiles(settings: IRadarrSettings): Observable<IRadarrProfile[]> {
|
||||
public getQualityProfiles(settings: IRadarrSettings): Observable<IRadarrProfile[]> {
|
||||
return this.http.post(`${this.url}/Profiles/`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
}
|
|
@ -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<ISonarrRootFolder[]> {
|
||||
public getRootFolders(settings: ISonarrSettings): Observable<ISonarrRootFolder[]> {
|
||||
return this.http.post(`${this.url}/RootFolders/`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
getQualityProfiles(settings: ISonarrSettings): Observable<ISonarrProfile[]> {
|
||||
public getQualityProfiles(settings: ISonarrSettings): Observable<ISonarrProfile[]> {
|
||||
return this.http.post(`${this.url}/Profiles/`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
}
|
|
@ -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<boolean> {
|
||||
public discordTest(settings: IDiscordNotifcationSettings): Observable<boolean> {
|
||||
return this.http.post(`${this.url}discord`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
|
||||
pushbulletTest(settings: IPushbulletNotificationSettings): Observable<boolean> {
|
||||
public pushbulletTest(settings: IPushbulletNotificationSettings): Observable<boolean> {
|
||||
return this.http.post(`${this.url}pushbullet`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
pushoverTest(settings: IPushoverNotificationSettings): Observable<boolean> {
|
||||
public pushoverTest(settings: IPushoverNotificationSettings): Observable<boolean> {
|
||||
return this.http.post(`${this.url}pushover`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
|
||||
mattermostTest(settings: IMattermostNotifcationSettings): Observable<boolean> {
|
||||
public mattermostTest(settings: IMattermostNotifcationSettings): Observable<boolean> {
|
||||
return this.http.post(`${this.url}mattermost`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
|
||||
slackTest(settings: ISlackNotificationSettings): Observable<boolean> {
|
||||
public slackTest(settings: ISlackNotificationSettings): Observable<boolean> {
|
||||
return this.http.post(`${this.url}slack`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
|
||||
emailTest(settings: IEmailNotificationSettings): Observable<boolean> {
|
||||
public emailTest(settings: IEmailNotificationSettings): Observable<boolean> {
|
||||
return this.http.post(`${this.url}email`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
plexTest(settings: IPlexServer): Observable<boolean> {
|
||||
public plexTest(settings: IPlexServer): Observable<boolean> {
|
||||
return this.http.post(`${this.url}plex`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
embyTest(settings: IEmbyServer): Observable<boolean> {
|
||||
public embyTest(settings: IEmbyServer): Observable<boolean> {
|
||||
return this.http.post(`${this.url}emby`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
radarrTest(settings: IRadarrSettings): Observable<boolean> {
|
||||
public radarrTest(settings: IRadarrSettings): Observable<boolean> {
|
||||
return this.http.post(`${this.url}radarr`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
sonarrTest(settings: ISonarrSettings): Observable<boolean> {
|
||||
public sonarrTest(settings: ISonarrSettings): Observable<boolean> {
|
||||
return this.http.post(`${this.url}sonarr`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
}
|
1
src/Ombi/ClientApp/app/services/helpers/index.ts
Normal file
1
src/Ombi/ClientApp/app/services/helpers/index.ts
Normal file
|
@ -0,0 +1 @@
|
|||
export * from "./validation.service";
|
|
@ -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);
|
||||
|
|
|
@ -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<boolean> {
|
||||
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<boolean> {
|
||||
return this.regularHttp.post(`${this.url}Wizard/`, JSON.stringify({ username, password }), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
|
||||
getUser(): Observable<IUser> {
|
||||
public getUser(): Observable<IUser> {
|
||||
return this.http.get(this.url).map(this.extractData);
|
||||
}
|
||||
|
||||
getUserById(id: string): Observable<IUser> {
|
||||
public getUserById(id: string): Observable<IUser> {
|
||||
return this.http.get(`${this.url}User/${id}`).map(this.extractData);
|
||||
}
|
||||
|
||||
getUsers(): Observable<IUser[]> {
|
||||
public getUsers(): Observable<IUser[]> {
|
||||
return this.http.get(`${this.url}Users`).map(this.extractData);
|
||||
}
|
||||
|
||||
getAllAvailableClaims(): Observable<ICheckbox[]> {
|
||||
public getAllAvailableClaims(): Observable<ICheckbox[]> {
|
||||
return this.http.get(`${this.url}Claims`).map(this.extractData);
|
||||
}
|
||||
|
||||
createUser(user: IUser): Observable<IIdentityResult> {
|
||||
public createUser(user: IUser): Observable<IIdentityResult> {
|
||||
return this.http.post(this.url, JSON.stringify(user), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
|
||||
updateUser(user: IUser): Observable<IIdentityResult> {
|
||||
public updateUser(user: IUser): Observable<IIdentityResult> {
|
||||
return this.http.put(this.url, JSON.stringify(user), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
updateLocalUser(user: IUpdateLocalUser): Observable<IIdentityResult> {
|
||||
return this.http.put(this.url + 'local', JSON.stringify(user), { headers: this.headers }).map(this.extractData);
|
||||
public updateLocalUser(user: IUpdateLocalUser): Observable<IIdentityResult> {
|
||||
return this.http.put(this.url + "local", JSON.stringify(user), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
|
||||
deleteUser(user: IUser): Observable<IIdentityResult> {
|
||||
public deleteUser(user: IUser): Observable<IIdentityResult> {
|
||||
return this.http.delete(`${this.url}/${user.id}`, { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
|
||||
submitResetPassword(email:string): Observable<IIdentityResult>{
|
||||
return this.regularHttp.post(this.url + 'reset', JSON.stringify({email:email}), { headers: this.headers }).map(this.extractData);
|
||||
public submitResetPassword(email: string): Observable<IIdentityResult> {
|
||||
return this.regularHttp.post(this.url + "reset", JSON.stringify({email}), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
|
||||
resetPassword(token: IResetPasswordToken):Observable<IIdentityResult>{
|
||||
return this.regularHttp.post(this.url + 'resetpassword', JSON.stringify(token), { headers: this.headers }).map(this.extractData);
|
||||
public resetPassword(token: IResetPasswordToken): Observable<IIdentityResult> {
|
||||
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;
|
||||
|
|
|
@ -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/');
|
||||
constructor(public http: Http) {
|
||||
super(http, "/api/v1/Images/");
|
||||
}
|
||||
|
||||
getRandomBackground(): Observable<IImages> {
|
||||
public getRandomBackground(): Observable<IImages> {
|
||||
return this.http.get(`${this.url}background/`, { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
}
|
11
src/Ombi/ClientApp/app/services/index.ts
Normal file
11
src/Ombi/ClientApp/app/services/index.ts
Normal file
|
@ -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";
|
|
@ -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/');
|
||||
constructor(public http: Http) {
|
||||
super(http, "/api/v1/LandingPage/");
|
||||
}
|
||||
|
||||
getServerStatus(): Observable<IMediaServerStatus> {
|
||||
public getServerStatus(): Observable<IMediaServerStatus> {
|
||||
return this.http.get(`${this.url}`, { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
}
|
|
@ -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,19 +11,19 @@ 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() {
|
||||
|
|
|
@ -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<IRequestEngineResult> {
|
||||
public requestMovie(movie: ISearchMovieResult): Observable<IRequestEngineResult> {
|
||||
return this.http.post(`${this.url}Movie/`, JSON.stringify(movie), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
|
||||
requestTv(tv: ISearchTvResult): Observable<IRequestEngineResult> {
|
||||
public requestTv(tv: ISearchTvResult): Observable<IRequestEngineResult> {
|
||||
return this.http.post(`${this.url}TV/`, JSON.stringify(tv), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
|
||||
getMovieRequests(count: number, position: number): Observable<IMovieRequests[]> {
|
||||
public getMovieRequests(count: number, position: number): Observable<IMovieRequests[]> {
|
||||
return this.http.get(`${this.url}movie/${count}/${position}`).map(this.extractData);
|
||||
}
|
||||
|
||||
searchMovieRequests(search: string): Observable<IMovieRequests[]> {
|
||||
public searchMovieRequests(search: string): Observable<IMovieRequests[]> {
|
||||
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<IMovieRequests> {
|
||||
public updateMovieRequest(request: IMovieRequests): Observable<IMovieRequests> {
|
||||
return this.http.put(`${this.url}movie/`, JSON.stringify(request), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
|
||||
getTvRequests(count: number, position: number): Observable<ITvRequests[]> {
|
||||
public getTvRequests(count: number, position: number): Observable<ITvRequests[]> {
|
||||
return this.http.get(`${this.url}tv/${count}/${position}`).map(this.extractData)
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getChildRequests(requestId: number): Observable<IChildRequests[]> {
|
||||
public getChildRequests(requestId: number): Observable<IChildRequests[]> {
|
||||
return this.http.get(`${this.url}tv/${requestId}/child`).map(this.extractData)
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
searchTvRequests(search: string): Observable<ITvRequests[]> {
|
||||
public searchTvRequests(search: string): Observable<ITvRequests[]> {
|
||||
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<ITvRequests> {
|
||||
public updateTvRequest(request: ITvRequests): Observable<ITvRequests> {
|
||||
return this.http.put(`${this.url}tv/`, JSON.stringify(request), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
updateChild(child: IChildRequests): Observable<IChildRequests> {
|
||||
public updateChild(child: IChildRequests): Observable<IChildRequests> {
|
||||
return this.http.put(`${this.url}tv/child`, JSON.stringify(child), { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
deleteChild(child: IChildRequests): Observable<IChildRequests> {
|
||||
public deleteChild(child: IChildRequests): Observable<IChildRequests> {
|
||||
return this.http.delete(`${this.url}tv/child/${child.id}`, { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
|
||||
getRequestsCount(): Observable<IRequestCountModel> {
|
||||
public getRequestsCount(): Observable<IRequestCountModel> {
|
||||
return this.basicHttp.get(`${this.url}count`).map(this.extractData);
|
||||
}
|
||||
|
||||
getMovieGrid(): Observable<IRequestGrid<IMovieRequests>> {
|
||||
public getMovieGrid(): Observable<IRequestGrid<IMovieRequests>> {
|
||||
return this.http.get(`${this.url}movie/grid`).map(this.extractData);
|
||||
}
|
||||
|
||||
getTvGrid(): Observable<IRequestGrid<ITvRequests>> {
|
||||
public getTvGrid(): Observable<IRequestGrid<ITvRequests>> {
|
||||
return this.http.get(`${this.url}tv/grid`).map(this.extractData);
|
||||
}
|
||||
}
|
|
@ -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<ISearchMovieResult[]> {
|
||||
public searchMovie(searchTerm: string): Observable<ISearchMovieResult[]> {
|
||||
return this.http.get(`${this.url}/Movie/` + searchTerm).map(this.extractData);
|
||||
}
|
||||
|
||||
popularMovies(): Observable<ISearchMovieResult[]> {
|
||||
public popularMovies(): Observable<ISearchMovieResult[]> {
|
||||
return this.http.get(`${this.url}/Movie/Popular`).map(this.extractData);
|
||||
}
|
||||
upcomignMovies(): Observable<ISearchMovieResult[]> {
|
||||
public upcomignMovies(): Observable<ISearchMovieResult[]> {
|
||||
return this.http.get(`${this.url}/Movie/upcoming`).map(this.extractData);
|
||||
}
|
||||
nowPlayingMovies(): Observable<ISearchMovieResult[]> {
|
||||
public nowPlayingMovies(): Observable<ISearchMovieResult[]> {
|
||||
return this.http.get(`${this.url}/Movie/nowplaying`).map(this.extractData);
|
||||
}
|
||||
topRatedMovies(): Observable<ISearchMovieResult[]> {
|
||||
public topRatedMovies(): Observable<ISearchMovieResult[]> {
|
||||
return this.http.get(`${this.url}/Movie/toprated`).map(this.extractData);
|
||||
}
|
||||
getMovieInformation(theMovieDbId: number): Observable<ISearchMovieResult> {
|
||||
public getMovieInformation(theMovieDbId: number): Observable<ISearchMovieResult> {
|
||||
return this.http.get(`${this.url}/Movie/info/${theMovieDbId}`).map(this.extractData);
|
||||
}
|
||||
|
||||
// TV
|
||||
searchTv(searchTerm: string): Observable<ISearchTvResult[]> {
|
||||
public searchTv(searchTerm: string): Observable<ISearchTvResult[]> {
|
||||
return this.http.get(`${this.url}/Tv/` + searchTerm).map(this.extractData);
|
||||
}
|
||||
searchTvTreeNode(searchTerm: string): Observable<TreeNode[]> {
|
||||
|
||||
public searchTvTreeNode(searchTerm: string): Observable<TreeNode[]> {
|
||||
return this.http.get(`${this.url}/Tv/${searchTerm}/tree`).map(this.extractData);
|
||||
}
|
||||
|
||||
getShowInformationTreeNode(theTvDbId: number): Observable<TreeNode> {
|
||||
public getShowInformationTreeNode(theTvDbId: number): Observable<TreeNode> {
|
||||
return this.http.get(`${this.url}/Tv/info/${theTvDbId}/Tree`).map(this.extractData);
|
||||
}
|
||||
|
||||
getShowInformation(theTvDbId: number): Observable<ISearchTvResult> {
|
||||
public getShowInformation(theTvDbId: number): Observable<ISearchTvResult> {
|
||||
return this.http.get(`${this.url}/Tv/info/${theTvDbId}`).map(this.extractData);
|
||||
}
|
||||
|
||||
popularTv(): Observable<TreeNode[]> {
|
||||
public popularTv(): Observable<TreeNode[]> {
|
||||
return this.http.get(`${this.url}/Tv/popular`).map(this.extractData);
|
||||
}
|
||||
mostWatchedTv(): Observable<TreeNode[]> {
|
||||
public mostWatchedTv(): Observable<TreeNode[]> {
|
||||
return this.http.get(`${this.url}/Tv/mostwatched`).map(this.extractData);
|
||||
}
|
||||
anticipatedTv(): Observable<TreeNode[]> {
|
||||
public anticipatedTv(): Observable<TreeNode[]> {
|
||||
return this.http.get(`${this.url}/Tv/anticipated`).map(this.extractData);
|
||||
}
|
||||
trendingTv(): Observable<TreeNode[]> {
|
||||
public trendingTv(): Observable<TreeNode[]> {
|
||||
return this.http.get(`${this.url}/Tv/trending`).map(this.extractData);
|
||||
}
|
||||
}
|
|
@ -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 {
|
||||
|
||||
constructor(protected http: Http, protected url: string) {
|
||||
this.headers = new Headers();
|
||||
this.headers.append('Content-Type', 'application/json; charset=utf-8');
|
||||
}
|
||||
|
||||
protected headers: Headers;
|
||||
|
||||
constructor(protected http: Http, protected url: string) {
|
||||
this.headers = new Headers();
|
||||
this.headers.append("Content-Type", "application/json; charset=utf-8");
|
||||
}
|
||||
|
||||
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 {
|
||||
|
||||
constructor(protected http: AuthHttp, protected url: string) {
|
||||
this.headers = new Headers();
|
||||
this.headers.append('Content-Type', 'application/json; charset=utf-8');
|
||||
}
|
||||
|
||||
protected headers: Headers;
|
||||
|
||||
constructor(protected http: AuthHttp, protected url: string) {
|
||||
this.headers = new Headers();
|
||||
this.headers.append("Content-Type", "application/json; charset=utf-8");
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,169 +1,167 @@
|
|||
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<IOmbiSettings> {
|
||||
return this.httpAuth.get(`${this.url}/Ombi/`).map(this.extractData).catch(this.handleError)
|
||||
public getOmbi(): Observable<IOmbiSettings> {
|
||||
return this.httpAuth.get(`${this.url}/Ombi/`).map(this.extractData).catch(this.handleError);
|
||||
}
|
||||
|
||||
saveOmbi(settings: IOmbiSettings): Observable<boolean> {
|
||||
public saveOmbi(settings: IOmbiSettings): Observable<boolean> {
|
||||
return this.httpAuth.post(`${this.url}/Ombi/`, JSON.stringify(settings), { headers: this.headers })
|
||||
.map(this.extractData).catch(this.handleError);
|
||||
}
|
||||
|
||||
resetOmbiApi(): Observable<string> {
|
||||
public resetOmbiApi(): Observable<string> {
|
||||
return this.httpAuth.post(`${this.url}/Ombi/resetApi`, { headers: this.headers }).map(this.extractData)
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getEmby(): Observable<IEmbySettings> {
|
||||
public getEmby(): Observable<IEmbySettings> {
|
||||
return this.httpAuth.get(`${this.url}/Emby/`).map(this.extractData).catch(this.handleError);
|
||||
}
|
||||
|
||||
saveEmby(settings: IEmbySettings): Observable<boolean> {
|
||||
public saveEmby(settings: IEmbySettings): Observable<boolean> {
|
||||
return this.httpAuth.post(`${this.url}/Emby/`, JSON.stringify(settings), { headers: this.headers })
|
||||
.map(this.extractData).catch(this.handleError);
|
||||
}
|
||||
|
||||
getPlex(): Observable<IPlexSettings> {
|
||||
public getPlex(): Observable<IPlexSettings> {
|
||||
return this.httpAuth.get(`${this.url}/Plex/`).map(this.extractData).catch(this.handleError);
|
||||
}
|
||||
|
||||
savePlex(settings: IPlexSettings): Observable<boolean> {
|
||||
public savePlex(settings: IPlexSettings): Observable<boolean> {
|
||||
return this.httpAuth.post(`${this.url}/Plex/`, JSON.stringify(settings), { headers: this.headers })
|
||||
.map(this.extractData).catch(this.handleError);
|
||||
}
|
||||
|
||||
getSonarr(): Observable<ISonarrSettings> {
|
||||
public getSonarr(): Observable<ISonarrSettings> {
|
||||
return this.httpAuth.get(`${this.url}/Sonarr`).map(this.extractData)
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
saveSonarr(settings: ISonarrSettings): Observable<boolean> {
|
||||
public saveSonarr(settings: ISonarrSettings): Observable<boolean> {
|
||||
return this.httpAuth.post(`${this.url}/Sonarr`, JSON.stringify(settings), { headers: this.headers })
|
||||
.map(this.extractData).catch(this.handleError);
|
||||
}
|
||||
|
||||
getRadarr(): Observable<IRadarrSettings> {
|
||||
public getRadarr(): Observable<IRadarrSettings> {
|
||||
return this.httpAuth.get(`${this.url}/Radarr`).map(this.extractData)
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
saveRadarr(settings: IRadarrSettings): Observable<boolean> {
|
||||
public saveRadarr(settings: IRadarrSettings): Observable<boolean> {
|
||||
return this.httpAuth.post(`${this.url}/Radarr`, JSON.stringify(settings), { headers: this.headers })
|
||||
.map(this.extractData).catch(this.handleError);
|
||||
}
|
||||
|
||||
|
||||
getAuthentication(): Observable<IAuthenticationSettings> {
|
||||
public getAuthentication(): Observable<IAuthenticationSettings> {
|
||||
return this.httpAuth.get(`${this.url}/Authentication`).map(this.extractData)
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
saveAuthentication(settings: IAuthenticationSettings): Observable<boolean> {
|
||||
public saveAuthentication(settings: IAuthenticationSettings): Observable<boolean> {
|
||||
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<ILandingPageSettings> {
|
||||
public getLandingPage(): Observable<ILandingPageSettings> {
|
||||
return this.nonAuthHttp.get(`${this.url}/LandingPage`).map(this.extractData).catch(this.handleError);
|
||||
}
|
||||
|
||||
saveLandingPage(settings: ILandingPageSettings): Observable<boolean> {
|
||||
public saveLandingPage(settings: ILandingPageSettings): Observable<boolean> {
|
||||
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<ICustomizationSettings> {
|
||||
return this.nonAuthHttp.get(`${this.url}/customization`).map(this.extractData).catch(this.handleError)
|
||||
public getCustomization(): Observable<ICustomizationSettings> {
|
||||
return this.nonAuthHttp.get(`${this.url}/customization`).map(this.extractData).catch(this.handleError);
|
||||
}
|
||||
|
||||
saveCustomization(settings: ICustomizationSettings): Observable<boolean> {
|
||||
public saveCustomization(settings: ICustomizationSettings): Observable<boolean> {
|
||||
return this.httpAuth.post(`${this.url}/customization`, JSON.stringify(settings), { headers: this.headers })
|
||||
.map(this.extractData).catch(this.handleError);
|
||||
}
|
||||
|
||||
getEmailNotificationSettings(): Observable<IEmailNotificationSettings> {
|
||||
return this.httpAuth.get(`${this.url}/notifications/email`).map(this.extractData).catch(this.handleError)
|
||||
public getEmailNotificationSettings(): Observable<IEmailNotificationSettings> {
|
||||
return this.httpAuth.get(`${this.url}/notifications/email`).map(this.extractData).catch(this.handleError);
|
||||
}
|
||||
|
||||
saveEmailNotificationSettings(settings: IEmailNotificationSettings): Observable<boolean> {
|
||||
public saveEmailNotificationSettings(settings: IEmailNotificationSettings): Observable<boolean> {
|
||||
return this.httpAuth
|
||||
.post(`${this.url}/notifications/email`, JSON.stringify(settings), { headers: this.headers })
|
||||
.map(this.extractData).catch(this.handleError);
|
||||
}
|
||||
|
||||
getDiscordNotificationSettings(): Observable<IDiscordNotifcationSettings> {
|
||||
return this.httpAuth.get(`${this.url}/notifications/discord`).map(this.extractData).catch(this.handleError)
|
||||
public getDiscordNotificationSettings(): Observable<IDiscordNotifcationSettings> {
|
||||
return this.httpAuth.get(`${this.url}/notifications/discord`).map(this.extractData).catch(this.handleError);
|
||||
}
|
||||
|
||||
getMattermostNotificationSettings(): Observable<IMattermostNotifcationSettings> {
|
||||
return this.httpAuth.get(`${this.url}/notifications/mattermost`).map(this.extractData).catch(this.handleError)
|
||||
public getMattermostNotificationSettings(): Observable<IMattermostNotifcationSettings> {
|
||||
return this.httpAuth.get(`${this.url}/notifications/mattermost`).map(this.extractData).catch(this.handleError);
|
||||
}
|
||||
|
||||
saveDiscordNotificationSettings(settings: IDiscordNotifcationSettings): Observable<boolean> {
|
||||
public saveDiscordNotificationSettings(settings: IDiscordNotifcationSettings): Observable<boolean> {
|
||||
return this.httpAuth
|
||||
.post(`${this.url}/notifications/discord`, JSON.stringify(settings), { headers: this.headers })
|
||||
.map(this.extractData).catch(this.handleError);
|
||||
}
|
||||
|
||||
saveMattermostNotificationSettings(settings: IMattermostNotifcationSettings): Observable<boolean> {
|
||||
public saveMattermostNotificationSettings(settings: IMattermostNotifcationSettings): Observable<boolean> {
|
||||
return this.httpAuth
|
||||
.post(`${this.url}/notifications/mattermost`, JSON.stringify(settings), { headers: this.headers })
|
||||
.map(this.extractData).catch(this.handleError);
|
||||
}
|
||||
getPushbulletNotificationSettings(): Observable<IPushbulletNotificationSettings> {
|
||||
return this.httpAuth.get(`${this.url}/notifications/pushbullet`).map(this.extractData).catch(this.handleError)
|
||||
public getPushbulletNotificationSettings(): Observable<IPushbulletNotificationSettings> {
|
||||
return this.httpAuth.get(`${this.url}/notifications/pushbullet`).map(this.extractData).catch(this.handleError);
|
||||
}
|
||||
getPushoverNotificationSettings(): Observable<IPushoverNotificationSettings> {
|
||||
return this.httpAuth.get(`${this.url}/notifications/pushover`).map(this.extractData).catch(this.handleError)
|
||||
public getPushoverNotificationSettings(): Observable<IPushoverNotificationSettings> {
|
||||
return this.httpAuth.get(`${this.url}/notifications/pushover`).map(this.extractData).catch(this.handleError);
|
||||
}
|
||||
|
||||
savePushbulletNotificationSettings(settings: IPushbulletNotificationSettings): Observable<boolean> {
|
||||
public savePushbulletNotificationSettings(settings: IPushbulletNotificationSettings): Observable<boolean> {
|
||||
return this.httpAuth
|
||||
.post(`${this.url}/notifications/pushbullet`, JSON.stringify(settings), { headers: this.headers })
|
||||
.map(this.extractData).catch(this.handleError);
|
||||
}
|
||||
savePushoverNotificationSettings(settings: IPushoverNotificationSettings): Observable<boolean> {
|
||||
public savePushoverNotificationSettings(settings: IPushoverNotificationSettings): Observable<boolean> {
|
||||
return this.httpAuth
|
||||
.post(`${this.url}/notifications/pushover`, JSON.stringify(settings), { headers: this.headers })
|
||||
.map(this.extractData).catch(this.handleError);
|
||||
}
|
||||
|
||||
getSlackNotificationSettings(): Observable<ISlackNotificationSettings> {
|
||||
return this.httpAuth.get(`${this.url}/notifications/slack`).map(this.extractData).catch(this.handleError)
|
||||
public getSlackNotificationSettings(): Observable<ISlackNotificationSettings> {
|
||||
return this.httpAuth.get(`${this.url}/notifications/slack`).map(this.extractData).catch(this.handleError);
|
||||
}
|
||||
|
||||
saveSlackNotificationSettings(settings: ISlackNotificationSettings): Observable<boolean> {
|
||||
public saveSlackNotificationSettings(settings: ISlackNotificationSettings): Observable<boolean> {
|
||||
return this.httpAuth
|
||||
.post(`${this.url}/notifications/slack`, JSON.stringify(settings), { headers: this.headers })
|
||||
.map(this.extractData).catch(this.handleError);
|
||||
|
|
|
@ -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<any> {
|
||||
public getWizardStatus(): Observable<any> {
|
||||
return this.http.get(`${this.url}Wizard/`, { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
}
|
|
@ -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 {
|
||||
|
||||
public settings: ICustomizationSettings;
|
||||
|
||||
constructor(private settingsService: SettingsService, private notificationService: NotificationService) { }
|
||||
|
||||
settings: ICustomizationSettings;
|
||||
|
||||
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");
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
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 {
|
||||
|
||||
public settings: IEmbySettings;
|
||||
|
||||
constructor(private settingsService: SettingsService,
|
||||
private notificationService: NotificationService,
|
||||
private testerService : TesterService) { }
|
||||
private testerService: TesterService) { }
|
||||
|
||||
settings: IEmbySettings;
|
||||
|
||||
ngOnInit(): void {
|
||||
public ngOnInit() {
|
||||
this.settingsService.getEmby().subscribe(x => this.settings = x);
|
||||
}
|
||||
|
||||
addTab() {
|
||||
public addTab() {
|
||||
if (this.settings.servers == null) {
|
||||
this.settings.servers = [];
|
||||
}
|
||||
|
@ -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");
|
||||
|
|
|
@ -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 {
|
||||
|
||||
public settings: ILandingPageSettings;
|
||||
|
||||
constructor(private settingsService: SettingsService, private notificationService: NotificationService) { }
|
||||
|
||||
settings: ILandingPageSettings;
|
||||
|
||||
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");
|
||||
|
|
|
@ -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 {
|
||||
|
||||
public NotificationType = NotificationType;
|
||||
public templates: INotificationTemplates[];
|
||||
public form: FormGroup;
|
||||
|
||||
constructor(private settingsService: SettingsService,
|
||||
private notificationService: NotificationService,
|
||||
private fb: FormBuilder,
|
||||
private testerService : TesterService) { }
|
||||
private testerService: TesterService) { }
|
||||
|
||||
NotificationType = NotificationType;
|
||||
templates: INotificationTemplates[];
|
||||
|
||||
form: FormGroup;
|
||||
|
||||
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 = <IDiscordNotifcationSettings>form.value;
|
||||
const settings = <IDiscordNotifcationSettings>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");
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
}
|
|
@ -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 {
|
||||
public NotificationType = NotificationType;
|
||||
public templates: INotificationTemplates[];
|
||||
public emailForm: FormGroup;
|
||||
|
||||
constructor(private settingsService: SettingsService,
|
||||
private notificationService: NotificationService,
|
||||
private fb: FormBuilder,
|
||||
private validationService: ValidationService,
|
||||
private testerService: TesterService) { }
|
||||
|
||||
NotificationType = NotificationType;
|
||||
templates: INotificationTemplates[];
|
||||
|
||||
emailForm: FormGroup;
|
||||
|
||||
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 = <IEmailNotificationSettings>form.value;
|
||||
const settings = <IEmailNotificationSettings>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,11 +87,11 @@ 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");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
||||
public NotificationType = NotificationType;
|
||||
public templates: INotificationTemplates[];
|
||||
public form: FormGroup;
|
||||
|
||||
constructor(private settingsService: SettingsService,
|
||||
private notificationService: NotificationService,
|
||||
private fb: FormBuilder,
|
||||
private testerService : TesterService) { }
|
||||
private testerService: TesterService) { }
|
||||
|
||||
NotificationType = NotificationType;
|
||||
templates: INotificationTemplates[];
|
||||
|
||||
form: FormGroup;
|
||||
|
||||
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 = <IMattermostNotifcationSettings>form.value;
|
||||
const settings = <IMattermostNotifcationSettings>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");
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
}
|
|
@ -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 <br/>
|
||||
{RequestedDate} : The Date the media was requested <br/>
|
||||
{Title} : The title of the request e.g. Lion King <br/>
|
||||
|
|
|
@ -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 {
|
||||
public NotificationType = NotificationType;
|
||||
public templates: INotificationTemplates[];
|
||||
public form: FormGroup;
|
||||
|
||||
constructor(private settingsService: SettingsService,
|
||||
private notificationService: NotificationService,
|
||||
private fb: FormBuilder,
|
||||
private testerService : TesterService) { }
|
||||
private testerService: TesterService) { }
|
||||
|
||||
NotificationType = NotificationType;
|
||||
templates: INotificationTemplates[];
|
||||
|
||||
form: FormGroup;
|
||||
|
||||
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 = <IPushbulletNotificationSettings>form.value;
|
||||
const settings = <IPushbulletNotificationSettings>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");
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
}
|
|
@ -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 {
|
||||
public NotificationType = NotificationType;
|
||||
public templates: INotificationTemplates[];
|
||||
public form: FormGroup;
|
||||
|
||||
constructor(private settingsService: SettingsService,
|
||||
private notificationService: NotificationService,
|
||||
private fb: FormBuilder,
|
||||
private testerService : TesterService) { }
|
||||
private testerService: TesterService) { }
|
||||
|
||||
NotificationType = NotificationType;
|
||||
templates: INotificationTemplates[];
|
||||
|
||||
form: FormGroup;
|
||||
|
||||
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 = <IPushoverNotificationSettings>form.value;
|
||||
const settings = <IPushoverNotificationSettings>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");
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
}
|
|
@ -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 {
|
||||
public NotificationType = NotificationType;
|
||||
public templates: INotificationTemplates[];
|
||||
public form: FormGroup;
|
||||
|
||||
constructor(private settingsService: SettingsService,
|
||||
private notificationService: NotificationService,
|
||||
private fb: FormBuilder,
|
||||
private testerService : TesterService) { }
|
||||
private testerService: TesterService) { }
|
||||
|
||||
NotificationType = NotificationType;
|
||||
templates: INotificationTemplates[];
|
||||
|
||||
form: FormGroup;
|
||||
|
||||
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 = <ISlackNotificationSettings>form.value;
|
||||
const settings = <ISlackNotificationSettings>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 = <ISlackNotificationSettings>form.value;
|
||||
const settings = <ISlackNotificationSettings>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");
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
}
|
|
@ -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 {
|
||||
|
||||
public form: FormGroup;
|
||||
|
||||
constructor(private settingsService: SettingsService,
|
||||
private notificationService: NotificationService,
|
||||
private fb: FormBuilder) { }
|
||||
|
||||
form: FormGroup;
|
||||
|
||||
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!");
|
||||
}
|
||||
}
|
|
@ -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 {
|
||||
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;
|
||||
|
||||
private subscriptions = new Subject<void>();
|
||||
|
||||
constructor(private settingsService: SettingsService,
|
||||
private notificationService: NotificationService,
|
||||
private plexService: PlexService,
|
||||
private testerService : TesterService) { }
|
||||
private testerService: TesterService) { }
|
||||
|
||||
settings: IPlexSettings;
|
||||
loadedServers: IPlexServerViewModel; // This comes from the api call for the user to select a server
|
||||
private subscriptions = new Subject<void>();
|
||||
username: string;
|
||||
password: string;
|
||||
serversButton = false;
|
||||
|
||||
ngOnInit(): void {
|
||||
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,7 +68,7 @@ export class PlexComponent implements OnInit, OnDestroy {
|
|||
});
|
||||
}
|
||||
|
||||
addTab() {
|
||||
public addTab() {
|
||||
if (this.settings.servers == null) {
|
||||
this.settings.servers = [];
|
||||
}
|
||||
|
@ -75,34 +76,34 @@ export class PlexComponent implements OnInit, OnDestroy {
|
|||
|
||||
}
|
||||
|
||||
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,7 +114,7 @@ export class PlexComponent implements OnInit, OnDestroy {
|
|||
});
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
public ngOnDestroy() {
|
||||
this.subscriptions.next();
|
||||
this.subscriptions.complete();
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
||||
public qualities: IRadarrProfile[];
|
||||
public rootFolders: IRadarrRootFolder[];
|
||||
public minimumAvailabilityOptions: IMinimumAvailability[];
|
||||
public profilesRunning: boolean;
|
||||
public rootFoldersRunning: boolean;
|
||||
public advanced = false;
|
||||
public form: FormGroup;
|
||||
|
||||
private subscriptions = new Subject<void>();
|
||||
|
||||
constructor(private settingsService: SettingsService,
|
||||
private radarrService: RadarrService,
|
||||
private notificationService: NotificationService,
|
||||
private fb: FormBuilder,
|
||||
private testerService : TesterService) { }
|
||||
qualities: IRadarrProfile[];
|
||||
rootFolders: IRadarrRootFolder[];
|
||||
|
||||
minimumAvailabilityOptions: IMinimumAvailability[];
|
||||
|
||||
profilesRunning: boolean;
|
||||
rootFoldersRunning: boolean;
|
||||
|
||||
advanced = false;
|
||||
private subscriptions = new Subject<void>();
|
||||
|
||||
form : FormGroup;
|
||||
ngOnInit(): void {
|
||||
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,8 +66,7 @@ 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;
|
||||
|
@ -80,7 +76,7 @@ export class RadarrComponent implements OnInit {
|
|||
});
|
||||
}
|
||||
|
||||
getRootFolders(form: FormGroup) {
|
||||
public getRootFolders(form: FormGroup) {
|
||||
this.rootFoldersRunning = true;
|
||||
this.radarrService.getRootFolders(form.value).subscribe(x => {
|
||||
this.rootFolders = x;
|
||||
|
@ -90,12 +86,12 @@ export class RadarrComponent implements OnInit {
|
|||
});
|
||||
}
|
||||
|
||||
test(form: FormGroup) {
|
||||
public test(form: FormGroup) {
|
||||
if (form.invalid) {
|
||||
this.notificationService.error("Validation", "Please check your entered values");
|
||||
return;
|
||||
}
|
||||
var settings = <IRadarrSettings>form.value;
|
||||
const settings = <IRadarrSettings>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 = <IRadarrSettings>form.value;
|
||||
const settings = <IRadarrSettings>form.value;
|
||||
this.settingsService.saveRadarr(settings).subscribe(x => {
|
||||
if (x) {
|
||||
this.notificationService.success("Settings Saved", "Successfully saved Radarr settings");
|
||||
|
@ -122,7 +118,7 @@ onSubmit(form: FormGroup) {
|
|||
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
public ngOnDestroy() {
|
||||
this.subscriptions.next();
|
||||
this.subscriptions.complete();
|
||||
}
|
||||
|
|
|
@ -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,7 +96,7 @@ const routes: Routes = [
|
|||
RadarrService,
|
||||
AuthGuard,
|
||||
ValidationService,
|
||||
TesterService
|
||||
TesterService,
|
||||
],
|
||||
|
||||
})
|
||||
|
|
|
@ -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 {
|
||||
|
||||
}
|
||||
export class SettingsMenuComponent { }
|
||||
|
|
|
@ -1,41 +1,39 @@
|
|||
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 {
|
||||
|
||||
public qualities: ISonarrProfile[];
|
||||
public rootFolders: ISonarrRootFolder[];
|
||||
public selectedRootFolder: ISonarrRootFolder;
|
||||
public selectedQuality: ISonarrProfile;
|
||||
public profilesRunning: boolean;
|
||||
public rootFoldersRunning: boolean;
|
||||
public form: FormGroup;
|
||||
public advanced = false;
|
||||
|
||||
private subscriptions = new Subject<void>();
|
||||
|
||||
constructor(private settingsService: SettingsService,
|
||||
private sonarrService: SonarrService,
|
||||
private notificationService: NotificationService,
|
||||
private testerService : TesterService,
|
||||
private fb : FormBuilder) { }
|
||||
private testerService: TesterService,
|
||||
private fb: FormBuilder) { }
|
||||
|
||||
qualities: ISonarrProfile[];
|
||||
rootFolders: ISonarrRootFolder[];
|
||||
|
||||
selectedRootFolder: ISonarrRootFolder;
|
||||
selectedQuality: ISonarrProfile;
|
||||
|
||||
profilesRunning: boolean;
|
||||
rootFoldersRunning: boolean;
|
||||
private subscriptions = new Subject<void>();
|
||||
form : FormGroup;
|
||||
advanced = false;
|
||||
|
||||
ngOnInit(): void {
|
||||
public ngOnInit() {
|
||||
|
||||
this.settingsService.getSonarr()
|
||||
.takeUntil(this.subscriptions)
|
||||
|
@ -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 = <ISonarrSettings>form.value;
|
||||
const settings = <ISonarrSettings>form.value;
|
||||
this.testerService.sonarrTest(settings).subscribe(x => {
|
||||
if (x) {
|
||||
this.notificationService.success("Connected", "Successfully connected to Sonarr!");
|
||||
|
@ -105,7 +100,7 @@ export class SonarrComponent implements OnInit, OnDestroy {
|
|||
});
|
||||
}
|
||||
|
||||
onSubmit(form:FormGroup) {
|
||||
public onSubmit(form: FormGroup) {
|
||||
if (form.invalid) {
|
||||
this.notificationService.error("Validation", "Please check your entered values");
|
||||
return;
|
||||
|
@ -121,7 +116,7 @@ export class SonarrComponent implements OnInit, OnDestroy {
|
|||
});
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
public ngOnDestroy() {
|
||||
this.subscriptions.next();
|
||||
this.subscriptions.complete();
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
||||
}
|
||||
export class UserManagementComponent { }
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
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 {
|
||||
public form: FormGroup;
|
||||
|
||||
constructor(private identityService: IdentityService,
|
||||
private notificationService: NotificationService,
|
||||
private fb: FormBuilder) { }
|
||||
|
||||
form: FormGroup;
|
||||
|
||||
ngOnInit(): void {
|
||||
public ngOnInit() {
|
||||
this.identityService.getUser().subscribe(x => {
|
||||
var localUser = x as IUpdateLocalUser;
|
||||
const localUser = x as IUpdateLocalUser;
|
||||
this.form = this.fb.group({
|
||||
id:[localUser.id],
|
||||
username: [localUser.username],
|
||||
|
@ -27,18 +27,17 @@ 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;
|
||||
|
@ -47,7 +46,7 @@ export class UpdateDetailsComponent implements OnInit {
|
|||
|
||||
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 {
|
|||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -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 {
|
||||
public user: IUser;
|
||||
public availableClaims: ICheckbox[];
|
||||
public confirmPass: "";
|
||||
|
||||
constructor(private identityService: IdentityService,
|
||||
private notificationSerivce: NotificationService,
|
||||
private router: Router) { }
|
||||
|
||||
user: IUser;
|
||||
availableClaims: ICheckbox[];
|
||||
confirmPass: "";
|
||||
|
||||
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);
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -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) {
|
||||
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);
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -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,14 +21,11 @@ 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;
|
||||
|
|
|
@ -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,10 +42,10 @@ const routes: Routes = [
|
|||
UpdateDetailsComponent,
|
||||
],
|
||||
exports: [
|
||||
RouterModule
|
||||
RouterModule,
|
||||
],
|
||||
providers: [
|
||||
IdentityService
|
||||
IdentityService,
|
||||
],
|
||||
|
||||
})
|
||||
|
|
|
@ -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 {
|
||||
|
||||
public username: string;
|
||||
public password: string;
|
||||
|
||||
constructor(private identityService: IdentityService, private notificationService: NotificationService,
|
||||
private router: Router, private auth: AuthService, private settings: SettingsService) { }
|
||||
|
||||
|
||||
username: string;
|
||||
password: string;
|
||||
|
||||
createUser() {
|
||||
public createUser() {
|
||||
this.identityService.createWizardUser(this.username, this.password).subscribe(x => {
|
||||
if (x) {
|
||||
// Log me in.
|
||||
|
@ -33,7 +31,7 @@ export class CreateAdminComponent {
|
|||
|
||||
this.settings.saveOmbi(ombi).subscribe(x => {
|
||||
|
||||
this.router.navigate(['search']);
|
||||
this.router.navigate(["search"]);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -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) {
|
||||
}
|
||||
|
||||
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"]);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -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) { }
|
||||
|
||||
public plex() {
|
||||
this.router.navigate(["Wizard/Plex"]);
|
||||
}
|
||||
|
||||
plex() {
|
||||
this.router.navigate(['Wizard/Plex']);
|
||||
public emby() {
|
||||
this.router.navigate(["Wizard/Emby"]);
|
||||
}
|
||||
|
||||
emby() {
|
||||
this.router.navigate(['Wizard/Emby']);
|
||||
}
|
||||
|
||||
skip() {
|
||||
this.router.navigate(['Wizard/CreateAdmin']);
|
||||
public skip() {
|
||||
this.router.navigate(["Wizard/CreateAdmin"]);
|
||||
}
|
||||
}
|
|
@ -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"]);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -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"]);
|
||||
}
|
||||
}
|
|
@ -1,46 +1,46 @@
|
|||
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,
|
||||
],
|
||||
|
||||
})
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
import 'rxjs/add/operator/map';
|
||||
import 'rxjs/add/operator/catch';
|
||||
import "rxjs/add/operator/catch";
|
||||
import "rxjs/add/operator/map";
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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');
|
||||
if (module.hot) {
|
||||
Error.stackTraceLimit = Infinity;
|
||||
// tslint:disable:no-var-requires
|
||||
require("zone.js/dist/long-stack-trace-zone");
|
||||
}
|
|
@ -32,10 +32,10 @@
|
|||
</ItemGroup>
|
||||
|
||||
<Target Name="NpmCommandsDebug" Condition="'$(Configuration)'=='Debug'" AfterTargets="Build">
|
||||
<Exec Command="npm run-script vendor" />
|
||||
<Exec Command="npm run vendor" />
|
||||
</Target>
|
||||
<Target Name="NpmCommandsRelease" Condition="'$(Configuration)'=='Release'" AfterTargets="Build">
|
||||
<Exec Command="npm run-script publish" />
|
||||
<Exec Command="npm run publish" />
|
||||
</Target>
|
||||
|
||||
<Target Name="RunWebpack" AfterTargets="ComputeFilesToPublish">
|
||||
|
|
42
src/Ombi/package-lock.json
generated
42
src/Ombi/package-lock.json
generated
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue