fixes
This commit is contained in:
parent
fb2bc9e330
commit
90ec62de0f
@ -72,6 +72,22 @@ jQuery(document).ready(function ($) {
|
||||
});
|
||||
};
|
||||
|
||||
const inputTypeUpdate = function () {
|
||||
const $el = $('#slide-add-type');
|
||||
const value = $el.val();
|
||||
const inputType = $el.find('option').filter(function (i, el) {
|
||||
return $(el).val() === value;
|
||||
}).data('input');
|
||||
|
||||
$('.slide-add-object-input')
|
||||
.addClass('hidden')
|
||||
.prop('disabled', true)
|
||||
.filter('#slide-add-object-input-' + inputType)
|
||||
.removeClass('hidden')
|
||||
.prop('disabled', false)
|
||||
;
|
||||
}
|
||||
|
||||
const main = function () {
|
||||
$("table").tableDnD({
|
||||
dragHandle: 'td a.slide-sort',
|
||||
@ -118,20 +134,7 @@ jQuery(document).ready(function ($) {
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('change', '#slide-add-type', function () {
|
||||
const value = $(this).val();
|
||||
const inputType = $(this).find('option').filter(function (i, el) {
|
||||
return $(el).val() === value;
|
||||
}).data('input');
|
||||
|
||||
$('.slide-add-object-input')
|
||||
.addClass('hidden')
|
||||
.prop('disabled', true)
|
||||
.filter('#slide-add-object-input-' + inputType)
|
||||
.removeClass('hidden')
|
||||
.prop('disabled', false)
|
||||
;
|
||||
});
|
||||
$(document).on('change', '#slide-add-type', inputTypeUpdate);
|
||||
|
||||
$(document).on('click', '.modal-close', function () {
|
||||
hideModal();
|
||||
@ -140,6 +143,7 @@ jQuery(document).ready(function ($) {
|
||||
$(document).on('click', '.slide-add', function () {
|
||||
showModal('modal-slide-add');
|
||||
loadDateTimePicker($('.modal-slide-add .datetimepicker'))
|
||||
inputTypeUpdate();
|
||||
$('.modal-slide-add input:eq(0)').focus().select();
|
||||
});
|
||||
|
||||
|
||||
@ -88,7 +88,7 @@
|
||||
"settings_variable_desc_fleet_enabled": "Enable fleet screen management view",
|
||||
"settings_variable_desc_auth_enabled": "Enable auth management",
|
||||
"settings_variable_desc_external_url": "External url (i.e: https://screen-01.company.com or http://10.10.3.100)",
|
||||
"settings_variable_desc_slide_upload_limit": "Slide upload limit (in bytes, 32*1024*1024 for 32MB)",
|
||||
"settings_variable_desc_slide_upload_limit": "Slide upload limit (in megabytes)",
|
||||
"settings_variable_desc_default_slide_duration": "Intro slide duration (in seconds)",
|
||||
"settings_variable_desc_polling_interval": "Refresh interval applied for settings to the player (in seconds)",
|
||||
|
||||
@ -148,7 +148,7 @@
|
||||
"enum_animation_speed_fast": "Fast",
|
||||
"enum_animation_speed_faster": "Faster",
|
||||
"enum_variable_section_general": "1. General",
|
||||
"enum_variable_section_player_options": "2. Options du lecteur",
|
||||
"enum_variable_section_player_options": "2. Player options",
|
||||
"enum_variable_section_player_animation": "3. Player animation",
|
||||
"enum_application_language_english": "English",
|
||||
"enum_application_language_french": "French",
|
||||
|
||||
@ -88,7 +88,7 @@
|
||||
"settings_variable_desc_fleet_enabled": "Activer la gestion de flotte des écrans",
|
||||
"settings_variable_desc_auth_enabled": "Activer la gestion de l'authentification",
|
||||
"settings_variable_desc_external_url": "URL externe (i.e: https://screen-01.company.com or http://10.10.3.100)",
|
||||
"settings_variable_desc_slide_upload_limit": "Limite d'upload du fichier d'une slide (en octets, 32*1024*1024 pour 32Mo)",
|
||||
"settings_variable_desc_slide_upload_limit": "Limite d'upload du fichier d'une slide (en mégaoctets)",
|
||||
"settings_variable_desc_default_slide_duration": "Durée de la slide d'introduction (en secondes)",
|
||||
"settings_variable_desc_polling_interval": "Intervalle de rafraîchissement des paramètres à appliquer au lecteur (en secondes)",
|
||||
|
||||
|
||||
@ -100,7 +100,7 @@ class VariableManager(ModelManager):
|
||||
{"name": "auth_enabled", "section": self.t(VariableSection.GENERAL), "value": False, "type": VariableType.BOOL, "editable": True, "description": self.t('settings_variable_desc_auth_enabled'), "refresh_player": False},
|
||||
{"name": "fleet_enabled", "section": self.t(VariableSection.GENERAL), "value": False, "type": VariableType.BOOL, "editable": True, "description": self.t('settings_variable_desc_fleet_enabled'), "refresh_player": False},
|
||||
{"name": "external_url", "section": self.t(VariableSection.GENERAL), "value": "", "type": VariableType.STRING, "editable": True, "description": self.t('settings_variable_desc_external_url'), "refresh_player": False},
|
||||
{"name": "slide_upload_limit", "section": self.t(VariableSection.GENERAL), "value": 32 * 1024 * 1024, "unit": VariableUnit.BYTE, "type": VariableType.INT, "editable": True, "description": self.t('settings_variable_desc_slide_upload_limit'), "refresh_player": False},
|
||||
{"name": "slide_upload_limit", "section": self.t(VariableSection.GENERAL), "value": 32, "unit": VariableUnit.MEGABYTE, "type": VariableType.INT, "editable": True, "description": self.t('settings_variable_desc_slide_upload_limit'), "refresh_player": False},
|
||||
|
||||
### Player Options
|
||||
{"name": "default_slide_duration", "section": self.t(VariableSection.PLAYER_OPTIONS), "value": 3, "unit": VariableUnit.SECOND, "type": VariableType.INT, "editable": True, "description": self.t('settings_variable_desc_default_slide_duration'), "refresh_player": False},
|
||||
|
||||
@ -90,21 +90,25 @@ class Slide:
|
||||
f")"
|
||||
|
||||
def to_json(self) -> str:
|
||||
return json.dumps(self.to_dict())
|
||||
return json.dumps(self.to_dict(with_virtual=True))
|
||||
|
||||
def to_dict(self) -> dict:
|
||||
return {
|
||||
def to_dict(self, with_virtual: bool = False) -> dict:
|
||||
slide = {
|
||||
"id": self.id,
|
||||
"name": self.name,
|
||||
"enabled": self.enabled,
|
||||
"position": self.position,
|
||||
"type": self.type.value,
|
||||
"is_editable": self.is_editable(),
|
||||
"duration": self.duration,
|
||||
"location": self.location,
|
||||
"cron_schedule": self.cron_schedule,
|
||||
}
|
||||
|
||||
if with_virtual:
|
||||
slide['is_editable'] = self.is_editable()
|
||||
|
||||
return slide
|
||||
|
||||
def has_file(self) -> bool:
|
||||
return (
|
||||
self.type == SlideType.VIDEO
|
||||
@ -115,4 +119,4 @@ class Slide:
|
||||
return SlideType.get_input(self.type)
|
||||
|
||||
def is_editable(self) -> bool:
|
||||
return SlideInputType.is_editable(self.get_input_type())
|
||||
return SlideInputType.is_editable(self.get_input_type())
|
||||
|
||||
@ -18,7 +18,6 @@ class Variable:
|
||||
self._name = name
|
||||
self._section = section
|
||||
self._type = str_to_enum(type, VariableType) if isinstance(type, str) else type
|
||||
self._unit = str_to_enum(unit, VariableUnit) if isinstance(unit, str) else unit
|
||||
self._description = description
|
||||
self._value = value
|
||||
self._editable = editable
|
||||
@ -26,6 +25,11 @@ class Variable:
|
||||
self._refresh_player = refresh_player
|
||||
self._selectables = selectables
|
||||
|
||||
try:
|
||||
self._unit = str_to_enum(unit, VariableUnit) if isinstance(unit, str) else unit
|
||||
except ValueError:
|
||||
self._unit = None
|
||||
|
||||
@property
|
||||
def id(self) -> Union[int, str]:
|
||||
return self._id
|
||||
@ -66,11 +70,11 @@ class Variable:
|
||||
self._type = value
|
||||
|
||||
@property
|
||||
def unit(self) -> VariableUnit:
|
||||
def unit(self) -> Optional[VariableUnit]:
|
||||
return self._unit
|
||||
|
||||
@unit.setter
|
||||
def unit(self, value: VariableUnit):
|
||||
def unit(self, value: Optional[VariableUnit]):
|
||||
self._unit = value
|
||||
|
||||
@property
|
||||
@ -168,9 +172,9 @@ class Variable:
|
||||
value = str(selectable.label)
|
||||
break
|
||||
|
||||
if self.unit == VariableUnit.BYTE:
|
||||
if self.unit == VariableUnit.MEGABYTE:
|
||||
value = "{} {}".format(
|
||||
value / 1024 / 1024,
|
||||
value,
|
||||
"MB"
|
||||
)
|
||||
elif self.unit == VariableUnit.SECOND:
|
||||
|
||||
@ -16,10 +16,10 @@ class SlideInputType(Enum):
|
||||
|
||||
class SlideType(Enum):
|
||||
|
||||
PICTURE = 'picture'
|
||||
YOUTUBE = 'youtube'
|
||||
VIDEO = 'video'
|
||||
URL = 'url'
|
||||
YOUTUBE = 'youtube'
|
||||
PICTURE = 'picture'
|
||||
VIDEO = 'video'
|
||||
|
||||
@staticmethod
|
||||
def get_input(value: Enum) -> SlideInputType:
|
||||
|
||||
@ -3,5 +3,5 @@ from enum import Enum
|
||||
|
||||
class VariableUnit(Enum):
|
||||
|
||||
BYTE = 'byte'
|
||||
MEGABYTE = 'megabyte'
|
||||
SECOND = 'second'
|
||||
|
||||
@ -59,7 +59,7 @@ class WebServer:
|
||||
)
|
||||
|
||||
self._app.config['UPLOAD_FOLDER'] = "{}/{}".format(WebDirConstant.FOLDER_STATIC, WebDirConstant.FOLDER_STATIC_WEB_UPLOADS)
|
||||
self._app.config['MAX_CONTENT_LENGTH'] = self._model_store.variable().map().get('slide_upload_limit').as_int()
|
||||
self._app.config['MAX_CONTENT_LENGTH'] = self._model_store.variable().map().get('slide_upload_limit').as_int() * 1024 * 1024
|
||||
|
||||
self._setup_flask_login()
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user