Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Feature/add sliders to customize x-ray rules (#3922)

vitalymatyushik662bfb647e2a
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 021aaa9fbc..47ebfb7dcb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improved the backgrounds of the chart of the holdings tab on the home page (experimental)
- Improved the labels of the chart of the holdings tab on the home page (experimental)
+- Improved the usability to customize the rule thresholds in the _X-ray_ section by introducing sliders (experimental)
- Refactored the rule thresholds in the _X-ray_ section (experimental)
- Exposed the timeout of the portfolio snapshot computation as an environment variable (`PROCESSOR_PORTFOLIO_SNAPSHOT_COMPUTATION_TIMEOUT`)
- Harmonized the processor concurrency environment variables
diff --git a/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.component.ts b/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.component.ts
index 0dd23ab16f..7aa228776c 100644
--- a/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.component.ts
+++ b/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.component.ts
@@ -9,8 +9,7 @@ import {
MatDialogModule,
MatDialogRef
} from '@angular/material/dialog';
-import { MatFormFieldModule } from '@angular/material/form-field';
-import { MatInputModule } from '@angular/material/input';
+import { MatSliderModule } from '@angular/material/slider';
import { IRuleSettingsDialogParams } from './interfaces/interfaces';
@@ -20,8 +19,7 @@ import { IRuleSettingsDialogParams } from './interfaces/interfaces';
FormsModule,
MatButtonModule,
MatDialogModule,
- MatFormFieldModule,
- MatInputModule
+ MatSliderModule
],
selector: 'gf-rule-settings-dialog',
standalone: true,
diff --git a/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.html b/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.html
index 0c2477b63e..3ae5234e94 100644
--- a/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.html
+++ b/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.html
@@ -1,32 +1,46 @@
<div mat-dialog-title>{{ data.rule.name }}</div>
<div class="py-3" mat-dialog-content>
- <mat-form-field
- appearance="outline"
+ <div
class="w-100"
[ngClass]="{ 'd-none': !data.rule.configuration.thresholdMin }"
>
- <mat-label i18n>Threshold Min</mat-label>
- <input
- matInput
+ <h6 class="mb-0">
+ <ng-container i18n>Threshold Min</ng-container> ({{
+ data.settings.thresholdMin?.toFixed(2)
+ }})
+ </h6>
+ <label>{{ data.rule.configuration.threshold.min.toFixed(2) }}</label>
+ <mat-slider
name="thresholdMin"
- type="number"
- [(ngModel)]="data.settings.thresholdMin"
- />
- </mat-form-field>
- <mat-form-field
- appearance="outline"
+ [max]="data.rule.configuration.threshold.max"
+ [min]="data.rule.configuration.threshold.min"
+ [step]="data.rule.configuration.threshold.step"
+ >
+ <input matSliderThumb [(ngModel)]="data.settings.thresholdMin" />
+ </mat-slider>
+ <label>{{ data.rule.configuration.threshold.max.toFixed(2) }}</label>
+ </div>
+ <div
class="w-100"
[ngClass]="{ 'd-none': !data.rule.configuration.thresholdMax }"
>
- <mat-label i18n>Threshold Max</mat-label>
- <input
- matInput
+ <h6 class="mb-0">
+ <ng-container i18n>Threshold Max</ng-container> ({{
+ data.settings.thresholdMax?.toFixed(2)
+ }})
+ </h6>
+ <label>{{ data.rule.configuration.threshold.min.toFixed(2) }}</label>
+ <mat-slider
name="thresholdMax"
- type="number"
- [(ngModel)]="data.settings.thresholdMax"
- />
- </mat-form-field>
+ [max]="data.rule.configuration.threshold.max"
+ [min]="data.rule.configuration.threshold.min"
+ [step]="data.rule.configuration.threshold.step"
+ >
+ <input matSliderThumb [(ngModel)]="data.settings.thresholdMax" />
+ </mat-slider>
+ <label>{{ data.rule.configuration.threshold.max.toFixed(2) }}</label>
+ </div>
</div>
<div align="end" mat-dialog-actions>