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

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
SavvasJaydipHirapara committed Oct 29, 2020
2 parents f2ba64f + 88ada27 commit f2cdc17
Show file tree
Hide file tree
Showing 45 changed files with 515 additions and 75 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/build-and-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: 'Build and Deploy'
on:
push:
branches:
- 'master'
paths-ignore:
- projects/server/**
- terraform/**
jobs:
bump-version:
name: 'Build and Deploy'
runs-on: ubuntu-latest
if: github.repository_owner == 'CarnegieLearningWeb'
steps:
- uses: 'actions/checkout@v2'
with:
fetch-depth: 0
- uses: actions/setup-node@v1
with:
node-version: 12.x
- uses: phips28/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: npm ci
- run: npm run build:prod
- run: zip -r upgrade-client-v${{ steps.package-version.outputs.current-version}}.zip *
working-directory: dist/abtesting
- run: mv dist/abtesting/upgrade-client-v${{ steps.package-version.outputs.current-version}}.zip .
- name: Generate Release Changelog
uses: Bullrich/[email protected]
id: changelog
env:
REPO: ${{ github.repository }}
- name: Generate Slack Changelog
run: |
echo 'CHANGELOG<<EOF' >> $GITHUB_ENV
git log --color=never --pretty='tformat:%xe2%x80%xa2 `%h` %s (%an)' ${{github.event.before}}..HEAD >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- uses: martinbeentjes/[email protected]
id: package-version
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: upgrade-client-v${{ steps.package-version.outputs.current-version}}.zip
tag: v${{ steps.package-version.outputs.current-version}}
name: Upgrade Client ${{ steps.package-version.outputs.current-version}}
body: ${{ steps.changelog.outputs.changelog }}
commit: master
token: ${{ secrets.GITHUB_TOKEN }}
- name: Success Build Message
uses: aibexhq/[email protected]
with:
token: ${{ secrets.SLACK_TOKEN }}
channel: ${{ secrets.SLACK_BUILD_CHANNEL }}
message: |
*<https://github.com/${{ github.event.repository.full_name }}/releases/tag/v${{ steps.package-version.outputs.current-version }}|UpGrade Client ${{ steps.package-version.outputs.current-version }}> build was successful*
{{ env.CHANGELOG }}
- name: Failure Build Message
uses: aibexhq/[email protected]
if: failure()
with:
token: ${{ secrets.SLACK_TOKEN }}
channel: ${{ secrets.SLACK_BUILD_CHANNEL }}
message: |
${{ secrets.SLACK_FAILURE_PINGS}} *UpGrade Client ${{ steps.package-version.outputs.current-version }}> build FAILURE*
<https://github.com/${{ github.event.repository.full_name }}/actions/runs/${{ github.run_id }}|Click here to view the full log>
{{ env.CHANGELOG }}
- name: Deploy to QA
id: deploy
uses: jakejarvis/[email protected]
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_S3_BUCKET: ${{ secrets.S3_BUCKET }}
SOURCE_DIR: dist/abtesting
- name: Success Deploy Message
uses: aibexhq/[email protected]
with:
token: ${{ secrets.SLACK_TOKEN }}
channel: ${{ secrets.SLACK_DEPLOY_CHANNEL }}
message: |
*<https://github.com/${{ github.event.repository.full_name }}/releases/tag/v${{ steps.package-version.outputs.current-version }}|UpGrade Client ${{ steps.package-version.outputs.current-version }}>* has been deployed to the `dev` environment at https://upgrade.qa-cli.net
{{ env.CHANGELOG }}
- name: Failure Deploy Message
uses: aibexhq/[email protected]
if: failure() && steps.deploy.outcome == 'failure'
with:
token: ${{ secrets.SLACK_TOKEN }}
channel: ${{ secrets.SLACK_DEPLOY_CHANNEL }}
message: |
${{ secrets.SLACK_FAILURE_PINGS}} *<https://github.com/${{ github.event.repository.full_name }}/releases/tag/v${{ steps.package-version.outputs.current-version }}|UpGrade Client ${{ steps.package-version.outputs.current-version }}> deployment FAILURE*
<https://github.com/${{ github.event.repository.full_name }}/actions/runs/${{ github.run_id }}|Click here to view the full log>
{{ env.CHANGELOG }}
20 changes: 0 additions & 20 deletions .github/workflows/version.yaml

This file was deleted.

13 changes: 9 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ab-testing",
"version": "1.0.2",
"version": "1.0.10",
"license": "MIT",
"scripts": {
"ng": "ng",
Expand Down Expand Up @@ -62,9 +62,10 @@
"lodash.groupby": "^4.6.0",
"ng-pick-datetime": "^7.0.0",
"ngx-skeleton-loader": "^2.2.0",
"papaparse": "^5.3.0",
"rxjs": "~6.5.0",
"tslib": "^1.9.0",
"upgrade_types": "1.0.3",
"upgrade_types": "^1.0.4",
"uuid": "^3.3.3",
"zone.js": "~0.9.1"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { EntityState } from '@ngrx/entity';

export enum EntityTypes {
GROUP_ID = 'Group ID',
USER_ID = 'User ID'
PARTICIPANT_ID = 'Participant ID'
}

export interface ExcludeEntity {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ export class ExperimentDataService {
return this.http.post(url, { ...experiment });
}

importExperiment(experiment: Experiment) {
const url = environment.api.importExperiment;
return this.http.post(url, {...experiment});
}

updateExperiment(experiment: Experiment) {
const url = `${environment.api.updateExperiments}/${experiment.id}`;
return this.http.put(url, { ...experiment });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ export class ExperimentService {
);
}

importExperiment(experiment: Experiment) {
this.store$.dispatch(
experimentAction.actionUpsertExperiment({ experiment, actionType: UpsertExperimentType.IMPORT_EXPERIMENT })
);
}

updateExperiment(experiment: ExperimentVM) {
delete experiment.stat;
this.store$.dispatch(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@ import {
} from './experiments.selectors';
import { combineLatest } from 'rxjs';
import { selectCurrentUser } from '../../auth/store/auth.selectors';
import { MatSnackBar } from '@angular/material';

@Injectable()
export class ExperimentEffects {
constructor(
private actions$: Actions,
private store$: Store<AppState>,
private experimentDataService: ExperimentDataService,
private router: Router
private router: Router,
private _snackBar: MatSnackBar
) {}

getPaginatedExperiment$ = createEffect(() =>
Expand Down Expand Up @@ -129,10 +131,11 @@ export class ExperimentEffects {
const experimentMethod =
actionType === UpsertExperimentType.CREATE_NEW_EXPERIMENT
? this.experimentDataService.createNewExperiment(experiment)
: actionType === UpsertExperimentType.IMPORT_EXPERIMENT
? this.experimentDataService.importExperiment(experiment)
: this.experimentDataService.updateExperiment(experiment);
return experimentMethod.pipe(
switchMap((data: Experiment) =>
this.experimentDataService.getAllExperimentsStats([data.id]).pipe(
switchMap((data: Experiment) => this.experimentDataService.getAllExperimentsStats([data.id]).pipe(
switchMap((experimentStat: IExperimentEnrollmentStats) => {
const stats = { ...experimentStats, [data.id]: experimentStat[0] };
const queryIds = data.queries.map(query => query.id);
Expand All @@ -145,7 +148,10 @@ export class ExperimentEffects {
})
)
),
catchError(() => [experimentAction.actionUpsertExperimentFailure()])
catchError((error) => {
this._snackBar.open(error.error.message, null, { duration: 2000 });
return [experimentAction.actionUpsertExperimentFailure()];
})
);
})
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export enum GroupTypes {
export enum NewExperimentDialogEvents {
CLOSE_DIALOG = 'Close Dialog',
SEND_FORM_DATA = 'Send Form Data',
UPDATE_EXPERIMENT = 'Update experiment'
UPDATE_EXPERIMENT = 'Update experiment',
SAVE_DATA = 'Save Data'
}

export enum NewExperimentPaths {
Expand All @@ -70,7 +71,8 @@ export enum DateType {

export enum UpsertExperimentType {
CREATE_NEW_EXPERIMENT = 'Create new experiment',
UPDATE_EXPERIMENT = 'Update experiment'
UPDATE_EXPERIMENT = 'Update experiment',
IMPORT_EXPERIMENT = 'Import experiment'
}

export enum EndExperimentCondition {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class DashboardRootComponent implements OnInit {
iconType: 'toggle_on'
},
{
path: ['/users'],
path: ['/participants'],
text: 'global.experiment-user.title',
iconType: 'supervisor_account'
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const routes: Routes = [
}
},
{
path: 'users',
path: 'participants',
loadChildren: () => import('./experiment-users/experiment-users.module').then(m => m.ExperimentUsersModule),
data: {
title: 'app-header.title.users'
Expand Down Expand Up @@ -59,4 +59,4 @@ const routes: Routes = [
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class DashboardRoutingModule {}
export class DashboardRoutingModule { }
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class ExperimentUsersComponent implements OnInit, OnDestroy {
allExcludedEntitiesSub: Subscription;

excludeEntitiesForm: FormGroup;
entityTypes = [{ value: EntityTypes.USER_ID }, { value: EntityTypes.GROUP_ID }];
entityTypes = [{ value: EntityTypes.PARTICIPANT_ID }, { value: EntityTypes.GROUP_ID }];
groupTypes = [
{ value: GroupTypes.CLASS },
{ value: GroupTypes.DISTRICT },
Expand Down Expand Up @@ -88,7 +88,7 @@ export class ExperimentUsersComponent implements OnInit, OnDestroy {
this.excludeEntitiesForm.get('id').reset();
this.excludeEntitiesForm.get('customGroupName').reset();
switch (entityType) {
case EntityTypes.USER_ID:
case EntityTypes.PARTICIPANT_ID:
this.experimentUserService.excludeUser(id);
break;
case EntityTypes.GROUP_ID:
Expand Down Expand Up @@ -120,8 +120,8 @@ export class ExperimentUsersComponent implements OnInit, OnDestroy {
// For getting custom placeholder
get getIdPlaceholder() {
const { entityType, groupType, customGroupName } = this.excludeEntitiesForm.value;
if (entityType === EntityTypes.USER_ID) {
return 'Enter user ID';
if (entityType === EntityTypes.PARTICIPANT_ID) {
return 'Enter participant ID';
} else {
if (groupType === GroupTypes.OTHER) {
return 'Enter ' + (customGroupName || '') + ' ID';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,14 @@
>
{{ 'global.cancel.text' | translate }}
</button>
<button
*ngIf="experimentInfo"
mat-raised-button
class="modal-btn default-button"
(click)="emitEvent(NewExperimentDialogEvents.SAVE_DATA)"
>
{{ 'global.save.text' | translate }}
</button>
<button
mat-raised-button
class="modal-btn default-button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ export class ExperimentDesignComponent implements OnInit, OnChanges, OnDestroy {
this.emitExperimentDialogEvent.emit({ type: eventType });
break;
case NewExperimentDialogEvents.SEND_FORM_DATA:
case NewExperimentDialogEvents.SAVE_DATA:
this.validateConditionCodes(this.experimentDesignForm.get('conditions').value);
if (!this.partitionPointErrors.length && this.experimentDesignForm.valid && !this.conditionCodeError) {
const experimentDesignFormData = this.experimentDesignForm.value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,28 @@
<mat-icon matSuffix>search</mat-icon>
</mat-form-field>
</div>
<button
mat-flat-button
color="primary"
class="ft-14-700"
(click)="openNewExperimentDialog()"
*ngIf="(permissions$ | async)?.experiments.create"
>
<mat-icon>add</mat-icon>
<span>{{ 'home.experiment.add-experiment.text' | translate }}</span>
</button>
<div>
<button
(click)="openImportExperimentDialog()"
mat-flat-button
color="primary"
class="ft-14-700 import-experiment"
*ngIf="(permissions$ | async)?.experiments.create"
>
<mat-icon>add</mat-icon>
<span>{{ 'home.experiment.import-experiment.text' | translate }}</span>
</button>
<button
mat-flat-button
color="primary"
class="ft-14-700"
(click)="openNewExperimentDialog()"
*ngIf="(permissions$ | async)?.experiments.create"
>
<mat-icon>add</mat-icon>
<span>{{ 'home.experiment.add-experiment.text' | translate }}</span>
</button>
</div>
</div>

<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ $experiment-state-light-color: #8f9bb3;
height: 40px;
color: var(--white);
}

.import-experiment{
margin-right: 20px;
}
}

::ng-deep .mat-form-field-suffix {
Expand Down
Loading

0 comments on commit f2cdc17

Please sign in to comment.