From c6534652f1e6af0a27e5a71bbfe08aeec134157a Mon Sep 17 00:00:00 2001 From: "Jamie.Rees" Date: Fri, 12 May 2017 09:41:27 +0100 Subject: [PATCH] Fixes --- Ombi/Ombi.Store/Context/OmbiContext.cs | 12 ++++++-- Ombi/Ombi.Store/Ombi.Store.csproj | 11 +++++++- Ombi/Ombi.Store/Sql.Designer.cs | 8 +++--- Ombi/Ombi/gulpfile.js | 28 ++++++------------- Ombi/Ombi/wwwroot/app/app.component.ts | 3 +- .../app/services/applications/emby.service.ts | 2 +- .../services/applications/sonarr.service.ts | 2 +- .../wwwroot/app/services/identity.service.ts | 4 +-- .../wwwroot/app/services/request.service.ts | 20 ++++++------- .../wwwroot/app/services/settings.service.ts | 27 +++++++++--------- .../wwwroot/app/services/status.service.ts | 2 +- 11 files changed, 63 insertions(+), 56 deletions(-) diff --git a/Ombi/Ombi.Store/Context/OmbiContext.cs b/Ombi/Ombi.Store/Context/OmbiContext.cs index 1ce4becf7..da4f6ac74 100644 --- a/Ombi/Ombi.Store/Context/OmbiContext.cs +++ b/Ombi/Ombi.Store/Context/OmbiContext.cs @@ -1,4 +1,6 @@ -using Microsoft.EntityFrameworkCore; +using System.IO; +using System.Resources; +using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; using Ombi.Store.Entities; @@ -15,9 +17,15 @@ namespace Ombi.Store.Context Database.EnsureCreated(); Database.Migrate(); +//#if DEBUG +// var file = File.ReadAllText(); +//#else + + var file = File.ReadAllText("SqlTables.sql"); +//#endif // Run Script - Database.ExecuteSqlCommand(Sql.SqlTables, 0); + Database.ExecuteSqlCommand(file, 0); } public DbSet Requests { get; set; } diff --git a/Ombi/Ombi.Store/Ombi.Store.csproj b/Ombi/Ombi.Store/Ombi.Store.csproj index 06d58a435..34cf60d9e 100644 --- a/Ombi/Ombi.Store/Ombi.Store.csproj +++ b/Ombi/Ombi.Store/Ombi.Store.csproj @@ -4,6 +4,10 @@ netstandard1.6 + + + + @@ -14,6 +18,11 @@ + + + PreserveNewest + + @@ -26,7 +35,7 @@ - ResXFileCodeGenerator + PublicResXFileCodeGenerator Sql.Designer.cs diff --git a/Ombi/Ombi.Store/Sql.Designer.cs b/Ombi/Ombi.Store/Sql.Designer.cs index 29f27c02a..86551871e 100644 --- a/Ombi/Ombi.Store/Sql.Designer.cs +++ b/Ombi/Ombi.Store/Sql.Designer.cs @@ -23,7 +23,7 @@ namespace Ombi.Store { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Sql { + public class Sql { private static global::System.Resources.ResourceManager resourceMan; @@ -37,7 +37,7 @@ namespace Ombi.Store { /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { + public static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Ombi.Store.Sql", typeof(Sql).GetTypeInfo().Assembly); @@ -52,7 +52,7 @@ namespace Ombi.Store { /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { + public static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } @@ -80,7 +80,7 @@ namespace Ombi.Store { /// Type INTEGER NOT NULL, /// Relea [rest of string was truncated]";. /// - internal static string SqlTables { + public static string SqlTables { get { return ResourceManager.GetString("SqlTables", resourceCulture); } diff --git a/Ombi/Ombi/gulpfile.js b/Ombi/Ombi/gulpfile.js index c7eb1cc4a..1edd79405 100644 --- a/Ombi/Ombi/gulpfile.js +++ b/Ombi/Ombi/gulpfile.js @@ -125,18 +125,14 @@ var paths = { dest: './lib/primeng/' } ], - sass: [ // Simple sass->css compilation + sass: // Simple sass->css compilation { src: ['./Styles/**/*.scss', '!./Styles/primeng/**'], dest: './css/', filter: '**/*.css' }, - { - src: path.join(wwwroot, 'app/**/*.scss'), - dest: './app/', - filter: '**/*.css' - } - ], + + bundle: { // This is the config for the bundler, you shouldn't need to change this root: './', dest: './lib/bundle.js', @@ -259,18 +255,12 @@ gulp.task('modules', function () { }) gulp.task('sass', function () { - var streams = [] - for (let module of paths.sass) { - streams.push( - gulp.src(module.src) - .pipe(changed(module.dest, { extension: '.css' })) - .pipe(gulpif(global.full, sourcemaps.init())) - .pipe(sass({ outputStyle: global.full ? 'compressed' : 'nested' }).on('error', sass.logError)) - .pipe(gulpif(global.full, sourcemaps.write('maps'))) - .pipe(gulp.dest(path.join(paths.wwwroot, module.dest))) - ); - } - return merge(streams); + return gulp.src(paths.sass.src) + .pipe(changed(paths.sass.dest)) + .pipe(gulpif(global.full, sourcemaps.init())) + .pipe(sass({ outputStyle: global.full ? 'compressed' : 'nested' }).on('error', sass.logError)) + .pipe(gulpif(global.full, sourcemaps.write('maps'))) + .pipe(gulp.dest(path.join(paths.wwwroot, paths.sass.dest))) }); diff --git a/Ombi/Ombi/wwwroot/app/app.component.ts b/Ombi/Ombi/wwwroot/app/app.component.ts index 8acf63019..e6bd7c45d 100644 --- a/Ombi/Ombi/wwwroot/app/app.component.ts +++ b/Ombi/Ombi/wwwroot/app/app.component.ts @@ -8,12 +8,11 @@ import { IdentityService } from './services/identity.service'; import { ICustomizationSettings } from './interfaces/ISettings'; -import template from './app.component.html'; @Component({ selector: 'ombi', moduleId: module.id, - templateUrl: template + templateUrl: './app.component.html' }) export class AppComponent implements OnInit { diff --git a/Ombi/Ombi/wwwroot/app/services/applications/emby.service.ts b/Ombi/Ombi/wwwroot/app/services/applications/emby.service.ts index 3bfa7812e..71a24003f 100644 --- a/Ombi/Ombi/wwwroot/app/services/applications/emby.service.ts +++ b/Ombi/Ombi/wwwroot/app/services/applications/emby.service.ts @@ -14,7 +14,7 @@ export class EmbyService extends ServiceHelpers { } logIn(settings: IEmbySettings): Observable { - 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); } } \ No newline at end of file diff --git a/Ombi/Ombi/wwwroot/app/services/applications/sonarr.service.ts b/Ombi/Ombi/wwwroot/app/services/applications/sonarr.service.ts index 93a7feb69..71acc3733 100644 --- a/Ombi/Ombi/wwwroot/app/services/applications/sonarr.service.ts +++ b/Ombi/Ombi/wwwroot/app/services/applications/sonarr.service.ts @@ -9,7 +9,7 @@ import { ISonarrRootFolder, ISonarrProfile } from '../../interfaces/ISonarr'; @Injectable() export class SonarrService extends ServiceAuthHelpers { constructor(http: AuthHttp) { - super(http, '/api/v1/Sonarr/'); + super(http, '/api/v1/Sonarr'); } getRootFolders(settings: ISonarrSettings): Observable { diff --git a/Ombi/Ombi/wwwroot/app/services/identity.service.ts b/Ombi/Ombi/wwwroot/app/services/identity.service.ts index 69e81c7a0..2a9fab0d0 100644 --- a/Ombi/Ombi/wwwroot/app/services/identity.service.ts +++ b/Ombi/Ombi/wwwroot/app/services/identity.service.ts @@ -21,11 +21,11 @@ export class IdentityService extends ServiceAuthHelpers { } getUsers(): Observable { - return this.http.get(`${this.url}/Users`).map(this.extractData); + return this.http.get(`${this.url}Users`).map(this.extractData); } getAllAvailableClaims(): Observable { - return this.http.get(`${this.url}/Claims`).map(this.extractData); + return this.http.get(`${this.url}Claims`).map(this.extractData); } createUser(user: IUser): Observable { diff --git a/Ombi/Ombi/wwwroot/app/services/request.service.ts b/Ombi/Ombi/wwwroot/app/services/request.service.ts index 6e124e1b7..a29c40d1e 100644 --- a/Ombi/Ombi/wwwroot/app/services/request.service.ts +++ b/Ombi/Ombi/wwwroot/app/services/request.service.ts @@ -15,42 +15,42 @@ export class RequestService extends ServiceAuthHelpers { } requestMovie(movie: ISearchMovieResult): Observable { - 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 { - 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 { - 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 { - 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: IMovieRequestModel) { - 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: IMovieRequestModel): Observable { - return this.http.post(`${this.url}/movie/`, JSON.stringify(request), { headers: this.headers }).map(this.extractData); + return this.http.post(`${this.url}movie/`, JSON.stringify(request), { headers: this.headers }).map(this.extractData); } getTvRequests(count: number, position: number): Observable { - return this.http.get(`${this.url}/tv/${count}/${position}`).map(this.extractData); + return this.http.get(`${this.url}tv/${count}/${position}`).map(this.extractData); } searchTvRequests(search: string): Observable { - 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: ITvRequestModel) { - 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: ITvRequestModel): Observable { - return this.http.post(`${this.url}/tv/`, JSON.stringify(request), { headers: this.headers }).map(this.extractData); + return this.http.post(`${this.url}tv/`, JSON.stringify(request), { headers: this.headers }).map(this.extractData); } } \ No newline at end of file diff --git a/Ombi/Ombi/wwwroot/app/services/settings.service.ts b/Ombi/Ombi/wwwroot/app/services/settings.service.ts index 2ca5d6052..4eaa8ee25 100644 --- a/Ombi/Ombi/wwwroot/app/services/settings.service.ts +++ b/Ombi/Ombi/wwwroot/app/services/settings.service.ts @@ -9,57 +9,58 @@ import { IOmbiSettings, IEmbySettings, IPlexSettings, ISonarrSettings,ILandingPa @Injectable() export class SettingsService extends ServiceAuthHelpers { constructor(public httpAuth: AuthHttp, private nonAuthHttp: Http) { - super(httpAuth, '/api/v1/Settings/'); + super(httpAuth, '/api/v1/Settings'); } getOmbi(): Observable { - return this.httpAuth.get(`${this.url}/Ombi/`).map(this.extractData); + return this.httpAuth.get(`${this.url}/Ombi/`).map(this.extractData).catch(this.handleError) } saveOmbi(settings: IOmbiSettings): Observable { - return this.httpAuth.post(`${this.url}/Ombi/`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); + return this.httpAuth.post(`${this.url}/Ombi/`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData).catch(this.handleError) } getEmby(): Observable { - return this.httpAuth.get(`${this.url}/Emby/`).map(this.extractData); + return this.httpAuth.get(`${this.url}/Emby/`).map(this.extractData).catch(this.handleError) } saveEmby(settings: IEmbySettings): Observable { - return this.httpAuth.post(`${this.url}/Emby/`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); + return this.httpAuth.post(`${this.url}/Emby/`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData).catch(this.handleError) } getPlex(): Observable { - return this.httpAuth.get(`${this.url}/Plex/`).map(this.extractData); + return this.httpAuth.get(`${this.url}/Plex/`).map(this.extractData).catch(this.handleError) } savePlex(settings: IPlexSettings): Observable { - return this.httpAuth.post(`${this.url}/Plex/`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); + return this.httpAuth.post(`${this.url}/Plex/`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData).catch(this.handleError) } getSonarr(): Observable { - return this.httpAuth.get(`${this.url}/Sonarr`).map(this.extractData); + return this.httpAuth.get(`${this.url}/Sonarr`).map(this.extractData) + .catch(this.handleError); } saveSonarr(settings: ISonarrSettings): Observable { - return this.httpAuth.post(`${this.url}/Sonarr`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); + return this.httpAuth.post(`${this.url}/Sonarr`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData).catch(this.handleError) } // Using http since we need it not to be authenticated to get the landing page settings getLandingPage(): Observable { - return this.nonAuthHttp.get(`${this.url}/LandingPage`).map(this.extractData); + return this.nonAuthHttp.get(`${this.url}/LandingPage`).map(this.extractData).catch(this.handleError) } saveLandingPage(settings: ILandingPageSettings): Observable { - return this.httpAuth.post(`${this.url}/LandingPage`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); + return this.httpAuth.post(`${this.url}/LandingPage`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData).catch(this.handleError) } // Using http since we need it not to be authenticated to get the customization settings getCustomization(): Observable { - return this.nonAuthHttp.get(`${this.url}/customization`).map(this.extractData); + return this.nonAuthHttp.get(`${this.url}/customization`).map(this.extractData).catch(this.handleError) } saveCustomization(settings: ICustomizationSettings): Observable { - return this.httpAuth.post(`${this.url}/customization`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); + return this.httpAuth.post(`${this.url}/customization`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData).catch(this.handleError) } diff --git a/Ombi/Ombi/wwwroot/app/services/status.service.ts b/Ombi/Ombi/wwwroot/app/services/status.service.ts index 906ec633e..71079e016 100644 --- a/Ombi/Ombi/wwwroot/app/services/status.service.ts +++ b/Ombi/Ombi/wwwroot/app/services/status.service.ts @@ -11,6 +11,6 @@ export class StatusService extends ServiceHelpers { super(http, '/api/v1/status/'); } getWizardStatus(): Observable { - 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); } } \ No newline at end of file