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")
|
Task("NPM")
|
||||||
.Does(() => {
|
.Does(() => {
|
||||||
var settings = new NpmInstallSettings {
|
var settings = new NpmInstallSettings {
|
||||||
LogLevel = NpmLogLevel.Silent,
|
LogLevel = NpmLogLevel.Silent,
|
||||||
WorkingDirectory = webProjDir,
|
WorkingDirectory = webProjDir,
|
||||||
Production = true
|
Production = true
|
||||||
|
@ -117,9 +117,21 @@ var settings = new NpmInstallSettings {
|
||||||
NpmInstall(settings);
|
NpmInstall(settings);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Task("TSLint")
|
||||||
|
.IsDependentOn("NPM")
|
||||||
|
.Does(() =>
|
||||||
|
{
|
||||||
|
var settings = new NpmRunScriptSettings {
|
||||||
|
WorkingDirectory = webProjDir,
|
||||||
|
ScriptName = "lint"
|
||||||
|
};
|
||||||
|
|
||||||
|
NpmRunScript(settings);
|
||||||
|
});
|
||||||
|
|
||||||
Task("Restore")
|
Task("Restore")
|
||||||
.IsDependentOn("SetVersionInfo")
|
.IsDependentOn("SetVersionInfo")
|
||||||
.IsDependentOn("NPM")
|
.IsDependentOn("TSLint")
|
||||||
.Does(() =>
|
.Does(() =>
|
||||||
{
|
{
|
||||||
DotNetCoreRestore(projDir);
|
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"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
51
src/Ombi/.vscode/launch.json
vendored
51
src/Ombi/.vscode/launch.json
vendored
|
@ -1,39 +1,46 @@
|
||||||
{
|
{
|
||||||
"version": "0.2.0",
|
// Use IntelliSense to find out which attributes exist for C# debugging
|
||||||
"configurations": [
|
// 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",
|
"type": "coreclr",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"preLaunchTask": "composeForDebug",
|
"preLaunchTask": "build",
|
||||||
"cwd": "/app",
|
// If you have changed target frameworks, make sure to update the program path.
|
||||||
"program": "/app/Ombi.dll",
|
"program": "${workspaceRoot}/bin/Debug/netcoreapp2.0/Ombi.dll",
|
||||||
"sourceFileMap": {
|
"args": [],
|
||||||
"/app": "${workspaceRoot}"
|
"cwd": "${workspaceRoot}",
|
||||||
},
|
"stopAtEntry": false,
|
||||||
|
"internalConsoleOptions": "openOnSessionStart",
|
||||||
"launchBrowser": {
|
"launchBrowser": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"args": "${auto-detect-url}",
|
"args": "http://localhost:5000",
|
||||||
"windows": {
|
"windows": {
|
||||||
"command": "cmd.exe",
|
"command": "cmd.exe",
|
||||||
"args": "/C start ${auto-detect-url}"
|
"args": "/C start http://localhost:5000"
|
||||||
},
|
},
|
||||||
"osx": {
|
"osx": {
|
||||||
"command": "open"
|
"command": "open"
|
||||||
|
},
|
||||||
|
"linux": {
|
||||||
|
"command": "xdg-open"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"env": {
|
||||||
"pipeTransport": {
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
"pipeProgram": "/bin/bash",
|
},
|
||||||
"pipeCwd": "${workspaceRoot}",
|
"sourceFileMap": {
|
||||||
"pipeArgs": [ "-c", "./dockerTask.sh startDebugging" ],
|
"/Views": "${workspaceRoot}/Views"
|
||||||
"windows": {
|
|
||||||
"pipeProgram": "${env.windir}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
|
|
||||||
"pipeCwd": "${workspaceRoot}",
|
|
||||||
"pipeArgs": [ ".\\dockerTask.ps1", "-StartDebugging" ]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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": {
|
"files.associations": {
|
||||||
"dockerfile.*": "dockerfile"
|
"dockerfile.*": "dockerfile"
|
||||||
|
},
|
||||||
|
"typescript.tsdk": "node_modules\\typescript\\lib",
|
||||||
|
"files.exclude": {
|
||||||
|
"**/*.js": {
|
||||||
|
"when": "$(basename).ts"
|
||||||
|
},
|
||||||
|
"**/*.js.map": true,
|
||||||
|
"node_modules": true,
|
||||||
|
"obj": true,
|
||||||
|
"bin": true
|
||||||
}
|
}
|
||||||
}
|
}
|
80
src/Ombi/.vscode/tasks.json
vendored
80
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",
|
"version": "0.1.0",
|
||||||
"windows": {
|
"command": "dotnet",
|
||||||
"command": "powershell",
|
"isShellCommand": true,
|
||||||
"options": {
|
"args": [],
|
||||||
"cwd": "${workspaceRoot}"
|
"tasks": [
|
||||||
|
{
|
||||||
|
"taskName": "build",
|
||||||
|
"args": [
|
||||||
|
"${workspaceRoot}/Ombi.csproj"
|
||||||
|
],
|
||||||
|
"isBuildCommand": true,
|
||||||
|
"problemMatcher": "$msCompile"
|
||||||
},
|
},
|
||||||
"tasks": [
|
{
|
||||||
{
|
"taskName": "lint",
|
||||||
"taskName": "build",
|
"command": "npm",
|
||||||
"suppressTaskName": true,
|
"isShellCommand": true,
|
||||||
"args": ["-ExecutionPolicy", "RemoteSigned", ".\\dockerTask.ps1", "-Build", "-Environment", "debug" ],
|
"args": ["run", "lint"]
|
||||||
"isBuildCommand": true,
|
}
|
||||||
"showOutput": "always",
|
]
|
||||||
"echoCommand": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"taskName": "compose",
|
|
||||||
"suppressTaskName": true,
|
|
||||||
"args": ["-ExecutionPolicy", "RemoteSigned", ".\\dockerTask.ps1", "-Compose", "-Environment", "debug" ],
|
|
||||||
"isBuildCommand": false,
|
|
||||||
"showOutput": "always",
|
|
||||||
"echoCommand": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"taskName": "composeForDebug",
|
|
||||||
"suppressTaskName": true,
|
|
||||||
"args": ["-ExecutionPolicy", "RemoteSigned", ".\\dockerTask.ps1", "-ComposeForDebug", "-Environment", "debug" ],
|
|
||||||
"isBuildCommand": false,
|
|
||||||
"showOutput": "always",
|
|
||||||
"echoCommand": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"osx": {
|
|
||||||
"command": "/bin/bash",
|
|
||||||
"options": {
|
|
||||||
"cwd": "${workspaceRoot}"
|
|
||||||
},
|
|
||||||
"tasks": [
|
|
||||||
{
|
|
||||||
"taskName": "build",
|
|
||||||
"suppressTaskName": true,
|
|
||||||
"args": [ "-c", "./dockerTask.sh build debug" ],
|
|
||||||
"isBuildCommand": true,
|
|
||||||
"showOutput": "always"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"taskName": "compose",
|
|
||||||
"suppressTaskName": true,
|
|
||||||
"args": [ "-c", "./dockerTask.sh compose debug" ],
|
|
||||||
"isBuildCommand": false,
|
|
||||||
"showOutput": "always"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"taskName": "composeForDebug",
|
|
||||||
"suppressTaskName": true,
|
|
||||||
"args": [ "-c", "./dockerTask.sh composeForDebug debug" ],
|
|
||||||
"isBuildCommand": false,
|
|
||||||
"showOutput": "always"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,28 +1,28 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from "@angular/core";
|
||||||
import { Router } from '@angular/router';
|
import { Router } from "@angular/router";
|
||||||
import { NotificationService } from './services/notification.service';
|
import { AuthService } from "./auth/auth.service";
|
||||||
import { SettingsService } from './services/settings.service';
|
import { ILocalUser } from "./auth/IUserLogin";
|
||||||
import { AuthService } from './auth/auth.service';
|
import { NotificationService } from "./services";
|
||||||
import { ILocalUser } from './auth/IUserLogin';
|
import { SettingsService } from "./services";
|
||||||
|
|
||||||
import { ICustomizationSettings } from './interfaces/ISettings';
|
|
||||||
|
|
||||||
|
import { ICustomizationSettings } from "./interfaces";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ombi',
|
selector: "ombi",
|
||||||
templateUrl: './app.component.html',
|
templateUrl: "./app.component.html",
|
||||||
styleUrls: ['./app.component.scss']
|
styleUrls: ["./app.component.scss"],
|
||||||
})
|
})
|
||||||
export class AppComponent implements OnInit {
|
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) { }
|
constructor(public notificationService: NotificationService, public authService: AuthService, private router: Router, private settingsService: SettingsService) { }
|
||||||
|
|
||||||
customizationSettings: ICustomizationSettings;
|
public ngOnInit() {
|
||||||
user: ILocalUser;
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
this.user = this.authService.claims();
|
this.user = this.authService.claims();
|
||||||
|
|
||||||
this.settingsService.getCustomization().subscribe(x => this.customizationSettings = x);
|
this.settingsService.getCustomization().subscribe(x => this.customizationSettings = x);
|
||||||
|
|
||||||
this.router.events.subscribe(() => {
|
this.router.events.subscribe(() => {
|
||||||
|
@ -31,14 +31,12 @@ export class AppComponent implements OnInit {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
hasRole(role: string): boolean {
|
public hasRole(role: string): boolean {
|
||||||
return this.user.roles.some(r => r === role);
|
return this.user.roles.some(r => r === role);
|
||||||
}
|
}
|
||||||
|
|
||||||
logOut() {
|
public logOut() {
|
||||||
this.authService.logout();
|
this.authService.logout();
|
||||||
this.router.navigate(["login"]);
|
this.router.navigate(["login"]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
showNav: boolean;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,57 +1,56 @@
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from "@angular/core";
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
||||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
import { HttpModule } from "@angular/http";
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
import { MdButtonModule, MdCardModule, MdInputModule, MdTabsModule } from "@angular/material";
|
||||||
import { MdButtonModule, MdCardModule, MdInputModule, MdTabsModule } from '@angular/material';
|
import { BrowserModule } from "@angular/platform-browser";
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
|
||||||
import { HttpModule } from '@angular/http';
|
import { RouterModule, Routes } from "@angular/router";
|
||||||
|
|
||||||
// Third Party
|
// 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 { 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
|
// Components
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from "./app.component";
|
||||||
|
|
||||||
import { LoginComponent } from './login/login.component';
|
import { PageNotFoundComponent } from "./errors/not-found.component";
|
||||||
import { ResetPasswordComponent } from './login/resetpassword.component';
|
import { LandingPageComponent } from "./landingpage/landingpage.component";
|
||||||
import { TokenResetPasswordComponent } from './login/tokenresetpassword.component';
|
import { LoginComponent } from "./login/login.component";
|
||||||
import { LandingPageComponent } from './landingpage/landingpage.component';
|
import { ResetPasswordComponent } from "./login/resetpassword.component";
|
||||||
import { PageNotFoundComponent } from './errors/not-found.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';
|
|
||||||
|
|
||||||
|
// Services
|
||||||
|
import { AuthGuard } from "./auth/auth.guard";
|
||||||
|
import { AuthModule } from "./auth/auth.module";
|
||||||
|
import { AuthService } from "./auth/auth.service";
|
||||||
|
import { IdentityService } from "./services";
|
||||||
|
import { ImageService } from "./services";
|
||||||
|
import { LandingPageService } from "./services";
|
||||||
|
import { NotificationService } from "./services";
|
||||||
|
import { RequestService } from "./services";
|
||||||
|
import { SettingsService } from "./services";
|
||||||
|
import { StatusService } from "./services";
|
||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
import { SettingsModule } from './settings/settings.module';
|
import { RequestsModule } from "./requests/requests.module";
|
||||||
import { WizardModule } from './wizard/wizard.module';
|
import { SearchModule } from "./search/search.module";
|
||||||
import { SearchModule } from './search/search.module';
|
import { SettingsModule } from "./settings/settings.module";
|
||||||
import { UserManagementModule } from './usermanagement/usermanagement.module';
|
import { UserManagementModule } from "./usermanagement/usermanagement.module";
|
||||||
import { RequestsModule } from './requests/requests.module';
|
import { WizardModule } from "./wizard/wizard.module";
|
||||||
//import { PipeModule } from './pipes/pipe.module';
|
//import { PipeModule } from './pipes/pipe.module';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{ path: '*', component: PageNotFoundComponent },
|
{ path: "*", component: PageNotFoundComponent },
|
||||||
{ path: '', redirectTo: '/search', pathMatch: 'full' },
|
{ path: "", redirectTo: "/search", pathMatch: "full" },
|
||||||
|
|
||||||
//{ path: 'requests-grid', component: RequestGridComponent },
|
//{ path: 'requests-grid', component: RequestGridComponent },
|
||||||
{ path: 'login', component: LoginComponent },
|
{ path: "login", component: LoginComponent },
|
||||||
{ path: 'login/:landing', component: LoginComponent },
|
{ path: "login/:landing", component: LoginComponent },
|
||||||
{ path: 'reset', component: ResetPasswordComponent },
|
{ path: "reset", component: ResetPasswordComponent },
|
||||||
{ path: 'token', component: TokenResetPasswordComponent },
|
{ path: "token", component: TokenResetPasswordComponent },
|
||||||
{ path: 'landingpage', component: LandingPageComponent }
|
{ path: "landingpage", component: LandingPageComponent },
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
@ -101,6 +100,6 @@ const routes: Routes = [
|
||||||
ImageService,
|
ImageService,
|
||||||
//DragulaService
|
//DragulaService
|
||||||
],
|
],
|
||||||
bootstrap: [AppComponent]
|
bootstrap: [AppComponent],
|
||||||
})
|
})
|
||||||
export class AppModule { }
|
export class AppModule { }
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
export interface IUserLogin {
|
export interface IUserLogin {
|
||||||
username: string,
|
username: string;
|
||||||
password: string,
|
password: string;
|
||||||
rememberMe:boolean,
|
rememberMe: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ILocalUser {
|
export interface ILocalUser {
|
||||||
roles: string[],
|
roles: string[];
|
||||||
name: string
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from "@angular/core";
|
||||||
import { Router } from '@angular/router';
|
import { Router } from "@angular/router";
|
||||||
import { CanActivate } from '@angular/router';
|
import { CanActivate } from "@angular/router";
|
||||||
import { AuthService } from './auth.service';
|
import { AuthService } from "./auth.service";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AuthGuard implements CanActivate {
|
export class AuthGuard implements CanActivate {
|
||||||
|
|
||||||
constructor(private auth: AuthService, private router: Router) { }
|
constructor(private auth: AuthService, private router: Router) { }
|
||||||
|
|
||||||
canActivate() {
|
public canActivate() {
|
||||||
if (this.auth.loggedIn()) {
|
if (this.auth.loggedIn()) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
this.router.navigate(['login']);
|
this.router.navigate(["login"]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from "@angular/core";
|
||||||
import { Http, RequestOptions } from '@angular/http';
|
import { Http, RequestOptions } from "@angular/http";
|
||||||
import { AuthHttp, AuthConfig } from 'angular2-jwt';
|
import { AuthConfig, AuthHttp } from "angular2-jwt";
|
||||||
|
|
||||||
export function authHttpServiceFactory(http: Http, options: RequestOptions) {
|
export function authHttpServiceFactory(http: Http, options: RequestOptions) {
|
||||||
return new AuthHttp(new AuthConfig({
|
return new AuthHttp(new AuthConfig({
|
||||||
tokenName: 'id_token',
|
tokenName: "id_token",
|
||||||
tokenGetter: (() => localStorage.getItem('id_token')!),
|
tokenGetter: (() => localStorage.getItem("id_token")!),
|
||||||
globalHeaders: [{ 'Content-Type': 'application/json' }],
|
globalHeaders: [{ "Content-Type": "application/json" }],
|
||||||
}), http, options);
|
}), http, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@ export function authHttpServiceFactory(http: Http, options: RequestOptions) {
|
||||||
{
|
{
|
||||||
provide: AuthHttp,
|
provide: AuthHttp,
|
||||||
useFactory: authHttpServiceFactory,
|
useFactory: authHttpServiceFactory,
|
||||||
deps: [Http, RequestOptions]
|
deps: [Http, RequestOptions],
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
})
|
})
|
||||||
export class AuthModule {}
|
export class AuthModule {}
|
||||||
|
|
|
@ -1,43 +1,42 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from "@angular/core";
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Headers, Http } from "@angular/http";
|
||||||
import { tokenNotExpired, JwtHelper } from 'angular2-jwt';
|
import { JwtHelper, tokenNotExpired } from "angular2-jwt";
|
||||||
import { Http, Headers } from '@angular/http';
|
import { Observable } from "rxjs/Rx";
|
||||||
|
|
||||||
import { ServiceHelpers } from '../services/service.helpers';
|
import { ServiceHelpers } from "../services";
|
||||||
import { IUserLogin, ILocalUser } from './IUserLogin';
|
import { ILocalUser, IUserLogin } from "./IUserLogin";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AuthService extends ServiceHelpers {
|
export class AuthService extends ServiceHelpers {
|
||||||
|
public jwtHelper: JwtHelper = new JwtHelper();
|
||||||
|
|
||||||
constructor(http: Http) {
|
constructor(http: Http) {
|
||||||
super(http, '/api/v1/token');
|
super(http, "/api/v1/token");
|
||||||
}
|
}
|
||||||
|
|
||||||
jwtHelper: JwtHelper = new JwtHelper();
|
public login(login: IUserLogin): Observable<any> {
|
||||||
|
|
||||||
login(login: IUserLogin): Observable<any> {
|
|
||||||
this.headers = new Headers();
|
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 })
|
return this.http.post(`${this.url}/`, JSON.stringify(login), { headers: this.headers })
|
||||||
.map(this.extractData);
|
.map(this.extractData);
|
||||||
}
|
}
|
||||||
|
|
||||||
loggedIn() {
|
public loggedIn() {
|
||||||
return tokenNotExpired('id_token');
|
return tokenNotExpired("id_token");
|
||||||
}
|
}
|
||||||
|
|
||||||
claims(): ILocalUser {
|
public claims(): ILocalUser {
|
||||||
if (this.loggedIn()) {
|
if (this.loggedIn()) {
|
||||||
var token = localStorage.getItem('id_token');
|
const token = localStorage.getItem("id_token");
|
||||||
if (!token) {
|
if (!token) {
|
||||||
throw "Invalid token";
|
throw new Error("Invalid token");
|
||||||
}
|
}
|
||||||
var json = this.jwtHelper.decodeToken(token);
|
const json = this.jwtHelper.decodeToken(token);
|
||||||
var roles = json["role"];
|
const roles = json.role;
|
||||||
var name = json["sub"];
|
const name = json.sub;
|
||||||
|
|
||||||
|
const u = { name, roles: [] as string[] };
|
||||||
var u = { name: name, roles: [] as string[] };
|
|
||||||
if (roles instanceof Array) {
|
if (roles instanceof Array) {
|
||||||
|
|
||||||
u.roles = roles;
|
u.roles = roles;
|
||||||
|
@ -49,13 +48,11 @@ export class AuthService extends ServiceHelpers {
|
||||||
return <ILocalUser>{};
|
return <ILocalUser>{};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public hasRole(role: string): boolean {
|
||||||
hasRole(role: string): boolean {
|
|
||||||
return this.claims().roles.some(r => r.toUpperCase() === role.toUpperCase());
|
return this.claims().roles.some(r => r.toUpperCase() === role.toUpperCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
logout() {
|
public logout() {
|
||||||
localStorage.removeItem('id_token');
|
localStorage.removeItem("id_token");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component } from "@angular/core";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
template: '<h2>Page not found</h2>'
|
template: "<h2>Page not found</h2>",
|
||||||
})
|
})
|
||||||
export class PageNotFoundComponent { }
|
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 {
|
export interface IImages {
|
||||||
url: string
|
url: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
export interface IMediaServerStatus {
|
export interface IMediaServerStatus {
|
||||||
serversAvailable: number,
|
serversAvailable: number;
|
||||||
serversUnavailable: number,
|
serversUnavailable: number;
|
||||||
partiallyDown: boolean,
|
partiallyDown: boolean;
|
||||||
completelyDown: boolean,
|
completelyDown: boolean;
|
||||||
fullyAvailable: boolean,
|
fullyAvailable: boolean;
|
||||||
totalServers:number
|
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 {
|
export interface IPlexAuthentication {
|
||||||
user: IPlexUser
|
user: IPlexUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IPlexUser {
|
export interface IPlexUser {
|
||||||
email: string,
|
email: string;
|
||||||
uuid: string,
|
uuid: string;
|
||||||
username: string,
|
username: string;
|
||||||
title: string,
|
title: string;
|
||||||
authentication_token: string,
|
authentication_token: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IPlexLibraries {
|
export interface IPlexLibraries {
|
||||||
|
@ -19,27 +19,27 @@ export interface IMediaContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IDirectory {
|
export interface IDirectory {
|
||||||
key: string,
|
key: string;
|
||||||
title: string,
|
title: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IPlexServerViewModel {
|
export interface IPlexServerViewModel {
|
||||||
success: boolean,
|
success: boolean;
|
||||||
message: string,
|
message: string;
|
||||||
servers: IPlexServerResponse;
|
servers: IPlexServerResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IPlexServerResponse {
|
export interface IPlexServerResponse {
|
||||||
accessToken: string,
|
accessToken: string;
|
||||||
address: string,
|
address: string;
|
||||||
createdAt: string,
|
createdAt: string;
|
||||||
home: string,
|
home: string;
|
||||||
host: string,
|
host: string;
|
||||||
localAddresses: string,
|
localAddresses: string;
|
||||||
machineIdentifier: string,
|
machineIdentifier: string;
|
||||||
name: string,
|
name: string;
|
||||||
owned: string,
|
owned: string;
|
||||||
ownerId: string,
|
ownerId: string;
|
||||||
port: string,
|
port: string;
|
||||||
scheme: string,
|
scheme: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +1,19 @@
|
||||||
export interface IRadarrRootFolder {
|
import { ICutoff, IItem } from "./ICommon";
|
||||||
id: number,
|
|
||||||
path: string,
|
export interface IRadarrRootFolder {
|
||||||
freespace:number,
|
id: number;
|
||||||
|
path: string;
|
||||||
|
freespace: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IRadarrProfile {
|
export interface IRadarrProfile {
|
||||||
name: string,
|
name: string;
|
||||||
id: number,
|
id: number;
|
||||||
cutoff: ICutoff,
|
cutoff: ICutoff;
|
||||||
items:IItem[],
|
items: IItem[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IMinimumAvailability {
|
export interface IMinimumAvailability {
|
||||||
value: string,
|
value: string;
|
||||||
name:string,
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ICutoff {
|
|
||||||
id: number,
|
|
||||||
name:string,
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IItem {
|
|
||||||
allowed: boolean,
|
|
||||||
quality:IQuality,
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IQuality {
|
|
||||||
id: number,
|
|
||||||
name:string,
|
|
||||||
}
|
|
|
@ -1,5 +1,5 @@
|
||||||
export interface IRequestEngineResult {
|
export interface IRequestEngineResult {
|
||||||
requestAdded: boolean,
|
requestAdded: boolean;
|
||||||
message: string,
|
message: string;
|
||||||
errorMessage: string,
|
errorMessage: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,145 +1,140 @@
|
||||||
import { IUser } from './IUser';
|
import { IUser } from "./IUser";
|
||||||
|
|
||||||
export interface IMediaBase {
|
export interface IMediaBase {
|
||||||
imdbId: string,
|
imdbId: string;
|
||||||
id: number,
|
id: number;
|
||||||
providerId: number,
|
providerId: number;
|
||||||
title: string,
|
title: string;
|
||||||
overview: string,
|
overview: string;
|
||||||
posterPath: string,
|
posterPath: string;
|
||||||
releaseDate: Date,
|
releaseDate: Date;
|
||||||
status: string,
|
status: string;
|
||||||
requestedDate: Date,
|
requestedDate: Date;
|
||||||
approved: boolean,
|
approved: boolean;
|
||||||
type: RequestType,
|
type: RequestType;
|
||||||
requested: boolean,
|
requested: boolean;
|
||||||
available: boolean,
|
available: boolean;
|
||||||
otherMessage: string,
|
otherMessage: string;
|
||||||
adminNote: string,
|
adminNote: string;
|
||||||
requestedUser: string,
|
requestedUser: string;
|
||||||
issueId: number,
|
issueId: number;
|
||||||
denied: boolean,
|
denied: boolean;
|
||||||
deniedReason: string,
|
deniedReason: string;
|
||||||
released: boolean
|
released: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IMovieRequestModel extends IMediaBase {
|
//export interface IMovieRequestModel extends IMediaBase { }
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ITvRequestModel extends IMediaBase {
|
export interface ITvRequestModel extends IMediaBase {
|
||||||
imdbId: string,
|
imdbId: string;
|
||||||
tvDbId: string,
|
tvDbId: string;
|
||||||
childRequests: IChildTvRequest[]
|
childRequests: IChildTvRequest[];
|
||||||
rootFolderSelected: number,
|
rootFolderSelected: number;
|
||||||
firstAired: string,
|
firstAired: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IRequestCountModel {
|
export interface IRequestCountModel {
|
||||||
pending: number,
|
pending: number;
|
||||||
approved: number,
|
approved: number;
|
||||||
available: number
|
available: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IChildTvRequest extends IMediaBase {
|
export interface IChildTvRequest extends IMediaBase {
|
||||||
requestAll: boolean,
|
requestAll: boolean;
|
||||||
seasonRequests: ISeasonRequests[],
|
seasonRequests: ISeasonRequests[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ISeasonRequests {
|
export interface ISeasonRequests {
|
||||||
seasonNumber: number,
|
seasonNumber: number;
|
||||||
episodes: IEpisodesRequested[],
|
episodes: IEpisodesRequested[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEpisodesRequested {
|
export interface IEpisodesRequested {
|
||||||
episodeNumber: number,
|
episodeNumber: number;
|
||||||
title: string,
|
title: string;
|
||||||
airDate: Date,
|
airDate: Date;
|
||||||
url: string,
|
url: string;
|
||||||
requested: boolean,
|
requested: boolean;
|
||||||
status: string,
|
status: string;
|
||||||
available: boolean
|
available: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export enum RequestType {
|
export enum RequestType {
|
||||||
movie = 1,
|
movie = 1,
|
||||||
tvShow = 2
|
tvShow = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IRequestsPageScroll {
|
export interface IRequestsPageScroll {
|
||||||
count: number,
|
count: number;
|
||||||
position: number
|
position: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IRequestGrid<T> {
|
export interface IRequestGrid<T> {
|
||||||
available: T[],
|
available: T[];
|
||||||
new: T[],
|
new: T[];
|
||||||
approved: T[]
|
approved: T[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// NEW WORLD
|
// NEW WORLD
|
||||||
|
|
||||||
export interface IMovieRequests extends IFullBaseRequest {
|
export interface IMovieRequests extends IFullBaseRequest {
|
||||||
theMovieDbId: number,
|
theMovieDbId: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IFullBaseRequest extends IBaseRequest {
|
export interface IFullBaseRequest extends IBaseRequest {
|
||||||
imdbId: string,
|
imdbId: string;
|
||||||
overview: string,
|
overview: string;
|
||||||
title: string,
|
title: string;
|
||||||
posterPath: string,
|
posterPath: string;
|
||||||
releaseDate: Date,
|
releaseDate: Date;
|
||||||
status: string,
|
status: string;
|
||||||
released: boolean,
|
released: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IBaseRequest {
|
export interface IBaseRequest {
|
||||||
id: number,
|
id: number;
|
||||||
approved: boolean,
|
approved: boolean;
|
||||||
requestedDate: Date,
|
requestedDate: Date;
|
||||||
available: boolean,
|
available: boolean;
|
||||||
requestedUserId: number,
|
requestedUserId: number;
|
||||||
issueId: number,
|
issueId: number;
|
||||||
denied: boolean,
|
denied: boolean;
|
||||||
deniedReason: string,
|
deniedReason: string;
|
||||||
requestType: RequestType,
|
requestType: RequestType;
|
||||||
requestedUser: IUser,
|
requestedUser: IUser;
|
||||||
canApprove:boolean,
|
canApprove: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ITvRequests {
|
export interface ITvRequests {
|
||||||
id: number,
|
id: number;
|
||||||
imdbId: string,
|
imdbId: string;
|
||||||
rootFolder: number,
|
rootFolder: number;
|
||||||
overview: string,
|
overview: string;
|
||||||
title: string,
|
title: string;
|
||||||
posterPath: string,
|
posterPath: string;
|
||||||
releaseDate: Date,
|
releaseDate: Date;
|
||||||
status: string,
|
status: string;
|
||||||
childRequests: IChildRequests[]
|
childRequests: IChildRequests[];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IChildRequests extends IBaseRequest {
|
export interface IChildRequests extends IBaseRequest {
|
||||||
seasonRequests: INewSeasonRequests[]
|
seasonRequests: INewSeasonRequests[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface INewSeasonRequests {
|
export interface INewSeasonRequests {
|
||||||
id: number,
|
id: number;
|
||||||
seasonNumber: number,
|
seasonNumber: number;
|
||||||
episodes: IEpisodesRequests[]
|
episodes: IEpisodesRequests[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEpisodesRequests {
|
export interface IEpisodesRequests {
|
||||||
id: number,
|
id: number;
|
||||||
episodeNumber: number,
|
episodeNumber: number;
|
||||||
title: string,
|
title: string;
|
||||||
airDate: Date,
|
airDate: Date;
|
||||||
url: string,
|
url: string;
|
||||||
available: boolean,
|
available: boolean;
|
||||||
requested: boolean,
|
requested: boolean;
|
||||||
approved: boolean,
|
approved: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
export interface ISearchMovieResult {
|
export interface ISearchMovieResult {
|
||||||
backdropPath: string,
|
backdropPath: string;
|
||||||
adult: boolean,
|
adult: boolean;
|
||||||
overview: string,
|
overview: string;
|
||||||
releaseDate: Date,
|
releaseDate: Date;
|
||||||
genreIds: number[],
|
genreIds: number[];
|
||||||
id: number,
|
id: number;
|
||||||
originalTitle: string,
|
originalTitle: string;
|
||||||
originalLanguage: string,
|
originalLanguage: string;
|
||||||
title: string,
|
title: string;
|
||||||
posterPath: string,
|
posterPath: string;
|
||||||
popularity: number,
|
popularity: number;
|
||||||
voteCount: number,
|
voteCount: number;
|
||||||
video: boolean,
|
video: boolean;
|
||||||
voteAverage: number,
|
voteAverage: number;
|
||||||
alreadyInCp: boolean,
|
alreadyInCp: boolean;
|
||||||
trailer: string,
|
trailer: string;
|
||||||
homepage: string,
|
homepage: string;
|
||||||
imdbId: string,
|
imdbId: string;
|
||||||
approved: boolean,
|
approved: boolean;
|
||||||
requested: boolean,
|
requested: boolean;
|
||||||
available: boolean,
|
available: boolean;
|
||||||
plexUrl: string,
|
plexUrl: string;
|
||||||
quality:string
|
quality: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +1,32 @@
|
||||||
import { ISeasonRequests } from "./IRequestModel";
|
import { ISeasonRequests } from "./IRequestModel";
|
||||||
|
|
||||||
export interface ISearchTvResult {
|
export interface ISearchTvResult {
|
||||||
id: number,
|
id: number;
|
||||||
title: string, // used in the request
|
title: string; // used in the request
|
||||||
aliases: string[],
|
aliases: string[];
|
||||||
banner: string,
|
banner: string;
|
||||||
seriesId: number,
|
seriesId: number;
|
||||||
status: string,
|
status: string;
|
||||||
firstAired: string,
|
firstAired: string;
|
||||||
network: string,
|
network: string;
|
||||||
networkId: string,
|
networkId: string;
|
||||||
runtime: string,
|
runtime: string;
|
||||||
genre: string[],
|
genre: string[];
|
||||||
overview: string,
|
overview: string;
|
||||||
lastUpdated: number,
|
lastUpdated: number;
|
||||||
airsDayOfWeek: string,
|
airsDayOfWeek: string;
|
||||||
airsTime: string,
|
airsTime: string;
|
||||||
rating: string,
|
rating: string;
|
||||||
imdbId: string,
|
imdbId: string;
|
||||||
siteRating: number,
|
siteRating: number;
|
||||||
trailer: string,
|
trailer: string;
|
||||||
homepage:string,
|
homepage: string;
|
||||||
seasonsRequests: ISeasonRequests[],
|
seasonsRequests: ISeasonRequests[];
|
||||||
requestAll:boolean,
|
requestAll: boolean;
|
||||||
approved: boolean,
|
approved: boolean;
|
||||||
requested: boolean,
|
requested: boolean;
|
||||||
available: boolean,
|
available: boolean;
|
||||||
plexUrl: string,
|
plexUrl: string;
|
||||||
firstSeason: boolean,
|
firstSeason: boolean;
|
||||||
latestSeason:boolean,
|
latestSeason: boolean;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,101 +1,99 @@
|
||||||
export interface ISettings {
|
import { ISettings } from "./ICommon";
|
||||||
id: number
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IExternalSettings extends ISettings {
|
export interface IExternalSettings extends ISettings {
|
||||||
ssl: boolean,
|
ssl: boolean;
|
||||||
subDir: string,
|
subDir: string;
|
||||||
ip: string,
|
ip: string;
|
||||||
port: number,
|
port: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IOmbiSettings extends ISettings {
|
export interface IOmbiSettings extends ISettings {
|
||||||
port: number,
|
port: number;
|
||||||
//baseUrl:string,
|
//baseUrl:string,
|
||||||
collectAnalyticData: boolean,
|
collectAnalyticData: boolean;
|
||||||
wizard: boolean,
|
wizard: boolean;
|
||||||
apiKey: string,
|
apiKey: string;
|
||||||
externalUrl: string,
|
externalUrl: string;
|
||||||
allowExternalUsersToAuthenticate:boolean,
|
allowExternalUsersToAuthenticate: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEmbySettings extends ISettings {
|
export interface IEmbySettings extends ISettings {
|
||||||
enable: boolean,
|
enable: boolean;
|
||||||
servers: IEmbyServer[]
|
servers: IEmbyServer[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEmbyServer extends IExternalSettings {
|
export interface IEmbyServer extends IExternalSettings {
|
||||||
name:string,
|
name: string;
|
||||||
apiKey: string,
|
apiKey: string;
|
||||||
administratorId: string,
|
administratorId: string;
|
||||||
enableEpisodeSearching: boolean,
|
enableEpisodeSearching: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IPlexSettings extends ISettings {
|
export interface IPlexSettings extends ISettings {
|
||||||
|
|
||||||
enable: boolean,
|
enable: boolean;
|
||||||
servers: IPlexServer[]
|
servers: IPlexServer[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IPlexServer extends IExternalSettings {
|
export interface IPlexServer extends IExternalSettings {
|
||||||
name: string,
|
name: string;
|
||||||
enableEpisodeSearching: boolean,
|
enableEpisodeSearching: boolean;
|
||||||
plexAuthToken: string,
|
plexAuthToken: string;
|
||||||
machineIdentifier: string,
|
machineIdentifier: string;
|
||||||
plexSelectedLibraries: IPlexLibraries[],
|
plexSelectedLibraries: IPlexLibrariesSettings[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IPlexLibraries {
|
export interface IPlexLibrariesSettings {
|
||||||
key: string,
|
key: string;
|
||||||
title: string,
|
title: string;
|
||||||
enabled: boolean,
|
enabled: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ISonarrSettings extends IExternalSettings {
|
export interface ISonarrSettings extends IExternalSettings {
|
||||||
apiKey: string,
|
apiKey: string;
|
||||||
enabled: boolean,
|
enabled: boolean;
|
||||||
qualityProfile: string,
|
qualityProfile: string;
|
||||||
seasonFolders: boolean,
|
seasonFolders: boolean;
|
||||||
rootPath: string,
|
rootPath: string;
|
||||||
fullRootPath: string,
|
fullRootPath: string;
|
||||||
addOnly:boolean,
|
addOnly: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IRadarrSettings extends IExternalSettings {
|
export interface IRadarrSettings extends IExternalSettings {
|
||||||
enabled: boolean,
|
enabled: boolean;
|
||||||
apiKey: string,
|
apiKey: string;
|
||||||
defaultQualityProfile: string,
|
defaultQualityProfile: string;
|
||||||
defaultRootPath: string,
|
defaultRootPath: string;
|
||||||
fullRootPath: string,
|
fullRootPath: string;
|
||||||
addOnly: boolean,
|
addOnly: boolean;
|
||||||
minimumAvailability:string,
|
minimumAvailability: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ILandingPageSettings extends ISettings {
|
export interface ILandingPageSettings extends ISettings {
|
||||||
enabled: boolean,
|
enabled: boolean;
|
||||||
|
|
||||||
noticeEnabled: boolean,
|
noticeEnabled: boolean;
|
||||||
noticeText: string,
|
noticeText: string;
|
||||||
|
|
||||||
timeLimit: boolean,
|
timeLimit: boolean;
|
||||||
startDateTime: Date,
|
startDateTime: Date;
|
||||||
endDateTime: Date,
|
endDateTime: Date;
|
||||||
expired:boolean,
|
expired: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ICustomizationSettings extends ISettings {
|
export interface ICustomizationSettings extends ISettings {
|
||||||
applicationName: string,
|
applicationName: string;
|
||||||
logo: string,
|
logo: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IAuthenticationSettings extends ISettings {
|
export interface IAuthenticationSettings extends ISettings {
|
||||||
|
|
||||||
allowExternalUsersToAuthenticate: boolean,
|
allowExternalUsersToAuthenticate: boolean;
|
||||||
// Password
|
// Password
|
||||||
|
|
||||||
requiredDigit: boolean,
|
requiredDigit: boolean;
|
||||||
requiredLength: number,
|
requiredLength: number;
|
||||||
requiredLowercase: boolean,
|
requiredLowercase: boolean;
|
||||||
requireNonAlphanumeric: boolean,
|
requireNonAlphanumeric: boolean;
|
||||||
requireUppercase:boolean,
|
requireUppercase: boolean;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +1,14 @@
|
||||||
export interface ISonarrRootFolder {
|
import { ICutoff, IItem } from "./ICommon";
|
||||||
id: number,
|
|
||||||
path: string,
|
export interface ISonarrRootFolder {
|
||||||
freespace:number,
|
id: number;
|
||||||
|
path: string;
|
||||||
|
freespace: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ISonarrProfile {
|
export interface ISonarrProfile {
|
||||||
name: string,
|
name: string;
|
||||||
id: number,
|
id: number;
|
||||||
cutoff: ICutoff,
|
cutoff: ICutoff;
|
||||||
items:IItem[],
|
items: IItem[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ICutoff {
|
|
||||||
id: number,
|
|
||||||
name:string,
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IItem {
|
|
||||||
allowed: boolean,
|
|
||||||
quality:IQuality,
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IQuality {
|
|
||||||
id: number,
|
|
||||||
name:string,
|
|
||||||
}
|
|
|
@ -1,40 +1,39 @@
|
||||||
export interface IUser {
|
export interface IUser {
|
||||||
id: string,
|
id: string;
|
||||||
username: string,
|
username: string;
|
||||||
alias: string,
|
alias: string;
|
||||||
claims: ICheckbox[],
|
claims: ICheckbox[];
|
||||||
emailAddress: string,
|
emailAddress: string;
|
||||||
password: string,
|
password: string;
|
||||||
userType: UserType,
|
userType: UserType;
|
||||||
isSetup:boolean,
|
isSetup: boolean;
|
||||||
// FOR UI
|
// FOR UI
|
||||||
checked: boolean,
|
checked: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum UserType {
|
export enum UserType {
|
||||||
LocalUser = 1,
|
LocalUser = 1,
|
||||||
PlexUser = 2,
|
PlexUser = 2,
|
||||||
EmbyUser = 3
|
EmbyUser = 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export interface ICheckbox {
|
export interface ICheckbox {
|
||||||
value: string,
|
value: string;
|
||||||
enabled: boolean,
|
enabled: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IIdentityResult {
|
export interface IIdentityResult {
|
||||||
errors: string[],
|
errors: string[];
|
||||||
successful: boolean,
|
successful: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IUpdateLocalUser extends IUser {
|
export interface IUpdateLocalUser extends IUser {
|
||||||
currentPassword: string,
|
currentPassword: string;
|
||||||
confirmNewPassword: string
|
confirmNewPassword: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IResetPasswordToken{
|
export interface IResetPasswordToken {
|
||||||
email:string,
|
email: string;
|
||||||
token:string,
|
token: string;
|
||||||
password: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,36 +1,34 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from "@angular/core";
|
||||||
import { SettingsService } from '../services/settings.service';
|
import { IMediaServerStatus } from "../interfaces";
|
||||||
import { LandingPageService } from '../services/landingpage.service';
|
import { ICustomizationSettings, ILandingPageSettings } from "../interfaces";
|
||||||
import { ILandingPageSettings, ICustomizationSettings } from '../interfaces/ISettings';
|
import { LandingPageService } from "../services";
|
||||||
import { IMediaServerStatus } from '../interfaces/IMediaServerStatus';
|
import { SettingsService } from "../services";
|
||||||
|
|
||||||
import { DomSanitizer } from '@angular/platform-browser';
|
import { DomSanitizer } from "@angular/platform-browser";
|
||||||
import { ImageService } from '../services/image.service';
|
import { ImageService } from "../services";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
templateUrl: "./landingpage.component.html",
|
||||||
templateUrl: './landingpage.component.html',
|
styleUrls: ["./landingpage.component.scss"],
|
||||||
styleUrls: ['./landingpage.component.scss']
|
|
||||||
})
|
})
|
||||||
export class LandingPageComponent implements OnInit {
|
export class LandingPageComponent implements OnInit {
|
||||||
|
|
||||||
|
public customizationSettings: ICustomizationSettings;
|
||||||
|
public landingPageSettings: ILandingPageSettings;
|
||||||
|
public background: any;
|
||||||
|
public mediaServerStatus: IMediaServerStatus;
|
||||||
|
|
||||||
constructor(private settingsService: SettingsService,
|
constructor(private settingsService: SettingsService,
|
||||||
private images: ImageService, private sanitizer: DomSanitizer, private landingPageService: LandingPageService) { }
|
private images: ImageService, private sanitizer: DomSanitizer, private landingPageService: LandingPageService) { }
|
||||||
|
|
||||||
customizationSettings : ICustomizationSettings;
|
public ngOnInit() {
|
||||||
landingPageSettings: ILandingPageSettings;
|
|
||||||
background: any;
|
|
||||||
|
|
||||||
mediaServerStatus: IMediaServerStatus;
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
this.settingsService.getCustomization().subscribe(x => this.customizationSettings = x);
|
this.settingsService.getCustomization().subscribe(x => this.customizationSettings = x);
|
||||||
this.settingsService.getLandingPage().subscribe(x => this.landingPageSettings = x);
|
this.settingsService.getLandingPage().subscribe(x => this.landingPageSettings = x);
|
||||||
this.images.getRandomBackground().subscribe(x => {
|
this.images.getRandomBackground().subscribe(x => {
|
||||||
this.background = this.sanitizer.bypassSecurityTrustStyle('linear-gradient(-10deg, transparent 20%, rgba(0,0,0,0.7) 20.0%, rgba(0,0,0,0.7) 80.0%, transparent 80%), url(' + x.url + ')');
|
this.background = this.sanitizer.bypassSecurityTrustStyle("linear-gradient(-10deg, transparent 20%, rgba(0,0,0,0.7) 20.0%, rgba(0,0,0,0.7) 80.0%, transparent 80%), url(" + x.url + ")");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.landingPageService.getServerStatus().subscribe(x => this.mediaServerStatus = x);
|
this.landingPageService.getServerStatus().subscribe(x => this.mediaServerStatus = x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,80 +1,76 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from "@angular/core";
|
||||||
import { Router, ActivatedRoute } from '@angular/router';
|
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
|
||||||
import { FormGroup, Validators, FormBuilder } from '@angular/forms';
|
import { ActivatedRoute, Router } from "@angular/router";
|
||||||
|
|
||||||
import { AuthService } from '../auth/auth.service';
|
import { AuthService } from "../auth/auth.service";
|
||||||
import { StatusService } from '../services/status.service';
|
import { ICustomizationSettings } from "../interfaces";
|
||||||
import { NotificationService } from '../services/notification.service';
|
import { NotificationService } from "../services";
|
||||||
import { SettingsService } from '../services/settings.service';
|
import { SettingsService } from "../services";
|
||||||
import { ICustomizationSettings } from '../interfaces/ISettings';
|
import { StatusService } 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({
|
@Component({
|
||||||
templateUrl: './login.component.html',
|
templateUrl: "./login.component.html",
|
||||||
styleUrls: ['./login.component.scss']
|
styleUrls: ["./login.component.scss"],
|
||||||
})
|
})
|
||||||
export class LoginComponent implements OnInit {
|
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,
|
constructor(private authService: AuthService, private router: Router, private notify: NotificationService, private status: StatusService,
|
||||||
private fb: FormBuilder, private settingsService: SettingsService, private images: ImageService, private sanitizer: DomSanitizer,
|
private fb: FormBuilder, private settingsService: SettingsService, private images: ImageService, private sanitizer: DomSanitizer,
|
||||||
private route: ActivatedRoute) {
|
private route: ActivatedRoute) {
|
||||||
this.form = this.fb.group({
|
this.form = this.fb.group({
|
||||||
username: ["", [Validators.required]],
|
username: ["", [Validators.required]],
|
||||||
password: ["", [Validators.required]],
|
password: ["", [Validators.required]],
|
||||||
rememberMe: [false]
|
rememberMe: [false],
|
||||||
});
|
});
|
||||||
|
|
||||||
this.status.getWizardStatus().subscribe(x => {
|
this.status.getWizardStatus().subscribe(x => {
|
||||||
if (!x.result) {
|
if (!x.result) {
|
||||||
this.router.navigate(['Wizard']);
|
this.router.navigate(["Wizard"]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.route.params
|
this.route.params
|
||||||
.subscribe(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 => {
|
this.settingsService.getLandingPage().subscribe(x => {
|
||||||
if (x.enabled && !this.landingFlag) {
|
if (x.enabled && !this.landingFlag) {
|
||||||
this.router.navigate(['landingpage']);
|
this.router.navigate(["landingpage"]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.settingsService.getCustomization().subscribe(x => this.customizationSettings = x);
|
this.settingsService.getCustomization().subscribe(x => this.customizationSettings = x);
|
||||||
this.images.getRandomBackground().subscribe(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 + ")");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public onSubmit(form: FormGroup) {
|
||||||
onSubmit(form: FormGroup): void {
|
|
||||||
if (form.invalid) {
|
if (form.invalid) {
|
||||||
this.notify.error("Validation", "Please check your entered values");
|
this.notify.error("Validation", "Please check your entered values");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var value = form.value;
|
const value = form.value;
|
||||||
this.authService.login({ password: value.password, username: value.username, rememberMe:value.rememberMe })
|
this.authService.login({ password: value.password, username: value.username, rememberMe:value.rememberMe })
|
||||||
.subscribe(x => {
|
.subscribe(x => {
|
||||||
localStorage.setItem("id_token", x.access_token);
|
localStorage.setItem("id_token", x.access_token);
|
||||||
|
|
||||||
if (this.authService.loggedIn()) {
|
if (this.authService.loggedIn()) {
|
||||||
this.router.navigate(['search']);
|
this.router.navigate(["search"]);
|
||||||
} else {
|
} else {
|
||||||
this.notify.error("Could not log in", "Incorrect username or password");
|
this.notify.error("Could not log in", "Incorrect username or password");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}, err => this.notify.error("Could not log in", "Incorrect username or password"));
|
}, err => this.notify.error("Could not log in", "Incorrect username or password"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,37 +1,35 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from "@angular/core";
|
||||||
import { FormGroup, Validators, FormBuilder } from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
|
||||||
|
|
||||||
import { IdentityService } from '../services/identity.service';
|
import { ICustomizationSettings } from "../interfaces";
|
||||||
import { NotificationService } from '../services/notification.service';
|
import { IdentityService } from "../services";
|
||||||
import { SettingsService } from '../services/settings.service';
|
import { NotificationService } from "../services";
|
||||||
import { ICustomizationSettings } from '../interfaces/ISettings';
|
import { SettingsService } from "../services";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './resetpassword.component.html',
|
templateUrl: "./resetpassword.component.html",
|
||||||
styleUrls: ['./login.component.scss']
|
styleUrls: ["./login.component.scss"],
|
||||||
})
|
})
|
||||||
export class ResetPasswordComponent implements OnInit {
|
export class ResetPasswordComponent implements OnInit {
|
||||||
|
|
||||||
|
public form: FormGroup;
|
||||||
|
public customizationSettings: ICustomizationSettings;
|
||||||
|
|
||||||
constructor(private identityService: IdentityService, private notify: NotificationService,
|
constructor(private identityService: IdentityService, private notify: NotificationService,
|
||||||
private fb: FormBuilder, private settingsService: SettingsService) {
|
private fb: FormBuilder, private settingsService: SettingsService) {
|
||||||
this.form = this.fb.group({
|
this.form = this.fb.group({
|
||||||
email: ["", [Validators.required]],
|
email: ["", [Validators.required]],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
form: FormGroup;
|
public ngOnInit() {
|
||||||
customizationSettings: ICustomizationSettings;
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
this.settingsService.getCustomization().subscribe(x => this.customizationSettings = x);
|
this.settingsService.getCustomization().subscribe(x => this.customizationSettings = x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public onSubmit(form: FormGroup) {
|
||||||
onSubmit(form: FormGroup): void {
|
|
||||||
if (form.invalid) {
|
if (form.invalid) {
|
||||||
this.notify.error("Validation", "Email address is required");
|
this.notify.error("Validation", "Email address is required");
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
this.identityService.submitResetPassword(form.value.email).subscribe(x => {
|
this.identityService.submitResetPassword(form.value.email).subscribe(x => {
|
||||||
x.errors.forEach((val) => {
|
x.errors.forEach((val) => {
|
||||||
|
@ -39,4 +37,4 @@ export class ResetPasswordComponent implements OnInit {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,53 +1,51 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from "@angular/core";
|
||||||
import { Router } from '@angular/router';
|
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
|
||||||
import { ActivatedRoute, Params } from '@angular/router';
|
import { Router } from "@angular/router";
|
||||||
import { FormGroup, Validators, FormBuilder } from '@angular/forms';
|
import { ActivatedRoute, Params } from "@angular/router";
|
||||||
|
|
||||||
import { IdentityService } from '../services/identity.service';
|
import { ICustomizationSettings } from "../interfaces";
|
||||||
import { NotificationService } from '../services/notification.service';
|
import { IResetPasswordToken } from "../interfaces";
|
||||||
import { SettingsService } from '../services/settings.service';
|
import { IdentityService } from "../services";
|
||||||
import { ICustomizationSettings } from '../interfaces/ISettings';
|
import { NotificationService } from "../services";
|
||||||
import { IResetPasswordToken } from '../interfaces/IUser';
|
import { SettingsService } from "../services";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './tokenresetpassword.component.html',
|
templateUrl: "./tokenresetpassword.component.html",
|
||||||
styleUrls: ['./login.component.scss']
|
styleUrls: ["./login.component.scss"],
|
||||||
})
|
})
|
||||||
export class TokenResetPasswordComponent implements OnInit {
|
export class TokenResetPasswordComponent implements OnInit {
|
||||||
|
|
||||||
|
public form: FormGroup;
|
||||||
|
public customizationSettings: ICustomizationSettings;
|
||||||
|
|
||||||
constructor(private identityService: IdentityService, private router: Router, private route: ActivatedRoute, private notify: NotificationService,
|
constructor(private identityService: IdentityService, private router: Router, private route: ActivatedRoute, private notify: NotificationService,
|
||||||
private fb: FormBuilder, private settingsService: SettingsService) {
|
private fb: FormBuilder, private settingsService: SettingsService) {
|
||||||
|
|
||||||
this.route.queryParams
|
this.route.queryParams
|
||||||
.subscribe((params:Params) => {
|
.subscribe((params: Params) => {
|
||||||
debugger;
|
|
||||||
this.form = this.fb.group({
|
this.form = this.fb.group({
|
||||||
email: ["", [Validators.required]],
|
email: ["", [Validators.required]],
|
||||||
password: ["", [Validators.required]],
|
password: ["", [Validators.required]],
|
||||||
confirmPassword: ["", [Validators.required]],
|
confirmPassword: ["", [Validators.required]],
|
||||||
token: [params['token']]
|
token: [params.token],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
form: FormGroup;
|
public ngOnInit() {
|
||||||
customizationSettings: ICustomizationSettings;
|
|
||||||
|
|
||||||
|
|
||||||
ngOnInit() : void {
|
|
||||||
this.settingsService.getCustomization().subscribe(x => this.customizationSettings = x);
|
this.settingsService.getCustomization().subscribe(x => this.customizationSettings = x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public onSubmit(form: FormGroup) {
|
||||||
onSubmit(form: FormGroup): void {
|
|
||||||
if (form.invalid) {
|
if (form.invalid) {
|
||||||
this.notify.error("Validation", "Email address is required");
|
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 => {
|
this.identityService.resetPassword(token).subscribe(x => {
|
||||||
if (x.successful) {
|
if (x.successful) {
|
||||||
this.notify.success("Success", `Your Password has been reset`)
|
this.notify.success("Success", `Your Password has been reset`);
|
||||||
this.router.navigate(['login']);
|
this.router.navigate(["login"]);
|
||||||
} else {
|
} else {
|
||||||
x.errors.forEach((val) => {
|
x.errors.forEach((val) => {
|
||||||
this.notify.error("Error", val);
|
this.notify.error("Error", val);
|
||||||
|
@ -56,4 +54,4 @@ export class TokenResetPasswordComponent implements OnInit {
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
import { Pipe, PipeTransform } from '@angular/core';
|
import { Pipe, PipeTransform } from "@angular/core";
|
||||||
|
|
||||||
@Pipe({
|
@Pipe({
|
||||||
name: 'humanize'
|
name: "humanize",
|
||||||
})
|
})
|
||||||
export class HumanizePipe implements PipeTransform {
|
export class HumanizePipe implements PipeTransform {
|
||||||
transform(value: string) {
|
public transform(value: string) {
|
||||||
if ((typeof value) !== 'string') {
|
if ((typeof value) !== "string") {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
value = value.split(/(?=[A-Z])/).join(' ');
|
value = value.split(/(?=[A-Z])/).join(" ");
|
||||||
value = value[0].toUpperCase() + value.slice(1);
|
value = value[0].toUpperCase() + value.slice(1);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { NgModule, ModuleWithProviders } from '@angular/core';
|
import { ModuleWithProviders, NgModule } from "@angular/core";
|
||||||
import { HumanizePipe } from './HumanizePipe';
|
import { HumanizePipe } from "./HumanizePipe";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [],
|
imports: [],
|
||||||
|
@ -8,10 +8,10 @@ import { HumanizePipe } from './HumanizePipe';
|
||||||
})
|
})
|
||||||
export class PipeModule {
|
export class PipeModule {
|
||||||
|
|
||||||
static forRoot() : ModuleWithProviders {
|
public static forRoot(): ModuleWithProviders {
|
||||||
return {
|
return {
|
||||||
ngModule: PipeModule,
|
ngModule: PipeModule,
|
||||||
providers: [],
|
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({
|
@Component({
|
||||||
selector: 'request-card',
|
selector: "request-card",
|
||||||
templateUrl: './request-card.component.html'
|
templateUrl: "./request-card.component.html",
|
||||||
})
|
})
|
||||||
export class RequestCardComponent {
|
export class RequestCardComponent {
|
||||||
@Input() request: IMediaBase;
|
@Input() public request: IMediaBase;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//import { Component, OnInit } from '@angular/core';
|
//import { Component, OnInit } from '@angular/core';
|
||||||
//import { DragulaService } from 'ng2-dragula/ng2-dragula';
|
//import { DragulaService } from 'ng2-dragula/ng2-dragula';
|
||||||
//import { RequestService } from '../services/request.service';
|
//import { RequestService } from '../services";
|
||||||
//import { ITvRequests, IMovieRequests, IRequestGrid } from '../interfaces/IRequestModel';
|
//import { ITvRequests, IMovieRequests, IRequestGrid } from '../interfaces";
|
||||||
|
|
||||||
//@Component({
|
//@Component({
|
||||||
// templateUrl: './request-grid.component.html'
|
// templateUrl: './request-grid.component.html'
|
||||||
|
@ -13,8 +13,7 @@
|
||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// ngOnInit() {
|
||||||
// ngOnInit(): void {
|
|
||||||
// this.requestService.getMovieGrid().subscribe(x => {
|
// this.requestService.getMovieGrid().subscribe(x => {
|
||||||
// this.movieRequests = x;
|
// this.movieRequests = x;
|
||||||
// });
|
// });
|
||||||
|
@ -23,8 +22,7 @@
|
||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
// movieRequests: IRequestGrid<IMovieRequests>;
|
// movieRequests: IRequestGrid<IMovieRequests>;
|
||||||
// tvRequests: IRequestGrid<ITvRequests>;
|
// tvRequests: IRequestGrid<ITvRequests>;
|
||||||
|
|
||||||
//}
|
//}
|
||||||
|
|
|
@ -1,27 +1,38 @@
|
||||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
import { Component, OnDestroy, OnInit } from "@angular/core";
|
||||||
import { Subject } from 'rxjs/Subject';
|
import "rxjs/add/operator/debounceTime";
|
||||||
import 'rxjs/add/operator/debounceTime';
|
import "rxjs/add/operator/distinctUntilChanged";
|
||||||
import 'rxjs/add/operator/distinctUntilChanged';
|
import "rxjs/add/operator/map";
|
||||||
import 'rxjs/add/operator/map';
|
import "rxjs/add/operator/takeUntil";
|
||||||
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 { AuthService } from "../auth/auth.service";
|
||||||
import 'rxjs/add/operator/distinctUntilChanged';
|
import { RequestService } from "../services";
|
||||||
import 'rxjs/add/operator/map';
|
|
||||||
|
|
||||||
import { RequestService } from '../services/request.service';
|
import { IMovieRequests } from "../interfaces";
|
||||||
import { AuthService } from '../auth/auth.service';
|
|
||||||
|
|
||||||
import { IMovieRequests } from '../interfaces/IRequestModel';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'movie-requests',
|
selector: "movie-requests",
|
||||||
templateUrl: './movierequests.component.html'
|
templateUrl: "./movierequests.component.html",
|
||||||
})
|
})
|
||||||
export class MovieRequestsComponent implements OnInit, OnDestroy {
|
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,
|
constructor(private requestService: RequestService,
|
||||||
private auth:AuthService) {
|
private auth: AuthService) {
|
||||||
this.searchChanged
|
this.searchChanged
|
||||||
.debounceTime(600) // Wait Xms afterthe last event before emitting last event
|
.debounceTime(600) // Wait Xms afterthe last event before emitting last event
|
||||||
.distinctUntilChanged() // only emit if value is different from previous value
|
.distinctUntilChanged() // only emit if value is different from previous value
|
||||||
|
@ -38,60 +49,50 @@ export class MovieRequestsComponent implements OnInit, OnDestroy {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
movieRequests: IMovieRequests[];
|
public ngOnInit() {
|
||||||
|
|
||||||
searchChanged: Subject<string> = new Subject<string>();
|
|
||||||
searchText: string;
|
|
||||||
|
|
||||||
isAdmin: boolean;
|
|
||||||
|
|
||||||
private currentlyLoaded: number;
|
|
||||||
private amountToLoad: number;
|
|
||||||
|
|
||||||
|
|
||||||
private subscriptions = new Subject<void>();
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
this.amountToLoad = 5;
|
this.amountToLoad = 5;
|
||||||
this.currentlyLoaded = 5;
|
this.currentlyLoaded = 5;
|
||||||
this.loadInit();
|
this.loadInit();
|
||||||
this.isAdmin = this.auth.hasRole("admin");
|
this.isAdmin = this.auth.hasRole("admin");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public loadMore() {
|
||||||
|
|
||||||
loadMore() {
|
|
||||||
this.loadRequests(this.amountToLoad, this.currentlyLoaded);
|
this.loadRequests(this.amountToLoad, this.currentlyLoaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
search(text: any) {
|
public search(text: any) {
|
||||||
this.searchChanged.next(text.target.value);
|
this.searchChanged.next(text.target.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
removeRequest(request: IMovieRequests) {
|
public removeRequest(request: IMovieRequests) {
|
||||||
this.requestService.removeMovieRequest(request);
|
this.requestService.removeMovieRequest(request);
|
||||||
this.removeRequestFromUi(request);
|
this.removeRequestFromUi(request);
|
||||||
this.loadRequests(1, this.currentlyLoaded);
|
this.loadRequests(1, this.currentlyLoaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
changeAvailability(request: IMovieRequests, available: boolean) {
|
public changeAvailability(request: IMovieRequests, available: boolean) {
|
||||||
request.available = available;
|
request.available = available;
|
||||||
|
|
||||||
this.updateRequest(request);
|
this.updateRequest(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
approve(request: IMovieRequests) {
|
public approve(request: IMovieRequests) {
|
||||||
request.approved = true;
|
request.approved = true;
|
||||||
request.denied = false;
|
request.denied = false;
|
||||||
this.updateRequest(request);
|
this.updateRequest(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
deny(request: IMovieRequests) {
|
public deny(request: IMovieRequests) {
|
||||||
request.approved = false;
|
request.approved = false;
|
||||||
request.denied = true;
|
request.denied = true;
|
||||||
this.updateRequest(request);
|
this.updateRequest(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ngOnDestroy() {
|
||||||
|
this.subscriptions.next();
|
||||||
|
this.subscriptions.complete();
|
||||||
|
}
|
||||||
|
|
||||||
private loadRequests(amountToLoad: number, currentlyLoaded: number) {
|
private loadRequests(amountToLoad: number, currentlyLoaded: number) {
|
||||||
this.requestService.getMovieRequests(amountToLoad, currentlyLoaded + 1)
|
this.requestService.getMovieRequests(amountToLoad, currentlyLoaded + 1)
|
||||||
.takeUntil(this.subscriptions)
|
.takeUntil(this.subscriptions)
|
||||||
|
@ -119,14 +120,9 @@ export class MovieRequestsComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
private removeRequestFromUi(key: IMovieRequests) {
|
private removeRequestFromUi(key: IMovieRequests) {
|
||||||
var index = this.movieRequests.indexOf(key, 0);
|
const index = this.movieRequests.indexOf(key, 0);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
this.movieRequests.splice(index, 1);
|
this.movieRequests.splice(index, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ngOnDestroy(): void {
|
|
||||||
this.subscriptions.next();
|
|
||||||
this.subscriptions.complete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component } from "@angular/core";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './request.component.html'
|
templateUrl: "./request.component.html",
|
||||||
})
|
})
|
||||||
export class RequestComponent {
|
export class RequestComponent {
|
||||||
|
|
||||||
showMovie = true;
|
public showMovie = true;
|
||||||
showTv = false;
|
public showTv = false;
|
||||||
|
|
||||||
selectTab() {
|
public selectTab() {
|
||||||
this.showMovie = !this.showMovie;
|
this.showMovie = !this.showMovie;
|
||||||
this.showTv = !this.showTv;
|
this.showTv = !this.showTv;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,29 +1,29 @@
|
||||||
import { NgModule, } from '@angular/core';
|
import { CommonModule } from "@angular/common";
|
||||||
import { CommonModule } from '@angular/common';
|
import { NgModule } from "@angular/core";
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from "@angular/forms";
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
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
|
// Request
|
||||||
import { RequestComponent } from './request.component';
|
import { RequestComponent } from "./request.component";
|
||||||
import { MovieRequestsComponent } from './movierequests.component';
|
import { TvRequestChildrenComponent } from "./tvrequest-children.component";
|
||||||
import { TvRequestsComponent } from './tvrequests.component';
|
import { TvRequestsComponent } from "./tvrequests.component";
|
||||||
import { TvRequestChildrenComponent } from './tvrequest-children.component';
|
|
||||||
|
|
||||||
import { TreeTableModule } from 'primeng/primeng';
|
import { TreeTableModule } from "primeng/primeng";
|
||||||
|
|
||||||
import { IdentityService } from '../services/identity.service';
|
import { IdentityService } from "../services";
|
||||||
import { RequestService } from '../services/request.service';
|
import { RequestService } from "../services";
|
||||||
|
|
||||||
import { AuthGuard } from '../auth/auth.guard';
|
import { AuthGuard } from "../auth/auth.guard";
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{ path: 'requests', component: RequestComponent, canActivate: [AuthGuard] },
|
{ path: "requests", component: RequestComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'requests/:id', component: TvRequestChildrenComponent, canActivate: [AuthGuard] },
|
{ path: "requests/:id", component: TvRequestChildrenComponent, canActivate: [AuthGuard] },
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
@ -35,7 +35,7 @@ const routes: Routes = [
|
||||||
InfiniteScrollModule,
|
InfiniteScrollModule,
|
||||||
ButtonModule,
|
ButtonModule,
|
||||||
DialogModule,
|
DialogModule,
|
||||||
TreeTableModule
|
TreeTableModule,
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
RequestComponent,
|
RequestComponent,
|
||||||
|
@ -44,12 +44,12 @@ const routes: Routes = [
|
||||||
TvRequestChildrenComponent,
|
TvRequestChildrenComponent,
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
RouterModule
|
RouterModule,
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
IdentityService,
|
IdentityService,
|
||||||
RequestService
|
RequestService,
|
||||||
],
|
],
|
||||||
|
|
||||||
})
|
})
|
||||||
export class RequestsModule { }
|
export class RequestsModule { }
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input } from "@angular/core";
|
||||||
import { RequestService } from '../services/request.service';
|
import { IChildRequests, IEpisodesRequests } from "../interfaces";
|
||||||
import { IChildRequests, IEpisodesRequests } from '../interfaces/IRequestModel';
|
import { RequestService } from "../services";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector:'tvrequests-children',
|
selector:"tvrequests-children",
|
||||||
templateUrl: './tvrequest-children.component.html'
|
templateUrl: "./tvrequest-children.component.html",
|
||||||
})
|
})
|
||||||
export class TvRequestChildrenComponent {
|
export class TvRequestChildrenComponent {
|
||||||
constructor(private requestService: RequestService ) {
|
@Input() public childRequests: IChildRequests[];
|
||||||
}
|
@Input() public isAdmin: boolean;
|
||||||
|
constructor(private requestService: RequestService ) { }
|
||||||
@Input() childRequests: IChildRequests[];
|
|
||||||
@Input() isAdmin: boolean;
|
|
||||||
public removeRequest(request: IChildRequests) {
|
public removeRequest(request: IChildRequests) {
|
||||||
this.requestService.deleteChild(request)
|
this.requestService.deleteChild(request)
|
||||||
.subscribe();
|
.subscribe();
|
||||||
|
@ -23,7 +21,6 @@ export class TvRequestChildrenComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
public deny(request: IChildRequests) {
|
public deny(request: IChildRequests) {
|
||||||
debugger;
|
|
||||||
request.approved = false;
|
request.approved = false;
|
||||||
request.denied = true;
|
request.denied = true;
|
||||||
|
|
||||||
|
@ -37,7 +34,6 @@ export class TvRequestChildrenComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
public approve(request: IChildRequests) {
|
public approve(request: IChildRequests) {
|
||||||
debugger;
|
|
||||||
request.approved = true;
|
request.approved = true;
|
||||||
request.denied = false;
|
request.denied = false;
|
||||||
this.requestService.updateChild(request)
|
this.requestService.updateChild(request)
|
||||||
|
@ -62,9 +58,9 @@ export class TvRequestChildrenComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
private removeRequestFromUi(key: IChildRequests) {
|
private removeRequestFromUi(key: IChildRequests) {
|
||||||
var index = this.childRequests.indexOf(key, 0);
|
const index = this.childRequests.indexOf(key, 0);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
this.childRequests.splice(index, 1);
|
this.childRequests.splice(index, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +1,44 @@
|
||||||
import { Component, OnInit, OnDestroy, ViewEncapsulation } from '@angular/core';
|
import { Component, OnDestroy, OnInit, ViewEncapsulation } from "@angular/core";
|
||||||
import { Subject } from 'rxjs/Subject';
|
import "rxjs/add/operator/debounceTime";
|
||||||
import 'rxjs/add/operator/debounceTime';
|
import "rxjs/add/operator/distinctUntilChanged";
|
||||||
import 'rxjs/add/operator/distinctUntilChanged';
|
import "rxjs/add/operator/map";
|
||||||
import 'rxjs/add/operator/map';
|
|
||||||
import "rxjs/add/operator/takeUntil";
|
import "rxjs/add/operator/takeUntil";
|
||||||
|
import { Subject } from "rxjs/Subject";
|
||||||
|
|
||||||
import 'rxjs/add/operator/debounceTime';
|
import "rxjs/add/operator/debounceTime";
|
||||||
import 'rxjs/add/operator/distinctUntilChanged';
|
import "rxjs/add/operator/distinctUntilChanged";
|
||||||
import 'rxjs/add/operator/map';
|
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({
|
@Component({
|
||||||
selector: 'tv-requests',
|
selector: "tv-requests",
|
||||||
templateUrl: './tvrequests.component.html',
|
templateUrl: "./tvrequests.component.html",
|
||||||
styleUrls: ['./tvrequests.component.scss'],
|
styleUrls: ["./tvrequests.component.scss"],
|
||||||
//Was required to turn off encapsulation since CSS only should be overridden for this component
|
//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
|
//However when encapsulation is on angular injects prefixes to all classes so css selectors
|
||||||
//Stop working
|
//Stop working
|
||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None,
|
||||||
})
|
})
|
||||||
export class TvRequestsComponent implements OnInit, OnDestroy {
|
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,
|
constructor(private requestService: RequestService,
|
||||||
private auth: AuthService) {
|
private auth: AuthService) {
|
||||||
this.searchChanged
|
this.searchChanged
|
||||||
.debounceTime(600) // Wait Xms afterthe last event before emitting last event
|
.debounceTime(600) // Wait Xms afterthe last event before emitting last event
|
||||||
.distinctUntilChanged() // only emit if value is different from previous value
|
.distinctUntilChanged() // only emit if value is different from previous value
|
||||||
|
@ -42,22 +54,20 @@ export class TvRequestsComponent implements OnInit, OnDestroy {
|
||||||
.subscribe(m => this.tvRequests = this.transformData(m));
|
.subscribe(m => this.tvRequests = this.transformData(m));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
openClosestTab(el: any): void {
|
public openClosestTab(el: any) {
|
||||||
var rowclass = "undefined";
|
const rowclass = "undefined";
|
||||||
el = el.toElement;
|
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
|
// Increment the loop to the parent node until we find the row we need
|
||||||
el = el.parentNode;
|
el = el.parentNode;
|
||||||
if (!el) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// At this point, the while loop has stopped and `el` represents the element that has
|
// At this point, the while loop has stopped and `el` represents the element that has
|
||||||
// the class you specified
|
// the class you specified
|
||||||
|
|
||||||
// Then we loop through the children to find the caret which we want to click
|
// 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";
|
const 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";
|
const caretdown = "ui-treetable-toggler fa fa-fw ui-clickable fa-caret-down";
|
||||||
for (var value of el.children) {
|
for (const value of el.children) {
|
||||||
// the caret from the ui has 2 class selectors depending on if expanded or not
|
// 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
|
// we search for both since we want to still toggle the clicking
|
||||||
if (value.className === caretright || value.className === caretdown) {
|
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 from loop since we no longer need to continue looking
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
transformData(data: ITvRequests[]): TreeNode[] {
|
public transformData(data: ITvRequests[]): TreeNode[] {
|
||||||
var temp: TreeNode[] = [];
|
const temp: TreeNode[] = [];
|
||||||
data.forEach((value) => {
|
data.forEach((value) => {
|
||||||
temp.push({
|
temp.push({
|
||||||
"data": value,
|
data: value,
|
||||||
"children": [{
|
children: [{
|
||||||
"data": this.fixEpisodeSort(value.childRequests), leaf: true
|
data: this.fixEpisodeSort(value.childRequests), leaf: true,
|
||||||
}],
|
}],
|
||||||
leaf: false
|
leaf: false,
|
||||||
});
|
});
|
||||||
}, this)
|
}, this);
|
||||||
return <TreeNode[]>temp;
|
return <TreeNode[]>temp;
|
||||||
}
|
}
|
||||||
private subscriptions = new Subject<void>();
|
|
||||||
|
|
||||||
tvRequests: TreeNode[];
|
public fixEpisodeSort(items: IChildRequests[]) {
|
||||||
|
items.forEach((value) => {
|
||||||
searchChanged = new Subject<string>();
|
value.seasonRequests.forEach((requests: INewSeasonRequests) => {
|
||||||
searchText: string;
|
requests.episodes.sort((a: IEpisodesRequests, b: IEpisodesRequests) => {
|
||||||
|
|
||||||
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) {
|
|
||||||
return a.episodeNumber - b.episodeNumber;
|
return a.episodeNumber - b.episodeNumber;
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
ngOnInit() {
|
public ngOnInit() {
|
||||||
this.amountToLoad = 1000;
|
this.amountToLoad = 1000;
|
||||||
this.currentlyLoaded = 5;
|
this.currentlyLoaded = 5;
|
||||||
this.tvRequests = [];
|
this.tvRequests = [];
|
||||||
|
@ -197,6 +193,11 @@ export class TvRequestsComponent implements OnInit, OnDestroy {
|
||||||
return "white";
|
return "white";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ngOnDestroy() {
|
||||||
|
this.subscriptions.next();
|
||||||
|
this.subscriptions.complete();
|
||||||
|
}
|
||||||
|
|
||||||
//private updateRequest(request: ITvRequests) {
|
//private updateRequest(request: ITvRequests) {
|
||||||
// this.requestService.updateTvRequest(request)
|
// this.requestService.updateTvRequest(request)
|
||||||
// .takeUntil(this.subscriptions)
|
// .takeUntil(this.subscriptions)
|
||||||
|
@ -217,14 +218,9 @@ export class TvRequestsComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
private removeRequestFromUi(key: ITvRequests) {
|
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) {
|
if (index > -1) {
|
||||||
this.tvRequests.splice(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 { Component, OnDestroy, OnInit } from "@angular/core";
|
||||||
import { Subject } from 'rxjs/Subject';
|
import "rxjs/add/operator/debounceTime";
|
||||||
import 'rxjs/add/operator/debounceTime';
|
import "rxjs/add/operator/distinctUntilChanged";
|
||||||
import 'rxjs/add/operator/distinctUntilChanged';
|
import "rxjs/add/operator/map";
|
||||||
import 'rxjs/add/operator/map';
|
|
||||||
import "rxjs/add/operator/takeUntil";
|
import "rxjs/add/operator/takeUntil";
|
||||||
|
import { Subject } from "rxjs/Subject";
|
||||||
|
|
||||||
import { SearchService } from '../services/search.service';
|
import { AuthService } from "../auth/auth.service";
|
||||||
import { AuthService } from '../auth/auth.service';
|
import { NotificationService } from "../services";
|
||||||
import { RequestService } from '../services/request.service';
|
import { RequestService } from "../services";
|
||||||
import { NotificationService } from '../services/notification.service';
|
import { SearchService } from "../services";
|
||||||
|
|
||||||
import { ISearchMovieResult } from '../interfaces/ISearchMovieResult';
|
import { IRequestEngineResult } from "../interfaces";
|
||||||
import { IRequestEngineResult } from '../interfaces/IRequestEngineResult';
|
import { ISearchMovieResult } from "../interfaces";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'movie-search',
|
selector: "movie-search",
|
||||||
templateUrl: './moviesearch.component.html',
|
templateUrl: "./moviesearch.component.html",
|
||||||
})
|
})
|
||||||
export class MovieSearchComponent implements OnInit, OnDestroy {
|
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>();
|
private subscriptions = new Subject<void>();
|
||||||
searchChanged: Subject<string> = new Subject<string>();
|
|
||||||
movieResults: ISearchMovieResult[];
|
|
||||||
result: IRequestEngineResult;
|
|
||||||
searchApplied = false;
|
|
||||||
|
|
||||||
constructor(private searchService: SearchService, private requestService: RequestService,
|
constructor(private searchService: SearchService, private requestService: RequestService,
|
||||||
private notificationService: NotificationService, private authService : AuthService) {
|
private notificationService: NotificationService, private authService: AuthService) {
|
||||||
|
|
||||||
this.searchChanged
|
this.searchChanged
|
||||||
.debounceTime(600) // Wait Xms afterthe last event before emitting last event
|
.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.searchText = "";
|
||||||
this.movieResults = [];
|
this.movieResults = [];
|
||||||
this.result = {
|
this.result = {
|
||||||
message: "",
|
message: "",
|
||||||
requestAdded: false,
|
requestAdded: false,
|
||||||
errorMessage: ""
|
errorMessage: "",
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
search(text: any) {
|
public search(text: any) {
|
||||||
this.searchChanged.next(text.target.value);
|
this.searchChanged.next(text.target.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
request(searchResult: ISearchMovieResult) {
|
public request(searchResult: ISearchMovieResult) {
|
||||||
searchResult.requested = true;
|
searchResult.requested = true;
|
||||||
if (this.authService.hasRole("admin") || this.authService.hasRole("AutoApproveMovie")) {
|
if (this.authService.hasRole("admin") || this.authService.hasRole("AutoApproveMovie")) {
|
||||||
searchResult.approved = true;
|
searchResult.approved = true;
|
||||||
|
@ -87,7 +87,7 @@ export class MovieSearchComponent implements OnInit, OnDestroy {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
popularMovies() {
|
public popularMovies() {
|
||||||
this.clearResults();
|
this.clearResults();
|
||||||
this.searchService.popularMovies()
|
this.searchService.popularMovies()
|
||||||
.takeUntil(this.subscriptions)
|
.takeUntil(this.subscriptions)
|
||||||
|
@ -96,7 +96,7 @@ export class MovieSearchComponent implements OnInit, OnDestroy {
|
||||||
this.getExtaInfo();
|
this.getExtaInfo();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
nowPlayingMovies() {
|
public nowPlayingMovies() {
|
||||||
this.clearResults();
|
this.clearResults();
|
||||||
this.searchService.nowPlayingMovies()
|
this.searchService.nowPlayingMovies()
|
||||||
.takeUntil(this.subscriptions)
|
.takeUntil(this.subscriptions)
|
||||||
|
@ -105,7 +105,7 @@ export class MovieSearchComponent implements OnInit, OnDestroy {
|
||||||
this.getExtaInfo();
|
this.getExtaInfo();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
topRatedMovies() {
|
public topRatedMovies() {
|
||||||
this.clearResults();
|
this.clearResults();
|
||||||
this.searchService.topRatedMovies()
|
this.searchService.topRatedMovies()
|
||||||
.takeUntil(this.subscriptions)
|
.takeUntil(this.subscriptions)
|
||||||
|
@ -114,7 +114,7 @@ export class MovieSearchComponent implements OnInit, OnDestroy {
|
||||||
this.getExtaInfo();
|
this.getExtaInfo();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
upcomingMovies() {
|
public upcomingMovies() {
|
||||||
this.clearResults();
|
this.clearResults();
|
||||||
this.searchService.upcomignMovies()
|
this.searchService.upcomignMovies()
|
||||||
.takeUntil(this.subscriptions)
|
.takeUntil(this.subscriptions)
|
||||||
|
@ -124,6 +124,11 @@ export class MovieSearchComponent implements OnInit, OnDestroy {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ngOnDestroy() {
|
||||||
|
this.subscriptions.next();
|
||||||
|
this.subscriptions.complete();
|
||||||
|
}
|
||||||
|
|
||||||
private getExtaInfo() {
|
private getExtaInfo() {
|
||||||
|
|
||||||
this.movieResults.forEach((val, index) => {
|
this.movieResults.forEach((val, index) => {
|
||||||
|
@ -134,7 +139,7 @@ export class MovieSearchComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateItem(key: ISearchMovieResult, updated: ISearchMovieResult) {
|
private updateItem(key: ISearchMovieResult, updated: ISearchMovieResult) {
|
||||||
var index = this.movieResults.indexOf(key, 0);
|
const index = this.movieResults.indexOf(key, 0);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
this.movieResults[index] = updated;
|
this.movieResults[index] = updated;
|
||||||
}
|
}
|
||||||
|
@ -143,10 +148,4 @@ export class MovieSearchComponent implements OnInit, OnDestroy {
|
||||||
this.movieResults = [];
|
this.movieResults = [];
|
||||||
this.searchApplied = false;
|
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({
|
@Component({
|
||||||
templateUrl: './search.component.html',
|
templateUrl: "./search.component.html",
|
||||||
})
|
})
|
||||||
export class SearchComponent implements OnInit {
|
export class SearchComponent implements OnInit {
|
||||||
ngOnInit(): void {
|
public showTv: boolean;
|
||||||
|
public showMovie: boolean;
|
||||||
|
|
||||||
|
public ngOnInit() {
|
||||||
this.showMovie = true;
|
this.showMovie = true;
|
||||||
this.showTv = false;
|
this.showTv = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
showTv : boolean;
|
public selectTab() {
|
||||||
showMovie: boolean;
|
|
||||||
|
|
||||||
|
|
||||||
selectTab() {
|
|
||||||
this.showMovie = !this.showMovie;
|
this.showMovie = !this.showMovie;
|
||||||
this.showTv = !this.showTv;
|
this.showTv = !this.showTv;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
import { NgModule, } from '@angular/core';
|
import { CommonModule } from "@angular/common";
|
||||||
import { CommonModule } from '@angular/common';
|
import { NgModule } from "@angular/core";
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from "@angular/forms";
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
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 { MovieSearchComponent } from './moviesearch.component';
|
import { SearchComponent } from "./search.component";
|
||||||
import { TvSearchComponent } from './tvsearch.component';
|
import { SeriesInformationComponent } from "./seriesinformation.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";
|
||||||
import { RequestService } from '../services/request.service';
|
import { SearchService } from "../services";
|
||||||
|
|
||||||
import { AuthGuard } from '../auth/auth.guard';
|
import { AuthGuard } from "../auth/auth.guard";
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{ path: 'search', component: SearchComponent, canActivate: [AuthGuard] },
|
{ path: "search", component: SearchComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'search/show/:id', component: SeriesInformationComponent, canActivate: [AuthGuard] },
|
{ path: "search/show/:id", component: SeriesInformationComponent, canActivate: [AuthGuard] },
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
@ -28,7 +28,7 @@ const routes: Routes = [
|
||||||
FormsModule,
|
FormsModule,
|
||||||
RouterModule.forChild(routes),
|
RouterModule.forChild(routes),
|
||||||
NgbModule.forRoot(),
|
NgbModule.forRoot(),
|
||||||
TreeTableModule
|
TreeTableModule,
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
SearchComponent,
|
SearchComponent,
|
||||||
|
@ -37,11 +37,11 @@ const routes: Routes = [
|
||||||
SeriesInformationComponent,
|
SeriesInformationComponent,
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
RouterModule
|
RouterModule,
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
SearchService,
|
SearchService,
|
||||||
RequestService
|
RequestService,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class SearchModule { }
|
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 { ActivatedRoute } from '@angular/router';
|
||||||
import { Subject } from 'rxjs/Subject';
|
import { Subject } from "rxjs/Subject";
|
||||||
|
|
||||||
import "rxjs/add/operator/takeUntil";
|
import "rxjs/add/operator/takeUntil";
|
||||||
|
|
||||||
import { SearchService } from '../services/search.service';
|
import { NotificationService } from "../services";
|
||||||
import { RequestService } from '../services/request.service';
|
import { RequestService } from "../services";
|
||||||
import { NotificationService } from '../services/notification.service';
|
import { SearchService } from "../services";
|
||||||
|
|
||||||
import { ISearchTvResult } from '../interfaces/ISearchTvResult';
|
import { IRequestEngineResult } from "../interfaces";
|
||||||
import { IRequestEngineResult } from '../interfaces/IRequestEngineResult';
|
import { IEpisodesRequests } from "../interfaces";
|
||||||
import { IEpisodesRequests } from "../interfaces/IRequestModel";
|
import { ISearchTvResult } from "../interfaces";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'seriesinformation',
|
selector: "seriesinformation",
|
||||||
templateUrl: './seriesinformation.component.html',
|
templateUrl: "./seriesinformation.component.html",
|
||||||
styleUrls: ['./seriesinformation.component.scss']
|
styleUrls: ["./seriesinformation.component.scss"],
|
||||||
})
|
})
|
||||||
export class SeriesInformationComponent implements OnInit, OnDestroy {
|
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>();
|
private subscriptions = new Subject<void>();
|
||||||
|
|
||||||
public result : IRequestEngineResult;
|
constructor(private searchService: SearchService, private requestService: RequestService, private notificationService: NotificationService) { }
|
||||||
@Input() private seriesId: number;
|
|
||||||
public series: ISearchTvResult;
|
|
||||||
|
|
||||||
requestedEpisodes: IEpisodesRequests[] = [];
|
public ngOnInit() {
|
||||||
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
this.searchService.getShowInformation(this.seriesId)
|
this.searchService.getShowInformation(this.seriesId)
|
||||||
.takeUntil(this.subscriptions)
|
.takeUntil(this.subscriptions)
|
||||||
.subscribe(x => {
|
.subscribe(x => {
|
||||||
|
@ -41,7 +38,7 @@ export class SeriesInformationComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
public submitRequests() {
|
public submitRequests() {
|
||||||
this.series.requested = true;
|
this.series.requested = true;
|
||||||
|
|
||||||
this.requestService.requestTv(this.series)
|
this.requestService.requestTv(this.series)
|
||||||
.takeUntil(this.subscriptions)
|
.takeUntil(this.subscriptions)
|
||||||
.subscribe(x => {
|
.subscribe(x => {
|
||||||
|
@ -63,9 +60,8 @@ export class SeriesInformationComponent implements OnInit, OnDestroy {
|
||||||
episode.requested = false;
|
episode.requested = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ngOnDestroy() {
|
||||||
ngOnDestroy(): void {
|
|
||||||
this.subscriptions.next();
|
this.subscriptions.next();
|
||||||
this.subscriptions.complete();
|
this.subscriptions.complete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +1,33 @@
|
||||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
import { Component, OnDestroy, OnInit } from "@angular/core";
|
||||||
import { Router } from '@angular/router';
|
import { Router } from "@angular/router";
|
||||||
import { Subject } from 'rxjs/Subject';
|
import { Subject } from "rxjs/Subject";
|
||||||
|
|
||||||
import { SearchService } from '../services/search.service';
|
import { AuthService } from "../auth/auth.service";
|
||||||
import { AuthService } from '../auth/auth.service';
|
import { NotificationService } from "../services";
|
||||||
import { RequestService } from '../services/request.service';
|
import { RequestService } from "../services";
|
||||||
import { NotificationService } from '../services/notification.service';
|
import { SearchService } from "../services";
|
||||||
|
|
||||||
import { ISearchTvResult } from '../interfaces/ISearchTvResult';
|
import { TreeNode } from "primeng/primeng";
|
||||||
import { IRequestEngineResult } from '../interfaces/IRequestEngineResult';
|
import { IRequestEngineResult } from "../interfaces";
|
||||||
import { TreeNode } from 'primeng/primeng';
|
import { ISearchTvResult } from "../interfaces";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'tv-search',
|
selector: "tv-search",
|
||||||
templateUrl: './tvsearch.component.html',
|
templateUrl: "./tvsearch.component.html",
|
||||||
styleUrls: ['./../requests/tvrequests.component.scss'],
|
styleUrls: ["./../requests/tvrequests.component.scss"],
|
||||||
})
|
})
|
||||||
export class TvSearchComponent implements OnInit, OnDestroy {
|
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>();
|
private subscriptions = new Subject<void>();
|
||||||
searchText: string;
|
|
||||||
searchChanged = new Subject<string>();
|
|
||||||
tvResults: TreeNode[];
|
|
||||||
result: IRequestEngineResult;
|
|
||||||
searchApplied = false;
|
|
||||||
|
|
||||||
constructor(private searchService: SearchService, private requestService: RequestService,
|
constructor(private searchService: SearchService, private requestService: RequestService,
|
||||||
private notificationService: NotificationService, private route: Router, private authService: AuthService) {
|
private notificationService: NotificationService, private route: Router, private authService: AuthService) {
|
||||||
|
|
||||||
this.searchChanged
|
this.searchChanged
|
||||||
.debounceTime(600) // Wait Xms afterthe last event before emitting last event
|
.debounceTime(600) // Wait Xms afterthe last event before emitting last event
|
||||||
|
@ -46,22 +47,20 @@ export class TvSearchComponent implements OnInit, OnDestroy {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
openClosestTab(el: any): void {
|
public openClosestTab(el: any) {
|
||||||
let rowclass = "undefined";
|
const rowclass = "undefined";
|
||||||
el = el.toElement;
|
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
|
// Increment the loop to the parent node until we find the row we need
|
||||||
el = el.parentNode;
|
el = el.parentNode;
|
||||||
if (!el) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// At this point, the while loop has stopped and `el` represents the element that has
|
// At this point, the while loop has stopped and `el` represents the element that has
|
||||||
// the class you specified
|
// the class you specified
|
||||||
|
|
||||||
// Then we loop through the children to find the caret which we want to click
|
// 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";
|
const 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";
|
const caretdown = "ui-treetable-toggler fa fa-fw ui-clickable fa-caret-down";
|
||||||
for (let value of el.children) {
|
for (const value of el.children) {
|
||||||
// the caret from the ui has 2 class selectors depending on if expanded or not
|
// 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
|
// we search for both since we want to still toggle the clicking
|
||||||
if (value.className === caretright || value.className === caretdown) {
|
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 from loop since we no longer need to continue looking
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
public ngOnInit() {
|
||||||
this.searchText = "";
|
this.searchText = "";
|
||||||
this.tvResults = [];
|
this.tvResults = [];
|
||||||
this.result = {
|
this.result = {
|
||||||
message: "",
|
message: "",
|
||||||
requestAdded: false,
|
requestAdded: false,
|
||||||
errorMessage:""
|
errorMessage:"",
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
search(text: any) {
|
public search(text: any) {
|
||||||
this.searchChanged.next(text.target.value);
|
this.searchChanged.next(text.target.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public popularShows() {
|
||||||
popularShows() {
|
|
||||||
this.clearResults();
|
this.clearResults();
|
||||||
this.searchService.popularTv()
|
this.searchService.popularTv()
|
||||||
.takeUntil(this.subscriptions)
|
.takeUntil(this.subscriptions)
|
||||||
|
@ -98,7 +96,7 @@ export class TvSearchComponent implements OnInit, OnDestroy {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
trendingShows() {
|
public trendingShows() {
|
||||||
this.clearResults();
|
this.clearResults();
|
||||||
this.searchService.trendingTv()
|
this.searchService.trendingTv()
|
||||||
.takeUntil(this.subscriptions)
|
.takeUntil(this.subscriptions)
|
||||||
|
@ -108,7 +106,7 @@ export class TvSearchComponent implements OnInit, OnDestroy {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
mostWatchedShows() {
|
public mostWatchedShows() {
|
||||||
this.clearResults();
|
this.clearResults();
|
||||||
this.searchService.mostWatchedTv()
|
this.searchService.mostWatchedTv()
|
||||||
.takeUntil(this.subscriptions)
|
.takeUntil(this.subscriptions)
|
||||||
|
@ -118,7 +116,7 @@ export class TvSearchComponent implements OnInit, OnDestroy {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
anticipatedShows() {
|
public anticipatedShows() {
|
||||||
this.clearResults();
|
this.clearResults();
|
||||||
this.searchService.anticipatedTv()
|
this.searchService.anticipatedTv()
|
||||||
.takeUntil(this.subscriptions)
|
.takeUntil(this.subscriptions)
|
||||||
|
@ -128,7 +126,7 @@ export class TvSearchComponent implements OnInit, OnDestroy {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getExtraInfo() {
|
public getExtraInfo() {
|
||||||
this.tvResults.forEach((val, index) => {
|
this.tvResults.forEach((val, index) => {
|
||||||
this.searchService.getShowInformationTreeNode(val.data.id)
|
this.searchService.getShowInformationTreeNode(val.data.id)
|
||||||
.takeUntil(this.subscriptions)
|
.takeUntil(this.subscriptions)
|
||||||
|
@ -138,7 +136,7 @@ export class TvSearchComponent implements OnInit, OnDestroy {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
request(searchResult: ISearchTvResult) {
|
public request(searchResult: ISearchTvResult) {
|
||||||
searchResult.requested = true;
|
searchResult.requested = true;
|
||||||
if (this.authService.hasRole("admin") || this.authService.hasRole("AutoApproveMovie")) {
|
if (this.authService.hasRole("admin") || this.authService.hasRole("AutoApproveMovie")) {
|
||||||
searchResult.approved = true;
|
searchResult.approved = true;
|
||||||
|
@ -156,40 +154,39 @@ export class TvSearchComponent implements OnInit, OnDestroy {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
allSeasons(searchResult: ISearchTvResult) {
|
public allSeasons(searchResult: ISearchTvResult) {
|
||||||
searchResult.requestAll = true;
|
searchResult.requestAll = true;
|
||||||
this.request(searchResult);
|
this.request(searchResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
firstSeason(searchResult: ISearchTvResult) {
|
public firstSeason(searchResult: ISearchTvResult) {
|
||||||
searchResult.firstSeason = true;
|
searchResult.firstSeason = true;
|
||||||
this.request(searchResult);
|
this.request(searchResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
latestSeason(searchResult: ISearchTvResult) {
|
public latestSeason(searchResult: ISearchTvResult) {
|
||||||
searchResult.latestSeason = true;
|
searchResult.latestSeason = true;
|
||||||
this.request(searchResult);
|
this.request(searchResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
selectSeason(searchResult: ISearchTvResult) {
|
public selectSeason(searchResult: ISearchTvResult) {
|
||||||
this.route.navigate(['/search/show', searchResult.id]);
|
this.route.navigate(["/search/show", searchResult.id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ngOnDestroy() {
|
||||||
|
this.subscriptions.next();
|
||||||
|
this.subscriptions.complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateItem(key: TreeNode, updated: TreeNode) {
|
private updateItem(key: TreeNode, updated: TreeNode) {
|
||||||
let item = this.tvResults.filter((val) => {
|
const index = this.tvResults.indexOf(key, 0);
|
||||||
return val.data == key;
|
if (index > -1) {
|
||||||
});
|
this.tvResults[index] = updated;
|
||||||
item[0].data = updated.data;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private clearResults() {
|
private clearResults() {
|
||||||
this.tvResults = [];
|
this.tvResults = [];
|
||||||
this.searchApplied = false;
|
this.searchApplied = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ngOnDestroy(): void {
|
|
||||||
this.subscriptions.next();
|
|
||||||
this.subscriptions.complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,20 +1,19 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from "@angular/core";
|
||||||
import { Http } from '@angular/http';
|
import { Http } from "@angular/http";
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from "rxjs/Rx";
|
||||||
|
|
||||||
import { ServiceHelpers } from '../service.helpers';
|
import { ServiceHelpers } from "../service.helpers";
|
||||||
|
|
||||||
import { IEmbySettings } from '../../interfaces/ISettings'
|
|
||||||
|
|
||||||
|
import { IEmbySettings } from "../../interfaces";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class EmbyService extends ServiceHelpers {
|
export class EmbyService extends ServiceHelpers {
|
||||||
constructor(http: Http) {
|
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);
|
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,31 +1,30 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from "@angular/core";
|
||||||
import { Http } from '@angular/http'
|
import { Http } from "@angular/http";
|
||||||
|
|
||||||
import { AuthHttp } from 'angular2-jwt';;
|
import { AuthHttp } from "angular2-jwt";
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from "rxjs/Rx";
|
||||||
|
|
||||||
import { ServiceAuthHelpers } from '../service.helpers';
|
import { ServiceAuthHelpers } from "../service.helpers";
|
||||||
|
|
||||||
import { IPlexAuthentication, IPlexLibraries, IPlexServerViewModel } from '../../interfaces/IPlex';
|
|
||||||
import { IPlexServer } from '../../interfaces/ISettings';
|
|
||||||
|
|
||||||
|
import { IPlexAuthentication, IPlexLibraries, IPlexServerViewModel } from "../../interfaces";
|
||||||
|
import { IPlexServer } from "../../interfaces";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class PlexService extends ServiceAuthHelpers {
|
export class PlexService extends ServiceAuthHelpers {
|
||||||
constructor(http: AuthHttp, private regularHttp: Http) {
|
constructor(http: AuthHttp, private regularHttp: Http) {
|
||||||
super(http, '/api/v1/Plex/');
|
super(http, "/api/v1/Plex/");
|
||||||
}
|
}
|
||||||
|
|
||||||
logIn(login: string, password: string): Observable<IPlexAuthentication> {
|
public 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);
|
return this.regularHttp.post(`${this.url}`, JSON.stringify({ login, password }), { headers: this.headers }).map(this.extractData);
|
||||||
}
|
}
|
||||||
|
|
||||||
getServers(login: string, password: string): Observable<IPlexServerViewModel> {
|
public 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);
|
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);
|
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 { Injectable } from "@angular/core";
|
||||||
import { AuthHttp } from 'angular2-jwt';
|
import { AuthHttp } from "angular2-jwt";
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from "rxjs/Rx";
|
||||||
|
|
||||||
import { ServiceAuthHelpers } from '../service.helpers';
|
import { IRadarrProfile, IRadarrRootFolder } from "../../interfaces";
|
||||||
import { IRadarrSettings } from '../../interfaces/ISettings';
|
import { IRadarrSettings } from "../../interfaces";
|
||||||
import { IRadarrProfile, IRadarrRootFolder } from '../../interfaces/IRadarr';
|
import { ServiceAuthHelpers } from "../service.helpers";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class RadarrService extends ServiceAuthHelpers {
|
export class RadarrService extends ServiceAuthHelpers {
|
||||||
constructor(http: AuthHttp) {
|
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);
|
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);
|
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 { Injectable } from "@angular/core";
|
||||||
import { AuthHttp } from 'angular2-jwt';
|
import { AuthHttp } from "angular2-jwt";
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from "rxjs/Rx";
|
||||||
|
|
||||||
import { ServiceAuthHelpers } from '../service.helpers';
|
import { ISonarrSettings } from "../../interfaces";
|
||||||
import { ISonarrSettings } from '../../interfaces/ISettings';
|
import { ISonarrProfile, ISonarrRootFolder } from "../../interfaces";
|
||||||
import { ISonarrRootFolder, ISonarrProfile } from '../../interfaces/ISonarr';
|
import { ServiceAuthHelpers } from "../service.helpers";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SonarrService extends ServiceAuthHelpers {
|
export class SonarrService extends ServiceAuthHelpers {
|
||||||
constructor(http: AuthHttp) {
|
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);
|
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);
|
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 { Injectable } from "@angular/core";
|
||||||
import { AuthHttp } from 'angular2-jwt';
|
import { AuthHttp } from "angular2-jwt";
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from "rxjs/Rx";
|
||||||
|
|
||||||
import { ServiceAuthHelpers } from '../service.helpers';
|
import { ServiceAuthHelpers } from "../service.helpers";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
IDiscordNotifcationSettings,
|
IDiscordNotifcationSettings,
|
||||||
IEmailNotificationSettings,
|
IEmailNotificationSettings,
|
||||||
IPushbulletNotificationSettings,
|
|
||||||
ISlackNotificationSettings,
|
|
||||||
IPushoverNotificationSettings,
|
|
||||||
IMattermostNotifcationSettings
|
|
||||||
} from '../../interfaces/INotifcationSettings'
|
|
||||||
|
|
||||||
import {
|
|
||||||
IEmbyServer,
|
IEmbyServer,
|
||||||
|
IMattermostNotifcationSettings,
|
||||||
IPlexServer,
|
IPlexServer,
|
||||||
|
IPushbulletNotificationSettings,
|
||||||
|
IPushoverNotificationSettings,
|
||||||
IRadarrSettings,
|
IRadarrSettings,
|
||||||
ISonarrSettings
|
ISlackNotificationSettings,
|
||||||
} from '../../interfaces/ISettings';
|
ISonarrSettings,
|
||||||
|
} from "../../interfaces";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class TesterService extends ServiceAuthHelpers {
|
export class TesterService extends ServiceAuthHelpers {
|
||||||
constructor(http: AuthHttp) {
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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 { Injectable } from "@angular/core";
|
||||||
import { FormGroup, Validators, ValidatorFn } from '@angular/forms';
|
import { FormGroup, ValidatorFn, Validators } from "@angular/forms";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ValidationService {
|
export class ValidationService {
|
||||||
|
@ -9,7 +9,7 @@ export class ValidationService {
|
||||||
* @param form
|
* @param form
|
||||||
* @param name
|
* @param name
|
||||||
*/
|
*/
|
||||||
public disableValidation(form: FormGroup, name: string): void {
|
public disableValidation(form: FormGroup, name: string) {
|
||||||
form.controls[name].clearValidators();
|
form.controls[name].clearValidators();
|
||||||
form.controls[name].updateValueAndValidity();
|
form.controls[name].updateValueAndValidity();
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ export class ValidationService {
|
||||||
* @param name
|
* @param name
|
||||||
*/
|
*/
|
||||||
public enableValidation(form: FormGroup, name: string): void;
|
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 (validators) {
|
||||||
// If we provide some use them
|
// If we provide some use them
|
||||||
form.controls[name].setValidators(validators);
|
form.controls[name].setValidators(validators);
|
||||||
|
@ -31,4 +31,4 @@ export class ValidationService {
|
||||||
form.controls[name].updateValueAndValidity();
|
form.controls[name].updateValueAndValidity();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,62 +1,61 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from "@angular/core";
|
||||||
import { AuthHttp } from 'angular2-jwt';
|
import { Http } from "@angular/http";
|
||||||
import { Http } from '@angular/http';
|
import { AuthHttp } from "angular2-jwt";
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from "rxjs/Rx";
|
||||||
|
|
||||||
import { ServiceAuthHelpers } from './service.helpers';
|
|
||||||
import { IUser, IUpdateLocalUser, ICheckbox, IIdentityResult, IResetPasswordToken } from '../interfaces/IUser';
|
|
||||||
|
|
||||||
|
import { ICheckbox, IIdentityResult, IResetPasswordToken, IUpdateLocalUser, IUser } from "../interfaces";
|
||||||
|
import { ServiceAuthHelpers } from "./service.helpers";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class IdentityService extends ServiceAuthHelpers {
|
export class IdentityService extends ServiceAuthHelpers {
|
||||||
constructor(http: AuthHttp, private regularHttp: Http) {
|
constructor(http: AuthHttp, private regularHttp: Http) {
|
||||||
super(http, '/api/v1/Identity/');
|
super(http, "/api/v1/Identity/");
|
||||||
}
|
}
|
||||||
createWizardUser(username: string, password: string): Observable<boolean> {
|
public 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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
return this.http.put(this.url, JSON.stringify(user), { headers: this.headers }).map(this.extractData);
|
||||||
}
|
}
|
||||||
updateLocalUser(user: IUpdateLocalUser): Observable<IIdentityResult> {
|
public updateLocalUser(user: IUpdateLocalUser): Observable<IIdentityResult> {
|
||||||
return this.http.put(this.url + 'local', JSON.stringify(user), { headers: this.headers }).map(this.extractData);
|
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);
|
return this.http.delete(`${this.url}/${user.id}`, { headers: this.headers }).map(this.extractData);
|
||||||
}
|
}
|
||||||
|
|
||||||
submitResetPassword(email:string): Observable<IIdentityResult>{
|
public submitResetPassword(email: string): Observable<IIdentityResult> {
|
||||||
return this.regularHttp.post(this.url + 'reset', JSON.stringify({email:email}), { headers: this.headers }).map(this.extractData);
|
return this.regularHttp.post(this.url + "reset", JSON.stringify({email}), { headers: this.headers }).map(this.extractData);
|
||||||
}
|
}
|
||||||
|
|
||||||
resetPassword(token: IResetPasswordToken):Observable<IIdentityResult>{
|
public resetPassword(token: IResetPasswordToken): Observable<IIdentityResult> {
|
||||||
return this.regularHttp.post(this.url + 'resetpassword', JSON.stringify(token), { headers: this.headers }).map(this.extractData);
|
return this.regularHttp.post(this.url + "resetpassword", JSON.stringify(token), { headers: this.headers }).map(this.extractData);
|
||||||
}
|
}
|
||||||
|
|
||||||
hasRole(role: string): boolean {
|
public hasRole(role: string): boolean {
|
||||||
var roles = localStorage.getItem("roles") as string[] | null;
|
const roles = localStorage.getItem("roles") as string[] | null;
|
||||||
if (roles) {
|
if (roles) {
|
||||||
if (roles.indexOf(role) > -1) {
|
if (roles.indexOf(role) > -1) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -65,4 +64,4 @@ export class IdentityService extends ServiceAuthHelpers {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from "@angular/core";
|
||||||
import { Http } from '@angular/http';
|
import { Http } from "@angular/http";
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from "rxjs/Rx";
|
||||||
|
|
||||||
import { ServiceHelpers } from './service.helpers';
|
import { IImages } from "../interfaces";
|
||||||
import { IImages } from '../interfaces/IImages';
|
import { ServiceHelpers } from "./service.helpers";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ImageService extends ServiceHelpers {
|
export class ImageService extends ServiceHelpers {
|
||||||
constructor(public http : Http) {
|
constructor(public http: Http) {
|
||||||
super(http, '/api/v1/Images/');
|
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);
|
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 { Injectable } from "@angular/core";
|
||||||
import { Http } from '@angular/http';
|
import { Http } from "@angular/http";
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from "rxjs/Rx";
|
||||||
|
|
||||||
import { ServiceHelpers } from './service.helpers';
|
import { IMediaServerStatus } from "../interfaces";
|
||||||
import { IMediaServerStatus } from '../interfaces/IMediaServerStatus';
|
import { ServiceHelpers } from "./service.helpers";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class LandingPageService extends ServiceHelpers {
|
export class LandingPageService extends ServiceHelpers {
|
||||||
constructor(public http : Http) {
|
constructor(public http: Http) {
|
||||||
super(http, '/api/v1/LandingPage/');
|
super(http, "/api/v1/LandingPage/");
|
||||||
}
|
}
|
||||||
|
|
||||||
getServerStatus(): Observable<IMediaServerStatus> {
|
public getServerStatus(): Observable<IMediaServerStatus> {
|
||||||
return this.http.get(`${this.url}`, { headers: this.headers }).map(this.extractData);
|
return this.http.get(`${this.url}`, { headers: this.headers }).map(this.extractData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from "@angular/core";
|
||||||
import { Message } from 'primeng/components/common/api';
|
import { Message } from "primeng/components/common/api";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class NotificationService {
|
export class NotificationService {
|
||||||
messages: Message[] = [];
|
public messages: Message[] = [];
|
||||||
public addMessage(message: Message) {
|
public addMessage(message: Message) {
|
||||||
this.clearMessages();
|
this.clearMessages();
|
||||||
this.messages.push(message);
|
this.messages.push(message);
|
||||||
|
@ -11,22 +11,22 @@ export class NotificationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public success(title: string, body: string) {
|
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) {
|
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) {
|
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) {
|
public error(title: string, body: string) {
|
||||||
this.addMessage({ severity: 'error', detail: body, summary: title });
|
this.addMessage({ severity: "error", detail: body, summary: title });
|
||||||
}
|
}
|
||||||
|
|
||||||
public clearMessages() {
|
public clearMessages() {
|
||||||
this.messages = [];
|
this.messages = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,81 +1,81 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from "@angular/core";
|
||||||
import { Http } from '@angular/http';
|
import { Http } from "@angular/http";
|
||||||
import { AuthHttp } from 'angular2-jwt';
|
import { AuthHttp } from "angular2-jwt";
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from "rxjs/Rx";
|
||||||
|
|
||||||
import { ServiceAuthHelpers } from './service.helpers';
|
import { IRequestEngineResult } from "../interfaces";
|
||||||
import { IRequestEngineResult } from '../interfaces/IRequestEngineResult';
|
import { IChildRequests, IMovieRequests, IRequestCountModel, IRequestGrid, ITvRequests } from "../interfaces";
|
||||||
import { ISearchMovieResult } from '../interfaces/ISearchMovieResult';
|
import { ISearchMovieResult } from "../interfaces";
|
||||||
import { ISearchTvResult } from '../interfaces/ISearchTvResult';
|
import { ISearchTvResult } from "../interfaces";
|
||||||
import { IMovieRequests, ITvRequests, IRequestCountModel, IRequestGrid, IChildRequests } from '../interfaces/IRequestModel';
|
import { ServiceAuthHelpers } from "./service.helpers";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class RequestService extends ServiceAuthHelpers {
|
export class RequestService extends ServiceAuthHelpers {
|
||||||
constructor(http: AuthHttp, private basicHttp : Http) {
|
constructor(http: AuthHttp, private basicHttp: Http) {
|
||||||
super(http, '/api/v1/Request/');
|
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);
|
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);
|
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);
|
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);
|
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();
|
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);
|
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)
|
return this.http.get(`${this.url}tv/${count}/${position}`).map(this.extractData)
|
||||||
.catch(this.handleError);
|
.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)
|
return this.http.get(`${this.url}tv/${requestId}/child`).map(this.extractData)
|
||||||
.catch(this.handleError);
|
.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);
|
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();
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
return this.http.get(`${this.url}tv/grid`).map(this.extractData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from "@angular/core";
|
||||||
import { AuthHttp } from 'angular2-jwt';
|
import { AuthHttp } from "angular2-jwt";
|
||||||
import { Observable } from 'rxjs/Rx';
|
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 { TreeNode } from "primeng/primeng";
|
||||||
|
import { ISearchMovieResult } from "../interfaces";
|
||||||
|
import { ISearchTvResult } from "../interfaces";
|
||||||
|
import { ServiceAuthHelpers } from "./service.helpers";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SearchService extends ServiceAuthHelpers {
|
export class SearchService extends ServiceAuthHelpers {
|
||||||
|
@ -14,52 +14,53 @@ export class SearchService extends ServiceAuthHelpers {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Movies
|
// Movies
|
||||||
searchMovie(searchTerm: string): Observable<ISearchMovieResult[]> {
|
public searchMovie(searchTerm: string): Observable<ISearchMovieResult[]> {
|
||||||
return this.http.get(`${this.url}/Movie/` + searchTerm).map(this.extractData);
|
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);
|
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);
|
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);
|
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);
|
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);
|
return this.http.get(`${this.url}/Movie/info/${theMovieDbId}`).map(this.extractData);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TV
|
// TV
|
||||||
searchTv(searchTerm: string): Observable<ISearchTvResult[]> {
|
public searchTv(searchTerm: string): Observable<ISearchTvResult[]> {
|
||||||
return this.http.get(`${this.url}/Tv/` + searchTerm).map(this.extractData);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
return this.http.get(`${this.url}/Tv/trending`).map(this.extractData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,19 @@
|
||||||
import { Headers, Response, Http } from '@angular/http';
|
import { Headers, Http, Response } from "@angular/http";
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from "rxjs/Observable";
|
||||||
|
|
||||||
|
import { AuthHttp } from "angular2-jwt";
|
||||||
import { AuthHttp } from 'angular2-jwt';
|
|
||||||
|
|
||||||
export class ServiceHelpers {
|
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;
|
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) {
|
protected extractData(res: Response) {
|
||||||
let body = res.json();
|
const body = res.json();
|
||||||
//console.log('extractData', body || {});
|
//console.log('extractData', body || {});
|
||||||
return body || {};
|
return body || {};
|
||||||
}
|
}
|
||||||
|
@ -22,25 +21,23 @@ export class ServiceHelpers {
|
||||||
protected handleError(error: any) {
|
protected handleError(error: any) {
|
||||||
// In a real world app, we might use a remote logging infrastructure
|
// 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
|
// We'd also dig deeper into the error to get a better message
|
||||||
let errMsg = (error.message) ? error.message :
|
const errMsg = (error.message) ? error.message :
|
||||||
error.status ? `${error.status} - ${error.statusText}` : 'Server error';
|
error.status ? `${error.status} - ${error.statusText}` : "Server error";
|
||||||
return Observable.throw(errMsg);
|
return Observable.throw(errMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ServiceAuthHelpers {
|
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;
|
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) {
|
protected extractData(res: Response) {
|
||||||
let body = res.json();
|
const body = res.json();
|
||||||
//console.log('extractData', body || {});
|
//console.log('extractData', body || {});
|
||||||
return body || {};
|
return body || {};
|
||||||
}
|
}
|
||||||
|
@ -48,10 +45,8 @@ export class ServiceAuthHelpers {
|
||||||
protected handleError(error: any) {
|
protected handleError(error: any) {
|
||||||
// In a real world app, we might use a remote logging infrastructure
|
// 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
|
// We'd also dig deeper into the error to get a better message
|
||||||
let errMsg = (error.message) ? error.message :
|
const errMsg = (error.message) ? error.message :
|
||||||
error.status ? `${error.status} - ${error.statusText}` : 'Server error';
|
error.status ? `${error.status} - ${error.statusText}` : "Server error";
|
||||||
return Observable.throw(errMsg);
|
return Observable.throw(errMsg);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,171 +1,169 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from "@angular/core";
|
||||||
import { AuthHttp } from 'angular2-jwt';
|
import { Http } from "@angular/http";
|
||||||
import { Http } from '@angular/http';
|
import { AuthHttp } from "angular2-jwt";
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from "rxjs/Rx";
|
||||||
|
|
||||||
import { ServiceAuthHelpers } from './service.helpers';
|
|
||||||
import {
|
import {
|
||||||
IOmbiSettings,
|
IAuthenticationSettings,
|
||||||
IEmbySettings,
|
|
||||||
IPlexSettings,
|
|
||||||
ISonarrSettings,
|
|
||||||
ILandingPageSettings,
|
|
||||||
ICustomizationSettings,
|
ICustomizationSettings,
|
||||||
IRadarrSettings,
|
|
||||||
IAuthenticationSettings
|
|
||||||
} from '../interfaces/ISettings';
|
|
||||||
import {
|
|
||||||
IEmailNotificationSettings,
|
|
||||||
IDiscordNotifcationSettings,
|
IDiscordNotifcationSettings,
|
||||||
|
IEmailNotificationSettings,
|
||||||
|
IEmbySettings,
|
||||||
|
ILandingPageSettings,
|
||||||
|
IMattermostNotifcationSettings,
|
||||||
|
IOmbiSettings,
|
||||||
|
IPlexSettings,
|
||||||
IPushbulletNotificationSettings,
|
IPushbulletNotificationSettings,
|
||||||
ISlackNotificationSettings,
|
|
||||||
IPushoverNotificationSettings,
|
IPushoverNotificationSettings,
|
||||||
IMattermostNotifcationSettings
|
IRadarrSettings,
|
||||||
} from '../interfaces/INotifcationSettings';
|
ISlackNotificationSettings,
|
||||||
|
ISonarrSettings,
|
||||||
|
} from "../interfaces";
|
||||||
|
|
||||||
|
import { ServiceAuthHelpers } from "./service.helpers";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SettingsService extends ServiceAuthHelpers {
|
export class SettingsService extends ServiceAuthHelpers {
|
||||||
constructor(public httpAuth: AuthHttp, private nonAuthHttp: Http) {
|
constructor(public httpAuth: AuthHttp, private nonAuthHttp: Http) {
|
||||||
super(httpAuth, '/api/v1/Settings');
|
super(httpAuth, "/api/v1/Settings");
|
||||||
}
|
}
|
||||||
|
|
||||||
getOmbi(): Observable<IOmbiSettings> {
|
public getOmbi(): Observable<IOmbiSettings> {
|
||||||
return this.httpAuth.get(`${this.url}/Ombi/`).map(this.extractData).catch(this.handleError)
|
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 })
|
return this.httpAuth.post(`${this.url}/Ombi/`, JSON.stringify(settings), { headers: this.headers })
|
||||||
.map(this.extractData).catch(this.handleError);
|
.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)
|
return this.httpAuth.post(`${this.url}/Ombi/resetApi`, { headers: this.headers }).map(this.extractData)
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
getEmby(): Observable<IEmbySettings> {
|
public getEmby(): Observable<IEmbySettings> {
|
||||||
return this.httpAuth.get(`${this.url}/Emby/`).map(this.extractData).catch(this.handleError);
|
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 })
|
return this.httpAuth.post(`${this.url}/Emby/`, JSON.stringify(settings), { headers: this.headers })
|
||||||
.map(this.extractData).catch(this.handleError);
|
.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);
|
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 })
|
return this.httpAuth.post(`${this.url}/Plex/`, JSON.stringify(settings), { headers: this.headers })
|
||||||
.map(this.extractData).catch(this.handleError);
|
.map(this.extractData).catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
getSonarr(): Observable<ISonarrSettings> {
|
public getSonarr(): Observable<ISonarrSettings> {
|
||||||
return this.httpAuth.get(`${this.url}/Sonarr`).map(this.extractData)
|
return this.httpAuth.get(`${this.url}/Sonarr`).map(this.extractData)
|
||||||
.catch(this.handleError);
|
.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 })
|
return this.httpAuth.post(`${this.url}/Sonarr`, JSON.stringify(settings), { headers: this.headers })
|
||||||
.map(this.extractData).catch(this.handleError);
|
.map(this.extractData).catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
getRadarr(): Observable<IRadarrSettings> {
|
public getRadarr(): Observable<IRadarrSettings> {
|
||||||
return this.httpAuth.get(`${this.url}/Radarr`).map(this.extractData)
|
return this.httpAuth.get(`${this.url}/Radarr`).map(this.extractData)
|
||||||
.catch(this.handleError);
|
.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 })
|
return this.httpAuth.post(`${this.url}/Radarr`, JSON.stringify(settings), { headers: this.headers })
|
||||||
.map(this.extractData).catch(this.handleError);
|
.map(this.extractData).catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getAuthentication(): Observable<IAuthenticationSettings> {
|
||||||
getAuthentication(): Observable<IAuthenticationSettings> {
|
|
||||||
return this.httpAuth.get(`${this.url}/Authentication`).map(this.extractData)
|
return this.httpAuth.get(`${this.url}/Authentication`).map(this.extractData)
|
||||||
.catch(this.handleError);
|
.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 })
|
return this.httpAuth.post(`${this.url}/Authentication`, JSON.stringify(settings), { headers: this.headers })
|
||||||
.map(this.extractData).catch(this.handleError);
|
.map(this.extractData).catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Using http since we need it not to be authenticated to get the landing page settings
|
// 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);
|
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 })
|
return this.httpAuth.post(`${this.url}/LandingPage`, JSON.stringify(settings), { headers: this.headers })
|
||||||
.map(this.extractData).catch(this.handleError);
|
.map(this.extractData).catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Using http since we need it not to be authenticated to get the customization settings
|
// Using http since we need it not to be authenticated to get the customization settings
|
||||||
getCustomization(): Observable<ICustomizationSettings> {
|
public getCustomization(): Observable<ICustomizationSettings> {
|
||||||
return this.nonAuthHttp.get(`${this.url}/customization`).map(this.extractData).catch(this.handleError)
|
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 })
|
return this.httpAuth.post(`${this.url}/customization`, JSON.stringify(settings), { headers: this.headers })
|
||||||
.map(this.extractData).catch(this.handleError);
|
.map(this.extractData).catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
getEmailNotificationSettings(): Observable<IEmailNotificationSettings> {
|
public getEmailNotificationSettings(): Observable<IEmailNotificationSettings> {
|
||||||
return this.httpAuth.get(`${this.url}/notifications/email`).map(this.extractData).catch(this.handleError)
|
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
|
return this.httpAuth
|
||||||
.post(`${this.url}/notifications/email`, JSON.stringify(settings), { headers: this.headers })
|
.post(`${this.url}/notifications/email`, JSON.stringify(settings), { headers: this.headers })
|
||||||
.map(this.extractData).catch(this.handleError);
|
.map(this.extractData).catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
getDiscordNotificationSettings(): Observable<IDiscordNotifcationSettings> {
|
public getDiscordNotificationSettings(): Observable<IDiscordNotifcationSettings> {
|
||||||
return this.httpAuth.get(`${this.url}/notifications/discord`).map(this.extractData).catch(this.handleError)
|
return this.httpAuth.get(`${this.url}/notifications/discord`).map(this.extractData).catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
getMattermostNotificationSettings(): Observable<IMattermostNotifcationSettings> {
|
public getMattermostNotificationSettings(): Observable<IMattermostNotifcationSettings> {
|
||||||
return this.httpAuth.get(`${this.url}/notifications/mattermost`).map(this.extractData).catch(this.handleError)
|
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
|
return this.httpAuth
|
||||||
.post(`${this.url}/notifications/discord`, JSON.stringify(settings), { headers: this.headers })
|
.post(`${this.url}/notifications/discord`, JSON.stringify(settings), { headers: this.headers })
|
||||||
.map(this.extractData).catch(this.handleError);
|
.map(this.extractData).catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
saveMattermostNotificationSettings(settings: IMattermostNotifcationSettings): Observable<boolean> {
|
public saveMattermostNotificationSettings(settings: IMattermostNotifcationSettings): Observable<boolean> {
|
||||||
return this.httpAuth
|
return this.httpAuth
|
||||||
.post(`${this.url}/notifications/mattermost`, JSON.stringify(settings), { headers: this.headers })
|
.post(`${this.url}/notifications/mattermost`, JSON.stringify(settings), { headers: this.headers })
|
||||||
.map(this.extractData).catch(this.handleError);
|
.map(this.extractData).catch(this.handleError);
|
||||||
}
|
}
|
||||||
getPushbulletNotificationSettings(): Observable<IPushbulletNotificationSettings> {
|
public getPushbulletNotificationSettings(): Observable<IPushbulletNotificationSettings> {
|
||||||
return this.httpAuth.get(`${this.url}/notifications/pushbullet`).map(this.extractData).catch(this.handleError)
|
return this.httpAuth.get(`${this.url}/notifications/pushbullet`).map(this.extractData).catch(this.handleError);
|
||||||
}
|
}
|
||||||
getPushoverNotificationSettings(): Observable<IPushoverNotificationSettings> {
|
public getPushoverNotificationSettings(): Observable<IPushoverNotificationSettings> {
|
||||||
return this.httpAuth.get(`${this.url}/notifications/pushover`).map(this.extractData).catch(this.handleError)
|
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
|
return this.httpAuth
|
||||||
.post(`${this.url}/notifications/pushbullet`, JSON.stringify(settings), { headers: this.headers })
|
.post(`${this.url}/notifications/pushbullet`, JSON.stringify(settings), { headers: this.headers })
|
||||||
.map(this.extractData).catch(this.handleError);
|
.map(this.extractData).catch(this.handleError);
|
||||||
}
|
}
|
||||||
savePushoverNotificationSettings(settings: IPushoverNotificationSettings): Observable<boolean> {
|
public savePushoverNotificationSettings(settings: IPushoverNotificationSettings): Observable<boolean> {
|
||||||
return this.httpAuth
|
return this.httpAuth
|
||||||
.post(`${this.url}/notifications/pushover`, JSON.stringify(settings), { headers: this.headers })
|
.post(`${this.url}/notifications/pushover`, JSON.stringify(settings), { headers: this.headers })
|
||||||
.map(this.extractData).catch(this.handleError);
|
.map(this.extractData).catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
getSlackNotificationSettings(): Observable<ISlackNotificationSettings> {
|
public getSlackNotificationSettings(): Observable<ISlackNotificationSettings> {
|
||||||
return this.httpAuth.get(`${this.url}/notifications/slack`).map(this.extractData).catch(this.handleError)
|
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
|
return this.httpAuth
|
||||||
.post(`${this.url}/notifications/slack`, JSON.stringify(settings), { headers: this.headers })
|
.post(`${this.url}/notifications/slack`, JSON.stringify(settings), { headers: this.headers })
|
||||||
.map(this.extractData).catch(this.handleError);
|
.map(this.extractData).catch(this.handleError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from "@angular/core";
|
||||||
import { Http } from '@angular/http';
|
import { Http } from "@angular/http";
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from "rxjs/Rx";
|
||||||
|
|
||||||
import { ServiceHelpers } from './service.helpers';
|
|
||||||
|
|
||||||
|
import { ServiceHelpers } from "./service.helpers";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class StatusService extends ServiceHelpers {
|
export class StatusService extends ServiceHelpers {
|
||||||
constructor(http : Http) {
|
constructor(http: Http) {
|
||||||
super(http, '/api/v1/status/');
|
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);
|
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 { ICustomizationSettings } from "../../interfaces";
|
||||||
import { SettingsService } from '../../services/settings.service';
|
import { NotificationService } from "../../services";
|
||||||
import { NotificationService } from "../../services/notification.service";
|
import { SettingsService } from "../../services";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
templateUrl: "./customization.component.html",
|
||||||
templateUrl: './customization.component.html',
|
|
||||||
})
|
})
|
||||||
export class CustomizationComponent implements OnInit {
|
export class CustomizationComponent implements OnInit {
|
||||||
|
|
||||||
|
public settings: ICustomizationSettings;
|
||||||
|
|
||||||
constructor(private settingsService: SettingsService, private notificationService: NotificationService) { }
|
constructor(private settingsService: SettingsService, private notificationService: NotificationService) { }
|
||||||
|
|
||||||
settings: ICustomizationSettings;
|
public ngOnInit() {
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
|
|
||||||
this.settingsService.getCustomization().subscribe(x => this.settings = x);
|
this.settingsService.getCustomization().subscribe(x => this.settings = x);
|
||||||
}
|
}
|
||||||
|
|
||||||
save() {
|
public save() {
|
||||||
this.settingsService.saveCustomization(this.settings).subscribe(x => {
|
this.settingsService.saveCustomization(this.settings).subscribe(x => {
|
||||||
if (x) {
|
if (x) {
|
||||||
this.notificationService.success("Settings Saved", "Successfully saved Ombi settings");
|
this.notificationService.success("Settings Saved", "Successfully saved Ombi settings");
|
||||||
|
@ -28,4 +27,4 @@ export class CustomizationComponent implements OnInit {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,29 +1,29 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from "@angular/core";
|
||||||
|
|
||||||
import { IEmbySettings, IEmbyServer } from '../../interfaces/ISettings'
|
import { IEmbyServer, IEmbySettings } from "../../interfaces";
|
||||||
import { SettingsService } from '../../services/settings.service';
|
import { TesterService } from "../../services";
|
||||||
import { NotificationService } from "../../services/notification.service";
|
import { NotificationService } from "../../services";
|
||||||
import { TesterService } from '../../services/applications/tester.service';
|
import { SettingsService } from "../../services";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './emby.component.html'
|
templateUrl: "./emby.component.html",
|
||||||
})
|
})
|
||||||
export class EmbyComponent implements OnInit {
|
export class EmbyComponent implements OnInit {
|
||||||
|
|
||||||
|
public settings: IEmbySettings;
|
||||||
|
|
||||||
constructor(private settingsService: SettingsService,
|
constructor(private settingsService: SettingsService,
|
||||||
private notificationService: NotificationService,
|
private notificationService: NotificationService,
|
||||||
private testerService : TesterService) { }
|
private testerService: TesterService) { }
|
||||||
|
|
||||||
settings: IEmbySettings;
|
public ngOnInit() {
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
this.settingsService.getEmby().subscribe(x => this.settings = x);
|
this.settingsService.getEmby().subscribe(x => this.settings = x);
|
||||||
}
|
}
|
||||||
|
|
||||||
addTab() {
|
public addTab() {
|
||||||
if (this.settings.servers == null) {
|
if (this.settings.servers == null) {
|
||||||
this.settings.servers = [];
|
this.settings.servers = [];
|
||||||
}
|
}
|
||||||
this.settings.servers.push({
|
this.settings.servers.push({
|
||||||
name: "New*",
|
name: "New*",
|
||||||
id: Math.floor(Math.random() * (99999 - 0 + 1) + 1),
|
id: Math.floor(Math.random() * (99999 - 0 + 1) + 1),
|
||||||
|
@ -33,11 +33,11 @@ export class EmbyComponent implements OnInit {
|
||||||
ip: "",
|
ip: "",
|
||||||
port: 0,
|
port: 0,
|
||||||
ssl: false,
|
ssl: false,
|
||||||
subDir: ""
|
subDir: "",
|
||||||
} as IEmbyServer);
|
} as IEmbyServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
test(server: IEmbyServer) {
|
public test(server: IEmbyServer) {
|
||||||
this.testerService.embyTest(server).subscribe(x => {
|
this.testerService.embyTest(server).subscribe(x => {
|
||||||
if (x) {
|
if (x) {
|
||||||
this.notificationService.success("Connected", `Successfully connected to the Emby server ${server.name}!`);
|
this.notificationService.success("Connected", `Successfully connected to the Emby server ${server.name}!`);
|
||||||
|
@ -47,15 +47,14 @@ export class EmbyComponent implements OnInit {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
removeServer(server: IEmbyServer) {
|
public removeServer(server: IEmbyServer) {
|
||||||
var index = this.settings.servers.indexOf(server, 0);
|
const index = this.settings.servers.indexOf(server, 0);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
this.settings.servers.splice(index, 1);
|
this.settings.servers.splice(index, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public save() {
|
||||||
save() {
|
|
||||||
this.settingsService.saveEmby(this.settings).subscribe(x => {
|
this.settingsService.saveEmby(this.settings).subscribe(x => {
|
||||||
if (x) {
|
if (x) {
|
||||||
this.notificationService.success("Settings Saved", "Successfully saved Emby settings");
|
this.notificationService.success("Settings Saved", "Successfully saved Emby settings");
|
||||||
|
@ -64,4 +63,4 @@ export class EmbyComponent implements OnInit {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,25 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from "@angular/core";
|
||||||
|
|
||||||
import { ILandingPageSettings } from '../../interfaces/ISettings'
|
import { ILandingPageSettings } from "../../interfaces";
|
||||||
import { SettingsService } from '../../services/settings.service';
|
import { NotificationService } from "../../services";
|
||||||
import { NotificationService } from "../../services/notification.service";
|
import { SettingsService } from "../../services";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
templateUrl: "./landingpage.component.html",
|
||||||
templateUrl: './landingpage.component.html',
|
|
||||||
})
|
})
|
||||||
export class LandingPageComponent implements OnInit {
|
export class LandingPageComponent implements OnInit {
|
||||||
|
|
||||||
|
public settings: ILandingPageSettings;
|
||||||
|
|
||||||
constructor(private settingsService: SettingsService, private notificationService: NotificationService) { }
|
constructor(private settingsService: SettingsService, private notificationService: NotificationService) { }
|
||||||
|
|
||||||
settings: ILandingPageSettings;
|
public ngOnInit() {
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
this.settingsService.getLandingPage().subscribe(x => {
|
this.settingsService.getLandingPage().subscribe(x => {
|
||||||
this.settings = x
|
this.settings = x;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
save() {
|
public save() {
|
||||||
this.settingsService.saveLandingPage(this.settings).subscribe(x => {
|
this.settingsService.saveLandingPage(this.settings).subscribe(x => {
|
||||||
if (x) {
|
if (x) {
|
||||||
this.notificationService.success("Settings Saved", "Successfully saved the Landing Page settings");
|
this.notificationService.success("Settings Saved", "Successfully saved the Landing Page settings");
|
||||||
|
@ -29,4 +28,4 @@ export class LandingPageComponent implements OnInit {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from "@angular/core";
|
||||||
import { FormGroup, Validators, FormBuilder } from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
|
||||||
|
|
||||||
import { INotificationTemplates, IDiscordNotifcationSettings, NotificationType } from '../../interfaces/INotifcationSettings';
|
import { IDiscordNotifcationSettings, INotificationTemplates, NotificationType } from "../../interfaces";
|
||||||
import { SettingsService } from '../../services/settings.service';
|
import { TesterService } from "../../services";
|
||||||
import { NotificationService } from "../../services/notification.service";
|
import { NotificationService } from "../../services";
|
||||||
import { TesterService } from "../../services/applications/tester.service";
|
import { SettingsService } from "../../services";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './discord.component.html',
|
templateUrl: "./discord.component.html",
|
||||||
})
|
})
|
||||||
export class DiscordComponent implements OnInit {
|
export class DiscordComponent implements OnInit {
|
||||||
|
|
||||||
|
public NotificationType = NotificationType;
|
||||||
|
public templates: INotificationTemplates[];
|
||||||
|
public form: FormGroup;
|
||||||
|
|
||||||
constructor(private settingsService: SettingsService,
|
constructor(private settingsService: SettingsService,
|
||||||
private notificationService: NotificationService,
|
private notificationService: NotificationService,
|
||||||
private fb: FormBuilder,
|
private fb: FormBuilder,
|
||||||
private testerService : TesterService) { }
|
private testerService: TesterService) { }
|
||||||
|
|
||||||
NotificationType = NotificationType;
|
public ngOnInit() {
|
||||||
templates: INotificationTemplates[];
|
|
||||||
|
|
||||||
form: FormGroup;
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
this.settingsService.getDiscordNotificationSettings().subscribe(x => {
|
this.settingsService.getDiscordNotificationSettings().subscribe(x => {
|
||||||
this.templates = x.notificationTemplates;
|
this.templates = x.notificationTemplates;
|
||||||
|
|
||||||
|
@ -33,13 +33,13 @@ export class DiscordComponent implements OnInit {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit(form: FormGroup) {
|
public onSubmit(form: FormGroup) {
|
||||||
if (form.invalid) {
|
if (form.invalid) {
|
||||||
this.notificationService.error("Validation", "Please check your entered values");
|
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;
|
settings.notificationTemplates = this.templates;
|
||||||
|
|
||||||
this.settingsService.saveDiscordNotificationSettings(settings).subscribe(x => {
|
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) {
|
if (form.invalid) {
|
||||||
this.notificationService.error("Validation", "Please check your entered values");
|
this.notificationService.error("Validation", "Please check your entered values");
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.testerService.discordTest(form.value).subscribe(x => {
|
this.testerService.discordTest(form.value).subscribe(x => {
|
||||||
|
@ -64,7 +64,7 @@ export class DiscordComponent implements OnInit {
|
||||||
} else {
|
} else {
|
||||||
this.notificationService.success("Error", "There was an error when sending the Discord message. Please check your settings");
|
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 { Component, OnInit } from "@angular/core";
|
||||||
import { FormGroup, Validators, FormBuilder } from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
|
||||||
|
|
||||||
import { INotificationTemplates, IEmailNotificationSettings, NotificationType } from '../../interfaces/INotifcationSettings';
|
import { IEmailNotificationSettings, INotificationTemplates, NotificationType } from "../../interfaces";
|
||||||
import { SettingsService } from '../../services/settings.service';
|
import { TesterService } from "../../services";
|
||||||
import { NotificationService } from "../../services/notification.service";
|
import { ValidationService } from "../../services";
|
||||||
import { TesterService } from "../../services/applications/tester.service";
|
import { NotificationService } from "../../services";
|
||||||
import { ValidationService } from "../../services/helpers/validation.service";
|
import { SettingsService } from "../../services";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './emailnotification.component.html',
|
templateUrl: "./emailnotification.component.html",
|
||||||
})
|
})
|
||||||
export class EmailNotificationComponent implements OnInit {
|
export class EmailNotificationComponent implements OnInit {
|
||||||
|
public NotificationType = NotificationType;
|
||||||
|
public templates: INotificationTemplates[];
|
||||||
|
public emailForm: FormGroup;
|
||||||
|
|
||||||
constructor(private settingsService: SettingsService,
|
constructor(private settingsService: SettingsService,
|
||||||
private notificationService: NotificationService,
|
private notificationService: NotificationService,
|
||||||
private fb: FormBuilder,
|
private fb: FormBuilder,
|
||||||
private validationService: ValidationService,
|
private validationService: ValidationService,
|
||||||
private testerService: TesterService) { }
|
private testerService: TesterService) { }
|
||||||
|
|
||||||
NotificationType = NotificationType;
|
public ngOnInit() {
|
||||||
templates: INotificationTemplates[];
|
|
||||||
|
|
||||||
emailForm: FormGroup;
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
this.settingsService.getEmailNotificationSettings().subscribe(x => {
|
this.settingsService.getEmailNotificationSettings().subscribe(x => {
|
||||||
this.templates = x.notificationTemplates;
|
this.templates = x.notificationTemplates;
|
||||||
|
|
||||||
|
@ -39,21 +38,21 @@ export class EmailNotificationComponent implements OnInit {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (x.authentication) {
|
if (x.authentication) {
|
||||||
this.validationService.enableValidation(this.emailForm, 'username');
|
this.validationService.enableValidation(this.emailForm, "username");
|
||||||
this.validationService.enableValidation(this.emailForm, 'password');
|
this.validationService.enableValidation(this.emailForm, "password");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.subscribeToAuthChanges();
|
this.subscribeToAuthChanges();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit(form: FormGroup) {
|
public onSubmit(form: FormGroup) {
|
||||||
if (form.invalid) {
|
if (form.invalid) {
|
||||||
this.notificationService.error("Validation", "Please check your entered values");
|
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;
|
settings.notificationTemplates = this.templates;
|
||||||
|
|
||||||
this.settingsService.saveEmailNotificationSettings(settings).subscribe(x => {
|
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) {
|
if (form.invalid) {
|
||||||
this.notificationService.error("Validation", "Please check your entered values");
|
this.notificationService.error("Validation", "Please check your entered values");
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.testerService.emailTest(form.value).subscribe(x => {
|
this.testerService.emailTest(form.value).subscribe(x => {
|
||||||
|
@ -78,7 +77,7 @@ export class EmailNotificationComponent implements OnInit {
|
||||||
} else {
|
} else {
|
||||||
this.notificationService.success("Error", "There was an error when sending the Email message, please check your settings.");
|
this.notificationService.success("Error", "There was an error when sending the Email message, please check your settings.");
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private subscribeToAuthChanges() {
|
private subscribeToAuthChanges() {
|
||||||
|
@ -88,12 +87,12 @@ export class EmailNotificationComponent implements OnInit {
|
||||||
changes$.subscribe((auth: boolean) => {
|
changes$.subscribe((auth: boolean) => {
|
||||||
|
|
||||||
if (auth) {
|
if (auth) {
|
||||||
this.validationService.enableValidation(this.emailForm, 'username');
|
this.validationService.enableValidation(this.emailForm, "username");
|
||||||
this.validationService.enableValidation(this.emailForm, 'password');
|
this.validationService.enableValidation(this.emailForm, "password");
|
||||||
} else {
|
} else {
|
||||||
this.validationService.disableValidation(this.emailForm, 'username');
|
this.validationService.disableValidation(this.emailForm, "username");
|
||||||
this.validationService.disableValidation(this.emailForm, 'password');
|
this.validationService.disableValidation(this.emailForm, "password");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from "@angular/core";
|
||||||
import { FormGroup, Validators, FormBuilder } from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
|
||||||
|
|
||||||
import { INotificationTemplates, IMattermostNotifcationSettings, NotificationType } from '../../interfaces/INotifcationSettings';
|
import { IMattermostNotifcationSettings, INotificationTemplates, NotificationType } from "../../interfaces";
|
||||||
import { SettingsService } from '../../services/settings.service';
|
import { TesterService } from "../../services";
|
||||||
import { NotificationService } from "../../services/notification.service";
|
import { NotificationService } from "../../services";
|
||||||
import { TesterService } from "../../services/applications/tester.service";
|
import { SettingsService } from "../../services";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './mattermost.component.html'
|
templateUrl: "./mattermost.component.html",
|
||||||
})
|
})
|
||||||
export class MattermostComponent implements OnInit {
|
export class MattermostComponent implements OnInit {
|
||||||
|
|
||||||
|
public NotificationType = NotificationType;
|
||||||
|
public templates: INotificationTemplates[];
|
||||||
|
public form: FormGroup;
|
||||||
|
|
||||||
constructor(private settingsService: SettingsService,
|
constructor(private settingsService: SettingsService,
|
||||||
private notificationService: NotificationService,
|
private notificationService: NotificationService,
|
||||||
private fb: FormBuilder,
|
private fb: FormBuilder,
|
||||||
private testerService : TesterService) { }
|
private testerService: TesterService) { }
|
||||||
|
|
||||||
NotificationType = NotificationType;
|
public ngOnInit() {
|
||||||
templates: INotificationTemplates[];
|
|
||||||
|
|
||||||
form: FormGroup;
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
this.settingsService.getMattermostNotificationSettings().subscribe(x => {
|
this.settingsService.getMattermostNotificationSettings().subscribe(x => {
|
||||||
this.templates = x.notificationTemplates;
|
this.templates = x.notificationTemplates;
|
||||||
|
|
||||||
|
@ -29,19 +29,19 @@ export class MattermostComponent implements OnInit {
|
||||||
username: [x.username],
|
username: [x.username],
|
||||||
webhookUrl: [x.webhookUrl, [Validators.required]],
|
webhookUrl: [x.webhookUrl, [Validators.required]],
|
||||||
channel: [x.channel],
|
channel: [x.channel],
|
||||||
iconUrl:[x.iconUrl]
|
iconUrl:[x.iconUrl],
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit(form: FormGroup) {
|
public onSubmit(form: FormGroup) {
|
||||||
if (form.invalid) {
|
if (form.invalid) {
|
||||||
this.notificationService.error("Validation", "Please check your entered values");
|
this.notificationService.error("Validation", "Please check your entered values");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var settings = <IMattermostNotifcationSettings>form.value;
|
const settings = <IMattermostNotifcationSettings>form.value;
|
||||||
settings.notificationTemplates = this.templates;
|
settings.notificationTemplates = this.templates;
|
||||||
|
|
||||||
this.settingsService.saveMattermostNotificationSettings(settings).subscribe(x => {
|
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) {
|
if (form.invalid) {
|
||||||
this.notificationService.error("Validation", "Please check your entered values");
|
this.notificationService.error("Validation", "Please check your entered values");
|
||||||
return;
|
return;
|
||||||
|
@ -66,7 +66,7 @@ export class MattermostComponent implements OnInit {
|
||||||
} else {
|
} else {
|
||||||
this.notificationService.success("Error", "There was an error when sending the Mattermost message. Please check your settings");
|
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({
|
@Component({
|
||||||
selector:'notification-templates',
|
selector:"notification-templates",
|
||||||
templateUrl: './notificationtemplate.component.html',
|
templateUrl: "./notificationtemplate.component.html",
|
||||||
})
|
})
|
||||||
export class NotificationTemplate {
|
export class NotificationTemplate {
|
||||||
@Input() templates: INotificationTemplates[];
|
@Input() public templates: INotificationTemplates[];
|
||||||
NotificationType = NotificationType;
|
public NotificationType = NotificationType;
|
||||||
|
|
||||||
helpText = `
|
public helpText = `
|
||||||
{RequestedUser} : The User who requested the content <br/>
|
{RequestedUser} : The User who requested the content <br/>
|
||||||
{RequestedDate} : The Date the media was requested <br/>
|
{RequestedDate} : The Date the media was requested <br/>
|
||||||
{Title} : The title of the request e.g. Lion King <br/>
|
{Title} : The title of the request e.g. Lion King <br/>
|
||||||
|
@ -26,4 +26,4 @@ export class NotificationTemplate {
|
||||||
{ShortTime} : 16:02 <br/>
|
{ShortTime} : 16:02 <br/>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,25 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from "@angular/core";
|
||||||
import { FormGroup, Validators, FormBuilder } from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
|
||||||
|
|
||||||
import { INotificationTemplates, IPushbulletNotificationSettings, NotificationType } from '../../interfaces/INotifcationSettings';
|
import { INotificationTemplates, IPushbulletNotificationSettings, NotificationType } from "../../interfaces";
|
||||||
import { SettingsService } from '../../services/settings.service';
|
import { TesterService } from "../../services";
|
||||||
import { NotificationService } from "../../services/notification.service";
|
import { NotificationService } from "../../services";
|
||||||
import { TesterService } from "../../services/applications/tester.service";
|
import { SettingsService } from "../../services";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './pushbullet.component.html',
|
templateUrl: "./pushbullet.component.html",
|
||||||
})
|
})
|
||||||
export class PushbulletComponent implements OnInit {
|
export class PushbulletComponent implements OnInit {
|
||||||
|
public NotificationType = NotificationType;
|
||||||
|
public templates: INotificationTemplates[];
|
||||||
|
public form: FormGroup;
|
||||||
|
|
||||||
constructor(private settingsService: SettingsService,
|
constructor(private settingsService: SettingsService,
|
||||||
private notificationService: NotificationService,
|
private notificationService: NotificationService,
|
||||||
private fb: FormBuilder,
|
private fb: FormBuilder,
|
||||||
private testerService : TesterService) { }
|
private testerService: TesterService) { }
|
||||||
|
|
||||||
NotificationType = NotificationType;
|
public ngOnInit() {
|
||||||
templates: INotificationTemplates[];
|
|
||||||
|
|
||||||
form: FormGroup;
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
this.settingsService.getPushbulletNotificationSettings().subscribe(x => {
|
this.settingsService.getPushbulletNotificationSettings().subscribe(x => {
|
||||||
this.templates = x.notificationTemplates;
|
this.templates = x.notificationTemplates;
|
||||||
|
|
||||||
|
@ -32,13 +31,13 @@ export class PushbulletComponent implements OnInit {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit(form: FormGroup) {
|
public onSubmit(form: FormGroup) {
|
||||||
if (form.invalid) {
|
if (form.invalid) {
|
||||||
this.notificationService.error("Validation", "Please check your entered values");
|
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;
|
settings.notificationTemplates = this.templates;
|
||||||
|
|
||||||
this.settingsService.savePushbulletNotificationSettings(settings).subscribe(x => {
|
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) {
|
if (form.invalid) {
|
||||||
this.notificationService.error("Validation", "Please check your entered values");
|
this.notificationService.error("Validation", "Please check your entered values");
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.testerService.pushbulletTest(form.value).subscribe(x => {
|
this.testerService.pushbulletTest(form.value).subscribe(x => {
|
||||||
|
@ -63,7 +62,7 @@ export class PushbulletComponent implements OnInit {
|
||||||
} else {
|
} else {
|
||||||
this.notificationService.success("Error", "There was an error when sending the Pushbullet message. Please check your settings");
|
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 { Component, OnInit } from "@angular/core";
|
||||||
import { FormGroup, Validators, FormBuilder } from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
|
||||||
|
|
||||||
import { INotificationTemplates, IPushoverNotificationSettings, NotificationType } from '../../interfaces/INotifcationSettings';
|
import { INotificationTemplates, IPushoverNotificationSettings, NotificationType } from "../../interfaces";
|
||||||
import { SettingsService } from '../../services/settings.service';
|
import { TesterService } from "../../services";
|
||||||
import { NotificationService } from "../../services/notification.service";
|
import { NotificationService } from "../../services";
|
||||||
import { TesterService } from "../../services/applications/tester.service";
|
import { SettingsService } from "../../services";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './pushover.component.html',
|
templateUrl: "./pushover.component.html",
|
||||||
})
|
})
|
||||||
export class PushoverComponent implements OnInit {
|
export class PushoverComponent implements OnInit {
|
||||||
|
public NotificationType = NotificationType;
|
||||||
|
public templates: INotificationTemplates[];
|
||||||
|
public form: FormGroup;
|
||||||
|
|
||||||
constructor(private settingsService: SettingsService,
|
constructor(private settingsService: SettingsService,
|
||||||
private notificationService: NotificationService,
|
private notificationService: NotificationService,
|
||||||
private fb: FormBuilder,
|
private fb: FormBuilder,
|
||||||
private testerService : TesterService) { }
|
private testerService: TesterService) { }
|
||||||
|
|
||||||
NotificationType = NotificationType;
|
public ngOnInit() {
|
||||||
templates: INotificationTemplates[];
|
|
||||||
|
|
||||||
form: FormGroup;
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
this.settingsService.getPushoverNotificationSettings().subscribe(x => {
|
this.settingsService.getPushoverNotificationSettings().subscribe(x => {
|
||||||
this.templates = x.notificationTemplates;
|
this.templates = x.notificationTemplates;
|
||||||
|
|
||||||
|
@ -32,13 +31,13 @@ export class PushoverComponent implements OnInit {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit(form: FormGroup) {
|
public onSubmit(form: FormGroup) {
|
||||||
if (form.invalid) {
|
if (form.invalid) {
|
||||||
this.notificationService.error("Validation", "Please check your entered values");
|
this.notificationService.error("Validation", "Please check your entered values");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var settings = <IPushoverNotificationSettings>form.value;
|
const settings = <IPushoverNotificationSettings>form.value;
|
||||||
settings.notificationTemplates = this.templates;
|
settings.notificationTemplates = this.templates;
|
||||||
|
|
||||||
this.settingsService.savePushoverNotificationSettings(settings).subscribe(x => {
|
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) {
|
if (form.invalid) {
|
||||||
this.notificationService.error("Validation", "Please check your entered values");
|
this.notificationService.error("Validation", "Please check your entered values");
|
||||||
return;
|
return;
|
||||||
|
@ -63,7 +62,7 @@ export class PushoverComponent implements OnInit {
|
||||||
} else {
|
} else {
|
||||||
this.notificationService.success("Error", "There was an error when sending the Pushbullet message. Please check your settings");
|
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 { Component, OnInit } from "@angular/core";
|
||||||
import { FormGroup, Validators, FormBuilder } from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
|
||||||
|
|
||||||
import { INotificationTemplates, ISlackNotificationSettings, NotificationType } from '../../interfaces/INotifcationSettings';
|
import { INotificationTemplates, ISlackNotificationSettings, NotificationType } from "../../interfaces";
|
||||||
import { SettingsService } from '../../services/settings.service';
|
import { TesterService } from "../../services";
|
||||||
import { NotificationService } from "../../services/notification.service";
|
import { NotificationService } from "../../services";
|
||||||
import { TesterService } from "../../services/applications/tester.service";
|
import { SettingsService } from "../../services";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './slack.component.html',
|
templateUrl: "./slack.component.html",
|
||||||
})
|
})
|
||||||
export class SlackComponent implements OnInit {
|
export class SlackComponent implements OnInit {
|
||||||
|
public NotificationType = NotificationType;
|
||||||
|
public templates: INotificationTemplates[];
|
||||||
|
public form: FormGroup;
|
||||||
|
|
||||||
constructor(private settingsService: SettingsService,
|
constructor(private settingsService: SettingsService,
|
||||||
private notificationService: NotificationService,
|
private notificationService: NotificationService,
|
||||||
private fb: FormBuilder,
|
private fb: FormBuilder,
|
||||||
private testerService : TesterService) { }
|
private testerService: TesterService) { }
|
||||||
|
|
||||||
NotificationType = NotificationType;
|
public ngOnInit() {
|
||||||
templates: INotificationTemplates[];
|
|
||||||
|
|
||||||
form: FormGroup;
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
this.settingsService.getSlackNotificationSettings().subscribe(x => {
|
this.settingsService.getSlackNotificationSettings().subscribe(x => {
|
||||||
this.templates = x.notificationTemplates;
|
this.templates = x.notificationTemplates;
|
||||||
|
|
||||||
|
@ -30,20 +29,19 @@ export class SlackComponent implements OnInit {
|
||||||
webhookUrl: [x.webhookUrl, [Validators.required]],
|
webhookUrl: [x.webhookUrl, [Validators.required]],
|
||||||
iconEmoji: [x.iconEmoji],
|
iconEmoji: [x.iconEmoji],
|
||||||
iconUrl: [x.iconUrl],
|
iconUrl: [x.iconUrl],
|
||||||
channel: [x.channel]
|
channel: [x.channel],
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit(form: FormGroup) {
|
public onSubmit(form: FormGroup) {
|
||||||
if (form.invalid) {
|
if (form.invalid) {
|
||||||
this.notificationService.error("Validation", "Please check your entered values");
|
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) {
|
if (settings.iconEmoji && settings.iconUrl) {
|
||||||
|
|
||||||
this.notificationService.error("Validation", "You cannot have a Emoji icon and a URL icon");
|
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) {
|
if (form.invalid) {
|
||||||
this.notificationService.error("Validation", "Please check your entered values");
|
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) {
|
if (settings.iconEmoji && settings.iconUrl) {
|
||||||
|
|
||||||
this.notificationService.error("Validation", "You cannot have a Emoji icon and a URL icon");
|
this.notificationService.error("Validation", "You cannot have a Emoji icon and a URL icon");
|
||||||
|
@ -79,7 +77,7 @@ export class SlackComponent implements OnInit {
|
||||||
} else {
|
} else {
|
||||||
this.notificationService.success("Error", "There was an error when sending the Slack message. Please check your settings");
|
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 { Component, OnInit } from "@angular/core";
|
||||||
import { FormGroup, FormBuilder } from '@angular/forms';
|
import { FormBuilder, FormGroup } from "@angular/forms";
|
||||||
|
|
||||||
import { SettingsService } from '../../services/settings.service';
|
import { NotificationService } from "../../services";
|
||||||
import { NotificationService } from "../../services/notification.service";
|
import { SettingsService } from "../../services";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './ombi.component.html',
|
templateUrl: "./ombi.component.html",
|
||||||
})
|
})
|
||||||
export class OmbiComponent implements OnInit {
|
export class OmbiComponent implements OnInit {
|
||||||
|
|
||||||
|
public form: FormGroup;
|
||||||
|
|
||||||
constructor(private settingsService: SettingsService,
|
constructor(private settingsService: SettingsService,
|
||||||
private notificationService: NotificationService,
|
private notificationService: NotificationService,
|
||||||
private fb: FormBuilder) { }
|
private fb: FormBuilder) { }
|
||||||
|
|
||||||
form: FormGroup;
|
public ngOnInit() {
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
this.settingsService.getOmbi().subscribe(x => {
|
this.settingsService.getOmbi().subscribe(x => {
|
||||||
this.form = this.fb.group({
|
this.form = this.fb.group({
|
||||||
port: [x.port],
|
port: [x.port],
|
||||||
collectAnalyticData: [x.collectAnalyticData],
|
collectAnalyticData: [x.collectAnalyticData],
|
||||||
apiKey: [x.apiKey],
|
apiKey: [x.apiKey],
|
||||||
externalUrl: [x.externalUrl],
|
externalUrl: [x.externalUrl],
|
||||||
allowExternalUsersToAuthenticate: [x.allowExternalUsersToAuthenticate]
|
allowExternalUsersToAuthenticate: [x.allowExternalUsersToAuthenticate],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public refreshApiKey() {
|
||||||
refreshApiKey() {
|
|
||||||
this.settingsService.resetOmbiApi().subscribe(x => {
|
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) {
|
if (form.invalid) {
|
||||||
this.notificationService.error("Validation", "Please check your entered values");
|
this.notificationService.error("Validation", "Please check your entered values");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.settingsService.saveOmbi(form.value).subscribe(x => {
|
this.settingsService.saveOmbi(form.value).subscribe(x => {
|
||||||
if (x) {
|
if (x) {
|
||||||
this.notificationService.success("Settings Saved", "Successfully saved Ombi settings");
|
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!");
|
this.notificationService.success("Copied", "Copied the Api Key to the clipboard!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,63 +1,64 @@
|
||||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
import { Component, OnDestroy, OnInit } from "@angular/core";
|
||||||
import { Subject } from 'rxjs/Subject';
|
|
||||||
import "rxjs/add/operator/takeUntil";
|
import "rxjs/add/operator/takeUntil";
|
||||||
|
import { Subject } from "rxjs/Subject";
|
||||||
|
|
||||||
import { IPlexSettings, IPlexLibraries, IPlexServer } from '../../interfaces/ISettings';
|
import { IPlexServerResponse, IPlexServerViewModel } from "../../interfaces";
|
||||||
import { IPlexServerResponse, IPlexServerViewModel } from '../../interfaces/IPlex'
|
import { IPlexLibrariesSettings, IPlexServer, IPlexSettings } from "../../interfaces";
|
||||||
|
|
||||||
import { SettingsService } from '../../services/settings.service';
|
import { PlexService } from "../../services";
|
||||||
import { TesterService } from '../../services/applications/tester.service';
|
import { TesterService } from "../../services";
|
||||||
import { PlexService } from '../../services/applications/plex.service';
|
import { NotificationService } from "../../services";
|
||||||
import { NotificationService } from "../../services/notification.service";
|
import { SettingsService } from "../../services";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './plex.component.html',
|
templateUrl: "./plex.component.html",
|
||||||
})
|
})
|
||||||
export class PlexComponent implements OnInit, OnDestroy {
|
export class PlexComponent implements OnInit, OnDestroy {
|
||||||
constructor(private settingsService: SettingsService,
|
public settings: IPlexSettings;
|
||||||
private notificationService: NotificationService,
|
public loadedServers: IPlexServerViewModel; // This comes from the api call for the user to select a server
|
||||||
private plexService: PlexService,
|
public username: string;
|
||||||
private testerService : TesterService) { }
|
public password: string;
|
||||||
|
public serversButton = false;
|
||||||
|
|
||||||
settings: IPlexSettings;
|
|
||||||
loadedServers: IPlexServerViewModel; // This comes from the api call for the user to select a server
|
|
||||||
private subscriptions = new Subject<void>();
|
private subscriptions = new Subject<void>();
|
||||||
username: string;
|
|
||||||
password: string;
|
|
||||||
serversButton = false;
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
constructor(private settingsService: SettingsService,
|
||||||
|
private notificationService: NotificationService,
|
||||||
|
private plexService: PlexService,
|
||||||
|
private testerService: TesterService) { }
|
||||||
|
|
||||||
|
public ngOnInit() {
|
||||||
this.settingsService.getPlex().subscribe(x => {
|
this.settingsService.getPlex().subscribe(x => {
|
||||||
this.settings = x;
|
this.settings = x;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
requestServers(server: IPlexServer): void {
|
public requestServers(server: IPlexServer) {
|
||||||
this.plexService.getServers(this.username, this.password)
|
this.plexService.getServers(this.username, this.password)
|
||||||
.takeUntil(this.subscriptions)
|
.takeUntil(this.subscriptions)
|
||||||
.subscribe(x => {
|
.subscribe(x => {
|
||||||
if (x.success) {
|
if (x.success) {
|
||||||
this.loadedServers = x;
|
this.loadedServers = x;
|
||||||
this.serversButton = true;
|
this.serversButton = true;
|
||||||
this.notificationService.success("Loaded", "Found the servers! Please select one!")
|
this.notificationService.success("Loaded", "Found the servers! Please select one!");
|
||||||
} else {
|
} else {
|
||||||
this.notificationService.warning("Error When Requesting Plex Servers", "Please make sure your username and password are correct");
|
this.notificationService.warning("Error When Requesting Plex Servers", "Please make sure your username and password are correct");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
selectServer(selectedServer: IPlexServerResponse, server: IPlexServer) {
|
public selectServer(selectedServer: IPlexServerResponse, server: IPlexServer) {
|
||||||
server.ip = selectedServer.localAddresses.split(',')[0];
|
server.ip = selectedServer.localAddresses.split(",")[0];
|
||||||
server.name = selectedServer.name;
|
server.name = selectedServer.name;
|
||||||
server.machineIdentifier = selectedServer.machineIdentifier;
|
server.machineIdentifier = selectedServer.machineIdentifier;
|
||||||
server.plexAuthToken = selectedServer.accessToken;
|
server.plexAuthToken = selectedServer.accessToken;
|
||||||
server.port = parseInt(selectedServer.port);
|
server.port = parseInt(selectedServer.port);
|
||||||
server.ssl = selectedServer.scheme === "http" ? false : true;
|
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 => {
|
this.testerService.plexTest(server).subscribe(x => {
|
||||||
if (x) {
|
if (x) {
|
||||||
this.notificationService.success("Connected", `Successfully connected to the Plex server ${server.name}!`);
|
this.notificationService.success("Connected", `Successfully connected to the Plex server ${server.name}!`);
|
||||||
|
@ -67,42 +68,42 @@ export class PlexComponent implements OnInit, OnDestroy {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
addTab() {
|
public addTab() {
|
||||||
if (this.settings.servers == null) {
|
if (this.settings.servers == null) {
|
||||||
this.settings.servers = [];
|
this.settings.servers = [];
|
||||||
}
|
}
|
||||||
this.settings.servers.push(<IPlexServer>{ name: "New*", id: Math.floor(Math.random() * (99999 - 0 + 1) + 1) });
|
this.settings.servers.push(<IPlexServer>{ name: "New*", id: Math.floor(Math.random() * (99999 - 0 + 1) + 1) });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
removeServer(server: IPlexServer) {
|
public removeServer(server: IPlexServer) {
|
||||||
var index = this.settings.servers.indexOf(server, 0);
|
const index = this.settings.servers.indexOf(server, 0);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
this.settings.servers.splice(index, 1);
|
this.settings.servers.splice(index, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loadLibraries(server: IPlexServer) {
|
public loadLibraries(server: IPlexServer) {
|
||||||
if (server.ip == null) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
this.plexService.getLibraries(server).subscribe(x => {
|
this.plexService.getLibraries(server).subscribe(x => {
|
||||||
server.plexSelectedLibraries = [];
|
server.plexSelectedLibraries = [];
|
||||||
x.mediaContainer.directory.forEach((item, index) => {
|
x.mediaContainer.directory.forEach((item, index) => {
|
||||||
var lib: IPlexLibraries = {
|
const lib: IPlexLibrariesSettings = {
|
||||||
key: item.key,
|
key: item.key,
|
||||||
title: item.title,
|
title: item.title,
|
||||||
enabled: false
|
enabled: false,
|
||||||
};
|
};
|
||||||
server.plexSelectedLibraries.push(lib);
|
server.plexSelectedLibraries.push(lib);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
err => { this.notificationService.error("Error", err) });
|
err => { this.notificationService.error("Error", err); });
|
||||||
}
|
}
|
||||||
|
|
||||||
save() {
|
public save() {
|
||||||
var filtered = this.settings.servers.filter(x => x.name !== "");
|
const filtered = this.settings.servers.filter(x => x.name !== "");
|
||||||
this.settings.servers = filtered;
|
this.settings.servers = filtered;
|
||||||
this.settingsService.savePlex(this.settings).subscribe(x => {
|
this.settingsService.savePlex(this.settings).subscribe(x => {
|
||||||
if (x) {
|
if (x) {
|
||||||
|
@ -113,8 +114,8 @@ export class PlexComponent implements OnInit, OnDestroy {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
public ngOnDestroy() {
|
||||||
this.subscriptions.next();
|
this.subscriptions.next();
|
||||||
this.subscriptions.complete();
|
this.subscriptions.complete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,40 +1,37 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from "@angular/core";
|
||||||
import { Subject } from 'rxjs/Subject';
|
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
|
||||||
import "rxjs/add/operator/takeUntil";
|
import "rxjs/add/operator/takeUntil";
|
||||||
import { FormGroup, Validators, FormBuilder } from '@angular/forms';
|
import { Subject } from "rxjs/Subject";
|
||||||
|
|
||||||
import { IRadarrSettings } from '../../interfaces/ISettings';
|
import { IMinimumAvailability, IRadarrProfile, IRadarrRootFolder } from "../../interfaces";
|
||||||
import { IRadarrProfile, IRadarrRootFolder, IMinimumAvailability } from '../../interfaces/IRadarr';
|
import { IRadarrSettings } from "../../interfaces";
|
||||||
import { SettingsService } from '../../services/settings.service';
|
import { RadarrService } from "../../services";
|
||||||
import { RadarrService } from '../../services/applications/radarr.service';
|
import { TesterService } from "../../services";
|
||||||
import { TesterService } from '../../services/applications/tester.service';
|
import { NotificationService } from "../../services";
|
||||||
import { NotificationService } from "../../services/notification.service";
|
import { SettingsService } from "../../services";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
templateUrl: "./radarr.component.html",
|
||||||
templateUrl: './radarr.component.html',
|
|
||||||
})
|
})
|
||||||
export class RadarrComponent implements OnInit {
|
export class RadarrComponent implements OnInit {
|
||||||
|
|
||||||
constructor(private settingsService: SettingsService,
|
public qualities: IRadarrProfile[];
|
||||||
private radarrService: RadarrService,
|
public rootFolders: IRadarrRootFolder[];
|
||||||
private notificationService: NotificationService,
|
public minimumAvailabilityOptions: IMinimumAvailability[];
|
||||||
private fb: FormBuilder,
|
public profilesRunning: boolean;
|
||||||
private testerService : TesterService) { }
|
public rootFoldersRunning: boolean;
|
||||||
qualities: IRadarrProfile[];
|
public advanced = false;
|
||||||
rootFolders: IRadarrRootFolder[];
|
public form: FormGroup;
|
||||||
|
|
||||||
minimumAvailabilityOptions: IMinimumAvailability[];
|
|
||||||
|
|
||||||
profilesRunning: boolean;
|
|
||||||
rootFoldersRunning: boolean;
|
|
||||||
|
|
||||||
advanced = false;
|
|
||||||
private subscriptions = new Subject<void>();
|
private subscriptions = new Subject<void>();
|
||||||
|
|
||||||
form : FormGroup;
|
constructor(private settingsService: SettingsService,
|
||||||
ngOnInit(): void {
|
private radarrService: RadarrService,
|
||||||
|
private notificationService: NotificationService,
|
||||||
|
private fb: FormBuilder,
|
||||||
|
private testerService: TesterService) { }
|
||||||
|
|
||||||
|
public ngOnInit() {
|
||||||
this.settingsService.getRadarr()
|
this.settingsService.getRadarr()
|
||||||
.takeUntil(this.subscriptions)
|
.takeUntil(this.subscriptions)
|
||||||
.subscribe(x => {
|
.subscribe(x => {
|
||||||
|
@ -49,7 +46,7 @@ export class RadarrComponent implements OnInit {
|
||||||
ip: [x.ip, [Validators.required]],
|
ip: [x.ip, [Validators.required]],
|
||||||
port: [x.port, [Validators.required]],
|
port: [x.port, [Validators.required]],
|
||||||
addOnly: [x.addOnly],
|
addOnly: [x.addOnly],
|
||||||
minimumAvailability: [x.minimumAvailability, [Validators.required]]
|
minimumAvailability: [x.minimumAvailability, [Validators.required]],
|
||||||
});
|
});
|
||||||
|
|
||||||
if (x.defaultQualityProfile) {
|
if (x.defaultQualityProfile) {
|
||||||
|
@ -69,33 +66,32 @@ export class RadarrComponent implements OnInit {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getProfiles(form: FormGroup) {
|
||||||
getProfiles(form: FormGroup) {
|
|
||||||
this.profilesRunning = true;
|
this.profilesRunning = true;
|
||||||
this.radarrService.getQualityProfiles(form.value).subscribe(x => {
|
this.radarrService.getQualityProfiles(form.value).subscribe(x => {
|
||||||
this.qualities = x;
|
this.qualities = x;
|
||||||
|
|
||||||
this.profilesRunning = false;
|
this.profilesRunning = false;
|
||||||
this.notificationService.success("Quality Profiles", "Successfully retrevied the Quality Profiles");
|
this.notificationService.success("Quality Profiles", "Successfully retrevied the Quality Profiles");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getRootFolders(form: FormGroup) {
|
public getRootFolders(form: FormGroup) {
|
||||||
this.rootFoldersRunning = true;
|
this.rootFoldersRunning = true;
|
||||||
this.radarrService.getRootFolders(form.value).subscribe(x => {
|
this.radarrService.getRootFolders(form.value).subscribe(x => {
|
||||||
this.rootFolders = x;
|
this.rootFolders = x;
|
||||||
|
|
||||||
this.rootFoldersRunning = false;
|
this.rootFoldersRunning = false;
|
||||||
this.notificationService.success("Settings Saved", "Successfully retrevied the Root Folders");
|
this.notificationService.success("Settings Saved", "Successfully retrevied the Root Folders");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
test(form: FormGroup) {
|
public test(form: FormGroup) {
|
||||||
if (form.invalid) {
|
if (form.invalid) {
|
||||||
this.notificationService.error("Validation", "Please check your entered values");
|
this.notificationService.error("Validation", "Please check your entered values");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var settings = <IRadarrSettings>form.value;
|
const settings = <IRadarrSettings>form.value;
|
||||||
this.testerService.radarrTest(settings).subscribe(x => {
|
this.testerService.radarrTest(settings).subscribe(x => {
|
||||||
if (x) {
|
if (x) {
|
||||||
this.notificationService.success("Connected", "Successfully connected to Radarr!");
|
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) {
|
if (form.invalid) {
|
||||||
this.notificationService.error("Validation", "Please check your entered values");
|
this.notificationService.error("Validation", "Please check your entered values");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var settings = <IRadarrSettings>form.value;
|
const settings = <IRadarrSettings>form.value;
|
||||||
this.settingsService.saveRadarr(settings).subscribe(x => {
|
this.settingsService.saveRadarr(settings).subscribe(x => {
|
||||||
if (x) {
|
if (x) {
|
||||||
this.notificationService.success("Settings Saved", "Successfully saved Radarr settings");
|
this.notificationService.success("Settings Saved", "Successfully saved Radarr settings");
|
||||||
|
@ -122,8 +118,8 @@ onSubmit(form: FormGroup) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
public ngOnDestroy() {
|
||||||
this.subscriptions.next();
|
this.subscriptions.next();
|
||||||
this.subscriptions.complete();
|
this.subscriptions.complete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,54 +1,54 @@
|
||||||
import { NgModule, } from '@angular/core';
|
import { CommonModule } from "@angular/common";
|
||||||
import { CommonModule } from '@angular/common';
|
import { NgModule } from "@angular/core";
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
import { RouterModule, Routes } from "@angular/router";
|
||||||
import { NgbModule, NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbAccordionModule, NgbModule } from "@ng-bootstrap/ng-bootstrap";
|
||||||
import { ClipboardModule } from 'ngx-clipboard/dist';
|
import { ClipboardModule } from "ngx-clipboard/dist";
|
||||||
|
|
||||||
import { AuthService } from '../auth/auth.service';
|
import { AuthGuard } from "../auth/auth.guard";
|
||||||
import { AuthGuard } from '../auth/auth.guard';
|
import { AuthModule } from "../auth/auth.module";
|
||||||
import { AuthModule } from '../auth/auth.module';
|
import { AuthService } from "../auth/auth.service";
|
||||||
import { SonarrService } from '../services/applications/sonarr.service';
|
import { RadarrService } from "../services";
|
||||||
import { RadarrService } from '../services/applications/radarr.service';
|
import { SonarrService } from "../services";
|
||||||
import { TesterService } from '../services/applications/tester.service';
|
import { TesterService } from "../services";
|
||||||
import { ValidationService } from '../services/helpers/validation.service';
|
import { ValidationService } from "../services";
|
||||||
|
|
||||||
import { OmbiComponent } from './ombi/ombi.component';
|
import { PipeModule } from "../pipes/pipe.module";
|
||||||
import { PlexComponent } from './plex/plex.component';
|
import { CustomizationComponent } from "./customization/customization.component";
|
||||||
import { EmbyComponent } from './emby/emby.component';
|
import { EmbyComponent } from "./emby/emby.component";
|
||||||
import { SonarrComponent } from './sonarr/sonarr.component';
|
import { LandingPageComponent } from "./landingpage/landingpage.component";
|
||||||
import { RadarrComponent } from './radarr/radarr.component';
|
import { DiscordComponent } from "./notifications/discord.component";
|
||||||
import { LandingPageComponent } from './landingpage/landingpage.component';
|
import { EmailNotificationComponent } from "./notifications/emailnotification.component";
|
||||||
import { CustomizationComponent } from './customization/customization.component';
|
import { MattermostComponent } from "./notifications/mattermost.component";
|
||||||
import { UserManagementComponent } from './usermanagement/usermanagement.component';
|
import { NotificationTemplate } from "./notifications/notificationtemplate.component";
|
||||||
import { EmailNotificationComponent } from './notifications/emailnotification.component';
|
import { PushbulletComponent } from "./notifications/pushbullet.component";
|
||||||
import { DiscordComponent } from './notifications/discord.component';
|
import { PushoverComponent } from "./notifications/pushover.component";
|
||||||
import { SlackComponent } from './notifications/slack.component';
|
import { SlackComponent } from "./notifications/slack.component";
|
||||||
import { PushoverComponent } from './notifications/pushover.component';
|
import { OmbiComponent } from "./ombi/ombi.component";
|
||||||
import { PushbulletComponent } from './notifications/pushbullet.component';
|
import { PlexComponent } from "./plex/plex.component";
|
||||||
import { MattermostComponent } from './notifications/mattermost.component';
|
import { RadarrComponent } from "./radarr/radarr.component";
|
||||||
import { NotificationTemplate } from './notifications/notificationtemplate.component';
|
import { SonarrComponent } from "./sonarr/sonarr.component";
|
||||||
import { PipeModule } from '../pipes/pipe.module';
|
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 = [
|
const routes: Routes = [
|
||||||
{ path: 'Settings/Ombi', component: OmbiComponent, canActivate: [AuthGuard] },
|
{ path: "Settings/Ombi", component: OmbiComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'Settings/Plex', component: PlexComponent, canActivate: [AuthGuard] },
|
{ path: "Settings/Plex", component: PlexComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'Settings/Emby', component: EmbyComponent, canActivate: [AuthGuard] },
|
{ path: "Settings/Emby", component: EmbyComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'Settings/Sonarr', component: SonarrComponent, canActivate: [AuthGuard] },
|
{ path: "Settings/Sonarr", component: SonarrComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'Settings/Radarr', component: RadarrComponent, canActivate: [AuthGuard] },
|
{ path: "Settings/Radarr", component: RadarrComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'Settings/LandingPage', component: LandingPageComponent, canActivate: [AuthGuard] },
|
{ path: "Settings/LandingPage", component: LandingPageComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'Settings/Customization', component: CustomizationComponent, canActivate: [AuthGuard] },
|
{ path: "Settings/Customization", component: CustomizationComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'Settings/Email', component: EmailNotificationComponent, canActivate: [AuthGuard] },
|
{ path: "Settings/Email", component: EmailNotificationComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'Settings/Discord', component: DiscordComponent, canActivate: [AuthGuard] },
|
{ path: "Settings/Discord", component: DiscordComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'Settings/Slack', component: SlackComponent, canActivate: [AuthGuard] },
|
{ path: "Settings/Slack", component: SlackComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'Settings/Pushover', component: PushoverComponent, canActivate: [AuthGuard] },
|
{ path: "Settings/Pushover", component: PushoverComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'Settings/Pushbullet', component: PushbulletComponent, canActivate: [AuthGuard] },
|
{ path: "Settings/Pushbullet", component: PushbulletComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'Settings/Mattermost', component: MattermostComponent, canActivate: [AuthGuard] },
|
{ path: "Settings/Mattermost", component: MattermostComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'Settings/UserManagement', component: UserManagementComponent, canActivate: [AuthGuard] },
|
{ path: "Settings/UserManagement", component: UserManagementComponent, canActivate: [AuthGuard] },
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
@ -88,7 +88,7 @@ const routes: Routes = [
|
||||||
UserManagementComponent,
|
UserManagementComponent,
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
RouterModule
|
RouterModule,
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
SonarrService,
|
SonarrService,
|
||||||
|
@ -96,8 +96,8 @@ const routes: Routes = [
|
||||||
RadarrService,
|
RadarrService,
|
||||||
AuthGuard,
|
AuthGuard,
|
||||||
ValidationService,
|
ValidationService,
|
||||||
TesterService
|
TesterService,
|
||||||
],
|
],
|
||||||
|
|
||||||
})
|
})
|
||||||
export class SettingsModule { }
|
export class SettingsModule { }
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component } from "@angular/core";
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'settings-menu',
|
selector: "settings-menu",
|
||||||
templateUrl: './settingsmenu.component.html'
|
templateUrl: "./settingsmenu.component.html",
|
||||||
})
|
})
|
||||||
export class SettingsMenuComponent {
|
export class SettingsMenuComponent { }
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,47 +1,45 @@
|
||||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
import { Component, OnDestroy, OnInit } from "@angular/core";
|
||||||
import { Subject } from 'rxjs/Subject';
|
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
|
||||||
import "rxjs/add/operator/takeUntil";
|
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";
|
||||||
import { ISonarrSettings } from '../../interfaces/ISettings';
|
import { SonarrService } from "../../services";
|
||||||
import { SettingsService } from '../../services/settings.service';
|
import { TesterService } from "../../services";
|
||||||
import { SonarrService } from '../../services/applications/sonarr.service';
|
import { NotificationService } from "../../services";
|
||||||
import { NotificationService } from "../../services/notification.service";
|
import { SettingsService } from "../../services";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
templateUrl: "./sonarr.component.html",
|
||||||
templateUrl: './sonarr.component.html',
|
|
||||||
})
|
})
|
||||||
export class SonarrComponent implements OnInit, OnDestroy {
|
export class SonarrComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
constructor(private settingsService: SettingsService,
|
public qualities: ISonarrProfile[];
|
||||||
private sonarrService: SonarrService,
|
public rootFolders: ISonarrRootFolder[];
|
||||||
private notificationService: NotificationService,
|
public selectedRootFolder: ISonarrRootFolder;
|
||||||
private testerService : TesterService,
|
public selectedQuality: ISonarrProfile;
|
||||||
private fb : FormBuilder) { }
|
public profilesRunning: boolean;
|
||||||
|
public rootFoldersRunning: boolean;
|
||||||
|
public form: FormGroup;
|
||||||
|
public advanced = false;
|
||||||
|
|
||||||
qualities: ISonarrProfile[];
|
|
||||||
rootFolders: ISonarrRootFolder[];
|
|
||||||
|
|
||||||
selectedRootFolder: ISonarrRootFolder;
|
|
||||||
selectedQuality: ISonarrProfile;
|
|
||||||
|
|
||||||
profilesRunning: boolean;
|
|
||||||
rootFoldersRunning: boolean;
|
|
||||||
private subscriptions = new Subject<void>();
|
private subscriptions = new Subject<void>();
|
||||||
form : FormGroup;
|
|
||||||
advanced = false;
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
constructor(private settingsService: SettingsService,
|
||||||
|
private sonarrService: SonarrService,
|
||||||
|
private notificationService: NotificationService,
|
||||||
|
private testerService: TesterService,
|
||||||
|
private fb: FormBuilder) { }
|
||||||
|
|
||||||
|
public ngOnInit() {
|
||||||
|
|
||||||
this.settingsService.getSonarr()
|
this.settingsService.getSonarr()
|
||||||
.takeUntil(this.subscriptions)
|
.takeUntil(this.subscriptions)
|
||||||
.subscribe(x => {
|
.subscribe(x => {
|
||||||
|
|
||||||
this.form = this.fb.group({
|
this.form = this.fb.group({
|
||||||
enabled: [x.enabled],
|
enabled: [x.enabled],
|
||||||
apiKey: [x.apiKey, [Validators.required]],
|
apiKey: [x.apiKey, [Validators.required]],
|
||||||
qualityProfile: [x.qualityProfile, [Validators.required]],
|
qualityProfile: [x.qualityProfile, [Validators.required]],
|
||||||
|
@ -54,19 +52,16 @@ export class SonarrComponent implements OnInit, OnDestroy {
|
||||||
seasonFolders: [x.seasonFolders],
|
seasonFolders: [x.seasonFolders],
|
||||||
});
|
});
|
||||||
|
|
||||||
if (x.qualityProfile)
|
if (x.qualityProfile) {
|
||||||
{
|
|
||||||
this.getProfiles(this.form);
|
this.getProfiles(this.form);
|
||||||
}
|
}
|
||||||
if (x.rootPath)
|
if (x.rootPath) {
|
||||||
{
|
|
||||||
this.getRootFolders(this.form);
|
this.getRootFolders(this.form);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getProfiles(form: FormGroup) {
|
||||||
getProfiles(form:FormGroup) {
|
|
||||||
this.profilesRunning = true;
|
this.profilesRunning = true;
|
||||||
this.sonarrService.getQualityProfiles(form.value)
|
this.sonarrService.getQualityProfiles(form.value)
|
||||||
.takeUntil(this.subscriptions)
|
.takeUntil(this.subscriptions)
|
||||||
|
@ -78,7 +73,7 @@ export class SonarrComponent implements OnInit, OnDestroy {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getRootFolders(form:FormGroup) {
|
public getRootFolders(form: FormGroup) {
|
||||||
this.rootFoldersRunning = true;
|
this.rootFoldersRunning = true;
|
||||||
this.sonarrService.getRootFolders(form.value)
|
this.sonarrService.getRootFolders(form.value)
|
||||||
.takeUntil(this.subscriptions)
|
.takeUntil(this.subscriptions)
|
||||||
|
@ -90,12 +85,12 @@ export class SonarrComponent implements OnInit, OnDestroy {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
test(form: FormGroup) {
|
public test(form: FormGroup) {
|
||||||
if (form.invalid) {
|
if (form.invalid) {
|
||||||
this.notificationService.error("Validation", "Please check your entered values");
|
this.notificationService.error("Validation", "Please check your entered values");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var settings = <ISonarrSettings>form.value;
|
const settings = <ISonarrSettings>form.value;
|
||||||
this.testerService.sonarrTest(settings).subscribe(x => {
|
this.testerService.sonarrTest(settings).subscribe(x => {
|
||||||
if (x) {
|
if (x) {
|
||||||
this.notificationService.success("Connected", "Successfully connected to Sonarr!");
|
this.notificationService.success("Connected", "Successfully connected to Sonarr!");
|
||||||
|
@ -105,11 +100,11 @@ export class SonarrComponent implements OnInit, OnDestroy {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit(form:FormGroup) {
|
public onSubmit(form: FormGroup) {
|
||||||
if (form.invalid) {
|
if (form.invalid) {
|
||||||
this.notificationService.error("Validation", "Please check your entered values");
|
this.notificationService.error("Validation", "Please check your entered values");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.settingsService.saveSonarr(form.value)
|
this.settingsService.saveSonarr(form.value)
|
||||||
.takeUntil(this.subscriptions)
|
.takeUntil(this.subscriptions)
|
||||||
.subscribe(x => {
|
.subscribe(x => {
|
||||||
|
@ -121,8 +116,8 @@ export class SonarrComponent implements OnInit, OnDestroy {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
public ngOnDestroy() {
|
||||||
this.subscriptions.next();
|
this.subscriptions.next();
|
||||||
this.subscriptions.complete();
|
this.subscriptions.complete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component } from "@angular/core";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
templateUrl: "./usermanagement.component.html",
|
||||||
templateUrl: './usermanagement.component.html',
|
|
||||||
})
|
})
|
||||||
export class UserManagementComponent {
|
export class UserManagementComponent { }
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from "@angular/core";
|
||||||
import { FormGroup, Validators, FormBuilder } from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
|
||||||
|
|
||||||
import { IUpdateLocalUser } from '../interfaces/IUser';
|
import { IUpdateLocalUser } from "../interfaces";
|
||||||
import { IdentityService } from '../services/identity.service';
|
import { IdentityService } from "../services";
|
||||||
import { NotificationService } from '../services/notification.service';
|
import { NotificationService } from "../services";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './updatedetails.component.html'
|
templateUrl: "./updatedetails.component.html",
|
||||||
})
|
})
|
||||||
export class UpdateDetailsComponent implements OnInit {
|
export class UpdateDetailsComponent implements OnInit {
|
||||||
|
public form: FormGroup;
|
||||||
|
|
||||||
constructor(private identityService: IdentityService,
|
constructor(private identityService: IdentityService,
|
||||||
private notificationService: NotificationService,
|
private notificationService: NotificationService,
|
||||||
private fb: FormBuilder) { }
|
private fb: FormBuilder) { }
|
||||||
|
|
||||||
form: FormGroup;
|
public ngOnInit() {
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
this.identityService.getUser().subscribe(x => {
|
this.identityService.getUser().subscribe(x => {
|
||||||
var localUser = x as IUpdateLocalUser;
|
const localUser = x as IUpdateLocalUser;
|
||||||
this.form = this.fb.group({
|
this.form = this.fb.group({
|
||||||
id:[localUser.id],
|
id:[localUser.id],
|
||||||
username: [localUser.username],
|
username: [localUser.username],
|
||||||
emailAddress: [localUser.emailAddress, [Validators.email]],
|
emailAddress: [localUser.emailAddress, [Validators.email]],
|
||||||
|
@ -27,27 +27,26 @@ export class UpdateDetailsComponent implements OnInit {
|
||||||
password: [localUser.password],
|
password: [localUser.password],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit(form : FormGroup) {
|
public onSubmit(form: FormGroup) {
|
||||||
if (form.invalid) {
|
if (form.invalid) {
|
||||||
this.notificationService.error("Validation", "Please check your entered values");
|
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) {
|
if (form.value.password !== form.value.confirmNewPassword) {
|
||||||
this.notificationService.error("Error", "Passwords do not match");
|
this.notificationService.error("Error", "Passwords do not match");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.identityService.updateLocalUser(this.form.value).subscribe(x => {
|
this.identityService.updateLocalUser(this.form.value).subscribe(x => {
|
||||||
if (x.successful) {
|
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 {
|
} else {
|
||||||
x.errors.forEach((val) => {
|
x.errors.forEach((val) => {
|
||||||
this.notificationService.error("Error", 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 { Component, OnInit } from "@angular/core";
|
||||||
import { Router } from '@angular/router';
|
import { Router } from "@angular/router";
|
||||||
|
|
||||||
import { IUser, UserType, ICheckbox } from '../interfaces/IUser';
|
import { ICheckbox, IUser, UserType } from "../interfaces";
|
||||||
import { IdentityService } from '../services/identity.service';
|
import { IdentityService } from "../services";
|
||||||
import { NotificationService } from '../services/notification.service';
|
import { NotificationService } from "../services";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
templateUrl: "./usermanagement-add.component.html",
|
||||||
templateUrl: './usermanagement-add.component.html'
|
|
||||||
})
|
})
|
||||||
export class UserManagementAddComponent implements OnInit {
|
export class UserManagementAddComponent implements OnInit {
|
||||||
|
public user: IUser;
|
||||||
|
public availableClaims: ICheckbox[];
|
||||||
|
public confirmPass: "";
|
||||||
|
|
||||||
constructor(private identityService: IdentityService,
|
constructor(private identityService: IdentityService,
|
||||||
private notificationSerivce: NotificationService,
|
private notificationSerivce: NotificationService,
|
||||||
private router: Router) { }
|
private router: Router) { }
|
||||||
|
|
||||||
user: IUser;
|
public ngOnInit() {
|
||||||
availableClaims: ICheckbox[];
|
|
||||||
confirmPass: "";
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
this.identityService.getAllAvailableClaims().subscribe(x => this.availableClaims = x);
|
this.identityService.getAllAvailableClaims().subscribe(x => this.availableClaims = x);
|
||||||
this.user = {
|
this.user = {
|
||||||
alias: "",
|
alias: "",
|
||||||
|
@ -29,11 +28,11 @@ export class UserManagementAddComponent implements OnInit {
|
||||||
username: "",
|
username: "",
|
||||||
userType: UserType.LocalUser,
|
userType: UserType.LocalUser,
|
||||||
checked:false,
|
checked:false,
|
||||||
isSetup:false
|
isSetup:false,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
create(): void {
|
public create() {
|
||||||
this.user.claims = this.availableClaims;
|
this.user.claims = this.availableClaims;
|
||||||
|
|
||||||
if (this.user.password) {
|
if (this.user.password) {
|
||||||
|
@ -42,7 +41,7 @@ export class UserManagementAddComponent implements OnInit {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var hasClaims = this.availableClaims.some((item) => {
|
const hasClaims = this.availableClaims.some((item) => {
|
||||||
if (item.enabled) { return true; }
|
if (item.enabled) { return true; }
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -55,14 +54,14 @@ export class UserManagementAddComponent implements OnInit {
|
||||||
|
|
||||||
this.identityService.createUser(this.user).subscribe(x => {
|
this.identityService.createUser(this.user).subscribe(x => {
|
||||||
if (x.successful) {
|
if (x.successful) {
|
||||||
this.notificationSerivce.success("Updated", `The user ${this.user.username} has been created successfully`)
|
this.notificationSerivce.success("Updated", `The user ${this.user.username} has been created successfully`);
|
||||||
this.router.navigate(['usermanagement']);
|
this.router.navigate(["usermanagement"]);
|
||||||
} else {
|
} else {
|
||||||
x.errors.forEach((val) => {
|
x.errors.forEach((val) => {
|
||||||
this.notificationSerivce.error("Error", val);
|
this.notificationSerivce.error("Error", val);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,25 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component } from "@angular/core";
|
||||||
import { Router } from '@angular/router';
|
import { Router } from "@angular/router";
|
||||||
|
|
||||||
import { IUser } from '../interfaces/IUser';
|
import { ActivatedRoute } from "@angular/router";
|
||||||
import { IdentityService } from '../services/identity.service';
|
import { IUser } from "../interfaces";
|
||||||
import { NotificationService } from '../services/notification.service';
|
import { IdentityService } from "../services";
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { NotificationService } from "../services";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './usermanagement-edit.component.html'
|
templateUrl: "./usermanagement-edit.component.html",
|
||||||
})
|
})
|
||||||
export class UserManagementEditComponent {
|
export class UserManagementEditComponent {
|
||||||
|
public user: IUser;
|
||||||
|
public userId: string;
|
||||||
|
|
||||||
constructor(private identityService: IdentityService,
|
constructor(private identityService: IdentityService,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private notificationSerivce: NotificationService,
|
private notificationSerivce: NotificationService,
|
||||||
private router: Router) {
|
private router: Router) {
|
||||||
this.route.params
|
this.route.params
|
||||||
.subscribe(params => {
|
.subscribe(params => {
|
||||||
this.userId = params['id'];
|
this.userId = params.id;
|
||||||
|
|
||||||
this.identityService.getUserById(this.userId).subscribe(x => {
|
this.identityService.getUserById(this.userId).subscribe(x => {
|
||||||
this.user = x;
|
this.user = x;
|
||||||
|
@ -24,14 +27,11 @@ export class UserManagementEditComponent {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
user: IUser;
|
public delete() {
|
||||||
userId: string;
|
|
||||||
|
|
||||||
delete(): void {
|
|
||||||
this.identityService.deleteUser(this.user).subscribe(x => {
|
this.identityService.deleteUser(this.user).subscribe(x => {
|
||||||
if (x.successful) {
|
if (x.successful) {
|
||||||
this.notificationSerivce.success("Deleted", `The user ${this.user.username} was deleted`)
|
this.notificationSerivce.success("Deleted", `The user ${this.user.username} was deleted`);
|
||||||
this.router.navigate(['usermanagement']);
|
this.router.navigate(["usermanagement"]);
|
||||||
} else {
|
} else {
|
||||||
x.errors.forEach((val) => {
|
x.errors.forEach((val) => {
|
||||||
this.notificationSerivce.error("Error", 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 => {
|
this.identityService.submitResetPassword(this.user.emailAddress).subscribe(x => {
|
||||||
if (x.successful) {
|
if (x.successful) {
|
||||||
this.notificationSerivce.success("Reset", `Sent reset password email to ${this.user.emailAddress}`);
|
this.notificationSerivce.success("Reset", `Sent reset password email to ${this.user.emailAddress}`);
|
||||||
this.router.navigate(['usermanagement']);
|
this.router.navigate(["usermanagement"]);
|
||||||
} else {
|
} else {
|
||||||
x.errors.forEach((val) => {
|
x.errors.forEach((val) => {
|
||||||
this.notificationSerivce.error("Error", val);
|
this.notificationSerivce.error("Error", val);
|
||||||
|
@ -55,8 +55,8 @@ export class UserManagementEditComponent {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
update(): void {
|
public update() {
|
||||||
var hasClaims = this.user.claims.some((item) => {
|
const hasClaims = this.user.claims.some((item) => {
|
||||||
if (item.enabled) { return true; }
|
if (item.enabled) { return true; }
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -69,14 +69,14 @@ export class UserManagementEditComponent {
|
||||||
|
|
||||||
this.identityService.updateUser(this.user).subscribe(x => {
|
this.identityService.updateUser(this.user).subscribe(x => {
|
||||||
if (x.successful) {
|
if (x.successful) {
|
||||||
this.notificationSerivce.success("Updated", `The user ${this.user.username} has been updated successfully`)
|
this.notificationSerivce.success("Updated", `The user ${this.user.username} has been updated successfully`);
|
||||||
this.router.navigate(['usermanagement']);
|
this.router.navigate(["usermanagement"]);
|
||||||
} else {
|
} else {
|
||||||
x.errors.forEach((val) => {
|
x.errors.forEach((val) => {
|
||||||
this.notificationSerivce.error("Error", 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 { IUser } from "../interfaces";
|
||||||
import { IdentityService } from '../services/identity.service';
|
import { IdentityService } from "../services";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
templateUrl: "./usermanagement.component.html",
|
||||||
templateUrl: './usermanagement.component.html'
|
|
||||||
})
|
})
|
||||||
export class UserManagementComponent implements OnInit {
|
export class UserManagementComponent implements OnInit {
|
||||||
|
|
||||||
|
public users: IUser[];
|
||||||
|
public checkAll = false;
|
||||||
|
|
||||||
constructor(private identityService: IdentityService) { }
|
constructor(private identityService: IdentityService) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
public ngOnInit() {
|
||||||
this.users = [];
|
this.users = [];
|
||||||
this.identityService.getUsers().subscribe(x => {
|
this.identityService.getUsers().subscribe(x => {
|
||||||
this.users = x;
|
this.users = x;
|
||||||
|
@ -18,17 +21,14 @@ export class UserManagementComponent implements OnInit {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
welcomeEmail(user: IUser): void {
|
public welcomeEmail(user: IUser) {
|
||||||
|
// todo
|
||||||
}
|
}
|
||||||
|
|
||||||
users: IUser[];
|
public checkAllBoxes() {
|
||||||
checkAll = false;
|
|
||||||
|
|
||||||
checkAllBoxes() {
|
|
||||||
this.checkAll = !this.checkAll;
|
this.checkAll = !this.checkAll;
|
||||||
this.users.forEach(user => {
|
this.users.forEach(user => {
|
||||||
user.checked = this.checkAll;
|
user.checked = this.checkAll;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
import { NgModule, } from '@angular/core';
|
import { CommonModule } from "@angular/common";
|
||||||
import { CommonModule } from '@angular/common';
|
import { NgModule } from "@angular/core";
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
import { RouterModule, Routes } from "@angular/router";
|
||||||
import { MultiSelectModule, TooltipModule, } from 'primeng/primeng';
|
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 { UpdateDetailsComponent } from "./updatedetails.component";
|
||||||
import { UserManagementEditComponent } from './usermanagement-edit.component';
|
import { UserManagementAddComponent } from "./usermanagement-add.component";
|
||||||
import { UserManagementAddComponent } from './usermanagement-add.component';
|
import { UserManagementEditComponent } from "./usermanagement-edit.component";
|
||||||
import { UpdateDetailsComponent } from './updatedetails.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 = [
|
const routes: Routes = [
|
||||||
{ path: 'usermanagement', component: UserManagementComponent, canActivate: [AuthGuard] },
|
{ path: "usermanagement", component: UserManagementComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'usermanagement/add', component: UserManagementAddComponent, canActivate: [AuthGuard] },
|
{ path: "usermanagement/add", component: UserManagementAddComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'usermanagement/edit/:id', component: UserManagementEditComponent, canActivate: [AuthGuard] },
|
{ path: "usermanagement/edit/:id", component: UserManagementEditComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'usermanagement/updatedetails', component: UpdateDetailsComponent, canActivate: [AuthGuard] },
|
{ path: "usermanagement/updatedetails", component: UpdateDetailsComponent, canActivate: [AuthGuard] },
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
@ -42,11 +42,11 @@ const routes: Routes = [
|
||||||
UpdateDetailsComponent,
|
UpdateDetailsComponent,
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
RouterModule
|
RouterModule,
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
IdentityService
|
IdentityService,
|
||||||
],
|
],
|
||||||
|
|
||||||
})
|
})
|
||||||
export class UserManagementModule { }
|
export class UserManagementModule { }
|
||||||
|
|
|
@ -1,25 +1,23 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component } from "@angular/core";
|
||||||
import { Router } from '@angular/router';
|
import { Router } from "@angular/router";
|
||||||
|
|
||||||
import { IdentityService } from '../../services/identity.service';
|
import { AuthService } from "../../auth/auth.service";
|
||||||
import { SettingsService } from '../../services/settings.service';
|
import { IdentityService } from "../../services";
|
||||||
import { AuthService } from '../../auth/auth.service';
|
import { NotificationService } from "../../services";
|
||||||
import { NotificationService } from '../../services/notification.service';
|
import { SettingsService } from "../../services";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
templateUrl: "./createadmin.component.html",
|
||||||
templateUrl: './createadmin.component.html',
|
|
||||||
})
|
})
|
||||||
export class CreateAdminComponent {
|
export class CreateAdminComponent {
|
||||||
|
|
||||||
|
public username: string;
|
||||||
|
public password: string;
|
||||||
|
|
||||||
constructor(private identityService: IdentityService, private notificationService: NotificationService,
|
constructor(private identityService: IdentityService, private notificationService: NotificationService,
|
||||||
private router: Router, private auth: AuthService, private settings: SettingsService) { }
|
private router: Router, private auth: AuthService, private settings: SettingsService) { }
|
||||||
|
|
||||||
|
public createUser() {
|
||||||
username: string;
|
|
||||||
password: string;
|
|
||||||
|
|
||||||
createUser() {
|
|
||||||
this.identityService.createWizardUser(this.username, this.password).subscribe(x => {
|
this.identityService.createWizardUser(this.username, this.password).subscribe(x => {
|
||||||
if (x) {
|
if (x) {
|
||||||
// Log me in.
|
// Log me in.
|
||||||
|
@ -32,8 +30,8 @@ export class CreateAdminComponent {
|
||||||
ombi.wizard = true;
|
ombi.wizard = true;
|
||||||
|
|
||||||
this.settings.saveOmbi(ombi).subscribe(x => {
|
this.settings.saveOmbi(ombi).subscribe(x => {
|
||||||
|
|
||||||
this.router.navigate(['search']);
|
this.router.navigate(["search"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -45,4 +43,4 @@ export class CreateAdminComponent {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +1,29 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from "@angular/core";
|
||||||
import { Router } from '@angular/router';
|
import { Router } from "@angular/router";
|
||||||
|
|
||||||
import { EmbyService } from '../../services/applications/emby.service';
|
import { EmbyService } from "../../services";
|
||||||
import { NotificationService } from '../../services/notification.service';
|
import { NotificationService } from "../../services";
|
||||||
|
|
||||||
import { IEmbySettings } from '../../interfaces/ISettings';
|
import { IEmbySettings } from "../../interfaces";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
templateUrl: "./emby.component.html",
|
||||||
templateUrl: './emby.component.html',
|
|
||||||
})
|
})
|
||||||
export class EmbyComponent implements OnInit {
|
export class EmbyComponent implements OnInit {
|
||||||
|
|
||||||
|
private embySettings: IEmbySettings;
|
||||||
|
|
||||||
constructor(private embyService: EmbyService,
|
constructor(private embyService: EmbyService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private notificationService: NotificationService) {
|
private notificationService: NotificationService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
public ngOnInit() {
|
||||||
this.embySettings = {
|
this.embySettings = {
|
||||||
servers: [],
|
servers: [],
|
||||||
id:0,
|
id:0,
|
||||||
enable: true,
|
enable: true,
|
||||||
}
|
};
|
||||||
this.embySettings.servers.push({
|
this.embySettings.servers.push({
|
||||||
ip: "",
|
ip: "",
|
||||||
administratorId: "",
|
administratorId: "",
|
||||||
|
@ -34,19 +35,16 @@ export class EmbyComponent implements OnInit {
|
||||||
ssl: false,
|
ssl: false,
|
||||||
subDir: "",
|
subDir: "",
|
||||||
|
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private embySettings: IEmbySettings;
|
public save() {
|
||||||
|
|
||||||
|
|
||||||
save() {
|
|
||||||
this.embyService.logIn(this.embySettings).subscribe(x => {
|
this.embyService.logIn(this.embySettings).subscribe(x => {
|
||||||
if (x == null || !x.servers[0].apiKey) {
|
if (x == null || !x.servers[0].apiKey) {
|
||||||
this.notificationService.error("Could Not Authenticate", "Username or password was incorrect. Could not authenticate with Emby.");
|
this.notificationService.error("Could Not Authenticate", "Username or password was incorrect. Could not authenticate with Emby.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.router.navigate(['Wizard/CreateAdmin']);
|
this.router.navigate(["Wizard/CreateAdmin"]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,21 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component } from "@angular/core";
|
||||||
import { Router } from '@angular/router';
|
import { Router } from "@angular/router";
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './mediaserver.component.html',
|
templateUrl: "./mediaserver.component.html",
|
||||||
})
|
})
|
||||||
export class MediaServerComponent {
|
export class MediaServerComponent {
|
||||||
constructor(private router: Router) {
|
constructor(private router: Router) { }
|
||||||
|
|
||||||
|
public plex() {
|
||||||
|
this.router.navigate(["Wizard/Plex"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
plex() {
|
public emby() {
|
||||||
this.router.navigate(['Wizard/Plex']);
|
this.router.navigate(["Wizard/Emby"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
emby() {
|
public skip() {
|
||||||
this.router.navigate(['Wizard/Emby']);
|
this.router.navigate(["Wizard/CreateAdmin"]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
skip() {
|
|
||||||
this.router.navigate(['Wizard/CreateAdmin']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,25 +1,24 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component } from "@angular/core";
|
||||||
import { Router } from '@angular/router';
|
import { Router } from "@angular/router";
|
||||||
|
|
||||||
import { PlexService } from '../../services/applications/plex.service';
|
import { PlexService } from "../../services";
|
||||||
import { NotificationService } from '../../services/notification.service';
|
import { NotificationService } from "../../services";
|
||||||
|
|
||||||
import { IPlexAuthentication } from '../../interfaces/IPlex';
|
import { IPlexAuthentication } from "../../interfaces";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
templateUrl: "./plex.component.html",
|
||||||
templateUrl: './plex.component.html',
|
|
||||||
})
|
})
|
||||||
export class PlexComponent {
|
export class PlexComponent {
|
||||||
|
|
||||||
constructor(private plexService: PlexService, private router: Router, private notificationService: NotificationService) { }
|
public login: string;
|
||||||
|
public password: string;
|
||||||
|
|
||||||
private authenticationResult: IPlexAuthentication;
|
private authenticationResult: IPlexAuthentication;
|
||||||
|
|
||||||
login: string;
|
constructor(private plexService: PlexService, private router: Router, private notificationService: NotificationService) { }
|
||||||
password: string;
|
|
||||||
|
|
||||||
requestAuthToken() {
|
public requestAuthToken() {
|
||||||
this.plexService.logIn(this.login, this.password).subscribe(x => {
|
this.plexService.logIn(this.login, this.password).subscribe(x => {
|
||||||
if (x.user == null) {
|
if (x.user == null) {
|
||||||
this.notificationService.error("Could Not Authenticate", "Username or password was incorrect. Could not authenticate with Plex.");
|
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.authenticationResult = x;
|
||||||
|
|
||||||
this.router.navigate(['Wizard/CreateAdmin']);
|
this.router.navigate(["Wizard/CreateAdmin"]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,13 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component } from "@angular/core";
|
||||||
import { Router } from '@angular/router';
|
import { Router } from "@angular/router";
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
templateUrl: "./welcome.component.html",
|
||||||
templateUrl: './welcome.component.html',
|
|
||||||
})
|
})
|
||||||
export class WelcomeComponent {
|
export class WelcomeComponent {
|
||||||
constructor(private router: Router) {
|
constructor(private router: Router) { }
|
||||||
|
|
||||||
|
public next() {
|
||||||
|
this.router.navigate(["Wizard/MediaServer"]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
next() {
|
|
||||||
this.router.navigate(['Wizard/MediaServer']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,47 +1,47 @@
|
||||||
import { NgModule, } from '@angular/core';
|
import { CommonModule } from "@angular/common";
|
||||||
import { CommonModule } from '@angular/common';
|
import { NgModule } from "@angular/core";
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from "@angular/forms";
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
import { RouterModule, Routes } from "@angular/router";
|
||||||
|
|
||||||
import { WelcomeComponent } from './welcome/welcome.component';
|
import { CreateAdminComponent } from "./createadmin/createadmin.component";
|
||||||
import { MediaServerComponent } from './mediaserver/mediaserver.component';
|
import { EmbyComponent } from "./emby/emby.component";
|
||||||
import { PlexComponent } from './plex/plex.component';
|
import { MediaServerComponent } from "./mediaserver/mediaserver.component";
|
||||||
import { CreateAdminComponent } from './createadmin/createadmin.component';
|
import { PlexComponent } from "./plex/plex.component";
|
||||||
import { EmbyComponent } from './emby/emby.component';
|
import { WelcomeComponent } from "./welcome/welcome.component";
|
||||||
|
|
||||||
import { PlexService } from '../services/applications/plex.service';
|
import { EmbyService } from "../services";
|
||||||
import { EmbyService } from '../services/applications/emby.service';
|
import { PlexService } from "../services";
|
||||||
import { IdentityService } from '../services/identity.service';
|
import { IdentityService } from "../services";
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{ path: 'Wizard', component: WelcomeComponent},
|
{ path: "Wizard", component: WelcomeComponent},
|
||||||
{ path: 'Wizard/MediaServer', component: MediaServerComponent},
|
{ path: "Wizard/MediaServer", component: MediaServerComponent},
|
||||||
{ path: 'Wizard/Plex', component: PlexComponent},
|
{ path: "Wizard/Plex", component: PlexComponent},
|
||||||
{ path: 'Wizard/Emby', component: EmbyComponent},
|
{ path: "Wizard/Emby", component: EmbyComponent},
|
||||||
{ path: 'Wizard/CreateAdmin', component: CreateAdminComponent},
|
{ path: "Wizard/CreateAdmin", component: CreateAdminComponent},
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
RouterModule.forChild(routes)
|
RouterModule.forChild(routes),
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
WelcomeComponent,
|
WelcomeComponent,
|
||||||
MediaServerComponent,
|
MediaServerComponent,
|
||||||
PlexComponent,
|
PlexComponent,
|
||||||
CreateAdminComponent,
|
CreateAdminComponent,
|
||||||
EmbyComponent
|
EmbyComponent,
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
RouterModule
|
RouterModule,
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
PlexService,
|
PlexService,
|
||||||
IdentityService,
|
IdentityService,
|
||||||
EmbyService
|
EmbyService,
|
||||||
],
|
],
|
||||||
|
|
||||||
})
|
})
|
||||||
export class WizardModule { }
|
export class WizardModule { }
|
||||||
|
|
|
@ -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/base.scss";
|
||||||
import "./styles/Themes/plex.scss";
|
import "./styles/Themes/plex.scss";
|
||||||
import './polyfills';
|
|
||||||
import './imports';
|
|
||||||
import 'bootstrap/dist/js/bootstrap';
|
|
||||||
import 'pace-progress';
|
|
||||||
|
|
||||||
import { enableProdMode } from '@angular/core';
|
import { enableProdMode } from "@angular/core";
|
||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from "@angular/platform-browser-dynamic";
|
||||||
import { AppModule } from './app/app.module';
|
import { AppModule } from "./app/app.module";
|
||||||
|
|
||||||
if (module['hot']) {
|
if (module.hot) {
|
||||||
module['hot'].accept();
|
module.hot.accept();
|
||||||
module['hot'].dispose(() => {
|
module.hot.dispose(() => {
|
||||||
// Before restarting the app, we create a new root element and dispose the old one
|
// Before restarting the app, we create a new root element and dispose the old one
|
||||||
const oldRootElem = document.querySelector('ombi');
|
const oldRootElem = document.querySelector("ombi");
|
||||||
const newRootElem = document.createElement('ombi');
|
const newRootElem = document.createElement("ombi");
|
||||||
if (oldRootElem && oldRootElem.parentNode) {
|
if (oldRootElem && oldRootElem.parentNode) {
|
||||||
oldRootElem.parentNode.insertBefore(newRootElem, oldRootElem);
|
oldRootElem.parentNode.insertBefore(newRootElem, oldRootElem);
|
||||||
oldRootElem.parentNode.removeChild(oldRootElem);
|
oldRootElem.parentNode.removeChild(oldRootElem);
|
||||||
|
@ -25,4 +25,4 @@ if (module['hot']) {
|
||||||
enableProdMode();
|
enableProdMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
const modulePromise = platformBrowserDynamic().bootstrapModule(AppModule);
|
const modulePromise = platformBrowserDynamic().bootstrapModule(AppModule);
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import 'core-js/es6/string';
|
import "core-js/es6/array";
|
||||||
import 'core-js/es6/array';
|
import "core-js/es6/object";
|
||||||
import 'core-js/es6/object';
|
import "core-js/es6/string";
|
||||||
|
|
||||||
import 'core-js/es7/reflect';
|
import "core-js/es7/reflect";
|
||||||
import 'zone.js/dist/zone';
|
import "zone.js/dist/zone";
|
||||||
|
|
||||||
if (module['hot']) {
|
if (module.hot) {
|
||||||
Error['stackTraceLimit'] = Infinity;
|
Error.stackTraceLimit = Infinity;
|
||||||
require('zone.js/dist/long-stack-trace-zone');
|
// tslint:disable:no-var-requires
|
||||||
}
|
require("zone.js/dist/long-stack-trace-zone");
|
||||||
|
}
|
||||||
|
|
|
@ -32,10 +32,10 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="NpmCommandsDebug" Condition="'$(Configuration)'=='Debug'" AfterTargets="Build">
|
<Target Name="NpmCommandsDebug" Condition="'$(Configuration)'=='Debug'" AfterTargets="Build">
|
||||||
<Exec Command="npm run-script vendor" />
|
<Exec Command="npm run vendor" />
|
||||||
</Target>
|
</Target>
|
||||||
<Target Name="NpmCommandsRelease" Condition="'$(Configuration)'=='Release'" AfterTargets="Build">
|
<Target Name="NpmCommandsRelease" Condition="'$(Configuration)'=='Release'" AfterTargets="Build">
|
||||||
<Exec Command="npm run-script publish" />
|
<Exec Command="npm run publish" />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<Target Name="RunWebpack" AfterTargets="ComputeFilesToPublish">
|
<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=",
|
"integrity": "sha1-gGZJMmzqp8qjMG112YXqJ0i6kTw=",
|
||||||
"dev": true
|
"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": {
|
"diffie-hellman": {
|
||||||
"version": "5.0.2",
|
"version": "5.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.2.tgz",
|
"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",
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.7.1.tgz",
|
||||||
"integrity": "sha1-vIAEFkaRkjp5/oN4u+s9ogF1OOw="
|
"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": {
|
"tty-browserify": {
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz",
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"vendor": "gulp vendor",
|
"vendor": "gulp vendor",
|
||||||
"publish": "gulp publish"
|
"publish": "gulp publish",
|
||||||
|
"lint": "tslint ClientApp/**/*.ts"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "4.4.1",
|
"@angular/animations": "4.4.1",
|
||||||
|
@ -58,7 +59,9 @@
|
||||||
"sass-loader": "^6.0.6",
|
"sass-loader": "^6.0.6",
|
||||||
"style-loader": "^0.18.2",
|
"style-loader": "^0.18.2",
|
||||||
"to-string-loader": "1.1.5",
|
"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",
|
"uglify-es": "^3.1.0",
|
||||||
"uglifyjs-webpack-plugin": "^1.0.0-beta.2",
|
"uglifyjs-webpack-plugin": "^1.0.0-beta.2",
|
||||||
"url-loader": "0.5.9",
|
"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