Skip to content
This repository has been archived by the owner on Mar 29, 2024. It is now read-only.

Commit

Permalink
Allow settings to be changed even when locked and unlock automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
ppacher committed Feb 2, 2022
1 parent eda50a1 commit 7fd33fd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class ConfigSettingsViewComponent implements OnInit, OnDestroy, AfterView
this._userSettingsMarker = coerceBooleanProperty(v);
}
get userSettingsMarker() { return this._userSettingsMarker }
private _userSettingsMarker = false;
private _userSettingsMarker = true;

@Input()
set searchTerm(v: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ <h3 [innerHTML]="setting?.Name | safe:'html'" class="mb-0 name"></h3>


<!-- Quick Settings -->
<div *ngIf="quickSettings.length > 0">
<div *ngIf="quickSettings.length > 0 && !disabled">
<app-menu-trigger [menu]="quickSettingsMenu" useContent="true" class="text-secondary hover:text-primary">
<svg xmlns="http://www.w3.org/2000/svg" class="inline-block w-4 h-4" fill="none" viewBox="0 0 24 24"
stroke="currentColor">
Expand All @@ -84,15 +84,15 @@ <h3 [innerHTML]="setting?.Name | safe:'html'" class="mb-0 name"></h3>
<!-- Actual settings input -->
<ng-container [ngSwitch]="externalOptType(setting)">
<!-- Security Level Switches -->
<app-security-setting *ngSwitchCase="optionHint.SecurityLevel" [disabled]="disabled || isLocked"
<app-security-setting *ngSwitchCase="optionHint.SecurityLevel" [disabled]="disabled"
class="w-full mt-2 xl:mt-0 xl:w-auto" [onOffMode]="!(networkRatingEnabled$ | async)" [autoFocus]="!isLocked"
[setting]="_setting" [ngModel]="_currentValue" (ngModelChange)="updateValue($event, true)">
</app-security-setting>

<!-- Rule lists -->
<ng-container *ngSwitchCase="optionHint.EndpointList">
<app-rule-list class="w-full mt-4" [readonly]="disabled || isLocked" [ngModel]="_currentValue"
[autoFocus]="!isLocked" (ngModelChange)="updateValue($event, true)"></app-rule-list>
<app-rule-list class="w-full mt-4" [readonly]="disabled" [ngModel]="_currentValue" [autoFocus]="!isLocked"
(ngModelChange)="updateValue($event, true)"></app-rule-list>

<div class="stacked-values" *ngIf="showStackable">
<h4>This setting stacks on top of the following <a class="underline text-tertiary hover:text-primary"
Expand All @@ -111,7 +111,7 @@ <h4>This setting stacks on top of the following <a class="underline text-tertiar
<!-- Ordered string lists -->
<ng-container *ngSwitchCase="optionHint.OrderedList">
<app-ordered-list class="w-full mt-4" [ngModel]="_currentValue" [autoFocus]="!isLocked"
(ngModelChange)="updateValue($event, true)" [readonly]="disabled || isLocked"></app-ordered-list>
(ngModelChange)="updateValue($event, true)" [readonly]="disabled"></app-ordered-list>

<div class="stacked-values" *ngIf="showStackable">
<h4>This setting stacks on top of the following <a class="underline text-tertiary hover:text-primary"
Expand All @@ -125,7 +125,7 @@ <h4>This setting stacks on top of the following <a class="underline text-tertiar
<!-- basic string array with fixed order on optional stacking -->
<ng-container *ngIf="setting?.OptType == optionType.StringArray; else: basicSetting">
<app-ordered-list class="w-full mt-4" fixedOrder="true" [autoFocus]="!isLocked" [ngModel]="_currentValue"
(ngModelChange)="updateValue($event, true)" [readonly]="disabled || isLocked">
(ngModelChange)="updateValue($event, true)" [readonly]="disabled">
</app-ordered-list>

<div class="stacked-values" *ngIf="showStackable">
Expand All @@ -138,9 +138,8 @@ <h4>This setting stacks on top of the following <a class="underline text-tertiar

<ng-template #basicSetting>
<!-- basic inputs -->
<app-basic-setting class="block" [setting]="_setting" [disabled]="disabled || isLocked"
[ngModel]="_currentValue" [autoFocus]="!isLocked" (ngModelChange)="updateValue($event)"
(onBlur)="updateValue(_currentValue!, true)">
<app-basic-setting class="block" [setting]="_setting" [disabled]="disabled" [ngModel]="_currentValue"
[autoFocus]="!isLocked" (ngModelChange)="updateValue($event)" (onBlur)="updateValue(_currentValue!, true)">
</app-basic-setting>
</ng-template>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ export class GenericSettingComponent<S extends BaseSetting<any, any>> implements
* @param qs The quick-settting to apply
*/
applyQuickSetting(qs: QuickSetting<SettingValueType<S>>) {
if (this.disabled || this.isLocked) {
if (this.disabled) {
return;
}

Expand Down

0 comments on commit 7fd33fd

Please sign in to comment.