remove all components in the filter of the inventory

This commit is contained in:
Cayo Puigdefabregas 2022-05-16 11:01:52 +02:00
parent ac0d6c7a22
commit 3bd2dd79b1
1 changed files with 1 additions and 53 deletions

View File

@ -52,7 +52,7 @@ from ereuse_devicehub.resources.user.exceptions import InsufficientPermission
from ereuse_devicehub.resources.user.models import User from ereuse_devicehub.resources.user.models import User
DEVICES = { DEVICES = {
"All": ["All Devices", "All Components"], "All": ["All Devices"],
"Computer": [ "Computer": [
"All Computers", "All Computers",
"Desktop", "Desktop",
@ -73,55 +73,12 @@ DEVICES = {
"Smartphone", "Smartphone",
"Cellphone", "Cellphone",
], ],
"DataStorage": ["All DataStorage", "HardDrive", "SolidStateDrive"],
"Accessories & Peripherals": [
"All Peripherals",
"GraphicCard",
"Motherboard",
"NetworkAdapter",
"Processor",
"RamModule",
"SoundCard",
"Battery",
"Keyboard",
"Mouse",
"MemoryCardReader",
],
} }
COMPUTERS = ['Desktop', 'Laptop', 'Server'] COMPUTERS = ['Desktop', 'Laptop', 'Server']
COMPONENTS = [
'GraphicCard',
'DataStorage',
'HardDrive',
'DataStorage',
'SolidStateDrive',
'Motherboard',
'NetworkAdapter',
'Processor',
'RamModule',
'SoundCard',
'Display',
'Battery',
'Camera',
]
MONITORS = ["ComputerMonitor", "Monitor", "TelevisionSet", "Projector"] MONITORS = ["ComputerMonitor", "Monitor", "TelevisionSet", "Projector"]
MOBILE = ["Mobile", "Tablet", "Smartphone", "Cellphone"] MOBILE = ["Mobile", "Tablet", "Smartphone", "Cellphone"]
DATASTORAGE = ["HardDrive", "SolidStateDrive"]
PERIPHERALS = [
"GraphicCard",
"Motherboard",
"NetworkAdapter",
"Processor",
"RamModule",
"SoundCard",
"Battery",
"Keyboard",
"Mouse",
"MemoryCardReader",
]
class FilterForm(FlaskForm): class FilterForm(FlaskForm):
@ -166,9 +123,6 @@ class FilterForm(FlaskForm):
if "All Devices" == self.device_type: if "All Devices" == self.device_type:
filter_type = COMPUTERS + ["Monitor"] + MOBILE filter_type = COMPUTERS + ["Monitor"] + MOBILE
elif "All Components" == self.device_type:
filter_type = COMPONENTS
elif "All Computers" == self.device_type: elif "All Computers" == self.device_type:
filter_type = COMPUTERS filter_type = COMPUTERS
@ -178,12 +132,6 @@ class FilterForm(FlaskForm):
elif "All Mobile" == self.device_type: elif "All Mobile" == self.device_type:
filter_type = MOBILE filter_type = MOBILE
elif "All DataStorage" == self.device_type:
filter_type = DATASTORAGE
elif "All Peripherals" == self.device_type:
filter_type = PERIPHERALS
if filter_type: if filter_type:
self.devices = self.devices.filter(Device.type.in_(filter_type)) self.devices = self.devices.filter(Device.type.in_(filter_type))