design and socket fix

This commit is contained in:
assada 2023-07-04 22:11:39 +03:00
parent 4f918298e3
commit 41d60e5019
Signed by: assada
GPG Key ID: 8905E8CE5CC3000D
2 changed files with 47 additions and 26 deletions

View File

@ -22,6 +22,10 @@
padding: 0;
margin-left: 20px;
}
#app > .notification {
border: none;
}
</style>
</head>
<body>
@ -31,41 +35,55 @@
неРадіоактивна ситуація в Києві.
</h1>
<h2 class="subtitle">В реальному часі.</h2>
<div class="notification is-warning">
Використовуйте ландшавтну орієнтацію екрану для зручного перегляду. Або планшет чи компьютер.
</div>
<div id="app">
<div>
<apexchart type="bar" height="350" :options="spectrumChartOptions" :series="spectrum_series"></apexchart>
<div>
<fieldset>
<input type="checkbox" id="spectrum_x_accum" v-model="spectrum_accum">
<label for="spectrum_x_accum">Акумульований</label>
</fieldset>
<fieldset>
<input type="radio" id="spectrum_x_channel" v-bind:value="false" v-model="spectrum_energy">
<label for="spectrum_x_channel">Канал</label>
<input type="radio" id="spectrum_x_energy" v-bind:value="true" v-model="spectrum_energy">
<label for="spectrum_x_energy">Енергія</label>
</fieldset>
<fieldset>
<input type="radio" id="spectrum_linear" v-bind:value="false" v-model="spectrum_logarithmic">
<label for="spectrum_linear">Лінійне</label>
<input type="radio" id="spectrum_log" v-bind:value="true" v-model="spectrum_logarithmic">
<label for="spectrum_log">Логарифмічне</label>
</fieldset>
</div>
<button @click="updateSpectrum">Оновити спектр</button>
</div>
<div>
<apexchart type="line" height="350" :options="ratesChartOptions" :series="rates_series"></apexchart>
<button @click="rates_autoupdate = !rates_autoupdate">Автооновлення: {{ rates_autoupdate ? "ВКЛ" : "ВИКЛ" }}</button>
<button @click="rates_autoupdate = !rates_autoupdate" class="button">Автооновлення: {{ rates_autoupdate ? "ВКЛ" : "ВИКЛ" }}</button>
</div>
<div class="notification">
<strong>До 0,3 мк3в/г - нормальний радіаційний фон.</strong>
<p>
Швидкість дози в мікрозівертах на годину вказує, скільки мікрозівертів (одиниця виміру еквівалентної дози) радіації поглинається організмом або матеріалом за одну годину. Ця величина може використовуватися для оцінки рівня радіаційного впливу на людей, а також для моніторингу і контролю радіаційної безпеки в радіаційних зонах, ядерних установках або природному середовищі.
</p>
<p>
Наприклад, якщо швидкість дози становить 10 μSv/h, це означає, що організм або матеріал отримує дозу 10 мікрозівертів радіації за кожну годину. Це може вказувати на наявність джерела радіації в цьому місці або на необхідність заходів з радіаційного захисту.
</p>
</div>
<div>
<apexchart type="bar" height="350" :options="spectrumChartOptions" :series="spectrum_series"></apexchart>
<div>
<fieldset>
<label class="checkbox" for="spectrum_x_accum"><input type="checkbox" id="spectrum_x_accum" v-model="spectrum_accum"> Акумульований</label>
</fieldset>
<fieldset class="control">
<label class="radio" for="spectrum_x_channel"><input type="radio" id="spectrum_x_channel" v-bind:value="false" v-model="spectrum_energy"> Канал</label>
<label class="radio" for="spectrum_x_energy"><input type="radio" id="spectrum_x_energy" v-bind:value="true" v-model="spectrum_energy"> Енергія</label>
</fieldset>
<fieldset class="control">
<label class="radio" for="spectrum_linear"><input type="radio" id="spectrum_linear" v-bind:value="false" v-model="spectrum_logarithmic"> Лінійне</label>
<label class="radio" for="spectrum_log"><input type="radio" id="spectrum_log" v-bind:value="true" v-model="spectrum_logarithmic"> Логарифмічне</label>
</fieldset>
</div>
<button @click="updateSpectrum" class="button">Оновити спектр</button>
</div>
</div>
<h2 class="subtitle">(Частина проекту <a href="https://dead.guru/">dead.guru</a>)</h2>
</div>
</section>
<script>
const common_options = {
chart: {
animations: {enabled: false},
animations: {enabled: false},
zoom: {autoScaleYaxis: true},
},
tooltip: {intersect: false},

View File

@ -77,7 +77,10 @@ async def process(app):
},
)
print(f'Rates updated, sending to {len(app.ws_clients)} connected clients')
await asyncio.gather(*[ws.send_str(jdata) for ws in app.ws_clients], asyncio.sleep(1.0))
try:
await asyncio.gather(*[ws.send_str(jdata) for ws in app.ws_clients], asyncio.sleep(1.0))
except Exception as e:
print(f'Error while sending to websocket: {e}')
async def on_startup(app):