mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 13:23:20 -07:00
Adjusts the margins. Resets enable toggle on failure to save. Improves an error message.
This commit is contained in:
parent
7df9cf8608
commit
044ba8e1eb
2 changed files with 52 additions and 38 deletions
|
@ -1,44 +1,54 @@
|
|||
<settings-menu></settings-menu>
|
||||
<div class="small-middle-container">
|
||||
<div *ngIf="currentSettings">
|
||||
<div *ngIf="savedSettings">
|
||||
<fieldset>
|
||||
<legend style="margin-bottom: 1em;">Emby Configuration</legend>
|
||||
<div class="form-group">
|
||||
<mat-slide-toggle (change)="toggleEnableFlag($event)" [checked]="savedSettings.enable">
|
||||
Enable
|
||||
</mat-slide-toggle>
|
||||
<div style="margin-bottom: 2em;">
|
||||
<mat-slide-toggle (change)="toggleEnableFlag($event)" [checked]="savedSettings.enable">
|
||||
Enable
|
||||
</mat-slide-toggle>
|
||||
</div>
|
||||
|
||||
<h2 style="margin: 1em 0 0 0;">Servers</h2>
|
||||
<mat-list style="display:flex; flex-flow: wrap;">
|
||||
<mat-card class="emby-server-card" *ngFor="let server of currentSettings.servers">
|
||||
<button mat-button (click)="editServer(server)">
|
||||
<h3>{{server.name}}</h3>
|
||||
<div style="margin-bottom: 1em;">
|
||||
<h2 style="margin: 0 0 .5em 0;">Servers</h2>
|
||||
<div style="display:flex; flex-flow: wrap;">
|
||||
<mat-card class="emby-server-card" *ngFor="let server of savedSettings.servers">
|
||||
<button mat-button (click)="editServer(server)">
|
||||
<h3>{{server.name}}</h3>
|
||||
</button>
|
||||
</mat-card>
|
||||
|
||||
<mat-card class="emby-server-card new-server-card">
|
||||
<button mat-button (click)="newServer()">
|
||||
<i class="fas fa-plus fa-xl"></i>
|
||||
<h3>New Server</h3>
|
||||
</button>
|
||||
</mat-card>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 1em;">
|
||||
<h2 style="margin: 0 0 .5em 0;">Actions</h2>
|
||||
<div class="md-form-field">
|
||||
<button mat-stroked-button
|
||||
[disabled]="!savedSettings.enable || savedSettings.servers.length == 0"
|
||||
style="margin: 0 1em 1em 0;" (click)="runIncrementalSync()" type="button"
|
||||
id="recentlyAddedSync">
|
||||
Run Incremental Sync
|
||||
</button>
|
||||
</mat-card>
|
||||
|
||||
<mat-card class="emby-server-card new-server-card">
|
||||
<button mat-button (click)="newServer()">
|
||||
<i class="fas fa-plus fa-xl"></i>
|
||||
<h3>New Server</h3>
|
||||
<button mat-stroked-button
|
||||
[disabled]="!savedSettings.enable|| savedSettings.servers.length == 0"
|
||||
style="margin: 0 1em 1em 0;" (click)="runFullSync()" type="button" id="save">
|
||||
Run Full Sync
|
||||
</button>
|
||||
</mat-card>
|
||||
</mat-list>
|
||||
|
||||
<h2 style="margin: 1em 0 0 0;">Actions</h2>
|
||||
<div class="md-form-field">
|
||||
<button mat-stroked-button [disabled]="!savedSettings.enable || savedSettings.servers.length == 0"
|
||||
style="margin: 0 1em 1em 0;" (click)="runIncrementalSync()" type="button"
|
||||
id="recentlyAddedSync">
|
||||
Run Incremental Sync
|
||||
</button>
|
||||
<button mat-stroked-button [disabled]="!savedSettings.enable|| savedSettings.servers.length == 0"
|
||||
style="margin: 0 1em 1em 0;" (click)="runFullSync()" type="button" id="save">
|
||||
Run Full Sync
|
||||
</button>
|
||||
<button mat-stroked-button [disabled]="!savedSettings.enable|| savedSettings.servers.length == 0"
|
||||
style="margin: 0 1em 1em 0;" (click)="runCacheWipeWithFullSync()" type="button" id="clearData">
|
||||
Clear Data And Resync
|
||||
</button>
|
||||
<button mat-stroked-button
|
||||
[disabled]="!savedSettings.enable|| savedSettings.servers.length == 0"
|
||||
style="margin: 0 1em 1em 0;" (click)="runCacheWipeWithFullSync()" type="button"
|
||||
id="clearData">
|
||||
Clear Data And Resync
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
|
|
@ -18,7 +18,6 @@ import {
|
|||
})
|
||||
export class EmbyComponent implements OnInit {
|
||||
public savedSettings: IEmbySettings;
|
||||
public currentSettings: IEmbySettings;
|
||||
|
||||
constructor(
|
||||
private settingsService: SettingsService,
|
||||
|
@ -32,7 +31,6 @@ export class EmbyComponent implements OnInit {
|
|||
next: (result) => {
|
||||
if (result.servers == null) result.servers = [];
|
||||
this.savedSettings = result;
|
||||
this.currentSettings = result;
|
||||
},
|
||||
error: () => {
|
||||
this.notificationService.error("Failed to retrieve Emby settings.");
|
||||
|
@ -41,9 +39,13 @@ export class EmbyComponent implements OnInit {
|
|||
}
|
||||
|
||||
public toggleEnableFlag(event: MatSlideToggleChange) {
|
||||
const newSettings: IEmbySettings = structuredClone(this.savedSettings);
|
||||
newSettings.enable = event.checked;
|
||||
const errorMessage = "There was an error saving Emby settings.";
|
||||
const newSettings: IEmbySettings = {
|
||||
...structuredClone(this.savedSettings),
|
||||
enable: event.checked,
|
||||
};
|
||||
const errorMessage = event.checked
|
||||
? "There was an error enabling Emby settings. Check that all servers are configured correctly."
|
||||
: "There was an error disabling Emby settings.";
|
||||
this.settingsService.saveEmby(newSettings).subscribe({
|
||||
next: (result) => {
|
||||
if (result) {
|
||||
|
@ -54,10 +56,12 @@ export class EmbyComponent implements OnInit {
|
|||
} Emby settings.`
|
||||
);
|
||||
} else {
|
||||
event.source.checked = !event.checked;
|
||||
this.notificationService.error(errorMessage);
|
||||
}
|
||||
},
|
||||
error: () => {
|
||||
event.source.checked = !event.checked;
|
||||
this.notificationService.error(errorMessage);
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue