tangram-system 0.2.1__py3-none-any.whl → 0.4.1__py3-none-any.whl
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.
- tangram_system/SystemWidget.vue +6 -2
- tangram_system/__init__.py +13 -6
- tangram_system/dist-frontend/index.css +1 -1
- tangram_system/dist-frontend/index.js +6 -6
- tangram_system/dist-frontend/index.js.map +1 -1
- tangram_system/package.json +2 -2
- {tangram_system-0.2.1.dist-info → tangram_system-0.4.1.dist-info}/METADATA +2 -2
- tangram_system-0.4.1.dist-info/RECORD +12 -0
- tangram_system-0.2.1.dist-info/RECORD +0 -12
- {tangram_system-0.2.1.dist-info → tangram_system-0.4.1.dist-info}/WHEEL +0 -0
- {tangram_system-0.2.1.dist-info → tangram_system-0.4.1.dist-info}/entry_points.txt +0 -0
tangram_system/SystemWidget.vue
CHANGED
|
@@ -68,16 +68,20 @@ const local_time = computed(() => {
|
|
|
68
68
|
|
|
69
69
|
<style scoped>
|
|
70
70
|
#uptime {
|
|
71
|
-
color:
|
|
71
|
+
color: var(--t-muted);
|
|
72
72
|
font-size: 9pt;
|
|
73
73
|
text-align: center;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
.clock {
|
|
77
|
+
color: var(--t-fg);
|
|
78
|
+
}
|
|
79
|
+
|
|
76
80
|
.system-widget {
|
|
77
81
|
display: flex;
|
|
78
82
|
flex-direction: column;
|
|
79
83
|
align-items: center;
|
|
80
84
|
padding: 1px;
|
|
81
|
-
border-bottom: 1px solid
|
|
85
|
+
border-bottom: 1px solid var(--t-border);
|
|
82
86
|
}
|
|
83
87
|
</style>
|
tangram_system/__init__.py
CHANGED
|
@@ -2,25 +2,29 @@ import asyncio
|
|
|
2
2
|
import logging
|
|
3
3
|
from dataclasses import dataclass
|
|
4
4
|
from datetime import datetime, timedelta, timezone
|
|
5
|
-
from typing import
|
|
5
|
+
from typing import Annotated, NoReturn
|
|
6
6
|
|
|
7
7
|
import orjson
|
|
8
8
|
import psutil
|
|
9
9
|
import redis.asyncio as redis
|
|
10
10
|
import tangram_core
|
|
11
|
+
from tangram_core.config import FrontendMutable
|
|
11
12
|
|
|
12
13
|
log = logging.getLogger(__name__)
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
@dataclass
|
|
16
|
-
class SystemConfig
|
|
17
|
+
class SystemConfig:
|
|
17
18
|
topbar_order: int = 0
|
|
18
19
|
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
@dataclass
|
|
22
|
+
class SystemFrontendConfig(tangram_core.config.HasTopbarUiConfig):
|
|
23
|
+
topbar_order: Annotated[int, FrontendMutable()]
|
|
24
|
+
|
|
22
25
|
|
|
23
|
-
|
|
26
|
+
def into_frontend(config: SystemConfig) -> SystemFrontendConfig:
|
|
27
|
+
return SystemFrontendConfig(topbar_order=config.topbar_order)
|
|
24
28
|
|
|
25
29
|
|
|
26
30
|
def uptime(counter: int) -> dict[str, str]:
|
|
@@ -72,7 +76,10 @@ async def server_events(redis_client: redis.Redis) -> NoReturn:
|
|
|
72
76
|
|
|
73
77
|
|
|
74
78
|
plugin = tangram_core.Plugin(
|
|
75
|
-
frontend_path="dist-frontend",
|
|
79
|
+
frontend_path="dist-frontend",
|
|
80
|
+
config_class=SystemConfig,
|
|
81
|
+
frontend_config_class=SystemFrontendConfig,
|
|
82
|
+
into_frontend_config_function=into_frontend,
|
|
76
83
|
)
|
|
77
84
|
|
|
78
85
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
#uptime[data-v-
|
|
1
|
+
#uptime[data-v-dc11558d]{color:var(--t-muted);font-size:9pt;text-align:center}.clock[data-v-dc11558d]{color:var(--t-fg)}.system-widget[data-v-dc11558d]{display:flex;flex-direction:column;align-items:center;padding:1px;border-bottom:1px solid var(--t-border)}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as l, inject as _, reactive as g, onMounted as f, onUnmounted as v, computed as
|
|
1
|
+
import { defineComponent as l, inject as _, reactive as g, onMounted as f, onUnmounted as v, computed as d, createElementBlock as S, openBlock as h, createElementVNode as c, toDisplayString as u } from "vue";
|
|
2
2
|
const w = { class: "system-widget" }, y = { id: "info_time" }, b = { id: "uptime" }, T = /* @__PURE__ */ l({
|
|
3
3
|
__name: "SystemWidget",
|
|
4
4
|
setup(s) {
|
|
@@ -25,10 +25,10 @@ const w = { class: "system-widget" }, y = { id: "info_time" }, b = { id: "uptime
|
|
|
25
25
|
}), v(() => {
|
|
26
26
|
i?.dispose();
|
|
27
27
|
});
|
|
28
|
-
const r =
|
|
28
|
+
const r = d(() => {
|
|
29
29
|
const t = new Date(e.info_utc), n = t.getUTCHours().toString().padStart(2, "0"), a = t.getUTCMinutes().toString().padStart(2, "0"), p = t.getUTCSeconds().toString().padStart(2, "0");
|
|
30
30
|
return `${n}:${a}:${p} Z`;
|
|
31
|
-
}), m =
|
|
31
|
+
}), m = d(() => new Date(e.info_utc).toLocaleTimeString([], {
|
|
32
32
|
hour: "2-digit",
|
|
33
33
|
minute: "2-digit",
|
|
34
34
|
second: "2-digit",
|
|
@@ -41,9 +41,9 @@ const w = { class: "system-widget" }, y = { id: "info_time" }, b = { id: "uptime
|
|
|
41
41
|
onMouseover: n[0] || (n[0] = (a) => e.hovered = !0),
|
|
42
42
|
onMouseleave: n[1] || (n[1] = (a) => e.hovered = !1)
|
|
43
43
|
}, [
|
|
44
|
-
c("span", y,
|
|
44
|
+
c("span", y, u(e.hovered ? m.value : r.value), 1)
|
|
45
45
|
], 32),
|
|
46
|
-
c("span", b,
|
|
46
|
+
c("span", b, u(e.uptime), 1)
|
|
47
47
|
]));
|
|
48
48
|
}
|
|
49
49
|
}), $ = (s, o) => {
|
|
@@ -51,7 +51,7 @@ const w = { class: "system-widget" }, y = { id: "info_time" }, b = { id: "uptime
|
|
|
51
51
|
for (const [i, r] of o)
|
|
52
52
|
e[i] = r;
|
|
53
53
|
return e;
|
|
54
|
-
}, k = /* @__PURE__ */ $(T, [["__scopeId", "data-v-
|
|
54
|
+
}, k = /* @__PURE__ */ $(T, [["__scopeId", "data-v-dc11558d"]]);
|
|
55
55
|
function D(s, o) {
|
|
56
56
|
s.ui.registerWidget("system-widget", "TopBar", k, {
|
|
57
57
|
priority: o?.topbar_order
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/tangram_system/SystemWidget.vue","../src/tangram_system/index.ts"],"sourcesContent":["<template>\n <div class=\"system-widget\">\n <div\n class=\"clock\"\n @mouseover=\"state.hovered = true\"\n @mouseleave=\"state.hovered = false\"\n >\n <span id=\"info_time\">{{ state.hovered ? local_time : utc_time }}</span>\n </div>\n <span id=\"uptime\">{{ state.uptime }}</span>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { reactive, computed, inject, onMounted, onUnmounted } from \"vue\";\nimport type { TangramApi, Disposable } from \"@open-aviation/tangram-core/api\";\n\nconst tangramApi = inject<TangramApi>(\"tangramApi\");\nif (!tangramApi) {\n throw new Error(\"assert: tangram api not provided\");\n}\n\nconst state = reactive({\n hovered: false,\n uptime: \"\",\n info_utc: new Date().getTime()\n});\n\nlet subscription: Disposable | null = null;\n\nonMounted(async () => {\n try {\n subscription = await tangramApi.realtime.subscribe(\n \"system:update-node\",\n (payload: { el: string; value: string | number }) => {\n if (payload.el === \"uptime\") state.uptime = payload.value as string;\n if (payload.el === \"info_utc\") state.info_utc = payload.value as number;\n }\n );\n } catch (e) {\n console.error(\"failed to subscribe to system:update-node\", e);\n }\n});\n\nonUnmounted(() => {\n subscription?.dispose();\n});\n\nconst utc_time = computed(() => {\n const date = new Date(state.info_utc);\n const hours = date.getUTCHours().toString().padStart(2, \"0\");\n const minutes = date.getUTCMinutes().toString().padStart(2, \"0\");\n const seconds = date.getUTCSeconds().toString().padStart(2, \"0\");\n return `${hours}:${minutes}:${seconds} Z`;\n});\n\nconst local_time = computed(() => {\n const date = new Date(state.info_utc);\n return date.toLocaleTimeString([], {\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n hour12: false,\n timeZoneName: \"shortOffset\"\n });\n});\n</script>\n\n<style scoped>\n#uptime {\n color:
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/tangram_system/SystemWidget.vue","../src/tangram_system/index.ts"],"sourcesContent":["<template>\n <div class=\"system-widget\">\n <div\n class=\"clock\"\n @mouseover=\"state.hovered = true\"\n @mouseleave=\"state.hovered = false\"\n >\n <span id=\"info_time\">{{ state.hovered ? local_time : utc_time }}</span>\n </div>\n <span id=\"uptime\">{{ state.uptime }}</span>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { reactive, computed, inject, onMounted, onUnmounted } from \"vue\";\nimport type { TangramApi, Disposable } from \"@open-aviation/tangram-core/api\";\n\nconst tangramApi = inject<TangramApi>(\"tangramApi\");\nif (!tangramApi) {\n throw new Error(\"assert: tangram api not provided\");\n}\n\nconst state = reactive({\n hovered: false,\n uptime: \"\",\n info_utc: new Date().getTime()\n});\n\nlet subscription: Disposable | null = null;\n\nonMounted(async () => {\n try {\n subscription = await tangramApi.realtime.subscribe(\n \"system:update-node\",\n (payload: { el: string; value: string | number }) => {\n if (payload.el === \"uptime\") state.uptime = payload.value as string;\n if (payload.el === \"info_utc\") state.info_utc = payload.value as number;\n }\n );\n } catch (e) {\n console.error(\"failed to subscribe to system:update-node\", e);\n }\n});\n\nonUnmounted(() => {\n subscription?.dispose();\n});\n\nconst utc_time = computed(() => {\n const date = new Date(state.info_utc);\n const hours = date.getUTCHours().toString().padStart(2, \"0\");\n const minutes = date.getUTCMinutes().toString().padStart(2, \"0\");\n const seconds = date.getUTCSeconds().toString().padStart(2, \"0\");\n return `${hours}:${minutes}:${seconds} Z`;\n});\n\nconst local_time = computed(() => {\n const date = new Date(state.info_utc);\n return date.toLocaleTimeString([], {\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n hour12: false,\n timeZoneName: \"shortOffset\"\n });\n});\n</script>\n\n<style scoped>\n#uptime {\n color: var(--t-muted);\n font-size: 9pt;\n text-align: center;\n}\n\n.clock {\n color: var(--t-fg);\n}\n\n.system-widget {\n display: flex;\n flex-direction: column;\n align-items: center;\n padding: 1px;\n border-bottom: 1px solid var(--t-border);\n}\n</style>\n","import type { TangramApi } from \"@open-aviation/tangram-core/api\";\nimport SystemWidget from \"./SystemWidget.vue\";\n\ninterface SystemConfig {\n topbar_order: number;\n}\n\nexport function install(api: TangramApi, config?: SystemConfig) {\n api.ui.registerWidget(\"system-widget\", \"TopBar\", SystemWidget, {\n priority: config?.topbar_order\n });\n}\n"],"names":["tangramApi","inject","state","reactive","subscription","onMounted","payload","e","onUnmounted","utc_time","computed","date","hours","minutes","seconds","local_time","_openBlock","_createElementBlock","_hoisted_1","_createElementVNode","_cache","$event","_hoisted_2","_toDisplayString","_hoisted_3","install","api","config","SystemWidget"],"mappings":";;;;AAiBA,UAAMA,IAAaC,EAAmB,YAAY;AAClD,QAAI,CAACD;AACH,YAAM,IAAI,MAAM,kCAAkC;AAGpD,UAAME,IAAQC,EAAS;AAAA,MACrB,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,WAAU,oBAAI,KAAA,GAAO,QAAA;AAAA,IAAQ,CAC9B;AAED,QAAIC,IAAkC;AAEtC,IAAAC,EAAU,YAAY;AACpB,UAAI;AACF,QAAAD,IAAe,MAAMJ,EAAW,SAAS;AAAA,UACvC;AAAA,UACA,CAACM,MAAoD;AACnD,YAAIA,EAAQ,OAAO,aAAUJ,EAAM,SAASI,EAAQ,QAChDA,EAAQ,OAAO,eAAYJ,EAAM,WAAWI,EAAQ;AAAA,UAC1D;AAAA,QAAA;AAAA,MAEJ,SAASC,GAAG;AACV,gBAAQ,MAAM,6CAA6CA,CAAC;AAAA,MAC9D;AAAA,IACF,CAAC,GAEDC,EAAY,MAAM;AAChB,MAAAJ,GAAc,QAAA;AAAA,IAChB,CAAC;AAED,UAAMK,IAAWC,EAAS,MAAM;AAC9B,YAAMC,IAAO,IAAI,KAAKT,EAAM,QAAQ,GAC9BU,IAAQD,EAAK,YAAA,EAAc,WAAW,SAAS,GAAG,GAAG,GACrDE,IAAUF,EAAK,cAAA,EAAgB,WAAW,SAAS,GAAG,GAAG,GACzDG,IAAUH,EAAK,cAAA,EAAgB,WAAW,SAAS,GAAG,GAAG;AAC/D,aAAO,GAAGC,CAAK,IAAIC,CAAO,IAAIC,CAAO;AAAA,IACvC,CAAC,GAEKC,IAAaL,EAAS,MACb,IAAI,KAAKR,EAAM,QAAQ,EACxB,mBAAmB,IAAI;AAAA,MACjC,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,cAAc;AAAA,IAAA,CACf,CACF;sBAhECc,EAAA,GAAAC,EASM,OATNC,GASM;AAAA,MARJC,EAMM,OAAA;AAAA,QALJ,OAAM;AAAA,QACL,aAASC,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAAC,MAAEnB,EAAM,UAAO;AAAA,QACxB,cAAUkB,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAAC,MAAEnB,EAAM,UAAO;AAAA,MAAA;QAE1BiB,EAAuE,QAAvEG,GAAuEC,EAA/CrB,EAAM,UAAUa,EAAA,QAAaN,EAAA,KAAQ,GAAA,CAAA;AAAA,MAAA;MAE/DU,EAA2C,QAA3CK,GAA2CD,EAAtBrB,EAAM,MAAM,GAAA,CAAA;AAAA,IAAA;;;;;;;;ACF9B,SAASuB,EAAQC,GAAiBC,GAAuB;AAC9D,EAAAD,EAAI,GAAG,eAAe,iBAAiB,UAAUE,GAAc;AAAA,IAC7D,UAAUD,GAAQ;AAAA,EAAA,CACnB;AACH;"}
|
tangram_system/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-aviation/tangram-system",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/tangram_system/index.ts",
|
|
@@ -11,6 +11,6 @@
|
|
|
11
11
|
"@open-aviation/tangram-core": "workspace:*"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"vue": "^3.5.
|
|
14
|
+
"vue": "^3.5.27"
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tangram_system
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.1
|
|
4
4
|
Summary: System monitoring plugin for tangram
|
|
5
5
|
Author-email: Xavier Olive <git@xoolive.org>, Junzi Sun <git@junzis.com>
|
|
6
6
|
License-Expression: AGPL-3.0
|
|
@@ -16,7 +16,7 @@ Classifier: Programming Language :: Python :: 3.14
|
|
|
16
16
|
Classifier: Topic :: System :: Monitoring
|
|
17
17
|
Requires-Python: >=3.10
|
|
18
18
|
Requires-Dist: psutil
|
|
19
|
-
Requires-Dist: tangram-core>=0.2.
|
|
19
|
+
Requires-Dist: tangram-core>=0.2.1
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
|
|
22
22
|
# tangram_system
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
tangram_system/SystemWidget.vue,sha256=HnUMBAzgKcMfpSFEt7-4NHBy2WAnw_RXXmk8ozmbmGM,2121
|
|
2
|
+
tangram_system/__init__.py,sha256=o3rNHiJoVBHwz45kGMSPbslq-BM55i6KVq2yMDwF-qs,2432
|
|
3
|
+
tangram_system/index.ts,sha256=COqiA9ro0jHvdtigahKbZ75SoApJtbV24vaakeNVXKI,343
|
|
4
|
+
tangram_system/dist-frontend/index.css,sha256=72FUxkp_PiCXE5A08YqcDMV4Ui_ei42tnkc8v67F7ls,259
|
|
5
|
+
tangram_system/dist-frontend/index.js,sha256=vsiBVDa1khsf7GEZo7imM6MA0daSd3gSl3iN-sVQcyQ,2108
|
|
6
|
+
tangram_system/dist-frontend/index.js.map,sha256=KeooVHix935GDpYmL75Pa1Epup9pPmIz5JFn0JmxEqY,4585
|
|
7
|
+
tangram_system/dist-frontend/plugin.json,sha256=f9ITIfSjnW0OhcoQa6pp3HgxSLxDszLCLiZ6H2coz9A,91
|
|
8
|
+
tangram_system/package.json,sha256=dcu23XOsd7ySYj6q60CFMGMZvbHDPDEhIcJakIMC1Xg,316
|
|
9
|
+
tangram_system-0.4.1.dist-info/METADATA,sha256=SUmpn3N4lE2yqrR7OHatGI8BSHxhI2-o35RmgCdldXs,1478
|
|
10
|
+
tangram_system-0.4.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
11
|
+
tangram_system-0.4.1.dist-info/entry_points.txt,sha256=lC7Uu8HPLHLg2ULa0lh2SWTN2qt_LrPFUrcqVL4heZk,62
|
|
12
|
+
tangram_system-0.4.1.dist-info/RECORD,,
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
tangram_system/SystemWidget.vue,sha256=A1eZIibTmmrCyPdmqtcJi60dArSg4qYw6Mn76Iw2rgE,2069
|
|
2
|
-
tangram_system/__init__.py,sha256=CJqn9VUAirPI8jOXCI1Lk3GR9FIgNhGF6if5yfsR3Wk,2245
|
|
3
|
-
tangram_system/index.ts,sha256=COqiA9ro0jHvdtigahKbZ75SoApJtbV24vaakeNVXKI,343
|
|
4
|
-
tangram_system/dist-frontend/index.css,sha256=Ck5orxty4qPRwI417S1V8NU7Xw606jMQZqdSf0bqgmk,199
|
|
5
|
-
tangram_system/dist-frontend/index.js,sha256=4d3jbhcLv9pwDophIF8UvD6Z8Si3wtTcV5HIh_sEKKk,2108
|
|
6
|
-
tangram_system/dist-frontend/index.js.map,sha256=8HSWZ_rCKEyo8HsqiPCqbGbCyAxvqDTTGjXOmp3R0nw,4529
|
|
7
|
-
tangram_system/dist-frontend/plugin.json,sha256=f9ITIfSjnW0OhcoQa6pp3HgxSLxDszLCLiZ6H2coz9A,91
|
|
8
|
-
tangram_system/package.json,sha256=zT1MUNUIYT1SqAtG8Kq70Gb9To8xT2kHIV4EwoB2MnM,316
|
|
9
|
-
tangram_system-0.2.1.dist-info/METADATA,sha256=m3IlhvIETh0ns9gBzD8VUWCc7AUjQh-tg6IDdJ0Jz1I,1478
|
|
10
|
-
tangram_system-0.2.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
11
|
-
tangram_system-0.2.1.dist-info/entry_points.txt,sha256=lC7Uu8HPLHLg2ULa0lh2SWTN2qt_LrPFUrcqVL4heZk,62
|
|
12
|
-
tangram_system-0.2.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|