Skip to content

Commit

Permalink
Merge pull request #1707 from CarnegieLearningWeb/feature/fix-weird-o…
Browse files Browse the repository at this point in the history
…bservable-usage-in-common-modal

correct a funky observable input
  • Loading branch information
Yagnik56 authored Jun 28, 2024
2 parents d275892 + 037e36c commit d99d051
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[cancelBtnLabel]="config.cancelBtnLabel"
[primaryActionBtnLabel]="config.primaryActionBtnLabel"
[primaryActionBtnColor]="config.primaryActionBtnColor"
[primaryActionBtnDisabled$]="isLoadingUpsertFeatureFlag$"
[primaryActionBtnDisabled]="isLoadingUpsertFeatureFlag$ | async"
(primaryActionBtnClicked)="onPrimaryActionBtnClicked()"
>
<form [formGroup]="featureFlagForm">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[cancelBtnLabel]="data.cancelBtnLabel"
[primaryActionBtnLabel]="data.primaryActionBtnLabel"
[primaryActionBtnColor]="data.primaryActionBtnColor"
[primaryActionBtnDisabled$]="isDeleteActionBtnDisabled$"
[primaryActionBtnDisabled]="isDeleteActionBtnDisabled$ | async"
(primaryActionBtnClicked)="onPrimaryActionBtnClicked(flag.id)"
>
<div mat-dialog-content class="dialog">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ export class DeleteFeatureFlagModalComponent {
private inputSubject: BehaviorSubject<string> = new BehaviorSubject<string>('');

// Observable that emits true if inputValue is 'delete', false otherwise
isDeleteNotTyped$: Observable<boolean> = this.inputSubject
.asObservable()
.pipe(map((value) => value.toLowerCase() !== 'delete'));
isDeleteNotTyped$: Observable<boolean> = this.inputSubject.pipe(map((value) => value.toLowerCase() !== 'delete'));

isDeleteActionBtnDisabled$: Observable<boolean> = combineLatest([
this.isDeleteNotTyped$,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[cancelBtnLabel]="config.cancelBtnLabel"
[primaryActionBtnLabel]="config.primaryActionBtnLabel"
[primaryActionBtnColor]="config.primaryActionBtnColor"
[primaryActionBtnDisabled$]="isLoadingUpsertFeatureFlag$"
[primaryActionBtnDisabled]="isLoadingUpsertFeatureFlag$ | async"
(primaryActionBtnClicked)="onPrimaryActionBtnClicked()"
>
<form [formGroup]="featureFlagForm">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ import { MatInputModule } from '@angular/material/input';
import { MatSelectModule } from '@angular/material/select';
import { FeatureFlagsService } from '../../../../../core/feature-flags/feature-flags.service';
import { CommonFormHelpersService } from '../../../../../shared/services/common-form-helpers.service';
import { FEATURE_FLAG_STATUS, SEGMENT_TYPE, FILTER_MODE } from '../../../../../../../../../../types/src';
import { AddFeatureFlagRequest, FeatureFlag, FeatureFlagFormData } from '../../../../../core/feature-flags/store/feature-flags.model';
import { FeatureFlag, FeatureFlagFormData } from '../../../../../core/feature-flags/store/feature-flags.model';
import { Subscription } from 'rxjs';
import { TranslateModule } from '@ngx-translate/core';
import { ExperimentService } from '../../../../../core/experiments/experiments.service';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h4 class="header-title">{{ title }}</h4>
class="dialog-action-btn primary-btn"
mat-flat-button
[color]="primaryActionBtnColor"
[disabled]="primaryActionBtnDisabled$ | async"
[disabled]="primaryActionBtnDisabled"
(click)="onPrimaryActionBtnClicked()"
>
{{ primaryActionBtnLabel }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class CommonModalComponent {
@Input() primaryActionBtnLabel = 'Submit';
@Input() primaryActionBtnColor = 'primary';
@Input() hideFooter = false;
@Input() primaryActionBtnDisabled$: Observable<boolean>;
@Input() primaryActionBtnDisabled = false;
@Output() primaryActionBtnClicked = new EventEmitter<string>();

onPrimaryActionBtnClicked() {
Expand Down

0 comments on commit d99d051

Please sign in to comment.