change consumers

This commit is contained in:
wh1te909 2021-04-04 01:59:06 +00:00
parent 7e7d272b06
commit a0c8a1ee65
2 changed files with 1 additions and 11 deletions

View File

@ -5,7 +5,6 @@ from channels.generic.websocket import AsyncJsonWebsocketConsumer
from django.conf import settings from django.conf import settings
from django.contrib.auth.models import AnonymousUser from django.contrib.auth.models import AnonymousUser
from accounts.models import User
from agents.models import Agent from agents.models import Agent
@ -62,15 +61,8 @@ class DashInfo(AsyncJsonWebsocketConsumer):
] ]
) )
user = User.objects.get(pk=self.user.pk)
ret = { ret = {
"trmm_version": settings.TRMM_VERSION, "trmm_version": settings.TRMM_VERSION,
"client_tree_sort": user.client_tree_sort,
"default_agent_tbl_tab": user.default_agent_tbl_tab,
"dbl_click_action": user.agent_dblclick_action,
"dark_mode": user.dark_mode,
"show_community_scripts": user.show_community_scripts,
"total_server_offline_count": server_offline_count, "total_server_offline_count": server_offline_count,
"total_workstation_offline_count": workstation_offline_count, "total_workstation_offline_count": workstation_offline_count,
"total_server_count": Agent.objects.filter( "total_server_count": Agent.objects.filter(
@ -86,4 +78,4 @@ class DashInfo(AsyncJsonWebsocketConsumer):
while self.connected: while self.connected:
c = await self.get_dashboard_info() c = await self.get_dashboard_info()
await self.send_json(c) await self.send_json(c)
await asyncio.sleep(1) await asyncio.sleep(30)

View File

@ -547,8 +547,6 @@ export default {
}; };
this.ws.onmessage = e => { this.ws.onmessage = e => {
const data = JSON.parse(e.data); const data = JSON.parse(e.data);
this.darkMode = data.dark_mode;
this.$q.dark.set(this.darkMode);
this.currentTRMMVersion = data.trmm_version; this.currentTRMMVersion = data.trmm_version;
this.serverCount = data.total_server_count; this.serverCount = data.total_server_count;
this.serverOfflineCount = data.total_server_offline_count; this.serverOfflineCount = data.total_server_offline_count;