Skip to content
This repository has been archived by the owner on May 6, 2021. It is now read-only.

Commit

Permalink
Merge pull request #174 from JD2455/fix/issue-173
Browse files Browse the repository at this point in the history
Fix link to UpGrade experiment does not load experiment dashboard
  • Loading branch information
JD2455 authored Dec 31, 2020
2 parents ec30438 + 17fccfe commit 1738989
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const selectSelectedExperiment = createSelector(
({ state: { params } }, experimentState) => {
return experimentState.stats[params.experimentId]
? ({ ...experimentState.entities[params.experimentId], stat: experimentState.stats[params.experimentId] })
: undefined;
: ({ ...experimentState.entities[params.experimentId], stat: null });
}
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// TODO: Make a common style with new experiment modal
.flag-stepper {
::ng-deep .mat-horizontal-stepper-header-container {
display: flex;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,36 @@
<div class="condition-table-container">
<span class="ft-24-700">{{ 'home.view-experiment.enrollments-by-condition.title.text' | translate }}</span>
<div class="data">
<div class="enrollment-condition-table-container">
<app-table-row
[dataSource]="experimentData"
[displayedColumns]="displayedColumns"
[referenceId]="'condition'"
[experiment]="experiment"
>
</app-table-row>
</div>

<div class="enrollment-statistic">
<div class="enrollment-statistic__unique">
<span class="ft-14-600 title">
{{ 'home.view-experiment.global.users-excluded.text' | translate }}
</span>
<span class="ft-30-700 numbers">{{ experiment.stat.usersExcluded || 0 }}</span>
<div class="spinner" *ngIf="isStatLoading; else conditionTableTemplate">
<mat-spinner
diameter="60"
></mat-spinner>
</div>
<ng-template #conditionTableTemplate>
<div class="data">
<div class="enrollment-condition-table-container">
<app-table-row
[dataSource]="experimentData"
[displayedColumns]="displayedColumns"
[referenceId]="'condition'"
[experiment]="experiment"
>
</app-table-row>
</div>
<div class="enrollment-statistic__class" *ngIf="experiment.assignmentUnit === AssignmentUnit.GROUP">
<span class="ft-14-600 title">
{{ 'home.view-experiment.global.group-excluded.text' | translate }}
</span>
<span class="ft-30-700 numbers">{{ experiment.stat.groupsExcluded || 0}}</span>

<div class="enrollment-statistic">
<div class="enrollment-statistic__unique">
<span class="ft-14-600 title">
{{ 'home.view-experiment.global.users-excluded.text' | translate }}
</span>
<span class="ft-30-700 numbers">{{ experiment.stat?.usersExcluded || 0 }}</span>
</div>
<div class="enrollment-statistic__class" *ngIf="experiment.assignmentUnit === AssignmentUnit.GROUP">
<span class="ft-14-600 title">
{{ 'home.view-experiment.global.group-excluded.text' | translate }}
</span>
<span class="ft-30-700 numbers">{{ experiment.stat?.groupsExcluded || 0}}</span>
</div>
</div>
</div>
</div>
</ng-template>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
flex-direction: column;
padding: 0 34px 14px 34px;
width: 100%;
min-height: 150px;

.spinner {
display: flex;
position: absolute;
align-items: center;
justify-content: center;
width: 100%;
height: 150px;
}

.data {
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export class EnrollmentConditionTableComponent implements OnChanges, OnInit {
'userEnrolled',
];
displayedColumns: string[] = [];
isStatLoading = true;

constructor(private experimentService: ExperimentService) {}

Expand All @@ -27,17 +28,13 @@ export class EnrollmentConditionTableComponent implements OnChanges, OnInit {
} else {
this.displayedColumns = [...this.commonColumns, 'groupEnrolled'];
}
if (changes.experiment) {
// TODO: Remove
this.experimentService.experimentStatById$(this.experiment.id).subscribe(stat => {
});
}
}

ngOnInit() {
this.experimentService.experimentStatById$(this.experiment.id).subscribe(stat => {
this.experimentData = [];
if (stat && stat.conditions) {
this.isStatLoading = false;
stat.conditions.forEach(condition => {

const conditionObj: EnrollmentByConditionOrPartitionData = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ export class ViewExperimentComponent implements OnInit, OnDestroy {
if (!this.experiment) {
this.experimentService.fetchExperimentDetailStat(experiment.id);
}
this.experiment = experiment;
// By refreshing page if we would have experimentId then only assign it's value
if (experiment.id) {
this.experiment = experiment;
}
});
}

Expand Down

0 comments on commit 1738989

Please sign in to comment.