mirror of
https://github.com/sergeyyarkov/modbus-logger.git
synced 2026-10-11 10:28:51 +03:00
594 lines
30 KiB
HTML
594 lines
30 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Modbus Logger App</title>
|
|
<link rel="stylesheet" href="/css/dist.css" />
|
|
<link rel="stylesheet" href="/css/dygraphs.css" />
|
|
<script defer src="/js/dygraphs.min.js"></script>
|
|
<script defer type="module" src="/js/app.js"></script>
|
|
</head>
|
|
<body>
|
|
<!-- <div class="border p-4" x-data>
|
|
<span>app state:</span>
|
|
<pre x-text="JSON.stringify($store.app, undefined, 2)"></pre>
|
|
</div> -->
|
|
|
|
<!-- Root element -->
|
|
<div x-data class="mx-auto max-w-5xl flex flex-col h-screen px-2.5">
|
|
<!-- Monitoring content -->
|
|
<template x-if="$store.app.currentPage === 'monitoring'">
|
|
<main x-data="monitoringPage" class="flex-1" x-bind:hidden="$store.app.currentPage !== 'monitoring'">
|
|
<div class="flex h-full flex-row space-x-2">
|
|
<div class="border-r min-w-[256px] p-2.5 pl-0 pt-5">
|
|
<div class="flex flex-col space-y-1">
|
|
<!-- List of devices -->
|
|
<span class="italic text-sm">Devices:</span>
|
|
<span x-show="devices.length === 0" class="text-gray-500 text-sm text-center block">
|
|
No devices added.
|
|
</span>
|
|
<div
|
|
@add-device.window="devices = [...devices, $event.detail];"
|
|
class="flex flex-col max-h-[400px] overflow-y-auto space-y-2"
|
|
>
|
|
<template x-for="device in devices" :key="device.id">
|
|
<button
|
|
@click="selectDevice(device)"
|
|
:class="{'bg-gray-100': selectedDevice?.id === device.id}"
|
|
class="w-full min-h-[50px] select-none border px-2.5 py-3 text-left rounded-sm hover:bg-gray-100 cursor-pointer"
|
|
>
|
|
<span x-text="device.name" class="text-md font-bold"></span>
|
|
</button>
|
|
</template>
|
|
</div>
|
|
<!-- MODAL: Create new device -->
|
|
<template x-teleport="body">
|
|
<div
|
|
x-data="deviceModal"
|
|
@open-create-device-modal.window="open()"
|
|
@keyup.escape.window="close()"
|
|
class="backdrop z-50"
|
|
x-show="isOpen"
|
|
>
|
|
<div class="modal">
|
|
<div class="flex justify-between items-center">
|
|
<h2 class="font-bold text-lg">Create new device</h2>
|
|
<button @click="close()" aria-label="Close">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
|
<path
|
|
fill="currentColor"
|
|
d="M6.4 19L5 17.6l5.6-5.6L5 6.4L6.4 5l5.6 5.6L17.6 5L19 6.4L13.4 12l5.6 5.6l-1.4 1.4l-5.6-5.6L6.4 19Z"
|
|
/>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
<hr />
|
|
<form @submit.prevent="create(() => graphView = 'none')" action="#">
|
|
<div
|
|
x-id="['id', 'name', 'graph-display', 'g_display_reg_addr', 'g_display_reg_format', 'g_y_label', 'is_logging']"
|
|
class="flex flex-col space-y-2"
|
|
>
|
|
<div>
|
|
<label :for="$id('id')"><span class="text-red-500">*</span>Slave ID:</label>
|
|
<input
|
|
x-model.number="data.id"
|
|
:id="$id('id')"
|
|
name="id"
|
|
placeholder="1"
|
|
type="number"
|
|
min="1"
|
|
max="255"
|
|
required
|
|
/>
|
|
</div>
|
|
<div>
|
|
<label :for="$id('name')"><span class="text-red-500">*</span>Name:</label>
|
|
<input
|
|
x-model="data.name"
|
|
placeholder="Device #1"
|
|
:id="$id('name')"
|
|
name="name"
|
|
type="text"
|
|
required
|
|
/>
|
|
</div>
|
|
<div>
|
|
<label :for="$id('graph-display')">Graph Display</label>
|
|
<select x-model="graphView" :id="$id('graph-display')">
|
|
<option value="none">None</option>
|
|
<option value="new-value">New value</option>
|
|
</select>
|
|
</div>
|
|
<div x-show="graphView === 'new-value'">
|
|
<div>
|
|
<label :for="$id('g_y_label')"><span class="text-red-500">*</span>Value name:</label>
|
|
<input
|
|
x-model="data.g_y_label"
|
|
:id="$id('g_y_label')"
|
|
:required="graphView === 'new-value'"
|
|
name="g_y_label"
|
|
placeholder="PV"
|
|
type="text"
|
|
/>
|
|
</div>
|
|
<div>
|
|
<label :for="$id('g_display_reg_addr')"
|
|
><span class="text-red-500">*</span>Register address:</label
|
|
>
|
|
<input
|
|
x-model="data.g_display_reg_addr"
|
|
:id="$id('g_display_reg_addr')"
|
|
name="g_display_reg_addr"
|
|
placeholder="1"
|
|
type="number"
|
|
min="0"
|
|
max="65534"
|
|
:required="graphView === 'new-value'"
|
|
/>
|
|
</div>
|
|
<div>
|
|
<label :for="$id('g_display_reg_type')"
|
|
><span class="text-red-500">*</span>Registers type:</label
|
|
>
|
|
<select
|
|
x-model="data.g_display_reg_type"
|
|
:id="$id('g_display_reg_type')"
|
|
name="g_display_reg_type"
|
|
:required="graphView === 'new-value'"
|
|
>
|
|
<option value="IR">Input Registers</option>
|
|
<option value="HR">Holding Registers</option>
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label :for="$id('g_display_reg_format')"
|
|
><span class="text-red-500">*</span>Format (type):</label
|
|
>
|
|
<select
|
|
x-model="data.g_display_reg_format"
|
|
:id="$id('g_display_reg_format')"
|
|
name="g_display_reg_format"
|
|
:required="graphView === 'new-value'"
|
|
>
|
|
<option value="UI16">Unsigned Int 16</option>
|
|
<option value="I16">Signed Int 16</option>
|
|
<option value="UI32">Unsigned Int 32</option>
|
|
<option value="I32">Signed Int 32</option>
|
|
<option value="FP32">Floating Point 32</option>
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<input
|
|
x-model="data.is_logging"
|
|
:id="$id('is_logging')"
|
|
name="is_logging"
|
|
type="checkbox"
|
|
/>
|
|
<label :for="$id('is_logging')">Logging</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<span x-text="error?.message" class="text-red-500"></span>
|
|
</div>
|
|
<div class="mt-4 flex justify-end space-x-2">
|
|
<button
|
|
x-bind:disabled="isLoading"
|
|
x-bind:class="isLoading && 'opacity-70'"
|
|
type="submit"
|
|
class="btn"
|
|
>
|
|
Create
|
|
</button>
|
|
<button @click="close()" class="btn bg-red-500">Cancel</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<!-- Create new device -->
|
|
<button
|
|
@click="$dispatch('open-create-device-modal')"
|
|
class="w-full min-h-[50px] text-center border-2 border-dashed rounded-sm hover:bg-gray-50 cursor-pointer"
|
|
>
|
|
<span class="text-4xl text-gray-400 select-none">+</span>
|
|
</button>
|
|
</div>
|
|
<hr class="my-4" />
|
|
<!-- Connection -->
|
|
<div>
|
|
<span class="italic text-sm">Connection:</span>
|
|
<div class="flex flex-col mt-1.5">
|
|
<span class="text-sm">
|
|
Status:
|
|
<b x-show="$store.app.is_opened" class="text-green-700">Opened</b>
|
|
<b x-show="!$store.app.is_opened" class="text-red-700">Closed</b>
|
|
</span>
|
|
<a class="text-sm" @click="$store.app.setPage('configuration')" href="#"> Reconfigurate </a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="flex-auto pl-2">
|
|
<div x-show="selectedDevice != null">
|
|
<div class="pt-5 border-b flex flex-wrap justify-between items-center pr-6">
|
|
<div class="mb-2">
|
|
<h2 x-text="selectedDevice?.name" class="font-bold text-3xl my-2 mr-2"></h2>
|
|
<span>ID: <span x-text="selectedDevice?.id"></span></span>
|
|
</div>
|
|
<!-- Device create, delete buttons -->
|
|
<div>
|
|
<a href="#">Edit</a>
|
|
<a
|
|
@click="$dispatch('dialog', {
|
|
title: 'Remove device',
|
|
body: `Remove ${selectedDevice.name}? All logs will be cleared.`,
|
|
isOpen: true,
|
|
onConfirm: async () => await removeDevice(selectedDevice.id)
|
|
});"
|
|
class="text-red-500"
|
|
href="#"
|
|
>
|
|
Delete
|
|
</a>
|
|
</div>
|
|
</div>
|
|
<!-- Error message -->
|
|
<div>
|
|
<span class="text-red-500" x-text="error?.message"></span>
|
|
</div>
|
|
<!-- Display Graph -->
|
|
<div x-show="!isLoading && selectedDevice?.g_display_reg_addr !== null" class="mt-4">
|
|
<div id="div_g" style="width: 720px; height: 300px"></div>
|
|
<div class="flex justify-evenly space-x-2 mt-3">
|
|
<span class="italic text-sm"
|
|
>Value: <span class="font-bold" x-text="selectedDevice?.g_value"></span
|
|
></span>
|
|
<span class="italic text-sm">
|
|
Register: <span x-text="selectedDevice?.g_display_reg_addr"></span
|
|
></span>
|
|
<span class="italic text-sm"
|
|
>Format: <span x-text="selectedDevice?.g_display_reg_format"></span
|
|
></span>
|
|
<span class="italic text-sm"
|
|
>Register type: <span x-text="selectedDevice?.g_display_reg_type"></span
|
|
></span>
|
|
</div>
|
|
<hr class="my-3" />
|
|
</div>
|
|
<div x-show="isLoading" class="text-center flex justify-center items-center h-[300px]">
|
|
<div>
|
|
<div role="status">
|
|
<svg
|
|
aria-hidden="true"
|
|
class="inline w-20 h-20 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600"
|
|
viewBox="0 0 100 101"
|
|
fill="none"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
>
|
|
<path
|
|
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
|
|
fill="currentColor"
|
|
/>
|
|
<path
|
|
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
|
|
fill="currentFill"
|
|
/>
|
|
</svg>
|
|
</div>
|
|
<p class="mt-4">Loading...</p>
|
|
</div>
|
|
</div>
|
|
<!-- Display values -->
|
|
<div x-show="!isLoading">
|
|
<h2 class="text-xl font-bold mb-3 mt-5">Display values</h2>
|
|
<div class="mb-2">
|
|
<div class="grid grid-cols-1 md:sm:grid-cols-2 lg:sm:grid-cols-3 gap-2">
|
|
<template x-for="value in selectedDevice?.display_values" :key="value.id">
|
|
<div class="border-2 p-2.5 rounded-sm">
|
|
<div class="flex justify-between items-start">
|
|
<h3 x-text="value.name" class="text-lg font-bold"></h3>
|
|
<div class="flex">
|
|
<!-- Edit display value -->
|
|
<button>
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
|
<path
|
|
fill="#eab308"
|
|
d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a.996.996 0 0 0 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83l3.75 3.75l1.83-1.83z"
|
|
/>
|
|
</svg>
|
|
</button>
|
|
<!-- Remove display value -->
|
|
<button
|
|
@click="$dispatch('dialog', {
|
|
title: 'Remove display value',
|
|
body: `Remove display value ${value.name}?`,
|
|
isOpen: true,
|
|
onConfirm: async () => await removeDisplayValue(value.id)
|
|
});"
|
|
>
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
|
<path
|
|
fill="#ef4444"
|
|
d="m9.4 16.5l2.6-2.6l2.6 2.6l1.4-1.4l-2.6-2.6L16 9.9l-1.4-1.4l-2.6 2.6l-2.6-2.6L8 9.9l2.6 2.6L8 15.1l1.4 1.4ZM5 21V6H4V4h5V3h6v1h5v2h-1v15H5Zm2-2h10V6H7v13ZM7 6v13V6Z"
|
|
/>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<hr />
|
|
<div class="flex flex-col">
|
|
<span>Value:
|
|
<span x-show="value?.reg_format === 'BOOL'"><input :value="Boolean(value?.data)" type="checkbox" onclick="return false;" /></span>
|
|
<span x-show="value?.reg_format !== 'BOOL'" x-text="Number.isInteger(value?.data) ? value?.data : value?.data?.toFixed(3)"></span>
|
|
</span>
|
|
<span>Reg Addr: <span x-text="value?.reg_addr"></span></span>
|
|
<span>Reg Type: <span x-text="value?.reg_type"></span></span>
|
|
<span>Format: <span x-text="value?.reg_format"></span></span>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<!-- Create Display -->
|
|
<div
|
|
@click="$dispatch('open-create-display-value-modal')"
|
|
class="flex justify-center min-h-[140px] items-center border-4 text-center border-dashed p-2.5 rounded-sm cursor-pointer hover:bg-gray-50"
|
|
>
|
|
<span class="text-5xl text-gray-400 font-bold select-none">+</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="select-none" x-show="selectedDevice === null">
|
|
<span class="block text-center italic text-gray-500 mt-10">No device selected.</span>
|
|
</div>
|
|
</div>
|
|
<!-- <div class="border-l"></div> -->
|
|
</div>
|
|
</main>
|
|
</template>
|
|
|
|
<!-- Configuration content -->
|
|
<template x-if="$store.app.currentPage === 'configuration'">
|
|
<main class="mt-6 mb-2" x-data="configAppPage" x-bind:hidden="$store.app.currentPage !== 'configuration'">
|
|
<div class="border rounded-sm p-5 max-w-md mx-auto mb-2">
|
|
<h2 class="text-2xl font-bold">Setup configuration</h2>
|
|
<p class="text-gray-700 italic">
|
|
Fill in the required configuration settings to connect to the Modbus network.
|
|
</p>
|
|
<hr />
|
|
<form @submit.prevent="configurateApp()" action="#">
|
|
<div>
|
|
<div>
|
|
<label class="block" for="connection_type"><span class="text-red-500">*</span>Network type</label>
|
|
<select
|
|
x-model="$store.app.config.mb_connection_type"
|
|
name="mb_connection_type"
|
|
id="connection_type"
|
|
required
|
|
>
|
|
<option value="TCP">TCP</option>
|
|
<option value="RTU">RTU</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div x-show="$store.app.config.mb_connection_type === 'TCP'" class="flex flex-col space-y-3">
|
|
<div>
|
|
<label for="tcp_ip"><span class="text-red-500">*</span>IP</label>
|
|
<input
|
|
x-model="$store.app.config.mb_tcp_ip"
|
|
id="tcp_ip"
|
|
name="tcp_ip"
|
|
placeholder="e.g 127.0.0.1"
|
|
type="text"
|
|
x-bind:required="$store.app.config.mb_connection_type === 'TCP'"
|
|
/>
|
|
</div>
|
|
|
|
<div>
|
|
<label for="rtu_port"><span class="text-red-500">*</span>Port</label>
|
|
<input
|
|
x-model.number="$store.app.config.mb_tcp_port"
|
|
id="rtu_port"
|
|
name="mb_rtu_port"
|
|
placeholder="e.g 502"
|
|
type="number"
|
|
x-bind:required="$store.app.config.mb_connection_type === 'TCP'"
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
<div x-show="$store.app.config.mb_connection_type === 'RTU'" class="flex flex-col space-y-3">
|
|
<div>
|
|
<label for="rtu_path"><span class="text-red-500">*</span>Path</label>
|
|
<input
|
|
id="rtu_path"
|
|
name="mb_rtu_path"
|
|
placeholder="e.g COM1"
|
|
type="text"
|
|
x-model="$store.app.config.mb_rtu_path"
|
|
x-bind:required="$store.app.config.mb_connection_type === 'RTU'"
|
|
/>
|
|
</div>
|
|
|
|
<div>
|
|
<label for="rtu_baud"><span class="text-red-500">*</span>Baud</label>
|
|
<select
|
|
name="mb_rtu_baud"
|
|
id="rtu_baud"
|
|
x-model.number="$store.app.config.mb_rtu_baud"
|
|
x-bind:required="$store.app.config.mb_connection_type === 'RTU'"
|
|
>
|
|
<option value="115200">115200</option>
|
|
<option value="57600">57600</option>
|
|
<option value="38400">38400</option>
|
|
<option value="19200">19200</option>
|
|
<option value="9600">9600</option>
|
|
<option value="1200">1200</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div>
|
|
<label for="rtu_parity"><span class="text-red-500">*</span>Parity</label>
|
|
<select
|
|
name="mb_rtu_parity"
|
|
id="rtu_parity"
|
|
x-model.number="$store.app.config.mb_rtu_parity"
|
|
x-bind:required="$store.app.config.mb_connection_type === 'RTU'"
|
|
>
|
|
<option value="even">even</option>
|
|
<option value="odd">odd</option>
|
|
<option value="none">none</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div>
|
|
<label for="rtu_data_bits"><span class="text-red-500">*</span>Data bits</label>
|
|
<select
|
|
name="mb_rtu_data_bits"
|
|
id="rtu_data_bits"
|
|
x-model.number="$store.app.config.mb_rtu_data_bits"
|
|
x-bind:required="$store.app.config.mb_connection_type === 'RTU'"
|
|
>
|
|
<option value="8">8</option>
|
|
<option value="7">7</option>
|
|
<option value="6">6</option>
|
|
<option value="5">5</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div>
|
|
<label for="rtu_stop_bits"><span class="text-red-500">*</span>Stop bits</label>
|
|
<select
|
|
name="mb_rtu_stop_bits"
|
|
id="rtu_stop_bits"
|
|
x-model.number="$store.app.config.mb_rtu_stop_bits"
|
|
x-bind:required="$store.app.config.mb_connection_type === 'RTU'"
|
|
>
|
|
<option value="1">1</option>
|
|
<option value="2">2</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mt-2">
|
|
<label for="rtu_path"><span class="text-red-500">*</span>Log Interval (ms)</label>
|
|
<input
|
|
id="log_interval_ms"
|
|
name="log_interval_ms"
|
|
type="number"
|
|
min="1000"
|
|
x-model.number="$store.app.config.log_interval_ms"
|
|
required
|
|
/>
|
|
</div>
|
|
|
|
<div class="mt-3 flex flex-row justify-between items-center">
|
|
<div class="mr-1">
|
|
<button
|
|
x-bind:disabled="isLoading"
|
|
x-bind:class="isLoading && 'opacity-70'"
|
|
class="btn ml-auto"
|
|
type="submit"
|
|
>
|
|
Save
|
|
</button>
|
|
</div>
|
|
<div>
|
|
<span class="text-red-600" x-text="errorMessage"></span>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</main>
|
|
</template>
|
|
|
|
<!-- Loading content -->
|
|
<template x-if="$store.app.currentPage === 'loading'">
|
|
<main x-bind:hidden="$store.app.currentPage !== 'loading'">
|
|
<div class="text-center mt-16">
|
|
<div role="status">
|
|
<svg
|
|
aria-hidden="true"
|
|
class="inline w-20 h-20 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600"
|
|
viewBox="0 0 100 101"
|
|
fill="none"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
>
|
|
<path
|
|
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
|
|
fill="currentColor"
|
|
/>
|
|
<path
|
|
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
|
|
fill="currentFill"
|
|
/>
|
|
</svg>
|
|
</div>
|
|
<p class="mt-4">Loading...</p>
|
|
</div>
|
|
</main>
|
|
</template>
|
|
|
|
<!-- Error content -->
|
|
<template x-if="$store.app.currentPage === 'error'">
|
|
<main x-bind:hidden="$store.app.currentPage !== 'error'">
|
|
<div>
|
|
<h1 class="text-2xl font-bold">Something went wrong.</h1>
|
|
<p>Refresh page to try again.</p>
|
|
<br />
|
|
<div class="border p-4">
|
|
<pre x-text="JSON.stringify($store.app.error, undefined, 2)" x-show="$store.app.error"></pre>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
</template>
|
|
|
|
<!-- 404 content -->
|
|
<template x-if="$store.app.currentPage === '404'">
|
|
<main x-bind:hidden="$store.app.currentPage !== '404'">
|
|
<div class="text-center mt-5">
|
|
<h1 class="text-2xl font-bold">Page not found</h1>
|
|
<a @click="$store.app.setPage('monitoring')" class="underline text-blue" href="#">return to monitoring</a>
|
|
</div>
|
|
</main>
|
|
</template>
|
|
|
|
<!-- Dialog -->
|
|
<div x-data="dialog">
|
|
<template @dialog.window="open($event)" @keyup.escape.window="close()" x-if="isOpen">
|
|
<div class="backdrop z-50">
|
|
<div role="dialog" class="modal">
|
|
<div class="flex justify-between items-center">
|
|
<h2 x-text="labels.title" class="font-bold text-lg"></h2>
|
|
<button @click="close()" aria-label="Close">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
|
<path
|
|
fill="currentColor"
|
|
d="M6.4 19L5 17.6l5.6-5.6L5 6.4L6.4 5l5.6 5.6L17.6 5L19 6.4L13.4 12l5.6 5.6l-1.4 1.4l-5.6-5.6L6.4 19Z"
|
|
/>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
<hr />
|
|
<p x-text="labels.body"></p>
|
|
<div class="mt-4 flex justify-end space-x-2">
|
|
<button
|
|
x-bind:disabled="isLoading"
|
|
x-bind:class="isLoading && 'opacity-70'"
|
|
@click="confirm()"
|
|
class="btn"
|
|
>
|
|
Confirm
|
|
</button>
|
|
<button @click="close()" class="btn bg-red-500">Cancel</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|