diff --git a/src/components/paneConnect.vue b/src/components/paneConnect.vue index dedd577b..1a63b305 100644 --- a/src/components/paneConnect.vue +++ b/src/components/paneConnect.vue @@ -2,54 +2,51 @@
-
-
- - -
- +

Connect

- -
- -
-
-

Host: {{ $store.state.host }}

-

Base URI: {{ $store.getters.uri }}

-

Device name: {{ $store.state.apiConfig.name }}

- - - -
- -
-
-
- -
- Error: {{ $store.state.error }} -
- -
- Enter a hostname and connect to start. -
+
+
+ +
+ + + +
+ +
+ +

Status

+ +
+

Host: {{ $store.state.host }}

+

Base URI: {{ $store.getters.uri }}

+

Device name: {{ $store.state.apiConfig.name }}

+ + + +
+ +
+
Error: {{ $store.state.error }}
+
No active connection
+

Saved hosts

-
- - {{ host.name }} ({{ host.hostname }}:{{ host.port }}) +
@@ -84,6 +81,25 @@ export default { } }, + mounted() { + // Try loading and parsing savedHosts from localStorage + if (localStorage.getItem('savedHosts')) { + try { + this.savedHosts = JSON.parse(localStorage.getItem('savedHosts')); + } catch(e) { + localStorage.removeItem('savedHosts'); + } + } + }, + + // When savedHosts changes, serialise to JSON and save to localStorage + watch: { + savedHosts(newSavedHosts) { + const parsed = JSON.stringify(this.savedHosts); + localStorage.setItem('savedHosts', parsed); + } + }, + methods: { handleSubmit: function(event) { if (this.hostname.includes(':')) {