Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pravinba9495 committed Apr 27, 2020
0 parents commit d685f83
Show file tree
Hide file tree
Showing 96 changed files with 17,567 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2


# Setup Node
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '12.x'

# Install Dependencies
- name: Install Dependencies
run: npm install

# Build
- name: Build
run: npm run build
48 changes: 48 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out

# dependencies
/node_modules

# profiling files
chrome-profiler-events*.json
speed-measure-plugin*.json

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings

# System Files
.DS_Store
Thumbs.db

**/.firebase
Empty file added README.md
Empty file.
110 changes: 110 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"axon": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss",
"skipTests": true
},
"@schematics/angular:class": {
"skipTests": true
},
"@schematics/angular:directive": {
"skipTests": true
},
"@schematics/angular:guard": {
"skipTests": true
},
"@schematics/angular:module": {
"skipTests": true
},
"@schematics/angular:pipe": {
"skipTests": true
},
"@schematics/angular:service": {
"skipTests": true
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/axon",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": true,
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.scss"
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "axon:build"
},
"configurations": {
"production": {
"browserTarget": "axon:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "axon:build"
}
}
}
}
},
"defaultProject": "axon",
"cli": {
"analytics": "df6da515-974d-42e6-89cd-f5660de09dce"
}
}
12 changes: 12 additions & 0 deletions browserslist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# You can see what browsers were selected by your queries by running:
# npx browserslist

> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.
50 changes: 50 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "axon",
"version": "0.1.0",
"description": "Dashboard for delivering neuroscience experiments on the web for the Neurodegenration Research Laboratory at The Neuro (formerly Montreal Neurological Institute)",
"main": "src/main.ts",
"dependencies": {
"@angular/animations": "~9.1.2",
"@angular/cdk": "~9.2.1",
"@angular/common": "~9.1.2",
"@angular/compiler": "~9.1.2",
"@angular/core": "~9.1.2",
"@angular/forms": "~9.1.2",
"@angular/material": "^9.2.1",
"@angular/platform-browser": "~9.1.2",
"@angular/platform-browser-dynamic": "~9.1.2",
"@angular/router": "~9.1.2",
"rxjs": "~6.5.5",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.901.2",
"@angular/cli": "~9.1.2",
"@angular/compiler-cli": "~9.1.2",
"@angular/language-service": "~9.1.2",
"@types/node": "^12.11.1",
"ts-node": "~8.9.0",
"tslint": "~6.1.1",
"typescript": "~3.8.3"
},
"scripts": {
"ng": "ng",
"start": "ng serve -o",
"build": "ng build --prod",
"lint": "ng lint"
},
"repository": {
"type": "git",
"url": "git+https://github.com/cognitive-neuroscience/axon.git"
},
"keywords": [
"neuroscience"
],
"author": "Praveen Ravichandran ([email protected])",
"license": "ISC",
"bugs": {
"url": "https://github.com/cognitive-neuroscience/axon/issues"
},
"homepage": "https://github.com/cognitive-neuroscience/axon#readme"
}
43 changes: 43 additions & 0 deletions src/app/AppHttpInterceptor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import {
HttpErrorResponse,
HttpEvent,
HttpHandler,
HttpInterceptor,
HttpRequest
} from "@angular/common/http";
import { Injectable } from "@angular/core";
import { Router } from "@angular/router";
import { Observable } from "rxjs";
import { tap } from "rxjs/operators";

@Injectable()
export class AppHttpInterceptor implements HttpInterceptor {

constructor(private router: Router) { }

public intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
if (localStorage.getItem('token')) {
request = request.clone({
setHeaders: {
"Content-Type": "application/json",
"Authorization": "Bearer " + localStorage.getItem('token')
},
});
} else {
request = request.clone({
setHeaders: {
"Content-Type": "application/json",
},
});
}
return next.handle(request).pipe(tap((event: HttpEvent<any>) => {
}, (err: any) => {
if (err instanceof HttpErrorResponse) {
if ((err.status === 401) || (err.status === 403)) {
this.router.navigate(["/public/login"]);
localStorage.removeItem('token');
}
}
}));
}
}
44 changes: 44 additions & 0 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { DashboardComponent } from './pages/dashboard/dashboard.component';
import { LoginComponent } from './pages/login/login.component';
import { ColorGameComponent } from './pages/experiments/color-game/color-game.component';
import { ShapeGameComponent } from './pages/experiments/shape-game/shape-game.component';
import { GoNogoComponent } from './pages/experiments/go-nogo/go-nogo.component';
import { DigitSpanComponent } from './pages/experiments/digit-span/digit-span.component';
import { TaskSwitchingComponent } from './pages/experiments/task-switching/task-switching.component';
import { DemandSelectionComponent } from './pages/experiments/demand-selection/demand-selection.component';
import { SimonTaskPrelimComponent } from './pages/experiments/simon-task-prelim/simon-task-prelim.component';
import { SimonTaskFinalComponent } from './pages/experiments/simon-task-final/simon-task-final.component';
import { SmileyFaceComponent } from './pages/experiments/smiley-face/smiley-face.component';
import { FingerTappingTaskComponent } from './pages/experiments/finger-tapping-task/finger-tapping-task.component';
import { NBackComponent } from './pages/experiments/n-back/n-back.component';
import { StroopTaskComponent } from './pages/experiments/stroop-task/stroop-task.component';
import { TrailMakingComponent } from './pages/experiments/trail-making/trail-making.component';


const routes: Routes = [
{ path: '', redirectTo: '/dashboard', pathMatch: 'full' },
{ path: 'dashboard', component: DashboardComponent },
{ path: 'login', component: LoginComponent },
{ path: 'experiments/color-game', component: ColorGameComponent },
{ path: 'experiments/shape-game', component: ShapeGameComponent },
{ path: 'experiments/go-nogo', component: GoNogoComponent },
{ path: 'experiments/digit-span', component: DigitSpanComponent },
{ path: 'experiments/ts', component: TaskSwitchingComponent },
{ path: 'experiments/dst', component: DemandSelectionComponent },
{ path: 'experiments/simon-1', component: SimonTaskPrelimComponent },
{ path: 'experiments/simon-2', component: SimonTaskFinalComponent },
{ path: 'experiments/smiley-face', component: SmileyFaceComponent },
{ path: 'experiments/ftt', component: FingerTappingTaskComponent },
{ path: 'experiments/n-back', component: NBackComponent },
{ path: 'experiments/stroop', component: StroopTaskComponent },
{ path: 'experiments/trail-making', component: TrailMakingComponent },
{ path: '**', redirectTo: '/login', pathMatch: 'full' }
];

@NgModule({
imports: [RouterModule.forRoot(routes, { useHash: true })],
exports: [RouterModule]
})
export class AppRoutingModule { }
17 changes: 17 additions & 0 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';

@Component({
selector: 'app-root',
template: `<router-outlet></router-outlet>`,
styles: []
})
export class AppComponent implements OnInit {

constructor(private router: Router) { }

ngOnInit() {
this.router.navigate(['/dashboard']);
}

}
Loading

0 comments on commit d685f83

Please sign in to comment.