From 2350bc780ddfc88175f9042b431499c72eb58ade Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Thu, 5 Jan 2023 21:39:59 +0100 Subject: [PATCH] Improving settings UI #569 --- src/common/config/private/PrivateConfig.ts | 3 ++ src/common/entities/job/JobDTO.ts | 5 ++- .../app/ui/admin/admin.component.html | 22 +++++++--- src/frontend/app/ui/admin/admin.component.ts | 9 +--- .../settings/template/ISettingsComponent.ts | 2 + .../settings/template/template.component.html | 42 ++++++++++++------- .../settings/template/template.component.ts | 15 +++++++ 7 files changed, 67 insertions(+), 31 deletions(-) diff --git a/src/common/config/private/PrivateConfig.ts b/src/common/config/private/PrivateConfig.ts index 32ad6fee..6e3247f3 100644 --- a/src/common/config/private/PrivateConfig.ts +++ b/src/common/config/private/PrivateConfig.ts @@ -882,6 +882,7 @@ export class ServerMediaConfig extends ClientMediaConfig { @ConfigProperty({ tags: { name: $localize`Video`, + uiIcon: 'video', priority: ConfigPriority.advanced, uiJob: [ { @@ -895,6 +896,7 @@ export class ServerMediaConfig extends ClientMediaConfig { @ConfigProperty({ tags: { name: $localize`Photo`, + uiIcon: 'camera-slr', priority: ConfigPriority.advanced, uiJob: [ { @@ -907,6 +909,7 @@ export class ServerMediaConfig extends ClientMediaConfig { @ConfigProperty({ tags: { name: $localize`Thumbnail`, + uiIcon: 'grid-three-up', priority: ConfigPriority.advanced, uiJob: [{job: DefaultsJobs[DefaultsJobs['Thumbnail Generation']]}] } as TAGS diff --git a/src/common/entities/job/JobDTO.ts b/src/common/entities/job/JobDTO.ts index e2cc54c7..d0e1ff68 100644 --- a/src/common/entities/job/JobDTO.ts +++ b/src/common/entities/job/JobDTO.ts @@ -1,4 +1,4 @@ -import { backendText } from '../../BackendTexts'; +import {backendText} from '../../BackendTexts'; export type fieldType = 'string' | 'number' | 'boolean' | 'number-array'; @@ -29,6 +29,7 @@ export interface JobDTO { export const JobDTOUtils = { getHashName: (jobName: string, config: any = {}) => { - return jobName + '-' + JSON.stringify(config); + const sorted = Object.keys(config).sort().reduce((ret, key) => `${ret},${key}:${JSON.stringify(config[key])}`, ''); + return jobName + '-' + JSON.stringify(sorted); }, }; diff --git a/src/frontend/app/ui/admin/admin.component.html b/src/frontend/app/ui/admin/admin.component.html index f880ae9a..aafcc0d7 100644 --- a/src/frontend/app/ui/admin/admin.component.html +++ b/src/frontend/app/ui/admin/admin.component.html @@ -73,12 +73,21 @@
Menu
- +
+ + +
@@ -90,6 +99,7 @@ #setting #tmpl [ConfigPath]="cp" + [enableNesting]="cp=='Media'" [hidden]="!tmpl.HasAvailableSettings"> diff --git a/src/frontend/app/ui/admin/admin.component.ts b/src/frontend/app/ui/admin/admin.component.ts index a2f214a6..d8e7f236 100644 --- a/src/frontend/app/ui/admin/admin.component.ts +++ b/src/frontend/app/ui/admin/admin.component.ts @@ -4,7 +4,7 @@ import {UserRoles} from '../../../../common/entities/UserDTO'; import {NotificationService} from '../../model/notification.service'; import {NotificationType} from '../../../../common/entities/NotificationDTO'; import {NavigationService} from '../../model/navigation.service'; -import {PageHelper} from '../../model/page.helper'; +import {ViewportScroller} from '@angular/common'; import {SettingsService} from '../settings/settings.service'; import {ConfigPriority} from '../../../../common/config/public/ClientConfig'; import {WebConfig} from '../../../../common/config/private/WebConfig'; @@ -29,6 +29,7 @@ export class AdminComponent implements OnInit, AfterViewInit { constructor( private authService: AuthenticationService, private navigation: NavigationService, + public viewportScroller: ViewportScroller, public notificationService: NotificationService, public settingsService: SettingsService, ) { @@ -42,12 +43,6 @@ export class AdminComponent implements OnInit, AfterViewInit { setTimeout(() => (this.contents = this.settingsComponents.toArray()), 0); } - scrollTo(i: number): void { - PageHelper.ScrollY = - this.settingsComponentsElemRef - .toArray()[i].nativeElement.getBoundingClientRect().top + PageHelper.ScrollY; - } - ngOnInit(): void { if ( !this.authService.isAuthenticated() || diff --git a/src/frontend/app/ui/settings/template/ISettingsComponent.ts b/src/frontend/app/ui/settings/template/ISettingsComponent.ts index bd16d6fe..3771fe67 100644 --- a/src/frontend/app/ui/settings/template/ISettingsComponent.ts +++ b/src/frontend/app/ui/settings/template/ISettingsComponent.ts @@ -2,5 +2,7 @@ export interface ISettingsComponent { HasAvailableSettings: boolean; Name: string; icon: string; + ConfigPath: string; Changed: boolean; + nestedConfigs: { id: string, name: string, visible: () => boolean, icon: string }[]; } diff --git a/src/frontend/app/ui/settings/template/template.component.html b/src/frontend/app/ui/settings/template/template.component.html index 86022286..3e553d00 100644 --- a/src/frontend/app/ui/settings/template/template.component.html +++ b/src/frontend/app/ui/settings/template/template.component.html @@ -1,4 +1,4 @@ -
+
{{Name}} @@ -24,7 +24,7 @@ @@ -32,7 +32,7 @@ *ngIf="states.value.enabled === false"> {{Name}} config is not supported with these settings.
-
+
-