1 Vue
.component('search-box', {
2 template
: '#searchbox-template',
8 update_parent : function(query
) {
9 this.$emit('input', query
);
14 Vue
.component('attack-panel', {
15 template
: '#apanel-template',
23 unselect: function() {
24 this.$emit('unselect_send_parent');
29 // register the grid component
30 Vue
.component('demo-grid', {
31 template
: '#grid-template',
40 this.columns
.forEach(function (key
) {
45 sortOrders
: sortOrders
49 filteredData: function () {
50 var sortKey
= this.sortKey
51 var filterKey
= this.filterKey
&& this.filterKey
.toLowerCase()
52 var order
= this.sortOrders
[sortKey
] || 1
55 data
= data
.filter(function (row
) {
56 return Object
.keys(row
).some(function (key
) {
57 return String(row
[key
]).toLowerCase().indexOf(filterKey
) > -1
62 data
= data
.slice().sort(function (a
, b
) {
65 return (a
=== b
? 0 : a
> b
? 1 : -1) * order
72 wps_version: function(x
) {
74 return (x
>> 4).toString() + "." + (x
& 0xf).toString();
76 capitalize: function (str
) {
77 return str
.charAt(0).toUpperCase() + str
.slice(1)
81 sortBy: function (key
) {
83 this.sortOrders
[key
] = this.sortOrders
[key
] * -1
85 select_click: function(bssid
) {
86 this.$emit('select_bssid', bssid
);
117 'wps_primary_device_type',
124 'bssid': 0, 'essid': '', 'channel':0, 'rssi':0,
127 'wps_locked':0, 'wps_state':0,
128 'wps_manufacturer':'', 'wps_model_name':'', 'wps_model_number':'',
129 'wps_device_name':'', 'wps_serial':'', 'wps_uuid':'',
130 'wps_response_type':'', 'wps_primary_device_type': '',
131 'wps_config_methods':''
143 'wps_manufacturer':'manuf',
144 'wps_model_name':'model',
145 'wps_model_number':'model#',
146 'wps_device_name':'device',
147 'wps_serial':'serial',
152 loadDataAll: function () {
154 .then(response
=> response
.json())
156 this.gridData
= json
.wifis
159 loadDataAll2: function () {
161 .then(response
=> response
.json())
163 this.gridData
= json
.wifis
166 installTimer: function (secs
) {
167 console
.log("ready");
169 this.interval
= setInterval(function () {
171 }.bind(this), secs
*1000);
173 update_query : function(query
) {
174 this.searchQuery
= query
;
176 select: function (bssid
) {
177 this.oldQuery
= this.searchQuery
;
178 this.searchQuery
= bssid
;
179 this.selected
= true;
180 fetch("/api/select/" + bssid
)
182 app_unselect: function () {
183 this.searchQuery
= this.oldQuery
;
184 this.selected
= false;
185 fetch("/api/unselect")
188 mounted: function () {
189 this.$nextTick(function () {
190 // Code that will run only after the
191 // entire view has been rendered
192 this.installTimer(2);
195 beforeDestroy: function() {
196 clearInterval(this.interval
);