added service code
parent
5cc513e03d
commit
8d81e87526
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
const colorClamp = "#34495e"
|
const colorClamp = "#34495e"
|
||||||
const colorTime = "#95a5a6"
|
const colorTime = "#95a5a6"
|
||||||
|
const serviceCodeColor = "#95a5a6"
|
||||||
|
|
||||||
const messageTypes = [
|
const messageTypes = [
|
||||||
"INFO",
|
"INFO",
|
||||||
|
@ -68,10 +69,12 @@ const connectionStatus = document.getElementById("connection-status")
|
||||||
const messages = document.getElementById("messages")
|
const messages = document.getElementById("messages")
|
||||||
let autoScroll = true;
|
let autoScroll = true;
|
||||||
|
|
||||||
function addMessage(messageType, serviceType, serviceName, message, timestamp) {
|
function addMessage(serviceCode, messageType, serviceType, serviceName, message, timestamp) {
|
||||||
let li = document.createElement("li")
|
let li = document.createElement("li")
|
||||||
|
|
||||||
li.innerHTML = formatDate(timestamp) +
|
li.innerHTML =
|
||||||
|
formatServiceCode(serviceCode) +
|
||||||
|
formatDate(timestamp) +
|
||||||
formatServiceType(serviceType) +
|
formatServiceType(serviceType) +
|
||||||
formatServiceName(serviceName) +
|
formatServiceName(serviceName) +
|
||||||
formatMessageType(messageType) +
|
formatMessageType(messageType) +
|
||||||
|
@ -121,6 +124,16 @@ function clampClosed() {
|
||||||
return "<span style='color: "+colorClamp+"'>]</span> "
|
return "<span style='color: "+colorClamp+"'>]</span> "
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatServiceCode(code) {
|
||||||
|
if (code == "") {
|
||||||
|
code = "000" // default value
|
||||||
|
}
|
||||||
|
|
||||||
|
return clampOn() +
|
||||||
|
"<span style='color: "+serviceCodeColor+"'>" +
|
||||||
|
code + "</span>" + clampClosed()
|
||||||
|
}
|
||||||
|
|
||||||
function formatDate(timestamp) {
|
function formatDate(timestamp) {
|
||||||
const date = new Date(timestamp)
|
const date = new Date(timestamp)
|
||||||
|
|
||||||
|
@ -200,6 +213,7 @@ function connectWS() {
|
||||||
for (i in messages) {
|
for (i in messages) {
|
||||||
data = messages[i]
|
data = messages[i]
|
||||||
|
|
||||||
|
serviceCode = data.ServiceCode
|
||||||
messageType = data.MessageType
|
messageType = data.MessageType
|
||||||
serviceName = data.ServiceName
|
serviceName = data.ServiceName
|
||||||
serviceType = data.ServiceType
|
serviceType = data.ServiceType
|
||||||
|
@ -216,7 +230,7 @@ function connectWS() {
|
||||||
addCustomMessage("<span style='color: #7f8c8d'>––––––––– START OF OLD MESSAGES –––––––––</span>")
|
addCustomMessage("<span style='color: #7f8c8d'>––––––––– START OF OLD MESSAGES –––––––––</span>")
|
||||||
|
|
||||||
for (const i in lastMessages) {
|
for (const i in lastMessages) {
|
||||||
addMessage(lastMessages[i].MessageType, lastMessages[i].ServiceType, lastMessages[i].ServiceName, lastMessages[i].Msg, lastMessages[i].Timestamp)
|
addMessage(lastMessages[i].ServiceCode, lastMessages[i].MessageType, lastMessages[i].ServiceType, lastMessages[i].ServiceName, lastMessages[i].Msg, lastMessages[i].Timestamp)
|
||||||
}
|
}
|
||||||
|
|
||||||
addCustomMessage("<span style='color: #7f8c8d'>––––––––– END OF OLD MESSAGES –––––––––</span>")
|
addCustomMessage("<span style='color: #7f8c8d'>––––––––– END OF OLD MESSAGES –––––––––</span>")
|
||||||
|
@ -226,7 +240,7 @@ function connectWS() {
|
||||||
if (serviceType == 1 && !checkboxBeta.checked) return
|
if (serviceType == 1 && !checkboxBeta.checked) return
|
||||||
if (serviceType == 2 && !checkboxStable.checked) return
|
if (serviceType == 2 && !checkboxStable.checked) return
|
||||||
|
|
||||||
addMessage(messageType, serviceType, serviceName, data.Msg, timestamp)
|
addMessage(serviceCode, messageType, serviceType, serviceName, data.Msg, timestamp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -3,7 +3,7 @@ module clickandjoin.app/managementsystem
|
||||||
go 1.18
|
go 1.18
|
||||||
|
|
||||||
require (
|
require (
|
||||||
git.clickandjoin.umbach.dev/ClickandJoin/go-cnj-helper v1.0.70
|
git.clickandjoin.umbach.dev/ClickandJoin/go-cnj-helper v1.0.71
|
||||||
github.com/gocql/gocql v0.0.0-20211015133455-b225f9b53fa1
|
github.com/gocql/gocql v0.0.0-20211015133455-b225f9b53fa1
|
||||||
github.com/gofiber/fiber/v2 v2.42.0
|
github.com/gofiber/fiber/v2 v2.42.0
|
||||||
github.com/gofiber/websocket/v2 v2.1.4
|
github.com/gofiber/websocket/v2 v2.1.4
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -10,6 +10,8 @@ git.clickandjoin.umbach.dev/ClickandJoin/go-cnj-helper v1.0.69 h1:adnMXdPtq1obVH
|
||||||
git.clickandjoin.umbach.dev/ClickandJoin/go-cnj-helper v1.0.69/go.mod h1:rnEM9rcZy2dg4SaDCGmSf34fp7ECzdyxxnRut2HBmrs=
|
git.clickandjoin.umbach.dev/ClickandJoin/go-cnj-helper v1.0.69/go.mod h1:rnEM9rcZy2dg4SaDCGmSf34fp7ECzdyxxnRut2HBmrs=
|
||||||
git.clickandjoin.umbach.dev/ClickandJoin/go-cnj-helper v1.0.70 h1:9/H8LSk+MK6Yuh3wI+wbFtIOc67w1uxiy3USZvm5lug=
|
git.clickandjoin.umbach.dev/ClickandJoin/go-cnj-helper v1.0.70 h1:9/H8LSk+MK6Yuh3wI+wbFtIOc67w1uxiy3USZvm5lug=
|
||||||
git.clickandjoin.umbach.dev/ClickandJoin/go-cnj-helper v1.0.70/go.mod h1:rnEM9rcZy2dg4SaDCGmSf34fp7ECzdyxxnRut2HBmrs=
|
git.clickandjoin.umbach.dev/ClickandJoin/go-cnj-helper v1.0.70/go.mod h1:rnEM9rcZy2dg4SaDCGmSf34fp7ECzdyxxnRut2HBmrs=
|
||||||
|
git.clickandjoin.umbach.dev/ClickandJoin/go-cnj-helper v1.0.71 h1:FPBLRwAiWf/mvvO7rUZIfWXyyoHE3mK04iHFf8Pvbv0=
|
||||||
|
git.clickandjoin.umbach.dev/ClickandJoin/go-cnj-helper v1.0.71/go.mod h1:rnEM9rcZy2dg4SaDCGmSf34fp7ECzdyxxnRut2HBmrs=
|
||||||
github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY=
|
github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY=
|
||||||
github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
|
github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
|
||||||
github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 h1:mXoPYz/Ul5HYEDvkta6I8/rnYM5gSdSV2tJ6XbZuEtY=
|
github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 h1:mXoPYz/Ul5HYEDvkta6I8/rnYM5gSdSV2tJ6XbZuEtY=
|
||||||
|
|
Loading…
Reference in New Issue