Skip to content

Commit

Permalink
Merge pull request #78 from Northeastern-Electric-Racing/#73-graph
Browse files Browse the repository at this point in the history
#73 Graph MVP
  • Loading branch information
Peyton-McKee authored Dec 17, 2023
2 parents 87dbe4c + 98907b4 commit bd11628
Show file tree
Hide file tree
Showing 67 changed files with 1,241 additions and 111 deletions.
3 changes: 3 additions & 0 deletions angular-client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ yarn-error.log
testem.log
/typings

# Environment variables
**/environment.prod.ts

# System files
.DS_Store
Thumbs.db
6 changes: 3 additions & 3 deletions angular-client/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
"tsConfig": "tsconfig.app.json",
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["@angular/material/prebuilt-themes/deeppurple-amber.css", "src/styles.css"],
"scripts": []
"scripts": ["node_modules/apexcharts/dist/apexcharts.min.js"]
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
Expand Down
149 changes: 146 additions & 3 deletions angular-client/package-lock.json

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

12 changes: 8 additions & 4 deletions angular-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,37 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"start:production": "ng serve --configuration production",
"start:production": "ng serve --configuration production --host 0.0.0.0",
"install-dependencies": "npm install",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular-devkit/build-angular": "^16.2.4",
"@angular/animations": "^16.2.0",
"@angular/cdk": "^16.2.6",
"@angular/cli": "^16.2.4",
"@angular/common": "^16.2.0",
"@angular/compiler": "^16.2.0",
"@angular/compiler-cli": "^16.2.0",
"@angular/core": "^16.2.0",
"@angular/forms": "^16.2.0",
"@angular/material": "^16.2.6",
"@angular/platform-browser": "^16.2.0",
"@angular/platform-browser-dynamic": "^16.2.0",
"@angular/router": "^16.2.0",
"@angular-devkit/build-angular": "^16.2.4",
"@angular/cli": "^16.2.4",
"@angular/compiler-cli": "^16.2.0",
"apexcharts": "^3.44.0",
"ng-apexcharts": "^1.8.0",
"primeng": "^16.7.0",
"rxjs": "~7.8.0",
"socket.io-client": "^4.7.2",
"tslib": "^2.3.0",
"zone.js": "~0.13.0"
},
"devDependencies": {
"@types/jasmine": "~4.3.0",
"@types/node": "^20.10.4",
"jasmine-core": "~4.6.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
Expand Down
5 changes: 5 additions & 0 deletions angular-client/src/api/data.api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { urls } from './urls';

export const getDataByDataTypeName = (dataTypeName: string): Promise<Response> => {
return fetch(urls.getDataByDataTypeName(dataTypeName));
};
2 changes: 1 addition & 1 deletion angular-client/src/api/node.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import { urls } from './urls';
* @returns A promise containing the response from the server
*/
export const getAllNodes = (): Promise<Response> => {
return fetch(urls.getAllNodes);
return fetch(urls.getAllNodes());
};
18 changes: 18 additions & 0 deletions angular-client/src/api/run.api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { urls } from './urls';

/**
* Fetches all runs from the server
* @returns A promise containing the response from the server
*/
export const getAllRuns = (): Promise<Response> => {
return fetch(urls.getAllRuns());
};

/**
* Fetches the run with the given id
* @param id The id of the run to request
* @returns The requested run
*/
export const getRunById = (id: number): Promise<Response> => {
return fetch(urls.getRunById(id));
};
23 changes: 19 additions & 4 deletions angular-client/src/api/urls.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
const baseURL = 'http://localhost:8000';
import { environment } from 'src/environment/environment';

const baseURL = environment.url;

/* Nodes */
const getAllNodes = `${baseURL}/nodes`;
const getAllNodes = () => `${baseURL}/nodes`;

/* Systems */
const getAllSystems = `${baseURL}/systems`;
const getAllSystems = () => `${baseURL}/systems`;

/* Data */
const getDataByDataTypeName = (dataTypeName: string) => `${baseURL}/data/${dataTypeName}`;

/* Runs */
const getRunById = (id: number) => `${baseURL}/runs/${id}`;
const getAllRuns = () => `${baseURL}/runs`;

export const urls = {
getAllNodes,
getAllSystems

getAllSystems,

getDataByDataTypeName,

getAllRuns,
getRunById
};
8 changes: 7 additions & 1 deletion angular-client/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import GraphPage from 'src/pages/graph-page/graph-page.component';
import LandingPage from 'src/pages/landing-page/landing-page.component';

const routes: Routes = [];
const routes: Routes = [
{ path: 'landing', component: LandingPage },
{ path: 'graph/:realTime/:runId', component: GraphPage },
{ path: '', redirectTo: '/landing', pathMatch: 'full' }
];

@NgModule({
imports: [RouterModule.forRoot(routes)],
Expand Down
Loading

0 comments on commit bd11628

Please sign in to comment.