Skip to content

Commit

Permalink
feat: ambianic edge connect page draft
Browse files Browse the repository at this point in the history
  • Loading branch information
ivelin committed Dec 11, 2019
1 parent c3e71d0 commit 511a791
Show file tree
Hide file tree
Showing 9 changed files with 510 additions and 105 deletions.
286 changes: 241 additions & 45 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@
"name": "ambianic-ui",
"version": "1.7.0",
"description": "Ambianic UI is the main user interface to Ambianic Edge deployments.",
"author": "Ivelin Ivanov",
"license": "Apache 2",
"homepage": "https://ambianic.ai",
"keywords": [
"Home Automation",
"Ambient Intelligence",
"AI",
"Business Automation",
"Workspace Automation"
],
"private": false,
"scripts": {
"serve": "vue-cli-service serve",
Expand All @@ -18,6 +26,7 @@
"konva": "^4.0.17",
"moment": "^2.24.0",
"node": "^13.0.0",
"peerjs": "^1.1.0",
"register-service-worker": "^1.5.2",
"vue": "^2.5.16",
"vue-infinite-loading": "^2.4.4",
Expand Down
1 change: 1 addition & 0 deletions src/components/AppFrame.vue
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ export default {
// { text: 'Integrations' }
// ]
// },
{ icon: 'mdi-video-input-antenna', text: 'Connect', link: '/edge-connect' },
{ icon: 'settings', text: 'Settings', link: '/settings' },
{ icon: 'chat_bubble', text: 'Send feedback', link: '/feedback' },
{ icon: 'help', text: 'Help', link: '/help' },
Expand Down
3 changes: 2 additions & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ export const ambianicConf = {
// AMBIANIC_API_URI: 'http://192.168.86.246:8778/api/'
AMBIANIC_API_FALLBACK_URI: '/sample-data/',
AMBIANIC_API_PORT: 8778,
AMBIANIC_API_ROOT: '/api/'
AMBIANIC_API_ROOT: '/api/',
AMBIANIC_PNP_SERVICE: 'https://ambianic-pnp.herokuapp.com'
}
8 changes: 8 additions & 0 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ const routes = [
// which is lazy-loaded when the route is visited.
component: () => import(/* webpackChunkName: "flows" */ '../views/Flows.vue')
},
{
path: '/edge-connect',
name: 'edge-connect',
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import(/* webpackChunkName: "edge-connect" */ '../views/EdgeConnect.vue')
},
{
path: '/settings',
name: 'settings',
Expand Down
99 changes: 49 additions & 50 deletions src/views/About.vue
Original file line number Diff line number Diff line change
@@ -1,62 +1,61 @@
<template>
<app-frame>
<v-row
align="center"
align="start"
justify="center"
align-content="space-around"
>
<v-tooltip right>
<template>
<v-card
max-width="344"
class="mx-auto"
<template>
<v-card
max-width="344"
>
<v-list-item
align="center"
justify="center"
>
<v-list-item
align="center"
justify="center"
>
<v-list-item-content>
<v-list-item-title class="headline">
Cozy at Home
</v-list-item-title>
<v-list-item-subtitle>
via Ambient Intelligence
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
<v-list-item-content>
<v-list-item-title class="headline">
Cozier Home and Workspace
</v-list-item-title>
<v-list-item-subtitle>
via Ambient Intelligence
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>

<v-img
src="@/assets/home-screen-logo.png"
height="194"
/>
<v-img
max-width="300"
class="mx-auto"
src="@/assets/home-screen-logo.png"
/>

<v-card-text>
Ambianic's mission is to make your home a little cozier.
Review your home timeline for notable moments. Configure input sensors and
camers for Ambianic to observe.
Share, purge
or backup your data - it never slips out of your control.
</v-card-text>
<v-card-text>
Ambianic's mission is to make your home a little cozier.
Review your home timeline for notable moments. Configure input sensors and
camers for Ambianic to observe.
Share, purge
or backup your data - it never slips out of your control.
</v-card-text>

<v-card-actions>
<v-btn
text
color="info"
:to="'timeline'"
>
View Timeline
</v-btn>
<v-spacer />
<v-btn
text
color="info"
:to="'settings'"
>
Settings
</v-btn>
</v-card-actions>
</v-card>
</template>
</v-tooltip>
<v-card-actions>
<v-btn
text
color="info"
:to="'timeline'"
>
View Timeline
</v-btn>
<v-spacer />
<v-btn
text
color="info"
:to="'settings'"
>
Settings
</v-btn>
</v-card-actions>
</v-card>
</template>
</v-row>
</app-frame>
</template>
Expand Down
167 changes: 167 additions & 0 deletions src/views/EdgeConnect.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
<template>
<app-frame>
<v-row
align="start"
justify="space-around"
>
<v-col
style="max-width: 420px;"
align="center"
justify="center"
cols="12"
class="pa-0 ma-0 fill-height"
>
<v-banner two-line>
<v-icon
slot="icon"
color="warning"
size="36"
>
mdi-wifi-strength-alert-outline
</v-icon>

Let's connect to your Ambianic Edge device.
Make sure its running and has Internet access.

</v-banner>
<v-stepper v-model="e6" vertical>
<v-stepper-step :complete="e6 > 1" step="1">
Discover
<small>Looking for your Ambianic Edge device</small>
</v-stepper-step>

<v-stepper-content step="1">
<v-progress-circular
:rotate="360"
:size="100"
:width="15"
:value="discoveryProgressValue"
color="teal"
>
{{ discoveryProgressValue }}
</v-progress-circular>
</v-stepper-content>

<v-stepper-step :complete="e6 > 2" step="2">
Authenticate
<small>Establish secure direct connection</small>
</v-stepper-step>

<v-stepper-content step="2">
<v-card color="grey lighten-1" class="mb-12" height="200px"></v-card>
<v-btn color="primary" @click="e6 = 3">Continue</v-btn>
<v-btn text>Cancel</v-btn>
</v-stepper-content>

<v-stepper-step :complete="e6 > 3" step="3">
Test
<small>Check connection quality</small>
</v-stepper-step>

<v-stepper-content step="3">
<v-card color="grey lighten-1" class="mb-12" height="200px"></v-card>
<v-btn color="primary" @click="e6 = 4">Continue</v-btn>
<v-btn text>Cancel</v-btn>
</v-stepper-content>

<v-stepper-step step="4">
Done
</v-stepper-step>
<v-stepper-content step="4">
<v-card color="grey lighten-1" class="mb-12" height="200px"></v-card>
<v-btn color="primary" @click="e6 = 1">Continue</v-btn>
<v-btn text>Cancel</v-btn>
</v-stepper-content>
</v-stepper>
</v-col>
</v-row>
</app-frame>
</template>
<script>
import AppFrame from '@/components/AppFrame.vue'
import { settingsDB } from '@/store/db'
import { testConnection, EdgeConnectionStatus } from '@/remote/edgeAPI'
export default {
data () {
return {
edgeAddress: '',
connectionStatus: '',
connectionTip: '',
testInProgress: false,
testDone: false,
statusColor: 'info',
e6: 0,
discoveryProgressValue: 0
}
},
components: {
AppFrame
},
mounted () {
this.loadSettings()
this.interval = setInterval(() => {
if (this.discoveryProgressValue === 100) {
return (this.discoveryProgressValue = 0)
}
this.discoveryProgressValue += 10
}, 1000)
},
beforeDestroy () {
clearInterval(this.interval)
},
methods: {
loadSettings () {
settingsDB.get('ambanic-edge-address').then(
(address) => {
this.edgeAddress = address
}
)
},
saveSettings () {
settingsDB.set('ambanic-edge-address', this.edgeAddress)
},
cancel () {
this.testInProgress = false
this.testDone = false
// load previously saved settings
this.loadSettings()
},
save () {
this.testInProgress = false
this.testDone = false
// store settings
this.saveSettings()
},
test () {
this.testInProgress = true
this.testDone = false
testConnection(this.settingsForm.address).then(
status => {
if (!this.testInProgress) return // test cancelled
switch (status) {
case EdgeConnectionStatus.OFFLINE:
this.connectionStatus = 'OFFLINE'
this.connectionTip = 'No connection to edge device.'
this.statusColor = 'error'
break
case EdgeConnectionStatus.UNAVAILABLE:
this.connectionStatus = 'OFFLINE'
this.connectionTip = 'Edge device is not responsive.'
this.statusColor = 'error'
break
case EdgeConnectionStatus.OK:
this.connectionStatus = 'OK'
this.connectionTip = 'Edge device API available.'
this.statusColor = 'success'
break
}
this.testInProgress = false
this.testDone = true
// console.debug(`Ambianic Edge device connection status ${status}`)
}
)
}
}
}
</script>
4 changes: 2 additions & 2 deletions src/views/Settings.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template>
<app-frame>
<v-row
align="center"
justify="center"
align="start"
justify="space-around"
>
<v-card>
<v-card-title class="grey darken-2">
Expand Down
Loading

0 comments on commit 511a791

Please sign in to comment.