go-duck-cli 1.4.5 → 1.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/generators/telemetry.js +0 -3
- package/package.json +1 -1
- package/templates/go/router.go.hbs +11 -11
package/generators/telemetry.js
CHANGED
|
@@ -109,11 +109,9 @@ service:
|
|
|
109
109
|
package telemetry
|
|
110
110
|
|
|
111
111
|
import (
|
|
112
|
-
"runtime"
|
|
113
112
|
"sync"
|
|
114
113
|
"time"
|
|
115
114
|
"github.com/gin-gonic/gin"
|
|
116
|
-
"net/http"
|
|
117
115
|
"{{app_name}}/config"
|
|
118
116
|
)
|
|
119
117
|
|
|
@@ -204,7 +202,6 @@ import (
|
|
|
204
202
|
"runtime"
|
|
205
203
|
"time"
|
|
206
204
|
"github.com/shirou/gopsutil/v3/cpu"
|
|
207
|
-
"github.com/shirou/gopsutil/v3/mem"
|
|
208
205
|
"github.com/shirou/gopsutil/v3/process"
|
|
209
206
|
"os"
|
|
210
207
|
"fmt"
|
package/package.json
CHANGED
|
@@ -831,7 +831,7 @@ func SetupRouter(appConfig *config.Config) *gin.Engine {
|
|
|
831
831
|
} else {
|
|
832
832
|
viewSub.style.display = 'block';
|
|
833
833
|
viewPub.style.display = 'none';
|
|
834
|
-
mqttConsole.innerHTML =
|
|
834
|
+
mqttConsole.innerHTML = 'Waiting for messages on ' + topic + '...\\n';
|
|
835
835
|
}
|
|
836
836
|
|
|
837
837
|
actionModal.style.display = 'flex';
|
|
@@ -918,12 +918,12 @@ func SetupRouter(appConfig *config.Config) *gin.Engine {
|
|
|
918
918
|
tbody.innerHTML = '<tr><td colspan="4" style="text-align: center; color: #888;">No data available</td></tr>';
|
|
919
919
|
} else {
|
|
920
920
|
endpoints.forEach(([path, stats]) => {
|
|
921
|
-
tbody.innerHTML +=
|
|
922
|
-
<td style="font-family: monospace; font-weight: bold;"
|
|
923
|
-
<td
|
|
924
|
-
<td
|
|
925
|
-
<td
|
|
926
|
-
</tr
|
|
921
|
+
tbody.innerHTML += '<tr>' +
|
|
922
|
+
'<td style="font-family: monospace; font-weight: bold;">' + path + '</td>' +
|
|
923
|
+
'<td>' + stats.count + '</td>' +
|
|
924
|
+
'<td>' + stats.mean_time_ms.toFixed(2) + ' ms</td>' +
|
|
925
|
+
'<td>' + stats.max_time_ms.toFixed(2) + ' ms</td>' +
|
|
926
|
+
'</tr>';
|
|
927
927
|
});
|
|
928
928
|
}
|
|
929
929
|
|
|
@@ -993,7 +993,7 @@ func SetupRouter(appConfig *config.Config) *gin.Engine {
|
|
|
993
993
|
brokerStatus.style.color = "#2ecc71";
|
|
994
994
|
if (actionTitle.innerText === 'SUBSCRIBE') {
|
|
995
995
|
mqttClient.subscribe(currentTopic, (err) => {
|
|
996
|
-
if(!err) mqttConsole.innerHTML +=
|
|
996
|
+
if(!err) mqttConsole.innerHTML += 'Subscribed to ' + currentTopic + '\\n';
|
|
997
997
|
});
|
|
998
998
|
}
|
|
999
999
|
});
|
|
@@ -1003,7 +1003,7 @@ func SetupRouter(appConfig *config.Config) *gin.Engine {
|
|
|
1003
1003
|
const time = new Date().toLocaleTimeString();
|
|
1004
1004
|
let msgStr = message.toString();
|
|
1005
1005
|
try { msgStr = JSON.stringify(JSON.parse(msgStr), null, 2); } catch(e){}
|
|
1006
|
-
mqttConsole.innerHTML +=
|
|
1006
|
+
mqttConsole.innerHTML += '\\n<span style="color:#888">[' + time + ']</span>\\n' + msgStr + '\\n';
|
|
1007
1007
|
mqttConsole.scrollTop = mqttConsole.scrollHeight;
|
|
1008
1008
|
}
|
|
1009
1009
|
});
|
|
@@ -1060,9 +1060,9 @@ func SetupRouter(appConfig *config.Config) *gin.Engine {
|
|
|
1060
1060
|
const isSend = /patch|put|post|create|update/i.test(topic);
|
|
1061
1061
|
const btnLabel = isSend ? "SEND" : "SUBSCRIBE";
|
|
1062
1062
|
const btnColor = isSend ? "#e74c3c" : "#3498db";
|
|
1063
|
-
btnHtml =
|
|
1063
|
+
btnHtml = ' <button class="mqtt-action-btn" style="background:' + btnColor + '" onclick="openMqttAction(\\'' + topic + '\\', \\'' + btnLabel + '\\')">' + btnLabel + '</button>';
|
|
1064
1064
|
}
|
|
1065
|
-
return
|
|
1065
|
+
return '"' + topic + '"' + punct + btnHtml;
|
|
1066
1066
|
}
|
|
1067
1067
|
return match;
|
|
1068
1068
|
});
|