Skip to content

Commit

Permalink
Merge pull request #13 from BME-MIT-IET/manualis-atvizsgalas---statik…
Browse files Browse the repository at this point in the history
…us-analizis

Manuális átvizsgálás és SonarCloud Action létrehozása
  • Loading branch information
kolcsong authored May 14, 2024
2 parents ba2f525 + a6b8bad commit fa470a3
Show file tree
Hide file tree
Showing 15 changed files with 72 additions and 46 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Build
on:
push:
branches:
- main
- manualis-atvizsgalas---statikus-analizis
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
4 changes: 1 addition & 3 deletions Frontend/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { BrowserModule } from '@angular/platform-browser';
import { Component, Injector } from '@angular/core';
import { RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router';
import { RouterLink, RouterOutlet } from '@angular/router';
import { ResourceListComponent } from './resource-list/resource-list.component';
import { createCustomElement } from '@angular/elements';
import { PopUpWindowComponent } from './pop-up-window/pop-up-window.component';
Expand Down
6 changes: 2 additions & 4 deletions Frontend/src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { ApplicationConfig } from '@angular/core';
import { ApplicationConfig, importProvidersFrom } from '@angular/core';
import { provideRouter } from '@angular/router';
import { HttpClientJsonpModule, HttpClientModule } from '@angular/common/http';
import { importProvidersFrom } from '@angular/core'
import { provideCharts, withDefaultRegisterables } from 'ng2-charts';

import { routes } from './app.routes';
import { BrowserAnimationsModule, provideAnimations } from '@angular/platform-browser/animations';
import { BrowserModule } from '@angular/platform-browser';
import { provideAnimations } from '@angular/platform-browser/animations';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';

Expand Down
2 changes: 1 addition & 1 deletion Frontend/src/app/chart/chart.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component,ElementRef,Input, ViewChild } from '@angular/core';
import { BaseChartDirective } from 'ng2-charts';
import { ChartData, ChartType, TooltipItem, ChartItem } from 'chart.js';
import { TooltipItem, ChartItem } from 'chart.js';
import { Chart } from 'chart.js/auto';
import { min } from 'rxjs';
import { CommonModule } from '@angular/common';
Expand Down
20 changes: 10 additions & 10 deletions Frontend/src/app/dataset-graph/dataset-graph.component.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Component, QueryList,ViewChildren } from '@angular/core';
import { BaseChartDirective } from 'ng2-charts';
import { DatasetService } from '../dataset.service';
import { CommonModule, NgFor } from '@angular/common';
import { ActivatedRoute, Data, Router, RouterLink, RouterLinkActive } from '@angular/router';
import { CommonModule } from '@angular/common';
import { ActivatedRoute, Router, RouterLink, RouterLinkActive } from '@angular/router';
import { GraphEnum } from '../enums/graphs';
import { ChartComponent } from '../chart/chart.component';
import { MatToolbarModule } from '@angular/material/toolbar';
Expand Down Expand Up @@ -180,17 +180,17 @@ export class DatasetGraphComponent {
next: (dataarray) =>
{
this.chartComponents.forEach(chart => chart.data = [])
for(let i = 0; i < dataarray.length; ++i)
for(const element of dataarray)
{
this.chartComponents[GraphEnum.temperature].data.push({date: dataarray[i].dataObserved, value: dataarray[i].temperature});
this.chartComponents[GraphEnum.humidity].data.push({date: dataarray[i].dataObserved, value: dataarray[i].humidity});
this.chartComponents[GraphEnum.soilmoisture].data.push({date: dataarray[i].dataObserved, value: dataarray[i].soilMoisture});
this.chartComponents[GraphEnum.soiltemp].data.push({date: dataarray[i].dataObserved, value: dataarray[i].soilTemperature});
this.chartComponents[GraphEnum.colevel].data.push({date: dataarray[i].dataObserved, value: dataarray[i].coLevel});
this.chartComponents[GraphEnum.temperature].data.push({date: element.dataObserved, value: element.temperature});
this.chartComponents[GraphEnum.humidity].data.push({date: element.dataObserved, value: element.humidity});
this.chartComponents[GraphEnum.soilmoisture].data.push({date: element.dataObserved, value: element.soilMoisture});
this.chartComponents[GraphEnum.soiltemp].data.push({date: element.dataObserved, value: element.soilTemperature});
this.chartComponents[GraphEnum.colevel].data.push({date: element.dataObserved, value: element.coLevel});
}
for(let i = 0; i < this.chartComponents.length; ++i)
for(const element of this.chartComponents)
{
this.chartComponents[i].chart?.setData(this.chartComponents[i].data);
element.chart?.setData(element.data);
}
},
error: (err)=> {
Expand Down
22 changes: 11 additions & 11 deletions Frontend/src/app/dataset-list/dataset-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ export class DatasetListComponent {
.subscribe({
next: (data) => {
let datasetArray : Dataset[] = [];
for(let i = 0; i < data.length; ++i)
for(const element of data)
{
const dateToConvert : Date = new Date(data[i].dataObserved);
const dateToConvert : Date = new Date(element.dataObserved);
const splitByYMD = dateToConvert.toISOString().split('T');
const splitByHMS = splitByYMD[1].split('.')[0];
const convertedConcetanatedDate = splitByYMD[0] + " " + splitByHMS;
data[i].dataObserved = convertedConcetanatedDate;
datasetArray.push(data[i]);
element.dataObserved = convertedConcetanatedDate;
datasetArray.push(element);
}
this.datasets.data = datasetArray;
this.progressSpinnerDisplayed = false;
Expand Down Expand Up @@ -137,15 +137,15 @@ export class DatasetListComponent {

let csvContent = this.resourceName+" ház adatrekordjai\n";
csvContent += "Megfigyelés dátuma;Hőmérséklet;Páratartalom;CO Szint;Talajnedvesség;Talajhőmérséklet\n"
for(let i = 0; i < this.datasets.data.length; ++i)
for(const element of this.datasets.data)
{
csvContent +=
this.datasets.data[i].dataObserved + ";" +
this.datasets.data[i].temperature + ";" +
this.datasets.data[i].humidity + ";" +
this.datasets.data[i].coLevel + ";"+
this.datasets.data[i].soilMoisture + ";" +
this.datasets.data[i].soilTemperature + "\n";
element.dataObserved + ";" +
element.temperature + ";" +
element.humidity + ";" +
element.coLevel + ";"+
element.soilMoisture + ";" +
element.soilTemperature + "\n";
}
const csvFile = new Blob([ new Uint8Array([0xEF,0xBB,0xBF]),csvContent], {type: "text/csv;charset=utf8"});
const objUrl = URL.createObjectURL(csvFile);
Expand Down
2 changes: 1 addition & 1 deletion Frontend/src/app/dataset.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Dataset } from './models/dataset';
import { BehaviorSubject, catchError, Observable, throwError } from 'rxjs';
import { catchError, Observable, throwError } from 'rxjs';
import { environment } from '../environments/environment';

@Injectable({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { Component, Inject, Input, ViewChild } from '@angular/core';
import { Component, Inject } from '@angular/core';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
import { MatCheckbox, MatCheckboxModule } from '@angular/material/checkbox';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatButtonModule } from '@angular/material/button';
import { CommonModule } from '@angular/common';
import { JsonPipe } from '@angular/common';
import { CommonModule, JsonPipe } from '@angular/common';
import { provideMomentDateAdapter } from '@angular/material-moment-adapter';


Expand Down
3 changes: 1 addition & 2 deletions Frontend/src/app/pop-up-window/pop-up-window.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { CommonModule } from '@angular/common';
import { Component,EventEmitter,Inject,Input,Output, booleanAttribute, numberAttribute } from '@angular/core';
import { PopupType } from '../enums/pouptype';
import { Component,EventEmitter,Inject, Output} from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
import { MatButtonModule } from '@angular/material/button';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CommonModule } from '@angular/common';
import { booleanAttribute, Component, Input } from '@angular/core';
import {ProgressSpinnerMode, MatProgressSpinnerModule} from '@angular/material/progress-spinner';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';

@Component({
selector: 'app-progress-spinner',
Expand Down
3 changes: 1 addition & 2 deletions Frontend/src/app/resource-form/resource-form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { FormControl,ReactiveFormsModule, FormGroup, Validators } from '@angular
import { ResourceService } from '../resource.service';
import { SnackbarComponent } from '../snackbar/snackbar.component';
import { MAT_DIALOG_DATA, MatDialog, MatDialogModule } from '@angular/material/dialog';
import {MatInputModule } from '@angular/material/input';
import { MatInputModule } from '@angular/material/input';
import { MatButtonModule } from '@angular/material/button';
import { MatFormFieldModule } from '@angular/material/form-field';
import { PopUpWindowComponent } from '../pop-up-window/pop-up-window.component';
Expand Down Expand Up @@ -86,7 +86,6 @@ export class ResourceFormComponent {
else this.saveResource();
}

//TODO: recomment
/**
* Saves a new resource with the data from the form.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CommonModule } from '@angular/common';
import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { MatAccordion, MatExpansionModule } from '@angular/material/expansion';
import { MatIconModule } from '@angular/material/icon';
import { RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router';
Expand Down
7 changes: 3 additions & 4 deletions Frontend/src/app/resource-list/resource-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import { RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router';
import { SnackbarComponent } from '../snackbar/snackbar.component';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatIconModule } from '@angular/material/icon';
import { MatIconButton } from '@angular/material/button';
import { MatButtonModule } from '@angular/material/button';
import { MatIconButton, MatButtonModule } from '@angular/material/button';
import { ProgressSpinnerComponent } from '../progress-spinner/progress-spinner.component';
import { animate, state, style, transition, trigger } from '@angular/animations';
import { PopUpWindowComponent } from '../pop-up-window/pop-up-window.component';
Expand Down Expand Up @@ -94,9 +93,9 @@ export class ResourceListComponent implements OnInit{
ngOnInit(){
this.resourceService.getAllResources().subscribe({
next: (data) => {
for(let i : number = 0; i < data.length; ++i)
for(const element of data)
{
this.resources.push(data[i]);
this.resources.push(element);
}
this.progressSpinnerDisplayed = false;
},
Expand Down
4 changes: 2 additions & 2 deletions Frontend/src/app/snackbar/snackbar.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CommonModule } from '@angular/common';
import { booleanAttribute, Component, inject, Input, numberAttribute } from '@angular/core';
import { MatSnackBar, MatSnackBarModule, MatSnackBarLabel } from '@angular/material/snack-bar';
import { booleanAttribute, Component, Input } from '@angular/core';
import { MatSnackBarModule, MatSnackBarLabel } from '@angular/material/snack-bar';

@Component({
selector: 'app-snackbar',
Expand Down
13 changes: 13 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
sonar.projectKey=BME-MIT-IET_iet-hf-2024-lg_iet_lab
sonar.organization=bme-mit-iet-org

# This is the name and version displayed in the SonarCloud UI.
#sonar.projectName=iet-hf-2024-lg_iet_lab
#sonar.projectVersion=1.0


# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
#sonar.sources=.

# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8

0 comments on commit fa470a3

Please sign in to comment.