-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
172 lines (158 loc) · 6.87 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>mqttDashboard</title>
<link rel="stylesheet" href="style.css">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,500,500i,700,700i,900,900i" rel="stylesheet">
<link href="https://use.fontawesome.com/releases/v5.0.6/css/all.css" rel="stylesheet">
</head>
<body>
<div class="hidden" id="start-container">
<h1>MQTT Dashboard</h1>
<p>With this page you can connect to your mqtt broker via websockets. After the connection is established, you can create dashboards and add widgets to them.
There are widgets for subscribing to topics and widgets for sending strings to topics via buttons.
Connections and Dashboards are saved in local storage and are available after reopening this page.</p>
<div class="connection-container" id="connections-screen">
<div class="connection_new">
<h2>Create connection</h2>
<form id="create_connection">
<input type="hidden" id="connection_id">
<div class="input-wrapper">
<label for="connect_url">Connection String</label>
<input type="text" id="connect_url" placeholder="broker.mqttdashboard.com:8000/mqtt">
</div>
<div class="input-wrapper">
<label for="connect_user">Username</label>
<input type="text" id="connect_user">
</div>
<div class="input-wrapper">
<label for="connect_password">Password</label>
<input type="text" id="connect_password">
</div>
<div class="input-wrapper">
<label for="connect_save">Save connection</label>
<input type="checkbox" id="connect_save" checked>
</div>
<div class="input-wrapper">
<label for="connect_secure">SSL</label>
<input type="checkbox" id="connect_secure">
</div>
</form>
<button onclick="connect()" id="button_connect" class="btn-primary"><i class="fas fa-arrow-circle-right"></i> Connect</button>
<button onclick="updateAndConnect()" id="button_updateAndConnect" class="hidden btn-primary">Update & Connect</button>
<button onclick="cancelUpdateConnection()" id="button_updateCancel" class="hidden btn-primary">Cancel</button>
<div id="connection_error" class="connection-error hidden"></div>
</div>
<div class="connection_load">
<h2>Saved connections</h2>
<div id="saved_connections"></div>
</div>
<div id="github-link">Code on: <a href="https://github.com/DirkHeinke/mqttDashboard">GitHub</a> </div>
</div>
</div>
<!-- The actual dashboard page -->
<div class="page" id="dashboard">
<div class="dashboard-top">
<div>
<i class="fas fa-globe"></i>
<span id="connection-current">Connecting...</span>
</div>
<button onclick="closeConnection()" class="btn-primary btn-icon-before"><i class="fas fa-sign-out-alt"></i>Close connection</button>
</div>
<div class="dashboard-container">
<div class="dashboard-sidebar">
<div id="sidebar-toggle"><span class="fa fa-chevron-circle-left" title="Toggle Sidebar"></span></div>
<div class="sidebar-inner">
<!-- Dashboards -->
<h3>Saved Dashboards</h3>
<div id="dashboards-list"></div>
<button onclick="openDashboardCreateDialog()" class="btn-primary btn-icon-before"><i class="fa fa-plus"></i>ADD Dashboard</button>
<div id="github-link">Code on: <a href="https://github.com/DirkHeinke/mqttDashboard">GitHub</a> </div>
</div>
</div>
<div class="dashboard-main">
<div class="dashboard-info">
<h3 id="current-dashboard">Dashboard</h3>
<button onclick="openWidgetCreateDialog()" class="btn-primary btn-icon-before"><i class="fa fa-plus"></i>ADD WIDGET</button>
</div>
<div id="widgets-container">
<!-- Widgets go here -->
</div>
</div>
</div>
</div>
<!-- Create Widget dialog -->
<div id="dialog-widget-create" class="dialog hidden">
<div class="dialog-top">
<div class="dialog-title">Create Widget</div>
<div class="dialog-close">
<button class="btn-icon btn-icon__inverted">
<i class="fas fa-times"></i>
</button>
</div>
</div>
<div class="dialog-body">
<form>
<select id="widget-type">
<option value="button" selected>Button</option>
<option value="subscriptionList">Single Subscription</option>
<option value="textInput">Text Input</option>
</select>
<div class="form-container"></div>
<button class="dialog-save btn-primary">Save</button>
</form>
</div>
</div>
<!-- Create Dashboard dialog -->
<div id="dialog-dashboard-create" class="dialog hidden">
<div class="dialog-top">
<div class="dialog-title">Create Dashboard</div>
<div class="dialog-close"><button class="btn-icon btn-icon__inverted"><i class="fas fa-times"></i></button></div>
</div>
<div class="dialog-body">
<form>
<div class="input-wrapper">
<label>Dashboard Name</label>
<input type="text" id="dashboard-name">
</div>
<button class="dialog-save btn-primary">Save</button>
</form>
</div>
</div>
<!-- Edit Widget dialog -->
<div id="dialog-widget-edit" class="dialog hidden">
<div class="dialog-top">
<div class="dialog-title">Edit Widget</div>
<div class="dialog-close">
<button class="btn-icon btn-icon__inverted">
<i class="fas fa-times"></i>
</button>
</div>
</div>
<div class="dialog-body">
<form>
<div class="form-container"></div>
<button class="dialog-save btn-primary">Save</button>
</form>
</div>
</div>
<div id="dialog-overlay" class="hidden"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js"></script>
<script src="libs/mqtt.js"></script>
<script src="utils.js"></script>
<script src="storage.js"></script>
<script src="connection.js"></script>
<script src="dialogs/dialog.js"></script>
<script src="dialogs/widgetCreateDialog.js"></script>
<script src="dialogs/widgetEditDialog.js"></script>
<script src="dialogs/dashboardCreateDialog.js"></script>
<script src="widgets/widget.js"></script>
<script src="widgets/buttonWidget.js"></script>
<script src="widgets/subscriptionListWidget.js"></script>
<script src="widgets/textInputWidget.js"></script>
<script src="dialogs/widgetsConfig.js"></script>
<script src="main.js"></script>
</body>
</html>