connectcore-demo-example: generalize constants and styles for configuration

Signed-off-by: David Escalona <david.escalona@digi.com>
This commit is contained in:
David Escalona 2022-09-05 16:18:01 +02:00
parent 4db2bb783b
commit fe23aafc92
4 changed files with 52 additions and 51 deletions

View File

@ -1882,20 +1882,20 @@ body {
}
/* END MULTIMEDIA VIEWER */
/* MANAGEMENT */
.system-monitor-param-container {
/* CONFIG CONTROLS */
.param-container {
margin-top: 10px;
width: 100%;
padding-left: 10px;
}
.system-monitor-param-label {
.param-label {
display: inline-block;
position: relative;
width: 170px;
}
.system-monitor-input {
.input-control {
position: relative;
-webkit-transition: none !important;
-moz-transition: none !important;
@ -1907,11 +1907,11 @@ body {
margin: 0px !important;
}
.system-monitor-input-error {
.input-control-error {
background-color: #f3b1b1 !important;
}
.system-monitor-error {
.error-label {
color: red;
font-size: 12px;
font-style: italic;
@ -1919,6 +1919,25 @@ body {
padding-left: 10px;
}
.config-button {
padding: 5px;
cursor: pointer;
margin-bottom: 0;
margin-top: 15px;
width: 100px;
float: left;
margin-left: 10px;
}
.config-button-disabled {
cursor: default;
color: white;
background-color: #c3c3c3;
pointer-events: none;
}
/* END CONFIG CONTROLS */
/* MANAGEMENT */
.system-monitor-help {
font-size: 16px;
padding-left: 5px;
@ -1940,21 +1959,6 @@ body {
outline: none;
}
.system-monitor-save {
padding: 5px;
cursor: pointer;
margin-bottom: 0;
margin-top: 15px;
width: 100px;
}
.system-monitor-save-disabled {
cursor: default;
color: white;
background-color: #c3c3c3;
pointer-events: none;
}
.firmware-file-input {
position: relative;
margin-top: 15px;
@ -2009,13 +2013,6 @@ body {
background-color: #a72a2a;
}
.management-button-disabled {
cursor: default;
color: #c3c3c3;
background-color: #e3e3e3;
pointer-events: none;
}
.update-firmware-progress {
position: relative;
margin-top: 15px;

View File

@ -136,18 +136,26 @@ const VALUE_UNKNOWN = "unknown";
const CLASS_D_NONE = "d-none";
const CLASS_DISABLED_DIV = "disabled-div";
const CLASS_ELEMENT_GRAYED = "element-grayed";
const CLASS_INPUT_ERROR = "input-control-error";
const CLASS_CONFIG_BUTTON_DISABLED = "config-button-disabled";
const CLASS_SELECTED = "selected";
const CLASS_VALUE_ANIMATION = "value-animation";
const CLASS_VALUE_UPDATED = "value-updated";
const ERROR_ABORTED = "Operation aborted";
const ERROR_BAD_REQUEST = "Bad request";
const ERROR_FIELD_EMPTY = "Field cannot be empty";
const ERROR_FORBIDDEN = "Could not perform the selected action. Make sure you have the correct access rights.";
const ERROR_URL_NOT_FOUND = "Requested URL not found";
const ERROR_SERVER_ERROR = "Internal server error";
const ERROR_TITLE = "Error";
const ERROR_UNKNOWN_ERROR = "Unknown error. Make sure that the server is running.";
const IFACE_BT = "hci0";
const IFACE_ETH0 = "eth0";
const IFACE_ETH1 = "eth1";
const IFACE_WIFI = "wlan0";
const PREFIX_STREAM = "system_monitor/";
const STREAM_CPU_LOAD = PREFIX_STREAM + "cpu_load";
const STREAM_MEMORY_FREE = PREFIX_STREAM + "free_memory";
@ -526,4 +534,4 @@ function removeSection(sectionID) {
var sectionElement = document.getElementById(sectionID);
if (sectionElement != null && sectionElement != "undefined")
sectionElement.parentNode.removeChild(sectionElement);
}
}

View File

@ -69,30 +69,25 @@ const ID_WIFI_BT_PANEL_AREA = "wifi_bt_panel_area";
const ID_WIFI_BT_PANEL_ARROW = "wifi_bt_panel_arrow";
const ID_WIFI_BT_PANEL_ICON = "wifi_bt_panel_icon";
const IFACE_BT = "hci0/";
const IFACE_ETHERNET0 = "eth0/";
const IFACE_ETHERNET1 = "eth1/";
const IFACE_WIFI = "wlan0/";
const USER_LED = "user_led";
const STREAM_CPU_FREQUENCY = PREFIX_STREAM + "frequency";
const STREAM_CPU_TEMPERATURE = PREFIX_STREAM + "cpu_temperature";
const STREAM_CPU_UPTIME = PREFIX_STREAM + "uptime";
const STREAM_ETHERNET0_READ_BYTES = PREFIX_STREAM + IFACE_ETHERNET0 + "rx_bytes";
const STREAM_ETHERNET0_SENT_BYTES = PREFIX_STREAM + IFACE_ETHERNET0 + "tx_bytes";
const STREAM_ETHERNET0_STATE = PREFIX_STREAM + IFACE_ETHERNET0 + "state";
const STREAM_ETHERNET1_READ_BYTES = PREFIX_STREAM + IFACE_ETHERNET1 + "rx_bytes";
const STREAM_ETHERNET1_SENT_BYTES = PREFIX_STREAM + IFACE_ETHERNET1 + "tx_bytes";
const STREAM_ETHERNET1_STATE = PREFIX_STREAM + IFACE_ETHERNET1 + "state";
const STREAM_ETHERNET0_READ_BYTES = PREFIX_STREAM + IFACE_ETH0 + "/rx_bytes";
const STREAM_ETHERNET0_SENT_BYTES = PREFIX_STREAM + IFACE_ETH0 + "/tx_bytes";
const STREAM_ETHERNET0_STATE = PREFIX_STREAM + IFACE_ETH0 + "/state";
const STREAM_ETHERNET1_READ_BYTES = PREFIX_STREAM + IFACE_ETH1 + "/rx_bytes";
const STREAM_ETHERNET1_SENT_BYTES = PREFIX_STREAM + IFACE_ETH1 + "/tx_bytes";
const STREAM_ETHERNET1_STATE = PREFIX_STREAM + IFACE_ETH1 + "/state";
const STREAM_LED_STATUS = PREFIX_STREAM + "led_status";
const STREAM_MEMORY_USED = PREFIX_STREAM + "used_memory";
const STREAM_WIFI_READ_BYTES = PREFIX_STREAM + IFACE_WIFI + "rx_bytes";
const STREAM_WIFI_SENT_BYTES = PREFIX_STREAM + IFACE_WIFI + "tx_bytes";
const STREAM_WIFI_STATE = PREFIX_STREAM + IFACE_WIFI + "state";
const STREAM_BT_READ_BYTES = PREFIX_STREAM + IFACE_BT + "rx_bytes";
const STREAM_BT_SENT_BYTES = PREFIX_STREAM + IFACE_BT + "tx_bytes";
const STREAM_BT_STATE = PREFIX_STREAM + IFACE_BT + "state";
const STREAM_WIFI_READ_BYTES = PREFIX_STREAM + IFACE_WIFI + "/rx_bytes";
const STREAM_WIFI_SENT_BYTES = PREFIX_STREAM + IFACE_WIFI + "/tx_bytes";
const STREAM_WIFI_STATE = PREFIX_STREAM + IFACE_WIFI + "/state";
const STREAM_BT_READ_BYTES = PREFIX_STREAM + IFACE_BT + "/rx_bytes";
const STREAM_BT_SENT_BYTES = PREFIX_STREAM + IFACE_BT + "/tx_bytes";
const STREAM_BT_STATE = PREFIX_STREAM + IFACE_BT + "/state";
const PANEL_ARROW_WIDTH_100 = 20;
const PANEL_BOARD_WIDTH_100 = 1200;

View File

@ -31,7 +31,6 @@ const ID_UPDATE_RUNNING = "update_running";
const CLASS_FIRMWARE_TAB = "firmware-tab";
const CLASS_FIRMWARE_TAB_HEADER = "firmware-tab-header";
const CLASS_FIRMWARE_TAB_HEADER_ACTIVE = "firmware-tab-header-active";
const CLASS_MANAGEMENT_BUTTON_DISABLED = "management-button-disabled";
const CLASS_PROGRESS_BAR_ERROR = "update-firmware-progress-bar-error";
const CLASS_PROGRESS_BAR_INFO = "update-firmware-progress-bar-info";
const CLASS_PROGRESS_BAR_SUCCESS = "update-firmware-progress-bar-success";
@ -625,10 +624,12 @@ function enableManagementButton(buttonID, enable) {
var buttonElement = document.getElementById(buttonID);
if (buttonElement != null) {
if (enable) {
if (buttonElement.classList.contains(CLASS_MANAGEMENT_BUTTON_DISABLED))
buttonElement.classList.remove(CLASS_MANAGEMENT_BUTTON_DISABLED);
} else
buttonElement.classList.add(CLASS_MANAGEMENT_BUTTON_DISABLED);
if (buttonElement.classList.contains(CLASS_CONFIG_BUTTON_DISABLED))
buttonElement.classList.remove(CLASS_CONFIG_BUTTON_DISABLED);
} else {
if (!buttonElement.classList.contains(CLASS_CONFIG_BUTTON_DISABLED))
buttonElement.classList.add(CLASS_CONFIG_BUTTON_DISABLED);
}
}
}