Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: nethsecurity, add hardware_table #107

Merged
merged 16 commits into from
Apr 17, 2024

Conversation

pietrocomelli
Copy link
Contributor

Creation of a model representign hardware data from the database, creation of a controller to manage the logic of operations to be performed on the hardware, creation of a web route associated with the controller, and creation of a view for data representation to users. Finally, a slight modification in the welcome view for adding a link that leads to the hardware web route.

README.md Outdated Show resolved Hide resolved
app/Http/Controllers/HardwareController.php Show resolved Hide resolved
app/Http/Controllers/NethsecurityHardwareController.php Outdated Show resolved Hide resolved
app/Http/Controllers/NethsecurityHardwareController.php Outdated Show resolved Hide resolved
app/Http/Controllers/NethsecurityHardwareController.php Outdated Show resolved Hide resolved
app/Http/Controllers/NethsecurityHardwareController.php Outdated Show resolved Hide resolved
app/Http/Controllers/NethserverHardwareController.php Outdated Show resolved Hide resolved
app/Models/Hardware.php Outdated Show resolved Hide resolved
app/Http/Controllers/NethserverHardwareController.php Outdated Show resolved Hide resolved
app/Http/Controllers/NethsecurityHardwareController.php Outdated Show resolved Hide resolved
routes/web.php Outdated Show resolved Hide resolved
routes/web.php Outdated Show resolved Hide resolved
routes/web.php Outdated Show resolved Hide resolved
public/css/style.css Outdated Show resolved Hide resolved
resources/views/select.blade.php Outdated Show resolved Hide resolved
resources/views/hardware.blade.php Outdated Show resolved Hide resolved
resources/views/hardware.blade.php Outdated Show resolved Hide resolved
app/Http/Controllers/HardwareController.php Outdated Show resolved Hide resolved
routes/web.php Outdated Show resolved Hide resolved
resources/views/select.blade.php Outdated Show resolved Hide resolved
resources/views/select.blade.php Outdated Show resolved Hide resolved
@gsanchietti gsanchietti marked this pull request as ready for review April 16, 2024 15:18
@gsanchietti gsanchietti requested a review from Tbaile April 16, 2024 15:19

class NethserverHardware extends Model
{
use HasFactory;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no factory, these are used when you have to add mock data to the DB, since it's a view, no use of this

Comment on lines 14 to 25
protected $fillable = [
'product_name',
'manufacturer',
'processor',
'vga_controller',
'usb_controller',
'pci_bridge',
'sata_controller',
'communication_controller',
'scsi_controller',
'ethernet',
];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fillable is used when you mass assign a value, not needed here


class NethsecurityHardware extends Model
{
use HasFactory;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no factory, these are used when you have to add mock data to the DB, since it's a view, no use of this

Comment on lines 14 to 25
protected $fillable = [
'product_name',
'manufacturer',
'processor',
'vga_controller',
'usb_controller',
'pci_bridge',
'sata_controller',
'communication_controller',
'scsi_controller',
'ethernet',
];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fillable is used when you mass assign a value, not needed here

routes/web.php Outdated
Comment on lines 27 to 29
Route::get('/select', function() {
return view('select');
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a name to this route, then set the route name in resources/views/welcome.html using route helper

Comment on lines 18 to 22
public function getHardwareType(Request $request){
// Retrieve hardware type from session
$hardwareType = $request->session()->get('hardwareType');
return $hardwareType;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method does not concern the controller part of the application

@@ -40,6 +40,7 @@
<a class="dropdown-item" id="interval_all">
All
</a>
<a href="/select" class="dropdown-item">Search Hardware</a>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Edit the href using the route helper and the name of the route instead of the url


class HardwareController extends Controller
{
public function index(Request $request, SelectController $selectController)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of passing a SelectController (not recommended), after editing the routes/web.php, you can add a string $installation to the parameters, use it to know which system you wanna search the system about (I.E. Nethserver or Nethsecurity)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the changes, this file is not used anymore, you can delete it to simplify even further the changes

@Tbaile Tbaile self-requested a review April 17, 2024 11:02
Creation of a model representign hardware data from the database,
creation of a controller to manage the logic of operations to be
performed on the hardware, creation of a web route associated with
the controller, and creation of a view for data representation to users.
Finally, a slight modification in the welcome view for adding a link that
leads to the hardware web route.
retrieval in the model from table to view, complete modification
of the hardware view, updating of routes based on the change in the
index method.
arrays, one containing all the individual hardware components where
the users-entered string is present and counting all the occurrences
of the string in input, the other groups all similar components and
counts them. Update CSS file to modify the appearance of the view
and finally modify the hardware view to correctly display the
search results.
and NethSecurity and modification of their respective routes on web.php.
Creation of a new view called "select" that displays a choice between
NethServer and NethSecurity for hardware search and addition of the
link in the dropdown of welcome.html.
HardwareController for managing NethServer and NethSecurity hardware,
creating a SelectController that passes the hardware types selected
by the user to the view for hardware search, renaming migration
files in the same way, creating two new CSS files for styling the
hardware and select views, creating a single view for hardware search
and modifying the routes in web.php.
NethserverHardwareController, hardware-nethsecurity.blade.php,
hardware-nethserver.blade.php and create_nethserver_view.php
…oller,

modifying queries in migrations to select only hardware updated in
the last 72 hours, moving CSS styles from hardware.blade.php to
hardware.css, deleting an unused function in select.blade.php,
changing the method of the 'hardware-selection' route from POST to GET.
search in case of empty search and lastly removed CSS styling from
the view hardware.blade.php to the CSS file hardware.css.
text 'NethServer' and 'NethSecurity' in the select.blade.php view.
HardwareController for checking the type of the hardware chosen
by the user.
that identifies the type of hardware the users want to search for
and removed SelectController parameter.
Removed factory and fillable in the models.
Added two new buttons in select.blade.php that link directly
to the hardware search page.
Added CSS styles in select.css for the created buttons.
Modification of URLs in hardware.blade.php.
Modification of the 'hardware' route in web.php and addition of the
name to the 'select' route.
Removal of the no longer useful SelectController file.
Change of file name from welcome.html to welcome.blade.php.
@Tbaile Tbaile merged commit 98875a9 into NethServer:master Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants