diff --git a/controllers/modbus.controller.js b/controllers/modbus.controller.js index 7eaffe2..a521f5f 100644 --- a/controllers/modbus.controller.js +++ b/controllers/modbus.controller.js @@ -60,7 +60,7 @@ export const modbusController = { */ async createDevice(req, res, next) { try { - const { id, name, g_display_reg_addr, g_display_reg_format, g_display_reg_type, g_y_label, is_logging } = + const { id, name, g_display_reg_addr, g_display_reg_format, g_display_reg_type, g_y_label } = req.body; await db.run( `INSERT INTO "modbus_slaves" ( @@ -69,10 +69,9 @@ export const modbusController = { "g_display_reg_addr", "g_display_reg_format", "g_display_reg_type", - "g_y_label", - "is_logging") + "g_y_label") VALUES (?, ?, ?, ?, ?, ?, ?)`, - [id, name, g_display_reg_addr, g_display_reg_format, g_display_reg_type, g_y_label, is_logging], + [id, name, g_display_reg_addr, g_display_reg_format, g_display_reg_type, g_y_label], ); return res.status(200).json({ message: "Device created." }); } catch (error) { diff --git a/data.db b/data.db index bdf8a2f..44fe851 100644 Binary files a/data.db and b/data.db differ diff --git a/getslaves.sql b/getslaves.sql index 4e96fed..86b0b2d 100644 --- a/getslaves.sql +++ b/getslaves.sql @@ -4,7 +4,6 @@ SELECT g_display_reg_addr, g_display_reg_format, g_y_label, - is_logging, CASE WHEN COUNT(dv.id) = 0 THEN '[]' ELSE '[' || GROUP_CONCAT( diff --git a/index.d.ts b/index.d.ts index 369ca53..47f4d9b 100644 --- a/index.d.ts +++ b/index.d.ts @@ -30,7 +30,6 @@ export type ModbusDevice = { g_display_reg_format: NumberType | null; g_display_reg_type: "HR" | "IR"; g_y_label: string | null; - is_logging: boolean; display_values?: DisplayValue[] } diff --git a/migrations/001-init.sql b/migrations/001-init.sql index 08f6fa3..dc2da23 100644 --- a/migrations/001-init.sql +++ b/migrations/001-init.sql @@ -25,7 +25,6 @@ CREATE TABLE IF NOT EXISTS "modbus_slaves" ( "g_display_reg_type" VARCHAR(3) CHECK(g_display_reg_type IN("HR", "IR")) DEFAULT "IR", "g_display_reg_format" VARCHAR(5) CHECK(g_display_reg_format IN("UI16", "I16", "UI32", "I32", "FP32")) DEFAULT "UI16", "g_y_label" VARCHAR(40) DEFAULT "Label", - "is_logging" BOOLEAN NOT NULL DEFAULT FALSE, PRIMARY KEY("id") ); @@ -56,12 +55,12 @@ CREATE TABLE IF NOT EXISTS "display_values" ( -- ) INSERT INTO "modbus_slaves" ( - "id", "name", "g_display_reg_addr", "g_display_reg_type", "g_display_reg_format", "g_y_label", "is_logging" + "id", "name", "g_display_reg_addr", "g_display_reg_type", "g_display_reg_format", "g_y_label" ) VALUES - (1, "Device #1", 0, "IR", "UI16", "Label 1", 1), - (2, "Device #2", 1, "IR", "UI32", "Label 2", 1), - (3, "Device #3", 3, "IR", "UI16", "Label 3", 0), - (4, "Device #4", NULL, NULL, NULL, "Label 4", 0); + (1, "Device #1", 0, "IR", "UI16", "Label 1"), + (2, "Device #2", 1, "IR", "UI32", "Label 2"), + (3, "Device #3", 3, "IR", "UI16", "Label 3"), + (4, "Device #4", NULL, NULL, NULL, "Label 4"); INSERT INTO "display_values" ( "id", "name", "slave_id", "reg_addr", "reg_format", "reg_type" diff --git a/public/index.html b/public/index.html index f0da556..0933531 100644 --- a/public/index.html +++ b/public/index.html @@ -66,7 +66,7 @@
@@ -158,15 +158,6 @@
-
- - -
diff --git a/public/js/app.js b/public/js/app.js index 4e02844..fb76336 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -70,7 +70,6 @@ document.addEventListener("alpine:init", async () => { g_display_reg_format: "UI16", g_display_reg_type: "IR", g_y_label: "", - is_logging: false, }, resetDataFields() { this.data.id = null; @@ -79,7 +78,6 @@ document.addEventListener("alpine:init", async () => { this.data.g_display_reg_format = "UI16"; this.g_display_reg_type = "IR"; this.data.g_y_label = ""; - this.data.is_logging = false; }, async create(cb) { try { diff --git a/services/modbus.service.js b/services/modbus.service.js index 9afa17d..ee8655f 100644 --- a/services/modbus.service.js +++ b/services/modbus.service.js @@ -123,7 +123,7 @@ export const modbusService = { async getDevices() { /** @type {import("..").ModbusDevice[]} */ const devices = await db.all(` - SELECT ms.id AS id, ms.name AS name, g_display_reg_addr, g_display_reg_format, g_display_reg_type, g_y_label, is_logging, + SELECT ms.id AS id, ms.name AS name, g_display_reg_addr, g_display_reg_format, g_display_reg_type, g_y_label, CASE WHEN COUNT(dv.id) = 0 THEN '[]' ELSE '[' || GROUP_CONCAT( diff --git a/validators/modbus-device.schema.js b/validators/modbus-device.schema.js index f5f9507..e5a892d 100644 --- a/validators/modbus-device.schema.js +++ b/validators/modbus-device.schema.js @@ -7,7 +7,6 @@ export const modbusDeviceSchema = object({ g_display_reg_format: string().oneOf(["UI16", "I16", "UI32", "I32", "FP32"]).nullable(), g_display_reg_type: string().oneOf(["HR", "IR"]).nullable(), g_y_label: string().max(40).nullable(), - is_logging: boolean().required() }); export const removeModbusDeviceSchema = modbusDeviceSchema.pick(['id']); \ No newline at end of file