diff --git a/UI/Web/src/app/admin/manage-system/manage-system.component.ts b/UI/Web/src/app/admin/manage-system/manage-system.component.ts
index 86c1f1599..ecab34faf 100644
--- a/UI/Web/src/app/admin/manage-system/manage-system.component.ts
+++ b/UI/Web/src/app/admin/manage-system/manage-system.component.ts
@@ -1,10 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
-import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { ToastrService } from 'ngx-toastr';
-import { finalize, take, takeWhile } from 'rxjs/operators';
-import { UpdateNotificationModalComponent } from 'src/app/shared/update-notification/update-notification-modal.component';
-import { DownloadService } from 'src/app/shared/_services/download.service';
+import { take } from 'rxjs/operators';
import { ServerService } from 'src/app/_services/server.service';
import { SettingsService } from '../settings.service';
import { ServerInfo } from '../_models/server-info';
@@ -21,14 +18,9 @@ export class ManageSystemComponent implements OnInit {
serverSettings!: ServerSettings;
serverInfo!: ServerInfo;
- clearCacheInProgress: boolean = false;
- backupDBInProgress: boolean = false;
- isCheckingForUpdate: boolean = false;
- downloadLogsInProgress: boolean = false;
constructor(private settingsService: SettingsService, private toastr: ToastrService,
- private serverService: ServerService, public downloadService: DownloadService,
- private modalService: NgbModal) { }
+ private serverService: ServerService) { }
ngOnInit(): void {
@@ -67,45 +59,4 @@ export class ManageSystemComponent implements OnInit {
console.error('error: ', err);
});
}
-
- clearCache() {
- this.clearCacheInProgress = true;
- this.serverService.clearCache().subscribe(res => {
- this.clearCacheInProgress = false;
- this.toastr.success('Cache has been cleared');
- });
- }
-
- backupDB() {
- this.backupDBInProgress = true;
- this.serverService.backupDatabase().subscribe(res => {
- this.backupDBInProgress = false;
- this.toastr.success('Database has been backed up');
- });
- }
-
- checkForUpdates() {
- this.isCheckingForUpdate = true;
- this.serverService.checkForUpdate().subscribe((update) => {
- this.isCheckingForUpdate = false;
- if (update === null) {
- this.toastr.info('No updates available');
- return;
- }
- const modalRef = this.modalService.open(UpdateNotificationModalComponent, { scrollable: true, size: 'lg' });
- modalRef.componentInstance.updateData = update;
- });
- }
-
- downloadLogs() {
- this.downloadLogsInProgress = true;
- this.downloadService.downloadLogs().pipe(
- takeWhile(val => {
- return val.state != 'DONE';
- }),
- finalize(() => {
- this.downloadLogsInProgress = false;
- })).subscribe(() => {/* No Operation */});
- }
-
}
diff --git a/UI/Web/src/app/admin/manage-tasks-settings/manage-tasks-settings.component.html b/UI/Web/src/app/admin/manage-tasks-settings/manage-tasks-settings.component.html
new file mode 100644
index 000000000..c6d22af31
--- /dev/null
+++ b/UI/Web/src/app/admin/manage-tasks-settings/manage-tasks-settings.component.html
@@ -0,0 +1,73 @@
+
\ No newline at end of file
diff --git a/UI/Web/src/app/admin/manage-tasks-settings/manage-tasks-settings.component.scss b/UI/Web/src/app/admin/manage-tasks-settings/manage-tasks-settings.component.scss
new file mode 100644
index 000000000..3fe4d1b01
--- /dev/null
+++ b/UI/Web/src/app/admin/manage-tasks-settings/manage-tasks-settings.component.scss
@@ -0,0 +1,3 @@
+.table {
+ background-color: lightgrey;
+}
\ No newline at end of file
diff --git a/UI/Web/src/app/admin/manage-tasks-settings/manage-tasks-settings.component.ts b/UI/Web/src/app/admin/manage-tasks-settings/manage-tasks-settings.component.ts
new file mode 100644
index 000000000..56c3edca4
--- /dev/null
+++ b/UI/Web/src/app/admin/manage-tasks-settings/manage-tasks-settings.component.ts
@@ -0,0 +1,151 @@
+import { Component, OnInit } from '@angular/core';
+import { FormGroup, FormControl, Validators } from '@angular/forms';
+import { ToastrService } from 'ngx-toastr';
+import { ConfirmService } from 'src/app/shared/confirm.service';
+import { SettingsService } from '../settings.service';
+import { ServerSettings } from '../_models/server-settings';
+import { catchError, finalize, shareReplay, take, takeWhile } from 'rxjs/operators';
+import { forkJoin, Observable, of } from 'rxjs';
+import { ServerService } from 'src/app/_services/server.service';
+import { Job } from 'src/app/_models/job/job';
+import { UpdateNotificationModalComponent } from 'src/app/shared/update-notification/update-notification-modal.component';
+import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
+import { DownloadService } from 'src/app/shared/_services/download.service';
+
+interface AdhocTask {
+ name: string;
+ description: string;
+ api: Observable
;
+ successMessage: string;
+ successFunction?: (data: any) => void;
+}
+
+@Component({
+ selector: 'app-manage-tasks-settings',
+ templateUrl: './manage-tasks-settings.component.html',
+ styleUrls: ['./manage-tasks-settings.component.scss']
+})
+export class ManageTasksSettingsComponent implements OnInit {
+
+ serverSettings!: ServerSettings;
+ settingsForm: FormGroup = new FormGroup({});
+ taskFrequencies: Array = [];
+ logLevels: Array = [];
+
+ reoccuringTasks$: Observable> = of([]);
+ adhocTasks: Array = [
+ {
+ name: 'Convert Bookmarks to WebP',
+ description: 'Runs a long-running task which will convert all bookmarks to WebP. This is slow (especially on ARM devices).',
+ api: this.serverService.convertBookmarks(),
+ successMessage: 'Conversion of Bookmarks has been queued'
+ },
+ {
+ name: 'Clear Cache',
+ description: 'Clears cached files for reading. Usefull when you\'ve just updated a file that you were previously reading within last 24 hours.',
+ api: this.serverService.clearCache(),
+ successMessage: 'Cache has been cleared'
+ },
+ {
+ name: 'Backup Database',
+ description: 'Takes a backup of the database, bookmarks, themes, manually uploaded covers, and config files',
+ api: this.serverService.backupDatabase(),
+ successMessage: 'A job to backup the database has been queued'
+ },
+ {
+ name: 'Download Logs',
+ description: 'Compiles all log files into a zip and downloads it',
+ api: this.downloadService.downloadLogs().pipe(
+ takeWhile(val => {
+ return val.state != 'DONE';
+ })),
+ successMessage: ''
+ },
+ {
+ name: 'Check for Updates',
+ description: 'See if there are any Stable releases ahead of your version',
+ api: this.serverService.checkForUpdate(),
+ successMessage: '',
+ successFunction: (update) => {
+ if (update === null) {
+ this.toastr.info('No updates available');
+ return;
+ }
+ const modalRef = this.modalService.open(UpdateNotificationModalComponent, { scrollable: true, size: 'lg' });
+ modalRef.componentInstance.updateData = update;
+ }
+ },
+ ];
+
+ constructor(private settingsService: SettingsService, private toastr: ToastrService,
+ private serverService: ServerService, private modalService: NgbModal,
+ private downloadService: DownloadService) { }
+
+ ngOnInit(): void {
+ forkJoin({
+ frequencies: this.settingsService.getTaskFrequencies(),
+ levels: this.settingsService.getLoggingLevels(),
+ settings: this.settingsService.getServerSettings()
+ }
+
+ ).subscribe(result => {
+ this.taskFrequencies = result.frequencies;
+ this.logLevels = result.levels;
+ this.serverSettings = result.settings;
+ this.settingsForm.addControl('taskScan', new FormControl(this.serverSettings.taskScan, [Validators.required]));
+ this.settingsForm.addControl('taskBackup', new FormControl(this.serverSettings.taskBackup, [Validators.required]));
+ });
+
+ this.reoccuringTasks$ = this.serverService.getReoccuringJobs().pipe(shareReplay());
+ }
+
+ resetForm() {
+ this.settingsForm.get('taskScan')?.setValue(this.serverSettings.taskScan);
+ this.settingsForm.get('taskBackup')?.setValue(this.serverSettings.taskBackup);
+ }
+
+ async saveSettings() {
+ const modelSettings = Object.assign({}, this.serverSettings);
+ modelSettings.taskBackup = this.settingsForm.get('taskBackup')?.value;
+ modelSettings.taskScan = this.settingsForm.get('taskScan')?.value;
+
+ this.settingsService.updateServerSettings(modelSettings).pipe(take(1)).subscribe(async (settings: ServerSettings) => {
+ this.serverSettings = settings;
+ this.resetForm();
+ this.reoccuringTasks$ = this.serverService.getReoccuringJobs().pipe(shareReplay());
+ this.toastr.success('Server settings updated');
+ }, (err: any) => {
+ console.error('error: ', err);
+ });
+ }
+
+ resetToDefaults() {
+ this.settingsService.resetServerSettings().pipe(take(1)).subscribe(async (settings: ServerSettings) => {
+ this.serverSettings = settings;
+ this.resetForm();
+ this.toastr.success('Server settings updated');
+ }, (err: any) => {
+ console.error('error: ', err);
+ });
+ }
+
+ runAdhocConvert() {
+ this.serverService.convertBookmarks().subscribe(() => {
+ this.toastr.success('Conversion of Bookmarks has been queued.');
+ });
+ }
+
+ runAdhoc(task: AdhocTask) {
+ task.api.subscribe((data: any) => {
+ if (task.successMessage.length > 0) {
+ this.toastr.success(task.successMessage);
+ }
+
+ if (task.successFunction) {
+ task.successFunction(data);
+ }
+ });
+ }
+
+
+}
diff --git a/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.html b/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.html
index 8e7ae79f1..f412c16aa 100644
--- a/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.html
+++ b/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.html
@@ -39,11 +39,10 @@
-
-
-
-