Skip to content
This repository has been archived by the owner on Jul 1, 2020. It is now read-only.

Commit

Permalink
Merge pull request #21 from RedRoundRobin/develop
Browse files Browse the repository at this point in the history
Baseline 0.13
  • Loading branch information
Maxelweb authored Apr 4, 2020
2 parents 62c07f4 + 7841e0e commit 8ca2534
Show file tree
Hide file tree
Showing 39 changed files with 2,138 additions and 342 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ APP_KEY=base64:Kx0bZ0S6BUK05v9vam8ty+7Zsigqlp/Wqf+cbLCyOEM=
APP_DEBUG=true
APP_URL=http://localhost

API_URL=http://core.redroundrobin.site:9999

LOG_CHANNEL=stack

BROADCAST_DRIVER=log
Expand Down
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/backend---bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Backend - Bug report
about: Bug trovato che va corretto nel Backend
title: "[BACKEND] "
labels: bug
assignees: BroHPotato

---

**Descrizione del bug**
Descrivi il problema

**Modifica da fare**
Come va modificato
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/frontend---bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Frontend - Bug report
about: Bug trovato che va corretto nel Frontend
title: "[FRONTEND] "
labels: bug
assignees: aletomm, giovd8, Maxelweb

---

**Descrizione del bug**
Descrivi il problema

**Modifica da fare**
Come va modificato

**Tipo di browser**
DESKTOP / MOBILE
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,21 @@

# Web application - ThiReMa

:fire: Versione componente: `v0.0.1-dev`
:fire: Versione componente: `v0.1.0-dev`

:pushpin: Main repo: [swe-thirema](https://github.com/Maxelweb/swe-thirema)
:pushpin: Main repo: [swe-thirema](https://github.com/RedRoundRobin/swe-thirema)

---

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=RedRoundRobin_swe-webapp&metric=alert_status)](https://sonarcloud.io/dashboard?id=RedRoundRobin_swe-webapp)

![SWE Web App CI](https://github.com/RedRoundRobin/swe-webapp/workflows/SWE%20Web%20App%20CI/badge.svg)

![Repository Checker](https://github.com/RedRoundRobin/swe-webapp/workflows/Repository%20Checker/badge.svg)

[![Coverage Status](https://coveralls.io/repos/github/RedRoundRobin/swe-webapp/badge.svg?branch=develop)](https://coveralls.io/github/RedRoundRobin/swe-webapp?branch=develop)


### Installazione e primo avvio

1. composer update
Expand Down
7 changes: 3 additions & 4 deletions __tests__/ChartManagement.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ import ChartManagement from "../resources/js/components/ChartManagement.vue";

describe("ChartManagement", () => {
test("is a Vue instance", () => {
const user = {};
const device = {};
const sensor = { sensorId: 1 };
const deviceId = 1;
const sensorId = 1;
const chart = mount(ChartManagement, {
propsData: { user, device, sensor },
propsData: { deviceId, sensorId },
});
expect(chart.isVueInstance()).toBeTruthy();
});
Expand Down
4 changes: 3 additions & 1 deletion app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ protected function redirectTo()
*/
public function __construct()
{
/*session()->flush();
session_reset();
Auth::logout();*/
$this->middleware('guest')->except('logout');
}

Expand All @@ -59,7 +62,6 @@ public function authenticate(Request $request)
if (Auth::attempt($credentials)) {
// Authentication passed...
return redirect(RouteServiceProvider::DASHBOARD);
;
}
}
public function showTfaForm()
Expand Down
24 changes: 23 additions & 1 deletion app/Http/Controllers/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace App\Http\Controllers;

use App\Providers\DeviceServiceProvider;
use App\Providers\EntityServiceProvider;
use App\Providers\UserServiceProvider;
use Illuminate\Support\Facades\Auth;

class DashboardController extends Controller
Expand All @@ -12,7 +15,26 @@ public function __construct()
}
public function index()
{
$userProvider = new UserServiceProvider();
$entityProvider = new EntityServiceProvider();
$deviceProvider = new DeviceServiceProvider();

$user = Auth::user();
return view('dashboard.index', compact('user'));
$entities = $entityProvider->findAll();//enti presenti
$users = $userProvider->findAll();//utenti registrati
$devices = $deviceProvider->findAll();//dispositivi registrati

$devicesEntity = $deviceProvider->findAllFromEntity($entityProvider->findFromUser($user->getAuthIdentifier()));
$usersEntity = $userProvider->findAllFromEntity($entityProvider->findFromUser($user->getAuthIdentifier()));

$usersActive = array_filter($users, function ($u) {
return !$u->deleted;
});
$usersActiveEntity = array_filter($usersEntity, function ($u) {
return !$u->deleted;
});
return view('dashboard.index', compact([
'user', 'users', 'entities', 'devices', 'devicesEntity', 'usersEntity', 'usersActive', 'usersActiveEntity'
]));
}
}
27 changes: 25 additions & 2 deletions app/Http/Controllers/DeviceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,35 @@ public function __construct()
$this->provider = new DeviceServiceProvider();
}

public function create()
{
$entities = $this->provider->findAll();
return view('devices.create', compact(['entities']));
}

public function edit($device)
{
$device = $this->provider->retrieveById($device);
return view('devices.edit', compact('user'));
}

/**
* Display a listing of the resource.
*
* @return Factory|View
*/
public function index()
{
$devices = $this->provider->findAll();
//$devices = $this->provider->findAll();
///FAKER
$user = new Device();
$arr = array_combine(
array('deviceId', 'name', 'frequency', 'gatewayId'),
array("1", "dev1", 123, 1)
);
$user->fill($arr);
$devices[] = $user;
//TODO remove
return view('devices.index', compact('devices'));
}

Expand All @@ -48,7 +62,16 @@ public function index()
*/
public function show($device)
{
$device = $this->provider->retrieveById($device);
//$device = $this->provider->find($device);
///FAKER
$user = new Device();
$arr = array_combine(
array('deviceId', 'name', 'frequency', 'gatewayId'),
array("1", "dev1", 123, 1)
);
$user->fill($arr);
$device = $user;
//TODO remove
return view('devices.show', compact('device'));
}
}
17 changes: 11 additions & 6 deletions app/Http/Controllers/SensorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ public function __construct()
*
* @return Factory|View
*/
public function index()
public function index($device)
{
$sensors = $this->provider->findAll();
return view('sensors.index', compact('sensors'));
$sensors = $this->provider->findAllFromDevice($device);
return view('sensors.index', compact(['sensors', 'device']));
}

/**
Expand All @@ -38,9 +38,14 @@ public function index()
* @param $sensor
* @return Factory|View
*/
public function show($sensor)
public function show($device, $sensor)
{
$sensor = $this->provider->retrieveById($sensor);
return view('sensors.show', compact('sensor'));
$sensor = $this->provider->find($device, $sensor);
return view('sensors.show', compact(['sensor', 'device']));
}

public function fetch($device, $sensor)
{
return $this->provider->fetch($device, $sensor);
}
}
8 changes: 2 additions & 6 deletions app/Http/Controllers/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,13 @@ public function update()

if (key_exists('tfa', $data)) {
$data['tfa'] = boolval($data['tfa']);
} else {
$data['tfa'] = false;
}
if ($data['telegramName'] != $user->getTelegramName() || is_null($user->getChatId())) {
$data['tfa'] = false;
}

$user->fill($data);
$data = array_diff_assoc($data, $user->getAttributes());
$service = new UserServiceProvider();
$service->update('/user/' . $user->getAuthIdentifier(), $user);
Auth::login($user);
$service->update($user->getAuthIdentifier(), json_encode($data));
return redirect('/settings/edit');
}
}
Loading

0 comments on commit 8ca2534

Please sign in to comment.