-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
app/Models/NethserverHardware.php
Outdated
|
||
class NethserverHardware extends Model | ||
{ | ||
use HasFactory; |
There was a problem hiding this comment.
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
app/Models/NethserverHardware.php
Outdated
protected $fillable = [ | ||
'product_name', | ||
'manufacturer', | ||
'processor', | ||
'vga_controller', | ||
'usb_controller', | ||
'pci_bridge', | ||
'sata_controller', | ||
'communication_controller', | ||
'scsi_controller', | ||
'ethernet', | ||
]; |
There was a problem hiding this comment.
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
app/Models/NethsecurityHardware.php
Outdated
|
||
class NethsecurityHardware extends Model | ||
{ | ||
use HasFactory; |
There was a problem hiding this comment.
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
app/Models/NethsecurityHardware.php
Outdated
protected $fillable = [ | ||
'product_name', | ||
'manufacturer', | ||
'processor', | ||
'vga_controller', | ||
'usb_controller', | ||
'pci_bridge', | ||
'sata_controller', | ||
'communication_controller', | ||
'scsi_controller', | ||
'ethernet', | ||
]; |
There was a problem hiding this comment.
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
Route::get('/select', function() { | ||
return view('select'); | ||
}); |
There was a problem hiding this comment.
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
public function getHardwareType(Request $request){ | ||
// Retrieve hardware type from session | ||
$hardwareType = $request->session()->get('hardwareType'); | ||
return $hardwareType; | ||
} |
There was a problem hiding this comment.
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
resources/views/welcome.html
Outdated
@@ -40,6 +40,7 @@ | |||
<a class="dropdown-item" id="interval_all"> | |||
All | |||
</a> | |||
<a href="/select" class="dropdown-item">Search Hardware</a> |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
)
There was a problem hiding this comment.
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
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.
link on cursor hover.
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.
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.