-
Notifications
You must be signed in to change notification settings - Fork 15
add edit-condition-weights modal #2646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bcb37
merged 6 commits into
experiment-design-refresh
from
feature/2628-edit-condition-weights-modal
Sep 17, 2025
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4238a9f
add edit-condition-weights modal
bcb37 f5e5443
Update frontend/projects/upgrade/src/app/features/dashboard/experimen…
bcb37 f1be157
remove inaccurate comment
bcb37 fa0ec28
tighten css
bcb37 c164dfb
changes to get closer to the spec
bcb37 767c36c
remove unneeded things
bcb37 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
122 changes: 122 additions & 0 deletions
122
...periments/modals/edit-condition-weights-modal/edit-condition-weights-modal.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| <app-common-dialog | ||
| [title]="config.title" | ||
| [cancelBtnLabel]="config.cancelBtnLabel" | ||
| [primaryActionBtnLabel]="config.primaryActionBtnLabel" | ||
| [primaryActionBtnColor]="config.primaryActionBtnColor" | ||
| [primaryActionBtnDisabled]="isPrimaryButtonDisabled$ | async" | ||
| (primaryActionBtnClicked)="onPrimaryActionBtnClicked()" | ||
| > | ||
| <form [formGroup]="conditionWeightForm" class="form-standard dense-3"> | ||
| <div class="weight-method-section dense-1"> | ||
| <mat-radio-group formControlName="weightingMethod"> | ||
| <span class="section-label ft-14-600">{{ 'experiments.edit-condition-weights-modal.method-header.text' | translate }}</span> | ||
| <mat-radio-button | ||
| *ngFor="let method of weightingMethods" | ||
| [value]="method.value" | ||
| [disabled]="method.disabled" | ||
| > | ||
| <div class="radio-content"> | ||
| <span | ||
| class="radio-label ft-14-600" | ||
| [class.disabled-text]="method.disabled" | ||
| > | ||
| {{ method.name | titlecase }} | ||
| </span> | ||
| <span | ||
| class="radio-description ft-12-400" | ||
| [class.disabled-text]="method.disabled" | ||
| > | ||
| {{ method.description | translate }} | ||
| </span> | ||
| </div> | ||
| </mat-radio-button> | ||
| </mat-radio-group> | ||
| </div> | ||
|
|
||
| <div class="table-container"> | ||
| <table | ||
| mat-table | ||
| [dataSource]="conditions" | ||
| class="conditions-table" | ||
| [ngClass]="{ 'no-data': !conditions?.length }" | ||
| > | ||
| <!-- Condition Column --> | ||
| <ng-container matColumnDef="condition"> | ||
| <th mat-header-cell *matHeaderCellDef class="condition-column ft-14-600"> | ||
| Condition | ||
| </th> | ||
| <td mat-cell *matCellDef="let condition" class="condition-column ft-14-400"> | ||
| {{ condition.conditionCode }} | ||
| </td> | ||
| <!-- Summary row for condition column --> | ||
| <td mat-footer-cell *matFooterCellDef class="condition-column ft-14-400 summary-row"> | ||
| @if (getTotalWeightStatus()?.totalWeightInvalid) { | ||
| <div class="error-text ft-12-400"> | ||
| {{ 'experiments.edit-condition-weights-modal.weights-sum-validation.text' | translate }} | ||
| </div> | ||
| } | ||
| @if (getTotalWeightStatus()?.max || getTotalWeightStatus()?.min ) { | ||
| <div class="error-text ft-12-400"> | ||
| {{ 'experiments.edit-condition-weights-modal.weights-range-validation.text' | translate }} | ||
| </div> | ||
| } | ||
| @if (getTotalWeightStatus()?.invalidNumber) { | ||
| <div class="error-text ft-12-400"> | ||
| {{ 'experiments.edit-condition-weights-modal.invalid-number-error.text' | translate }} | ||
| </div> | ||
| } | ||
| @if (getTotalWeightStatus()?.tooManyDecimals) { | ||
| <div class="error-text ft-12-400"> | ||
| {{ 'experiments.edit-condition-weights-modal.weights-decimal-validation.text' | translate }} | ||
| </div> | ||
| } | ||
| </td> | ||
| </ng-container> | ||
|
|
||
| <!-- Weight Column --> | ||
| <ng-container matColumnDef="weight"> | ||
| <th mat-header-cell *matHeaderCellDef class="weight-column ft-14-600"> | ||
| Weight (%) | ||
| </th> | ||
| <td mat-cell *matCellDef="let condition; let i = index" class="weight-column ft-14-400"> | ||
| <mat-form-field appearance="outline" class="weight-input"> | ||
| <input | ||
| matInput | ||
| type="number" | ||
| min="0" | ||
| max="100" | ||
| step="0.01" | ||
| [formControl]="getWeightControl(i)" | ||
| (input)="onWeightChange()" | ||
| placeholder="0.00" | ||
| /> | ||
|
|
||
|
|
||
| </mat-form-field> | ||
| </td> | ||
| <!-- Summary row for weight column --> | ||
| <td mat-footer-cell *matFooterCellDef class="weight-column ft-14-600 summary-row"> | ||
| <span class="total-weight"> | ||
| {{ getCurrentTotal() | number:'1.2-2' }} | ||
| </span> | ||
| </td> | ||
| </ng-container> | ||
|
|
||
| <!-- Header and Row Definitions --> | ||
| <tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: true"></tr> | ||
| <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr> | ||
|
|
||
| <!-- Footer Row for Summary --> | ||
| <tr mat-footer-row *matFooterRowDef="displayedColumns" class="summary-footer-row"></tr> | ||
|
|
||
| <!-- No Data Row --> | ||
| <tr *matNoDataRow> | ||
| <td class="ft-14-400" [attr.colspan]="displayedColumns.length"> | ||
| No conditions available | ||
| </td> | ||
| </tr> | ||
| </table> | ||
|
|
||
| </div> | ||
| </form> | ||
| </app-common-dialog> | ||
161 changes: 161 additions & 0 deletions
161
...periments/modals/edit-condition-weights-modal/edit-condition-weights-modal.component.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,161 @@ | ||
| .weight-input { | ||
| width: 90px; | ||
|
|
||
| .mat-mdc-form-field-subscript-wrapper { | ||
| display: none; | ||
| } | ||
| } | ||
|
|
||
| .table-container { | ||
| position: relative; | ||
| overflow: auto; | ||
| width: 100%; | ||
|
|
||
| /* Add gap between header and body when no data exists */ | ||
| ::ng-deep .no-data tbody:before { | ||
| display: block; | ||
| line-height: 8px; | ||
| content: '\200C'; | ||
| } | ||
| .conditions-table { | ||
| /* Remove arrows/spinners from input type number */ | ||
| input[type="number"] { | ||
| -webkit-appearance: textfield; | ||
| -moz-appearance: textfield; | ||
|
|
||
| &::-webkit-outer-spin-button, | ||
| &::-webkit-inner-spin-button { | ||
| -webkit-appearance: none; | ||
| margin: 0; | ||
| } | ||
| } | ||
|
|
||
| ::ng-deep thead { | ||
| background-color: var(--zircon); | ||
|
|
||
| tr.mat-mdc-header-row { | ||
| height: 48px; | ||
| border: 0; | ||
|
|
||
| th { | ||
| padding-left: 0; | ||
| color: var(--darker-grey); | ||
|
|
||
| &:first-child { | ||
| border-top-left-radius: 4px; | ||
| } | ||
|
|
||
| &:last-child { | ||
| border-top-right-radius: 4px; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| ::ng-deep tbody { | ||
| tr.mat-mdc-row { | ||
| height: 56px; | ||
|
|
||
| td { | ||
| min-width: 96px; | ||
| padding-left: 0; | ||
| color: var(--black-2); | ||
| } | ||
| } | ||
|
|
||
| tr.mat-mdc-no-data-row { | ||
| td { | ||
| height: 48px; | ||
| text-align: center; | ||
| border: 1.5px dashed var(--light-grey-2); | ||
| color: var(--dark-grey); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| ::ng-deep tfoot { | ||
| tr.mat-mdc-footer-row.summary-footer-row { | ||
| height: 48px; | ||
| border-top: 2px solid var(--light-grey-2); | ||
| background-color: var(--light-grey-0); | ||
|
|
||
| td.summary-row { | ||
| min-width: 96px; | ||
| padding-left: 0; | ||
| font-weight: 600; | ||
|
|
||
| &.condition-column { | ||
| padding-left: 32px; | ||
| } | ||
|
|
||
| &.weight-column { | ||
| text-align: right; | ||
| padding-right: 32px; | ||
| } | ||
|
|
||
| .total-weight { | ||
| margin: 4px; | ||
| } | ||
|
|
||
| .error-text { | ||
| color: #f44336; | ||
| font-weight: 500; | ||
| } | ||
|
|
||
| } | ||
| } | ||
| } | ||
|
|
||
| .condition-column { | ||
| width: 65%; | ||
| padding-left: 32px; | ||
| } | ||
|
|
||
| .weight-column { | ||
| width: 35%; | ||
| text-align: right; | ||
| padding-right: 32px; | ||
|
|
||
| .weight-input { | ||
| width: 90px; | ||
| flex-direction: row; | ||
|
|
||
| input { | ||
| text-align: right; | ||
| } | ||
|
|
||
|
|
||
| .mat-mdc-form-field-subscript-wrapper { | ||
| display: none; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| .weight-method-section { | ||
| margin-bottom: 6px; | ||
|
|
||
| .section-label { | ||
| display: block; | ||
| } | ||
|
|
||
| mat-radio-group { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 6px; | ||
| } | ||
|
|
||
| .radio-content { | ||
| display: flex; | ||
| flex-direction: column; | ||
|
|
||
| .radio-description { | ||
| color: var(--dark-grey); | ||
| } | ||
| } | ||
|
|
||
| .disabled-text { | ||
| opacity: 0.6; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.