add placeholder datastorage
This commit is contained in:
parent
6aa643c197
commit
57882ca2c5
|
@ -402,7 +402,7 @@ class NewDeviceForm(FlaskForm):
|
||||||
sku = StringField('SKU', [validators.Optional()])
|
sku = StringField('SKU', [validators.Optional()])
|
||||||
image = URLField('Image', [validators.Optional(), validators.URL()])
|
image = URLField('Image', [validators.Optional(), validators.URL()])
|
||||||
imei = IntegerField('IMEI', [validators.Optional()])
|
imei = IntegerField('IMEI', [validators.Optional()])
|
||||||
data_storage_size = IntegerField('Storage Size', [validators.Optional()])
|
data_storage_size = FloatField('Storage Size', [validators.Optional()])
|
||||||
meid = StringField('MEID', [validators.Optional()])
|
meid = StringField('MEID', [validators.Optional()])
|
||||||
resolution = IntegerField('Resolution width', [validators.Optional()])
|
resolution = IntegerField('Resolution width', [validators.Optional()])
|
||||||
screen = FloatField('Screen size', [validators.Optional()])
|
screen = FloatField('Screen size', [validators.Optional()])
|
||||||
|
@ -435,7 +435,7 @@ class NewDeviceForm(FlaskForm):
|
||||||
"Other": Other,
|
"Other": Other,
|
||||||
}
|
}
|
||||||
|
|
||||||
def reset_from_obj(self):
|
def reset_from_obj(self): # noqa: C901
|
||||||
if not self._obj:
|
if not self._obj:
|
||||||
return
|
return
|
||||||
disabled = {'disabled': "disabled"}
|
disabled = {'disabled': "disabled"}
|
||||||
|
@ -476,6 +476,9 @@ class NewDeviceForm(FlaskForm):
|
||||||
if self._obj.type == 'ComputerMonitor':
|
if self._obj.type == 'ComputerMonitor':
|
||||||
self.resolution.data = self._obj.resolution_width
|
self.resolution.data = self._obj.resolution_width
|
||||||
self.screen.data = self._obj.size
|
self.screen.data = self._obj.size
|
||||||
|
if self._obj.type in ['HardDrive', 'SolidStateDrive']:
|
||||||
|
if self._obj.size:
|
||||||
|
self.data_storage_size.data = self._obj.size / 1000
|
||||||
|
|
||||||
if self._obj.placeholder.is_abstract:
|
if self._obj.placeholder.is_abstract:
|
||||||
self.type.render_kw = disabled
|
self.type.render_kw = disabled
|
||||||
|
@ -501,6 +504,8 @@ class NewDeviceForm(FlaskForm):
|
||||||
self.imei.render_kw = disabled
|
self.imei.render_kw = disabled
|
||||||
self.meid.render_kw = disabled
|
self.meid.render_kw = disabled
|
||||||
self.data_storage_size.render_kw = disabled
|
self.data_storage_size.render_kw = disabled
|
||||||
|
if self._obj.type in ['HardDrive', 'SolidStateDrive']:
|
||||||
|
self.data_storage_size.render_kw = disabled
|
||||||
if self._obj.type == 'ComputerMonitor':
|
if self._obj.type == 'ComputerMonitor':
|
||||||
self.resolution.render_kw = disabled
|
self.resolution.render_kw = disabled
|
||||||
self.screen.render_kw = disabled
|
self.screen.render_kw = disabled
|
||||||
|
@ -570,7 +575,6 @@ class NewDeviceForm(FlaskForm):
|
||||||
|
|
||||||
if commit:
|
if commit:
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
# import pdb; pdb.set_trace()
|
|
||||||
|
|
||||||
def create_device(self):
|
def create_device(self):
|
||||||
schema = SnapshotSchema()
|
schema = SnapshotSchema()
|
||||||
|
@ -617,7 +621,8 @@ class NewDeviceForm(FlaskForm):
|
||||||
device.data_storage_size = self.data_storage_size.data
|
device.data_storage_size = self.data_storage_size.data
|
||||||
|
|
||||||
if self.type.data in ['HardDrive', 'SolidStateDrive']:
|
if self.type.data in ['HardDrive', 'SolidStateDrive']:
|
||||||
device.data_storage_size = self.data_storage_size.data
|
if self.data_storage_size.data:
|
||||||
|
self._obj.size = self.data_storage_size.data * 1000
|
||||||
|
|
||||||
device.image = URL(self.image.data)
|
device.image = URL(self.image.data)
|
||||||
|
|
||||||
|
@ -688,6 +693,10 @@ class NewDeviceForm(FlaskForm):
|
||||||
self._obj.meid = self.meid.data
|
self._obj.meid = self.meid.data
|
||||||
self._obj.data_storage_size = self.data_storage_size.data
|
self._obj.data_storage_size = self.data_storage_size.data
|
||||||
|
|
||||||
|
if self.type.data in ['HardDrive', 'SolidStateDrive']:
|
||||||
|
if self.data_storage_size.data:
|
||||||
|
self._obj.size = self.data_storage_size.data * 1000
|
||||||
|
|
||||||
if (
|
if (
|
||||||
self.appearance.data
|
self.appearance.data
|
||||||
and self.appearance.data != self._obj.appearance().name
|
and self.appearance.data != self._obj.appearance().name
|
||||||
|
|
|
@ -334,7 +334,7 @@
|
||||||
<tr style="border-bottom: 1px dashed #000;">
|
<tr style="border-bottom: 1px dashed #000;">
|
||||||
{% if erasure.device.is_mobile() %}
|
{% if erasure.device.is_mobile() %}
|
||||||
<td>
|
<td>
|
||||||
{{ (erasure.device.imei or '') }}
|
IMEI:{{ (erasure.device.imei or '') }}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
</td>
|
</td>
|
||||||
|
@ -376,7 +376,7 @@
|
||||||
<dd>Model: {{ erasure.device.model }}</dd>
|
<dd>Model: {{ erasure.device.model }}</dd>
|
||||||
<dd>IMEI: {{ (erasure.device.imei or '') }}</dd>
|
<dd>IMEI: {{ (erasure.device.imei or '') }}</dd>
|
||||||
<dd>DHID: {{ erasure.device.dhid }}</dd>
|
<dd>DHID: {{ erasure.device.dhid }}</dd>
|
||||||
<dd>Size: {{ erasure.device.get_size() or '' }}</dd>
|
<dd>Size: {{ erasure.device.get_size() or '?' }} GB</dd>
|
||||||
{% else %}
|
{% else %}
|
||||||
<h4>{{ (erasure.device.serial_number or '').upper() }}</h4>
|
<h4>{{ (erasure.device.serial_number or '').upper() }}</h4>
|
||||||
<dl>
|
<dl>
|
||||||
|
|
Reference in New Issue