Skip to content

Commit 30388da

Browse files
committed
Add Addresses output as well as Setting Page
1 parent 9be6868 commit 30388da

File tree

6 files changed

+148
-2
lines changed

6 files changed

+148
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ava-gui",
3-
"version": "0.2.0",
3+
"version": "0.3.0",
44
"author": "AVA Team <[email protected]>",
55
"description": "An electron-vue project",
66
"license": null,

src/renderer/App.vue

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,31 @@
22
<div id="app">
33
<Menu v-if="isLoggedIn" mode="horizontal" active-name="Home" class="menu-nav-bar">
44
<MenuItem name="Home">
5+
<Icon
6+
type="home"
7+
color="white"
8+
/>
59
<router-link to='landing-page'>Home</router-link>
610
</MenuItem>
711
<MenuItem name="Plugins">
12+
<Icon
13+
type="ios-filing"
14+
color="white"
15+
/>
816
<router-link to='plugin'>Plugin</router-link>
917
</MenuItem>
10-
<MenuItem name="Logout">
18+
<MenuItem name="Setting">
19+
<Icon
20+
type="gear-a"
21+
color="white"
22+
/>
23+
<router-link to='setting'>Setting</router-link>
24+
</MenuItem>
25+
<MenuItem name="Exit">
26+
<Icon
27+
type="power"
28+
color="white"
29+
/>
1130
<a v-on:click="logout()" href="#">Logout</a>
1231
</MenuItem>
1332
</Menu>

src/renderer/components/LandingPage.vue

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@
55
<p>First Name: {{firstName}}</p>
66
<p>Last Name: {{lastName}}</p>
77
<p>Email: {{email}}</p>
8+
</br>
9+
<p>Addresses to conect with the mobile application: <span v-for="address in addresses">{{address}}:8765</br></span></p>
810
</div>
911
</div>
1012
</template>
1113

1214
<script>
15+
import os from 'os';
16+
1317
export default {
1418
1519
name: 'landing-page',
@@ -34,10 +38,13 @@
3438
email: '',
3539
firstName: '',
3640
lastName: '',
41+
addresses: [],
3742
};
3843
},
3944
4045
mounted() {
46+
const interfaces = os.networkInterfaces();
47+
4148
this.$http.get('http://localhost:8001/me').then((res) => {
4249
if (res.status === 200) {
4350
this.username = res.body.username;
@@ -47,6 +54,15 @@
4754
}
4855
}).catch(() => {
4956
});
57+
58+
Object.keys(interfaces).map((interfacesKey) => {
59+
interfaces[interfacesKey].forEach((inet) => {
60+
if (inet.family === 'IPv4' && !inet.internal) {
61+
this.addresses.push(inet.address);
62+
}
63+
});
64+
return true;
65+
});
5066
},
5167
};
5268
</script>
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<template>
2+
<div>
3+
<h1>All Settings</h1>
4+
<p>What speech recognition engine would you like to use:
5+
</br>
6+
<i-switch
7+
:disabled="engineDisabled"
8+
@on-change="changeEngine"
9+
class="switch-engine"
10+
size="large"
11+
v-model="switchEngine"
12+
>
13+
<span slot="open">Sphinx</span>
14+
<span slot="close">Watson</span>
15+
</i-switch>
16+
</p>
17+
<p>Would you like to use mobile Jack entry:
18+
</br>
19+
<i-switch
20+
:disabled="entryDisabled"
21+
@on-change="changeEntry"
22+
class="switch-engine"
23+
size="large"
24+
v-model="switchEntry"
25+
>
26+
<span slot="open">Mobile</span>
27+
<span slot="close">Raw</span>
28+
</i-switch>
29+
</p>
30+
</div>
31+
</template>
32+
33+
<script>
34+
export default {
35+
36+
name: 'configuration-page',
37+
38+
data() {
39+
return {
40+
switchEngine: false,
41+
switchEntry: false,
42+
engineDisabled: false,
43+
entryDisabled: false,
44+
};
45+
},
46+
methods: {
47+
changeEngine() {
48+
const body = {
49+
engine: this.switchEngine ? 'sphinx' : 'watson',
50+
};
51+
const option = { emulateJSON: true };
52+
53+
this.engineDisabled = true;
54+
this.$http.post('http://localhost:8001/config', body, option).then(() => {
55+
this.engineDisabled = false;
56+
}).catch((err) => {
57+
this.engineDisabled = false;
58+
/* eslint no-console: ["error", { allow: ["warn", "error", "log"] }] */
59+
console.log(err);
60+
});
61+
},
62+
changeEntry() {
63+
const body = {
64+
STT: this.switchEntry ? 'mobile' : 'raw',
65+
};
66+
const option = { emulateJSON: true };
67+
68+
this.engineDisabled = true;
69+
this.$http.post('http://localhost:8001/config', body, option).then(() => {
70+
this.engineDisabled = false;
71+
}).catch((err) => {
72+
this.engineDisabled = false;
73+
/* eslint no-console: ["error", { allow: ["warn", "error", "log"] }] */
74+
console.log(err);
75+
});
76+
},
77+
},
78+
};
79+
</script>
80+
81+
<style>
82+
.switch-engine {
83+
width: 78px;
84+
}
85+
86+
.switch-engine.ivu-switch-checked::after {
87+
left: 54px;
88+
}
89+
90+
.switch-engine.ivu-switch-checked {
91+
border-color: #EE578A;
92+
background-color: #EE578A;
93+
}
94+
</style>

src/renderer/router/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ export default new Router({
2222
name: 'plugin-page',
2323
component: require('@/components/PluginPage'),
2424
},
25+
{
26+
path: '/setting',
27+
name: 'setting',
28+
component: require('@/components/Setting'),
29+
},
2530
{
2631
path: '*',
2732
redirect: '/',

yarn.lock

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1792,6 +1792,10 @@ clone@^1.0.2:
17921792
version "1.0.2"
17931793
resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.2.tgz#260b7a99ebb1edfe247538175f783243cb19d149"
17941794

1795+
clone@^2.1.1:
1796+
version "2.1.1"
1797+
resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.1.tgz#d217d1e961118e3ac9a4b8bba3285553bf647cdb"
1798+
17951799
co@^4.6.0:
17961800
version "4.6.0"
17971801
resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184"
@@ -4795,6 +4799,14 @@ lcid@^1.0.0:
47954799
dependencies:
47964800
invert-kv "^1.0.0"
47974801

4802+
less-loader@^4.0.5:
4803+
version "4.0.5"
4804+
resolved "https://registry.yarnpkg.com/less-loader/-/less-loader-4.0.5.tgz#ae155a7406cac6acd293d785587fcff0f478c4dd"
4805+
dependencies:
4806+
clone "^2.1.1"
4807+
loader-utils "^1.1.0"
4808+
pify "^2.3.0"
4809+
47984810
levn@^0.3.0, levn@~0.3.0:
47994811
version "0.3.0"
48004812
resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee"

0 commit comments

Comments
 (0)