removed enabled per arr config and added enabled per arr instance

This commit is contained in:
Flaminel
2025-06-21 16:01:03 +03:00
parent 861c74e452
commit 5ea1361832
30 changed files with 269 additions and 421 deletions

View File

@@ -269,7 +269,7 @@ export class ConfigurationService {
/**
* Update Sonarr configuration (global settings only)
*/
updateSonarrConfig(config: {enabled: boolean, failedImportMaxStrikes: number}): Observable<any> {
updateSonarrConfig(config: {failedImportMaxStrikes: number}): Observable<any> {
return this.http.put<any>(this.basePathService.buildApiUrl('/configuration/sonarr'), config).pipe(
catchError((error) => {
console.error("Error updating Sonarr config:", error);
@@ -292,8 +292,8 @@ export class ConfigurationService {
/**
* Update Radarr configuration
*/
updateRadarrConfig(config: RadarrConfig): Observable<RadarrConfig> {
return this.http.put<RadarrConfig>(this.basePathService.buildApiUrl('/configuration/radarr'), config).pipe(
updateRadarrConfig(config: {failedImportMaxStrikes: number}): Observable<any> {
return this.http.put<any>(this.basePathService.buildApiUrl('/configuration/radarr'), config).pipe(
catchError((error) => {
console.error("Error updating Radarr config:", error);
return throwError(() => new Error(error.error?.error || "Failed to update Radarr configuration"));
@@ -315,8 +315,8 @@ export class ConfigurationService {
/**
* Update Lidarr configuration
*/
updateLidarrConfig(config: LidarrConfig): Observable<LidarrConfig> {
return this.http.put<LidarrConfig>(this.basePathService.buildApiUrl('/configuration/lidarr'), config).pipe(
updateLidarrConfig(config: {failedImportMaxStrikes: number}): Observable<any> {
return this.http.put<any>(this.basePathService.buildApiUrl('/configuration/lidarr'), config).pipe(
catchError((error) => {
console.error("Error updating Lidarr config:", error);
return throwError(() => new Error(error.error?.error || "Failed to update Lidarr configuration"));

View File

@@ -49,44 +49,32 @@ export class LidarrConfigStore extends signalStore(
),
/**
* Save the Lidarr configuration (basic settings only)
* Save the Lidarr global configuration
*/
saveConfig: rxMethod<Partial<LidarrConfig>>(
(config$: Observable<Partial<LidarrConfig>>) => config$.pipe(
saveConfig: rxMethod<{failedImportMaxStrikes: number}>(
(globalConfig$: Observable<{failedImportMaxStrikes: number}>) => globalConfig$.pipe(
tap(() => patchState(store, { saving: true, error: null })),
switchMap(configUpdate => {
const currentConfig = store.config();
if (!currentConfig) {
patchState(store, {
saving: false,
error: 'No current configuration available'
});
return EMPTY;
}
const updatedConfig: LidarrConfig = {
...currentConfig,
...configUpdate
};
return configService.updateLidarrConfig(updatedConfig).pipe(
tap({
next: () => {
switchMap(globalConfig => configService.updateLidarrConfig(globalConfig).pipe(
tap({
next: () => {
const currentConfig = store.config();
if (currentConfig) {
// Update the local config with the new global settings
patchState(store, {
config: updatedConfig,
config: { ...currentConfig, ...globalConfig },
saving: false
});
},
error: (error) => {
patchState(store, {
saving: false,
error: error.message || 'Failed to save Lidarr configuration'
});
}
}),
catchError(() => EMPTY)
);
})
},
error: (error) => {
patchState(store, {
saving: false,
error: error.message || 'Failed to save Lidarr configuration'
});
}
}),
catchError(() => EMPTY)
))
)
),

View File

@@ -32,14 +32,6 @@
</ng-template>
<form [formGroup]="globalForm" class="p-fluid">
<div class="field-row">
<label class="field-label">Enable Lidarr Integration</label>
<div class="field-input">
<p-checkbox formControlName="enabled" [binary]="true"></p-checkbox>
<small class="form-helper-text">When enabled, Lidarr API integration will be used</small>
</div>
</div>
<div class="field-row">
<label class="field-label">Failed Import Max Strikes</label>
<div>
@@ -108,7 +100,7 @@
type="button"
icon="pi pi-pencil"
class="p-button-text p-button-sm"
[disabled]="instanceManagementDisabled"
[disabled]="lidarrSaving()"
(click)="openEditInstanceModal(instance)"
pTooltip="Edit instance"
></button>
@@ -117,7 +109,7 @@
type="button"
icon="pi pi-trash"
class="p-button-text p-button-sm p-button-danger"
[disabled]="instanceManagementDisabled"
[disabled]="lidarrSaving()"
(click)="deleteInstance(instance)"
pTooltip="Delete instance"
></button>
@@ -128,6 +120,13 @@
<div class="instance-field">
<label>{{ instance.url }}</label>
</div>
<div class="instance-field">
<label>Status:
<span [class]="instance.enabled ? 'text-green-500' : 'text-red-500'">
{{ instance.enabled ? 'Enabled' : 'Disabled' }}
</span>
</label>
</div>
</div>
</div>
</div>
@@ -140,7 +139,7 @@
icon="pi pi-plus"
label="Add Instance"
class="p-button-outlined"
[disabled]="instanceManagementDisabled"
[disabled]="lidarrSaving()"
(click)="openAddInstanceModal()"
></button>
</div>
@@ -160,6 +159,14 @@
(onHide)="closeInstanceModal()"
>
<form [formGroup]="instanceForm" class="p-fluid instance-form">
<div class="field flex flex-row">
<label class="field-label">Enabled</label>
<div class="field-input">
<p-checkbox formControlName="enabled" [binary]="true"></p-checkbox>
<small class="form-helper-text">Enable this Lidarr instance</small>
</div>
</div>
<div class="field">
<label for="instance-name">Name *</label>
<input

View File

@@ -82,11 +82,11 @@ export class LidarrSettingsComponent implements OnDestroy, CanComponentDeactivat
constructor() {
// Initialize forms
this.globalForm = this.formBuilder.group({
enabled: [false],
failedImportMaxStrikes: [{ value: -1, disabled: true }],
failedImportMaxStrikes: [-1],
});
this.instanceForm = this.formBuilder.group({
enabled: [true],
name: ['', Validators.required],
url: ['', [Validators.required, this.uriValidator.bind(this)]],
apiKey: ['', Validators.required],
@@ -95,9 +95,6 @@ export class LidarrSettingsComponent implements OnDestroy, CanComponentDeactivat
// Load Lidarr config data
this.lidarrStore.loadConfig();
// Setup form value change listeners
this.setupFormValueChangeListeners();
// Setup effect to update form when config changes
effect(() => {
const config = this.lidarrConfig();
@@ -127,56 +124,13 @@ export class LidarrSettingsComponent implements OnDestroy, CanComponentDeactivat
*/
private updateGlobalFormFromConfig(config: LidarrConfig): void {
this.globalForm.patchValue({
enabled: config.enabled,
failedImportMaxStrikes: config.failedImportMaxStrikes,
});
// Update form control disabled states
this.updateFormControlDisabledStates(config);
// Store original values for dirty checking
this.storeOriginalGlobalValues();
}
/**
* Set up listeners for form control value changes to manage dependent control states
*/
private setupFormValueChangeListeners(): void {
// Listen for changes to the 'enabled' control
const enabledControl = this.globalForm.get('enabled');
if (enabledControl) {
enabledControl.valueChanges
.pipe(takeUntil(this.destroy$))
.subscribe(enabled => {
this.updateMainControlsState(enabled);
});
}
}
/**
* Update form control disabled states based on the configuration
*/
private updateFormControlDisabledStates(config: LidarrConfig): void {
const enabled = config.enabled;
this.updateMainControlsState(enabled);
}
/**
* Update the state of main controls based on the 'enabled' control value
*/
private updateMainControlsState(enabled: boolean): void {
const failedImportMaxStrikesControl = this.globalForm.get('failedImportMaxStrikes');
// Disable emitting events during state changes to prevent infinite loops
const options = { emitEvent: false };
if (enabled) {
failedImportMaxStrikesControl?.enable(options);
} else {
failedImportMaxStrikesControl?.disable(options);
}
}
/**
* Store original global form values for dirty checking
*/
@@ -280,11 +234,7 @@ export class LidarrSettingsComponent implements OnDestroy, CanComponentDeactivat
return;
}
const currentConfig = this.lidarrConfig();
if (!currentConfig) return;
const updatedConfig = {
enabled: this.globalForm.get('enabled')?.value,
failedImportMaxStrikes: this.globalForm.get('failedImportMaxStrikes')?.value
};
@@ -330,20 +280,18 @@ export class LidarrSettingsComponent implements OnDestroy, CanComponentDeactivat
return this.lidarrConfig()?.instances || [];
}
/**
* Check if instance management should be disabled
*/
get instanceManagementDisabled(): boolean {
return !this.globalForm.get('enabled')?.value;
}
/**
* Open modal to add new instance
*/
openAddInstanceModal(): void {
this.modalMode = 'add';
this.editingInstance = null;
this.instanceForm.reset();
this.instanceForm.reset({
enabled: true,
name: '',
url: '',
apiKey: ''
});
this.showInstanceModal = true;
}
@@ -354,6 +302,7 @@ export class LidarrSettingsComponent implements OnDestroy, CanComponentDeactivat
this.modalMode = 'edit';
this.editingInstance = instance;
this.instanceForm.patchValue({
enabled: instance.enabled,
name: instance.name,
url: instance.url,
apiKey: instance.apiKey,
@@ -382,6 +331,7 @@ export class LidarrSettingsComponent implements OnDestroy, CanComponentDeactivat
}
const instanceData: CreateArrInstanceDto = {
enabled: this.instanceForm.get('enabled')?.value,
name: this.instanceForm.get('name')?.value,
url: this.instanceForm.get('url')?.value,
apiKey: this.instanceForm.get('apiKey')?.value,
@@ -456,12 +406,12 @@ export class LidarrSettingsComponent implements OnDestroy, CanComponentDeactivat
});
}
/**
* Get modal title based on mode
*/
get modalTitle(): string {
return this.modalMode === 'add' ? 'Add Lidarr Instance' : 'Edit Lidarr Instance';
}
// Add any other necessary methods here
}

View File

@@ -49,44 +49,32 @@ export class RadarrConfigStore extends signalStore(
),
/**
* Save the Radarr configuration (basic settings only)
* Save the Radarr global configuration
*/
saveConfig: rxMethod<Partial<RadarrConfig>>(
(config$: Observable<Partial<RadarrConfig>>) => config$.pipe(
saveConfig: rxMethod<{failedImportMaxStrikes: number}>(
(globalConfig$: Observable<{failedImportMaxStrikes: number}>) => globalConfig$.pipe(
tap(() => patchState(store, { saving: true, error: null })),
switchMap(configUpdate => {
const currentConfig = store.config();
if (!currentConfig) {
patchState(store, {
saving: false,
error: 'No current configuration available'
});
return EMPTY;
}
const updatedConfig: RadarrConfig = {
...currentConfig,
...configUpdate
};
return configService.updateRadarrConfig(updatedConfig).pipe(
tap({
next: () => {
switchMap(globalConfig => configService.updateRadarrConfig(globalConfig).pipe(
tap({
next: () => {
const currentConfig = store.config();
if (currentConfig) {
// Update the local config with the new global settings
patchState(store, {
config: updatedConfig,
config: { ...currentConfig, ...globalConfig },
saving: false
});
},
error: (error) => {
patchState(store, {
saving: false,
error: error.message || 'Failed to save Radarr configuration'
});
}
}),
catchError(() => EMPTY)
);
})
},
error: (error) => {
patchState(store, {
saving: false,
error: error.message || 'Failed to save Radarr configuration'
});
}
}),
catchError(() => EMPTY)
))
)
),

View File

@@ -32,14 +32,6 @@
</ng-template>
<form [formGroup]="globalForm" class="p-fluid">
<div class="field-row">
<label class="field-label">Enable Radarr Integration</label>
<div class="field-input">
<p-checkbox formControlName="enabled" [binary]="true"></p-checkbox>
<small class="form-helper-text">When enabled, Radarr API integration will be used</small>
</div>
</div>
<div class="field-row">
<label class="field-label">Failed Import Max Strikes</label>
<div>
@@ -108,7 +100,7 @@
type="button"
icon="pi pi-pencil"
class="p-button-text p-button-sm"
[disabled]="instanceManagementDisabled"
[disabled]="radarrSaving()"
(click)="openEditInstanceModal(instance)"
pTooltip="Edit instance"
></button>
@@ -117,7 +109,7 @@
type="button"
icon="pi pi-trash"
class="p-button-text p-button-sm p-button-danger"
[disabled]="instanceManagementDisabled"
[disabled]="radarrSaving()"
(click)="deleteInstance(instance)"
pTooltip="Delete instance"
></button>
@@ -128,6 +120,13 @@
<div class="instance-field">
<label>{{ instance.url }}</label>
</div>
<div class="instance-field">
<label>Status:
<span [class]="instance.enabled ? 'text-green-500' : 'text-red-500'">
{{ instance.enabled ? 'Enabled' : 'Disabled' }}
</span>
</label>
</div>
</div>
</div>
</div>
@@ -140,7 +139,7 @@
icon="pi pi-plus"
label="Add Instance"
class="p-button-outlined"
[disabled]="instanceManagementDisabled"
[disabled]="radarrSaving()"
(click)="openAddInstanceModal()"
></button>
</div>
@@ -160,6 +159,14 @@
(onHide)="closeInstanceModal()"
>
<form [formGroup]="instanceForm" class="p-fluid instance-form">
<div class="field flex flex-row">
<label class="field-label">Enabled</label>
<div class="field-input">
<p-checkbox formControlName="enabled" [binary]="true"></p-checkbox>
<small class="form-helper-text">Enable this Radarr instance</small>
</div>
</div>
<div class="field">
<label for="instance-name">Name *</label>
<input

View File

@@ -82,11 +82,11 @@ export class RadarrSettingsComponent implements OnDestroy, CanComponentDeactivat
constructor() {
// Initialize forms
this.globalForm = this.formBuilder.group({
enabled: [false],
failedImportMaxStrikes: [{ value: -1, disabled: true }],
failedImportMaxStrikes: [-1],
});
this.instanceForm = this.formBuilder.group({
enabled: [true],
name: ['', Validators.required],
url: ['', [Validators.required, this.uriValidator.bind(this)]],
apiKey: ['', Validators.required],
@@ -95,9 +95,6 @@ export class RadarrSettingsComponent implements OnDestroy, CanComponentDeactivat
// Load Radarr config data
this.radarrStore.loadConfig();
// Setup form value change listeners
this.setupFormValueChangeListeners();
// Setup effect to update form when config changes
effect(() => {
const config = this.radarrConfig();
@@ -127,56 +124,13 @@ export class RadarrSettingsComponent implements OnDestroy, CanComponentDeactivat
*/
private updateGlobalFormFromConfig(config: RadarrConfig): void {
this.globalForm.patchValue({
enabled: config.enabled,
failedImportMaxStrikes: config.failedImportMaxStrikes,
});
// Update form control disabled states
this.updateFormControlDisabledStates(config);
// Store original values for dirty checking
this.storeOriginalGlobalValues();
}
/**
* Set up listeners for form control value changes to manage dependent control states
*/
private setupFormValueChangeListeners(): void {
// Listen for changes to the 'enabled' control
const enabledControl = this.globalForm.get('enabled');
if (enabledControl) {
enabledControl.valueChanges
.pipe(takeUntil(this.destroy$))
.subscribe(enabled => {
this.updateMainControlsState(enabled);
});
}
}
/**
* Update form control disabled states based on the configuration
*/
private updateFormControlDisabledStates(config: RadarrConfig): void {
const enabled = config.enabled;
this.updateMainControlsState(enabled);
}
/**
* Update the state of main controls based on the 'enabled' control value
*/
private updateMainControlsState(enabled: boolean): void {
const failedImportMaxStrikesControl = this.globalForm.get('failedImportMaxStrikes');
// Disable emitting events during state changes to prevent infinite loops
const options = { emitEvent: false };
if (enabled) {
failedImportMaxStrikesControl?.enable(options);
} else {
failedImportMaxStrikesControl?.disable(options);
}
}
/**
* Store original global form values for dirty checking
*/
@@ -280,11 +234,7 @@ export class RadarrSettingsComponent implements OnDestroy, CanComponentDeactivat
return;
}
const currentConfig = this.radarrConfig();
if (!currentConfig) return;
const updatedConfig = {
enabled: this.globalForm.get('enabled')?.value,
failedImportMaxStrikes: this.globalForm.get('failedImportMaxStrikes')?.value
};
@@ -330,20 +280,18 @@ export class RadarrSettingsComponent implements OnDestroy, CanComponentDeactivat
return this.radarrConfig()?.instances || [];
}
/**
* Check if instance management should be disabled
*/
get instanceManagementDisabled(): boolean {
return !this.globalForm.get('enabled')?.value;
}
/**
* Open modal to add new instance
*/
openAddInstanceModal(): void {
this.modalMode = 'add';
this.editingInstance = null;
this.instanceForm.reset();
this.instanceForm.reset({
enabled: true,
name: '',
url: '',
apiKey: ''
});
this.showInstanceModal = true;
}
@@ -354,6 +302,7 @@ export class RadarrSettingsComponent implements OnDestroy, CanComponentDeactivat
this.modalMode = 'edit';
this.editingInstance = instance;
this.instanceForm.patchValue({
enabled: instance.enabled,
name: instance.name,
url: instance.url,
apiKey: instance.apiKey,
@@ -382,6 +331,7 @@ export class RadarrSettingsComponent implements OnDestroy, CanComponentDeactivat
}
const instanceData: CreateArrInstanceDto = {
enabled: this.instanceForm.get('enabled')?.value,
name: this.instanceForm.get('name')?.value,
url: this.instanceForm.get('url')?.value,
apiKey: this.instanceForm.get('apiKey')?.value,
@@ -456,12 +406,12 @@ export class RadarrSettingsComponent implements OnDestroy, CanComponentDeactivat
});
}
/**
* Get modal title based on mode
*/
get modalTitle(): string {
return this.modalMode === 'add' ? 'Add Radarr Instance' : 'Edit Radarr Instance';
}
// Add any other necessary methods here
}

View File

@@ -51,8 +51,8 @@ export class SonarrConfigStore extends signalStore(
/**
* Save the Sonarr global configuration
*/
saveConfig: rxMethod<{enabled: boolean, failedImportMaxStrikes: number}>(
(globalConfig$: Observable<{enabled: boolean, failedImportMaxStrikes: number}>) => globalConfig$.pipe(
saveConfig: rxMethod<{failedImportMaxStrikes: number}>(
(globalConfig$: Observable<{failedImportMaxStrikes: number}>) => globalConfig$.pipe(
tap(() => patchState(store, { saving: true, error: null })),
switchMap(globalConfig => configService.updateSonarrConfig(globalConfig).pipe(
tap({

View File

@@ -32,14 +32,6 @@
</ng-template>
<form [formGroup]="globalForm" class="p-fluid">
<div class="field-row">
<label class="field-label">Enable Sonarr Integration</label>
<div class="field-input">
<p-checkbox formControlName="enabled" [binary]="true"></p-checkbox>
<small class="form-helper-text">When enabled, Sonarr API integration will be used</small>
</div>
</div>
<div class="field-row">
<label class="field-label">Failed Import Max Strikes</label>
<div>
@@ -108,7 +100,7 @@
type="button"
icon="pi pi-pencil"
class="p-button-text p-button-sm"
[disabled]="instanceManagementDisabled"
[disabled]="sonarrSaving()"
(click)="openEditInstanceModal(instance)"
pTooltip="Edit instance"
></button>
@@ -117,7 +109,7 @@
type="button"
icon="pi pi-trash"
class="p-button-text p-button-sm p-button-danger"
[disabled]="instanceManagementDisabled"
[disabled]="sonarrSaving()"
(click)="deleteInstance(instance)"
pTooltip="Delete instance"
></button>
@@ -128,6 +120,13 @@
<div class="instance-field">
<label>{{ instance.url }}</label>
</div>
<div class="instance-field">
<label>Status:
<span [class]="instance.enabled ? 'text-green-500' : 'text-red-500'">
{{ instance.enabled ? 'Enabled' : 'Disabled' }}
</span>
</label>
</div>
</div>
</div>
</div>
@@ -140,7 +139,7 @@
icon="pi pi-plus"
label="Add Instance"
class="p-button-outlined"
[disabled]="instanceManagementDisabled"
[disabled]="sonarrSaving()"
(click)="openAddInstanceModal()"
></button>
</div>
@@ -160,6 +159,14 @@
(onHide)="closeInstanceModal()"
>
<form [formGroup]="instanceForm" class="p-fluid instance-form">
<div class="field flex flex-row">
<label class="field-label">Enabled</label>
<div class="field-input">
<p-checkbox formControlName="enabled" [binary]="true"></p-checkbox>
<small class="form-helper-text">Enable this Sonarr instance</small>
</div>
</div>
<div class="field">
<label for="instance-name">Name *</label>
<input

View File

@@ -82,11 +82,11 @@ export class SonarrSettingsComponent implements OnDestroy, CanComponentDeactivat
constructor() {
// Initialize forms
this.globalForm = this.formBuilder.group({
enabled: [false],
failedImportMaxStrikes: [{ value: -1, disabled: true }],
failedImportMaxStrikes: [-1],
});
this.instanceForm = this.formBuilder.group({
enabled: [true],
name: ['', Validators.required],
url: ['', [Validators.required, this.uriValidator.bind(this)]],
apiKey: ['', Validators.required],
@@ -95,9 +95,6 @@ export class SonarrSettingsComponent implements OnDestroy, CanComponentDeactivat
// Load Sonarr config data
this.sonarrStore.loadConfig();
// Setup form value change listeners
this.setupFormValueChangeListeners();
// Setup effect to update form when config changes
effect(() => {
const config = this.sonarrConfig();
@@ -127,56 +124,13 @@ export class SonarrSettingsComponent implements OnDestroy, CanComponentDeactivat
*/
private updateGlobalFormFromConfig(config: SonarrConfig): void {
this.globalForm.patchValue({
enabled: config.enabled,
failedImportMaxStrikes: config.failedImportMaxStrikes,
});
// Update form control disabled states
this.updateFormControlDisabledStates(config);
// Store original values for dirty checking
this.storeOriginalGlobalValues();
}
/**
* Set up listeners for form control value changes to manage dependent control states
*/
private setupFormValueChangeListeners(): void {
// Listen for changes to the 'enabled' control
const enabledControl = this.globalForm.get('enabled');
if (enabledControl) {
enabledControl.valueChanges
.pipe(takeUntil(this.destroy$))
.subscribe(enabled => {
this.updateMainControlsState(enabled);
});
}
}
/**
* Update form control disabled states based on the configuration
*/
private updateFormControlDisabledStates(config: SonarrConfig): void {
const enabled = config.enabled;
this.updateMainControlsState(enabled);
}
/**
* Update the state of main controls based on the 'enabled' control value
*/
private updateMainControlsState(enabled: boolean): void {
const failedImportMaxStrikesControl = this.globalForm.get('failedImportMaxStrikes');
// Disable emitting events during state changes to prevent infinite loops
const options = { emitEvent: false };
if (enabled) {
failedImportMaxStrikesControl?.enable(options);
} else {
failedImportMaxStrikesControl?.disable(options);
}
}
/**
* Store original global form values for dirty checking
*/
@@ -280,11 +234,7 @@ export class SonarrSettingsComponent implements OnDestroy, CanComponentDeactivat
return;
}
const currentConfig = this.sonarrConfig();
if (!currentConfig) return;
const updatedConfig = {
enabled: this.globalForm.get('enabled')?.value,
failedImportMaxStrikes: this.globalForm.get('failedImportMaxStrikes')?.value
};
@@ -330,20 +280,18 @@ export class SonarrSettingsComponent implements OnDestroy, CanComponentDeactivat
return this.sonarrConfig()?.instances || [];
}
/**
* Check if instance management should be disabled
*/
get instanceManagementDisabled(): boolean {
return !this.globalForm.get('enabled')?.value;
}
/**
* Open modal to add new instance
*/
openAddInstanceModal(): void {
this.modalMode = 'add';
this.editingInstance = null;
this.instanceForm.reset();
this.instanceForm.reset({
enabled: true,
name: '',
url: '',
apiKey: ''
});
this.showInstanceModal = true;
}
@@ -354,6 +302,7 @@ export class SonarrSettingsComponent implements OnDestroy, CanComponentDeactivat
this.modalMode = 'edit';
this.editingInstance = instance;
this.instanceForm.patchValue({
enabled: instance.enabled,
name: instance.name,
url: instance.url,
apiKey: instance.apiKey,
@@ -382,6 +331,7 @@ export class SonarrSettingsComponent implements OnDestroy, CanComponentDeactivat
}
const instanceData: CreateArrInstanceDto = {
enabled: this.instanceForm.get('enabled')?.value,
name: this.instanceForm.get('name')?.value,
url: this.instanceForm.get('url')?.value,
apiKey: this.instanceForm.get('apiKey')?.value,
@@ -456,12 +406,12 @@ export class SonarrSettingsComponent implements OnDestroy, CanComponentDeactivat
});
}
/**
* Get modal title based on mode
*/
get modalTitle(): string {
return this.modalMode === 'add' ? 'Add Sonarr Instance' : 'Edit Sonarr Instance';
}
// Add any other necessary methods here
}

View File

@@ -3,6 +3,7 @@
*/
export interface ArrInstance {
id?: string;
enabled: boolean;
name: string;
url: string;
apiKey: string;
@@ -12,6 +13,7 @@ export interface ArrInstance {
* DTO for creating new Arr instances without requiring an ID
*/
export interface CreateArrInstanceDto {
enabled: boolean;
name: string;
url: string;
apiKey: string;

View File

@@ -9,7 +9,6 @@ import { ArrInstance } from "./arr-config.model";
* Main LidarrConfig model representing the configuration for Lidarr integration
*/
export interface LidarrConfig {
enabled: boolean;
failedImportMaxStrikes: number;
instances: ArrInstance[];
}

View File

@@ -9,7 +9,6 @@ import { ArrInstance } from "./arr-config.model";
* Main RadarrConfig model representing the configuration for Radarr integration
*/
export interface RadarrConfig {
enabled: boolean;
failedImportMaxStrikes: number;
instances: ArrInstance[];
}

View File

@@ -9,7 +9,6 @@ import { ArrInstance } from "./arr-config.model";
* Main SonarrConfig model representing the configuration for Sonarr integration
*/
export interface SonarrConfig {
enabled: boolean;
failedImportMaxStrikes: number;
instances: ArrInstance[];
}