mirror of
https://github.com/xuthus83/pigallery2.git
synced 2025-01-14 14:43:17 +08:00
Fixing publicUrl settings #264
This commit is contained in:
parent
cb8a2d86a6
commit
90a6c4b6b1
@ -51,7 +51,7 @@ export abstract class SettingsComponentDirective<T extends { [key: string]: any
|
||||
public inProgress = false;
|
||||
public error: string = null;
|
||||
public changed = false;
|
||||
public states: RecursiveState = {} as any;
|
||||
public states: RecursiveState = {} as any;
|
||||
|
||||
|
||||
private subscription: Subscription = null;
|
||||
@ -100,7 +100,7 @@ export abstract class SettingsComponentDirective<T extends { [key: string]: any
|
||||
};
|
||||
addOriginal(this.states);
|
||||
this.ngOnChanges();
|
||||
}
|
||||
};
|
||||
|
||||
settingsSame(newSettings: T, original: T): boolean {
|
||||
if (typeof original !== 'object' || original == null) {
|
||||
@ -133,6 +133,8 @@ export abstract class SettingsComponentDirective<T extends { [key: string]: any
|
||||
onOptionChange = () => {
|
||||
setTimeout(() => {
|
||||
const settingsSame = (state: RecursiveState): boolean => {
|
||||
|
||||
|
||||
if (typeof state === 'undefined') {
|
||||
return true;
|
||||
}
|
||||
@ -142,7 +144,9 @@ export abstract class SettingsComponentDirective<T extends { [key: string]: any
|
||||
if (typeof state.original !== 'undefined') {
|
||||
return state.value === state.original;
|
||||
}
|
||||
|
||||
const keys = Object.keys(state);
|
||||
|
||||
for (const key of keys) {
|
||||
if (settingsSame(state[key]) === false) {
|
||||
return false;
|
||||
@ -154,7 +158,7 @@ export abstract class SettingsComponentDirective<T extends { [key: string]: any
|
||||
|
||||
this.changed = !settingsSame(this.states);
|
||||
}, 0);
|
||||
}
|
||||
};
|
||||
|
||||
ngOnInit(): void {
|
||||
if (!this.authService.isAuthenticated() ||
|
||||
|
@ -63,7 +63,7 @@
|
||||
|
||||
<app-settings-entry
|
||||
name="Page public url"
|
||||
[(ngModel)]="states.publicUrl"
|
||||
[ngModel]="states.publicUrl"
|
||||
(change)="onUrlChanged()"
|
||||
description="If you access the page form local network its good to know the public
|
||||
url for creating sharing link"
|
||||
|
Loading…
x
Reference in New Issue
Block a user