-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConfigMaker.vue
236 lines (221 loc) · 10.9 KB
/
ConfigMaker.vue
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<head>
</head>
<template>
<div class="app align-items-center">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-2">
<div class="card p-2">
<b-btn v-b-toggle.collapse1 variant="primary">Target system --></b-btn>
<b-collapse id="collapse1" class="mt-2">
<ul style="list-style-type:none">
<li><b-btn v-b-toggle.collapse1_inner size="sm" variant="success" v-on:click="ChangeTarget('#0000FF','ath25')">Atheros AR231x/AR5312</b-btn></li>
<li><b-btn v-b-toggle.collapse1_inner size="sm" variant="success" v-on:click="ChangeTarget('#00FF00','ar71xx')">Atheros AR7xxx/AR9xxx</b-btn></li>
</ul>
</b-collapse><br>
<b-btn v-b-toggle.collapse2 variant="primary">Subtarget --></b-btn>
<b-collapse id="collapse2" class="mt-2">
<ul style="list-style-type:none">
<li><b-btn v-b-toggle.collapse2_inner size="sm" variant="success" v-on:click="ChangeSubtarget([1,1,1],'_generic')">Default Profile</b-btn></li>
<li><b-btn v-b-toggle.collapse2_inner size="sm" variant="success" v-on:click="ChangeSubtarget([0.8,0.8,0.8],'_tiny')">Devices with small flash</b-btn></li>
<li><b-btn v-b-toggle.collapse2_inner size="sm" variant="success" v-on:click="ChangeSubtarget([1.2,1.2,1.2],'_nand')">Generic devices with NAND flash</b-btn></li>
</ul>
</b-collapse><br>
<b-btn v-b-toggle.collapse3 variant="primary">Base system --></b-btn>
<b-collapse id="collapse3" class="mt-2">
<ul style="list-style-type:none">
<li>base-files:
<b-button-group>
<b-btn v-b-toggle.collapse3_inner size="sm" variant="success" v-b-tooltip.hover title="Auto" v-on:click="ChangeComponents('base-files', 'auto')">A</b-btn>
<b-btn v-b-toggle.collapse3_inner size="sm" variant="warning" v-b-tooltip.hover title="Manual" v-on:click="ChangeComponents('base-files', 'manual')">M</b-btn>
<b-btn v-b-toggle.collapse3_inner size="sm" variant="danger" v-b-tooltip.hover title="None" v-on:click="ChangeComponents('base-files', 'none')">N</b-btn>
</b-button-group>
</li>
<li>busybox:
<b-button-group>
<b-btn v-b-toggle.collapse4_inner size="sm" variant="success" v-b-tooltip.hover title="Auto" v-on:click="ChangeComponents('busybox', 'auto')">A</b-btn>
<b-btn v-b-toggle.collapse4_inner size="sm" variant="warning" v-b-tooltip.hover title="Manual" v-on:click="ChangeComponents('busybox', 'manual')">M</b-btn>
<b-btn v-b-toggle.collapse4_inner size="sm" variant="danger" v-b-tooltip.hover title="None" v-on:click="ChangeComponents('busybox', 'none')">N</b-btn>
</b-button-group>
</li>
<li>dns-masq:
<b-button-group>
<b-btn v-b-toggle.collapse5_inner size="sm" variant="success" v-b-tooltip.hover title="Auto" v-on:click="ChangeComponents('dns-masq', 'auto')">A</b-btn>
<b-btn v-b-toggle.collapse5_inner size="sm" variant="warning" v-b-tooltip.hover title="Manual" v-on:click="ChangeComponents('dns-masq', 'manual')">M</b-btn>
<b-btn v-b-toggle.collapse5_inner size="sm" variant="danger" v-b-tooltip.hover title="None" v-on:click="ChangeComponents('dns-masq', 'none')">N</b-btn>
</b-button-group>
</li>
<li>dropbear:
<b-button-group>
<b-btn v-b-toggle.collapse6_inner size="sm" variant="success" v-b-tooltip.hover title="Auto" v-on:click="ChangeComponents('dropbear', 'auto')">A</b-btn>
<b-btn v-b-toggle.collapse6_inner size="sm" variant="warning" v-b-tooltip.hover title="Manual" v-on:click="ChangeComponents('dropbear', 'manual')">M</b-btn>
<b-btn v-b-toggle.collapse6_inner size="sm" variant="danger" v-b-tooltip.hover title="None" v-on:click="ChangeComponents('dropbear', 'none')">N</b-btn>
</b-button-group>
</li>
<li>firewall:
<b-button-group>
<b-btn v-b-toggle.collapse7_inner size="sm" variant="success" v-b-tooltip.hover title="Auto" v-on:click="ChangeComponents('firewall', 'auto')">A</b-btn>
<b-btn v-b-toggle.collapse7_inner size="sm" variant="warning" v-b-tooltip.hover title="Manual" v-on:click="ChangeComponents('firewall', 'manual')">M</b-btn>
<b-btn v-b-toggle.collapse7_inner size="sm" variant="danger" v-b-tooltip.hover title="None" v-on:click="ChangeComponents('firewall', 'none')">N</b-btn>
</b-button-group>
</li>
</ul>
</b-collapse>
</div>
</div>
<div class="col-md-10">
<div class="card p-10">
<Scene :fog="none">
<Entity>
<Camera :position="[0, -3.5, 7]">
<IcoSphere :position="[0, 3, 0]" v-bind:scaling="this.CoreSize">
<Material v-bind:diffuse="this.CoreColor"></Material>
</IcoSphere>
<Box :position="[2, 3, 2]" >
<Material v-bind:alpha="this.Packages[0].status" v-bind:diffuse="this.Packages[0].color"></Material>
</Box>
<Box :position="[-2, 3, -2]" ><Material v-bind:alpha="this.Packages[1].status" v-bind:diffuse="this.Packages[1].color"></Material></Box>
<Box :position="[2, 3, -2]" ><Material v-bind:alpha="this.Packages[2].status" v-bind:diffuse="this.Packages[2].color"></Material></Box>
<Box :position="[-2, 3, 2]" ><Material v-bind:alpha="this.Packages[3].status" v-bind:diffuse="this.Packages[3].color"></Material></Box>
<Box :position="[2, 3, 0]" ></Box>
<Box :position="[0, 3, 2]" ></Box>
<Box :position="[0, 3, -2]" ></Box>
<Box :position="[-2, 3, 0]" ></Box>
<Box :position="[-2, 1, -2]" ></Box>
<Box :position="[2, 1, -2]" ></Box>
<Box :position="[-2, 1, 2]" ></Box>
<Box :position="[2, 1, 2]" ></Box>
<Box :position="[2, 1, 0]" ></Box>
<Box :position="[0, 1, 2]" ></Box>
<Box :position="[0, 1, -2]" ></Box>
<Box :position="[-2, 1, 0]" ></Box>
<Box :position="[0, 1, 0]" ><Material v-bind:alpha="this.Packages[4].status" v-bind:diffuse="this.Packages[4].color"></Material></Box>
<Box :position="[-2, 5, -2]" ></Box>
<Box :position="[2, 5, -2]" ></Box>
<Box :position="[-2, 5, 2]" ></Box>
<Box :position="[2, 5, 2]" ></Box>
<Box :position="[0, 5, -2]" ></Box>
<Box :position="[0, 5, 2]" ></Box>
<Box :position="[-2, 5, 0]" ></Box>
<Box :position="[0, 5, 0]" ></Box>
<Box :position="[2, 5, 0]" ></Box>
<Animation property="rotation.y" :duration="25">
<Key frame="0%" :value="0"></Key>
<Key frame="100%" :value="Math.PI * 2"></Key>
</Animation>
<Animation property="rotation.y" :duration="125" :end="Math.PI * 2"></Animation>
<PointLight diffuse="#FF0000"></PointLight>
</Camera>
</Entity>
</Scene>
</div>
</div>
<div class="col-md-12">
<div class="card p-12">
<b-form>
<b-form-textarea
v-model="this.OutputConfig"
placeholder="Config file"
:rows="5"
:max-rows="100">
</b-form-textarea><br>
</b-form>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'ConfigMaker',
data: function () {
return {
CoreColor: '#FF0000',
Platform: '',
Subtarget: '',
CoreSize: [1, 1, 1],
OutputConfig: '',
Packages: [
{ name: 'base-files',
status: 1,
color: '#FF00FF'
},
{ name: 'busybox',
status: 1,
color: '#FF00FF'
},
{ name: 'dns-masq',
status: 1,
color: '#FF00FF'
},
{ name: 'dropbear',
status: 1,
color: '#FF00FF'
},
{ name: 'firewall',
status: 1,
color: '#FF00FF'
}
]
}
},
created: function () {
// console.log('created')
// window.location.resize()
},
methods: {
ChangeTarget (CoreColor, Platform) {
this.CoreColor = CoreColor
this.Platform = Platform
this.MakeConfig()
},
ChangeSubtarget (Size, Subtarget) {
this.CoreSize = Size
this.Subtarget = Subtarget
this.MakeConfig()
},
MakeConfig () {
this.OutputConfig = ''
var t = ''
t = t + 'CONFIG_MODULES=y \n'
t = t + 'CONFIG_HAVE_DOT_CONFIG=y \n'
t = t + 'CONFIG_TARGET_' + this.Platform + '=y\n'
t = t + 'CONFIG_TARGET_' + this.Platform + this.Subtarget + '=y\n'
if (this.Packages[0].status === 1) {
t = t + 'CONFIG_PACKAGE_base-files=y \n'
}
if (this.Packages[1].status === 1) {
t = t + 'CONFIG_PACKAGE_busybox=y \n'
}
if (this.Packages[2].status === 1) {
t = t + 'CONFIG_PACKAGE_dns-masq=y \n'
}
if (this.Packages[3].status === 1) {
t = t + 'CONFIG_PACKAGE_dropbear=y \n'
}
if (this.Packages[4].status === 1) {
t = t + 'CONFIG_PACKAGE_firewall=y \n'
}
this.OutputConfig = t
},
ChangeComponents (name, status) {
for (var i in this.Packages) {
if (this.Packages[i].name === name) {
if (status === 'auto') {
this.Packages[i].status = 1
this.Packages[i].color = '#FF00FF'
} else if (status === 'manual') {
this.Packages[i].status = 0.2
this.Packages[i].color = '#0000FF'
} else if (status === 'none') {
this.Packages[i].status = 0
}
}
}
this.MakeConfig()
// console.log(this.Packages)
}
}
}
</script>