Skip to content
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

correct a funky observable input #1707

Merged
merged 2 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[primaryActionBtnDisabled] instead?

(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'));
Copy link
Collaborator

@Yagnik56 Yagnik56 Jun 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has messed up something, isDeleteActionBtnDisabled is always false and I can delete the feature flag without typing anything.


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
Loading