Skip to content

Commit

Permalink
Merge pull request #142 from amosproj/main
Browse files Browse the repository at this point in the history
Sprint 11: Merging main branch into release branch.
  • Loading branch information
ScoutAtlas authored Jun 30, 2021
2 parents 9eee6df + 1fba93c commit 5157017
Show file tree
Hide file tree
Showing 46 changed files with 1,127 additions and 273 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/Reactjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ on:

jobs:
buildAndTest:
name: Build and Test Frontend
runs-on: ubuntu-latest
name: Build and Test Frontend on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
defaults:
run:
working-directory: ./frontend
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@ node_modules
.idea
/.vs/slnx.sqlite-journal
.vs/slnx.sqlite
obj/Debug/netcoreapp5.0/amos-ss2021-carbon-footprint.csproj.AssemblyReference.cache

frontend/yarn.lock
.vs/slnx.sqlite
.vs/amos-ss2021-carbon-footprint/v16/.suo
.vs/slnx.sqlite
.vs/slnx.sqlite
Binary file modified .vs/slnx.sqlite
Binary file not shown.
42 changes: 42 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/backend/Backend/Backend.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/backend/Backend/Backend.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/backend/Backend/Backend.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
}
2 changes: 1 addition & 1 deletion backend/Backend/Backend.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<ItemGroup>
<PackageReference Include="AspNetCore.Proxy" Version="4.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.4" />
</ItemGroup>

<ItemGroup>
Expand Down
14 changes: 13 additions & 1 deletion backend/Backend/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,19 @@ public Startup(IConfiguration configuration)

public IConfiguration Configuration { get; }

readonly string MyAllowSpecificOrigins = "_myAllowSpecificOrigins";

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddCors(options =>
{
options.AddPolicy(name: MyAllowSpecificOrigins,
builder => {
builder.WithOrigins("http://localhost:3000").AllowAnyHeader();

});
});
services.AddControllers();
services.AddSwaggerGen(c =>
{
Expand Down Expand Up @@ -76,11 +85,14 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)

app.UseRouting();

app.UseCors();

app.UseAuthorization();

app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapControllers()
.RequireCors(MyAllowSpecificOrigins);
});
}

Expand Down
Binary file not shown.
Binary file added deliverables/2021-06-30 Kanban Board.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
123 changes: 123 additions & 0 deletions docs/drawing.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions frontend/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,9 @@ module.exports = {
// Whether to use watchman for file crawling
// watchman: true,
};
module.exports = {
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|css|png|less|scss)$':
'identity-obj-proxy'
}
};
12 changes: 10 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,25 @@
"dependencies": {
"@material-ui/core": "^4.11.4",
"@react-pdf/renderer": "^2.0.12",
"apexcharts": "^3.26.1",
"@reduxjs/toolkit": "^1.6.0",
"apexcharts": "^3.27.1",
"axios": "^0.21.1",
"cors": "^2.8.5",
"html2canvas": "^1.0.0-rc.7",
"jspdf": "^2.3.1",
"jspdf-autotable": "^3.5.14",
"prop-types": "^15.7.2",
"react": "^16.13.1",
"react-alice-carousel": "^2.5.1",
"react-apexcharts": "^1.3.9",
"react-burger-menu": "^2.6.13",
"react-collapsible": "^2.8.3",
"react-collapsible-content": "^1.0.0",
"react-dom": "^16.8.6",
"react-grid-system": "^7.1.2",
"react-hook-form": "^7.4.2",
"react-jss": "^10.6.0",
"react-redux": "^7.2.4",
"react-router-dom": "^5.2.0",
"react-scripts": "^4.0.3",
"react-select": "^4.3.0",
Expand Down Expand Up @@ -54,8 +58,12 @@
"devDependencies": {
"@testing-library/jest-dom": "^5.12.0",
"@testing-library/react": "^11.2.7",
"gh-pages": "^2.2.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.6",
"gh-pages": "^3.2.3",
"identity-obj-proxy": "^3.0.0",
"jest": "26.6.0",
"jest-transform-stub": "^2.0.0",
"prettier": "2.3.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ function UnresolvedTicketsComponent({ containerStyles }) {
title='Unresolved tickets'
link='View details'
subtitle='Group:'

subtitleTwo='Support'
items={[
renderStat('Waiting on Feature Request', 4238),
renderStat('Awaiting Customer Response', 1005),
renderStat('Awaiting Developer Fix', 914),
renderStat('Pending', 281),
renderStat('Waiting on Feature Request', 4238),
renderStat('Awaiting Customer Response', 1005),
renderStat('Awaiting Developer Fix', 914),
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/components/details/ColumnChartComponent.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import React from 'react';
import { React } from 'react';
import ReactApexChart from 'react-apexcharts';
import { getImpactAssessmentData, getLifeCycleStages } from 'interface/projectInterface';
import { getColumnChartData, getLifeCycleStages } from 'interface/projectInterface';

/**
* Column Chart
*
* @author Julian Oelhaf
* Recieves the data from projectInterface.js using "getColumnChartData()"
* populates the data ito the column chart in Details Page.
*/
const ColumnChartComponent = () => {
const values = getColumnChartData();
const series = [
{
name: 'Global warming in kg CO2 equivalents',
// TODO: this data needs to be recieved from backend
data: getImpactAssessmentData()
data: values
}
];

Expand Down Expand Up @@ -68,7 +68,7 @@ const ColumnChartComponent = () => {
},
responsive: [
{
breakpoint: 300,
breakpoint: 6400,
options: {
chart: {
width: 500
Expand Down
24 changes: 19 additions & 5 deletions frontend/src/components/details/DetailsComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import { jsPDF } from 'jspdf';
import html2canvas from 'html2canvas';
import { Col, Container, Row } from 'react-grid-system';
import './navbar.css';
// import { postCalculationRequest } from 'interface/BackendConnect';

import { postCalculationRequest } from 'interface/BackendConnect';
import LoadingComponent from 'components/loading';
/**
* the main component for detail page which includes
* canvas page and variable drop down list
*
* @param props the recently selected model of a product.
*/

class DetailsComponent extends Component {
/* State consists of three variable one for each of the possible state
* baselineScenario: only display the baseline scenario
Expand All @@ -22,7 +23,8 @@ class DetailsComponent extends Component {
state = {
baselineScenario: true,
modifiedScenario: false,
loadComparePage: false
loadComparePage: false,
stillLoading: true
};

render() {
Expand Down Expand Up @@ -82,17 +84,29 @@ class DetailsComponent extends Component {
pdf.save('invoice.pdf');
});
};

/*
* Important function that is given as the callback parameter to the postCalculationRequest in order to be called
* when the data processing is finished. Then the state stillLoading will be set to false.
* This change of state trigger the DetailsComponent to rerender and now display the charts and tables
* instead of the LoadingComponent.
*/
let handleFinishedDataRequest = () => {
this.setState({ stillLoading: false });
};
const scenarioNames = {
baseline: 'Baseline Scenario',
modified: 'Modified Scenario'
};
const { selectedProduct } = this.props;

// postCalculationRequest(selectedProduct.productID);
if (this.state.stillLoading) {
postCalculationRequest(selectedProduct.productID, handleFinishedDataRequest);
return <LoadingComponent loading />;
}

if (this.state.baselineScenario) {
// if state equals baseline scenario only
console.log(selectedProduct);
return (
<Container className='ScenarioContainer' id='capture' fluid>
<Row>
Expand Down
Loading

0 comments on commit 5157017

Please sign in to comment.