Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cloud-quote
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
cloud-quote
Commits
982f4ff5
Commit
982f4ff5
authored
Mar 19, 2013
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix: called refresh on table vs. table.table
parent
f5d1263a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
269 additions
and
156 deletions
+269
-156
gadgets/configure.html
gadgets/configure.html
+174
-104
gadgets/results.html
gadgets/results.html
+2
-8
js/controller.js
js/controller.js
+43
-0
js/libs/jio/complex_queries.js
js/libs/jio/complex_queries.js
+50
-44
No files found.
gadgets/configure.html
View file @
982f4ff5
...
@@ -95,6 +95,7 @@
...
@@ -95,6 +95,7 @@
</div>
</div>
<div
class=
"ui-rwd-b"
>
<div
class=
"ui-rwd-b"
>
<div
class=
"ui-body ui-body-d"
>
<div
class=
"ui-body ui-body-d"
>
<form
action=
"results.html"
method=
"post"
name=
"compare"
class=
"val"
>
<table
data-role=
"table"
id=
"configure"
data-mode=
"reflow"
class=
"ui-responsive table-stroke table-inline"
>
<table
data-role=
"table"
id=
"configure"
data-mode=
"reflow"
class=
"ui-responsive table-stroke table-inline"
>
<thead>
<thead>
<tr>
<tr>
...
@@ -208,6 +209,7 @@
...
@@ -208,6 +209,7 @@
</tr>
</tr>
</tbody>
</tbody>
</table>
</table>
</form>
</div>
</div>
</div>
</div>
<div
class=
"ui-rwd-c ui-last-child"
>
<div
class=
"ui-rwd-c ui-last-child"
>
...
@@ -219,6 +221,74 @@
...
@@ -219,6 +221,74 @@
<script
type=
"text/javascript"
language=
"javascript"
>
<script
type=
"text/javascript"
language=
"javascript"
>
//
<!
[
CDATA
[
//
<!
[
CDATA
[
// initialize jio_config
if
(
$
.
fn
.
fauna
.
jio_item_config
===
undefined
)
{
$
.
fn
.
fauna
.
jio_item_config
=
jIO
.
newJio
({
"
type
"
:
"
local
"
,
"
username
"
:
"
item_config
"
,
"
application_name
"
:
"
cloudquote
"
});
// request configuration options -> this should be a query on the server on whats available
// should get the options available and dynamically add the configuration options
var
ajaxObject
=
{
url
:
"
../data/machine_config.json
"
,
target
:
""
,
successHandler
:
function
(
data
,
target
)
{
// build table options and defaults
},
errorHandler
:
function
(
XMLHttpRequest
,
textStatus
,
errorThrown
)
{
//
}
};
$
.
fn
.
util
.
ajaxContent
(
ajaxObject
);
}
// retrieve data when a search is triggered.
// could also do this in the background
// allDocs should clean up, otherwise we need to GET here to check timestamp
$
(
document
)
.
find
(
"
.menu_compare
"
)
.
filter
(
function
()
{
return
$
(
this
).
jqmData
(
'
bound
'
)
!==
true
;
})
.
jqmData
(
'
bound
'
,
true
)
.
on
(
'
click
'
,
'
a
'
,
function
(
e
)
{
e
.
preventDefault
();
var
m
,
formdata
=
$
(
"
form[name=compare]
"
).
serialize
(),
ajaxObject
=
{
url
:
"
../data/stats.json
"
,
type
:
"
post
"
,
returnformat
:
"
JSON
"
,
handleDataInResponse
:
"
true
"
,
formdata
:
formdata
,
successHandler
:
function
(
data
)
{
$
.
fn
.
util
.
spin
(
'
show
'
);
// add entries to localstorage. We should only be getting 10 at a time
for
(
machine
in
data
)
{
if
(
data
.
hasOwnProperty
(
machine
))
{
m
=
data
[
machine
];
$
.
fn
.
fauna
.
jio_item_config
.
put
({
"
_id
"
:
machine
,
"
init
"
:
m
[
"
init
"
],
"
last
"
:
m
[
"
last
"
],
"
downtime
"
:
m
[
"
machine_downtime
"
],
"
totaltime
"
:
m
[
"
totaltime
"
],
"
percentile
"
:
m
[
"
percentile
"
],
"
ts
"
:
new
Date
()
});
}
}
$
.
fn
.
util
.
spin
(
'
hide
'
);
// go to results page
$
.
mobile
.
changePage
(
'
results.html
'
,
{
transition
:
'
fade
'
});
},
errorHandler
:
function
(
XMLHttpRequest
,
textStatus
,
errorThrown
)
{
//
}
};
$
.
fn
.
util
.
ajaxFormSubmit
(
ajaxObject
);
});
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
var
gadget
=
RenderJs
.
getSelfGadget
();
var
gadget
=
RenderJs
.
getSelfGadget
();
...
...
gadgets/results.html
View file @
982f4ff5
...
@@ -172,9 +172,8 @@
...
@@ -172,9 +172,8 @@
// enhance elements in the table rows
// enhance elements in the table rows
//.trigger("create") > breaks the table on 2nd run
//.trigger("create") > breaks the table on 2nd run
.
closest
(
'
table
'
)
.
closest
(
'
table
'
)
// refresh table
.
filter
(
function
()
{
return
$
(
this
).
jqmData
(
'
bound
'
)
===
true
;
})
.
filter
(
function
()
{
return
$
(
this
).
jqmData
(
'
bound
'
)
===
true
;
})
.
t
rigger
(
'
table
refresh
'
)
.
t
able
(
'
refresh
'
)
.
end
()
.
end
()
.
closest
(
'
table
'
)
.
closest
(
'
table
'
)
// create table on first run
// create table on first run
...
@@ -266,14 +265,9 @@
...
@@ -266,14 +265,9 @@
timer
=
null
;
timer
=
null
;
gadget
.
filter_value
=
val
;
gadget
.
filter_value
=
val
;
renderData
(
gadget
.
sort_field
,
gadget
.
sort_direction
,
val
);
renderData
(
gadget
.
sort_field
,
gadget
.
sort_direction
,
val
);
},
10
00
);
},
5
00
);
}
}
})
})
// delete filter value
.
on
(
'
click.results_filter
'
,
'
.ui-input-clear
'
,
function
()
{
var
val
=
""
;
renderData
(
gadget
.
sort_field
,
gadget
.
sort_direction
,
val
);
})
// unbind on hide (block with jqmData/class prevents multiple calls?
// unbind on hide (block with jqmData/class prevents multiple calls?
.
off
(
'
pagehide
'
,
'
results_filter
'
);
.
off
(
'
pagehide
'
,
'
results_filter
'
);
});
});
...
...
js/controller.js
View file @
982f4ff5
...
@@ -142,7 +142,50 @@ define([], function () {
...
@@ -142,7 +142,50 @@ define([], function () {
};
};
// ===========================================================
// ===========================================================
// debug timer
(
function
(
$
,
window
,
undefined
)
{
function
getTime
()
{
return
(
new
Date
()
).
getTime
();
}
var
startChange
,
stopChange
,
startLoad
,
stopLoad
,
startEnhance
,
stopEnhance
,
startTransition
,
stopTransition
,
lock
=
0
;
$
(
document
)
.
bind
(
"
pagebeforechange
"
,
function
(
e
,
data
)
{
if
(
typeof
data
.
toPage
===
"
string
"
)
{
startChange
=
stopChange
=
startLoad
=
stopLoad
=
startEnhance
=
stopEnhance
=
startTransition
=
stopTransition
=
getTime
();
}
})
.
bind
(
"
pagebeforeload
"
,
function
()
{
startLoad
=
stopLoad
=
getTime
();
})
.
bind
(
"
pagebeforecreate
"
,
function
()
{
if
(
++
lock
===
1
)
{
stopLoad
=
startEnhance
=
stopEnhance
=
getTime
();
}
})
.
bind
(
"
pageinit
"
,
function
()
{
if
(
--
lock
===
0
)
{
stopEnhance
=
getTime
();
}
})
.
bind
(
"
pagebeforeshow
"
,
function
()
{
startTransition
=
stopTransition
=
getTime
();
})
.
bind
(
"
pageshow
"
,
function
()
{
stopTransition
=
getTime
();
})
.
bind
(
"
pagechange
"
,
function
(
e
,
data
)
{
if
(
typeof
data
.
toPage
===
"
object
"
)
{
stopChange
=
getTime
();
console
.
log
(
"
load + processing:
"
+
(
stopLoad
-
startLoad
)
+
"
\n
enhance:
"
+
(
stopEnhance
-
startEnhance
)
+
"
\n
transition:
"
+
(
stopTransition
-
startTransition
)
+
"
\n
totalTime:
"
+
(
stopChange
-
startChange
)
);
startChange
=
stopChange
=
startLoad
=
stopLoad
=
startEnhance
=
stopEnhance
=
startTransition
=
stopTransition
=
0
;
}
});
})(
jQuery
,
window
);
// global page handling
// global page handling
$
(
document
).
on
(
'
pagecreate
'
,
'
div:jqmData(role="page")
'
,
function
()
{
$
(
document
).
on
(
'
pagecreate
'
,
'
div:jqmData(role="page")
'
,
function
()
{
...
...
js/libs/jio/complex_queries.js
View file @
982f4ff5
...
@@ -6,6 +6,8 @@
...
@@ -6,6 +6,8 @@
(
function
(
scope
)
{
(
function
(
scope
)
{
"
use strict
"
;
"
use strict
"
;
console
.
log
(
"
aloha in scope - complexqueries
"
);
console
.
log
(
scope
)
Object
.
defineProperty
(
scope
,
"
ComplexQueries
"
,
{
Object
.
defineProperty
(
scope
,
"
ComplexQueries
"
,
{
configurable
:
false
,
configurable
:
false
,
enumerable
:
false
,
enumerable
:
false
,
...
@@ -35,15 +37,15 @@ Object.defineProperty(scope.ComplexQueries, "parse", {
...
@@ -35,15 +37,15 @@ Object.defineProperty(scope.ComplexQueries, "parse", {
This is in the public domain.
This is in the public domain.
*/
*/
var
_dbg_withtrace
=
false
;
var
NODEJS_
_dbg_withtrace
=
false
;
var
_dbg_string
=
new
String
();
var
NODEJS_
_dbg_string
=
new
String
();
function
__dbg_print
(
text
)
function
__
NODEJS_
dbg_print
(
text
)
{
{
_dbg_string
+=
text
+
"
\n
"
;
NODEJS_
_dbg_string
+=
text
+
"
\n
"
;
}
}
function
__lex
(
info
)
function
__
NODEJS_
lex
(
info
)
{
{
var
state
=
0
;
var
state
=
0
;
var
match
=
-
1
;
var
match
=
-
1
;
...
@@ -249,7 +251,7 @@ switch( state )
...
@@ -249,7 +251,7 @@ switch( state )
}
}
function
__parse
(
src
,
err_off
,
err_la
)
function
__
NODEJS_
parse
(
src
,
err_off
,
err_la
)
{
{
var
sstack
=
new
Array
();
var
sstack
=
new
Array
();
var
vstack
=
new
Array
();
var
vstack
=
new
Array
();
...
@@ -377,7 +379,7 @@ var labels = new Array(
...
@@ -377,7 +379,7 @@ var labels = new Array(
sstack
.
push
(
0
);
sstack
.
push
(
0
);
vstack
.
push
(
0
);
vstack
.
push
(
0
);
la
=
__lex
(
info
);
la
=
__
NODEJS_
lex
(
info
);
while
(
true
)
while
(
true
)
{
{
...
@@ -391,9 +393,9 @@ var labels = new Array(
...
@@ -391,9 +393,9 @@ var labels = new Array(
}
}
}
}
if
(
_dbg_withtrace
&&
sstack
.
length
>
0
)
if
(
NODEJS_
_dbg_withtrace
&&
sstack
.
length
>
0
)
{
{
__dbg_print
(
"
\n
State
"
+
sstack
[
sstack
.
length
-
1
]
+
"
\n
"
+
__
NODEJS_
dbg_print
(
"
\n
State
"
+
sstack
[
sstack
.
length
-
1
]
+
"
\n
"
+
"
\t
Lookahead:
"
+
labels
[
la
]
+
"
(
\"
"
+
info
.
att
+
"
\"
)
\n
"
+
"
\t
Lookahead:
"
+
labels
[
la
]
+
"
(
\"
"
+
info
.
att
+
"
\"
)
\n
"
+
"
\t
Action:
"
+
act
+
"
\n
"
+
"
\t
Action:
"
+
act
+
"
\n
"
+
"
\t
Source:
\"
"
+
info
.
src
.
substr
(
info
.
offset
,
30
)
+
(
(
info
.
offset
+
30
<
info
.
src
.
length
)
?
"
\t
Source:
\"
"
+
info
.
src
.
substr
(
info
.
offset
,
30
)
+
(
(
info
.
offset
+
30
<
info
.
src
.
length
)
?
...
@@ -406,8 +408,8 @@ var labels = new Array(
...
@@ -406,8 +408,8 @@ var labels = new Array(
//Panic-mode: Try recovery when parse-error occurs!
//Panic-mode: Try recovery when parse-error occurs!
if
(
act
==
25
)
if
(
act
==
25
)
{
{
if
(
_dbg_withtrace
)
if
(
NODEJS_
_dbg_withtrace
)
__dbg_print
(
"
Error detected: There is no reduce or shift on the symbol
"
+
labels
[
la
]
);
__
NODEJS_
dbg_print
(
"
Error detected: There is no reduce or shift on the symbol
"
+
labels
[
la
]
);
err_cnt
++
;
err_cnt
++
;
err_off
.
push
(
info
.
offset
-
info
.
att
.
length
);
err_off
.
push
(
info
.
offset
-
info
.
att
.
length
);
...
@@ -426,8 +428,8 @@ var labels = new Array(
...
@@ -426,8 +428,8 @@ var labels = new Array(
while
(
act
==
25
&&
la
!=
19
)
while
(
act
==
25
&&
la
!=
19
)
{
{
if
(
_dbg_withtrace
)
if
(
NODEJS_
_dbg_withtrace
)
__dbg_print
(
"
\t
Error recovery
\n
"
+
__
NODEJS_
dbg_print
(
"
\t
Error recovery
\n
"
+
"
Current lookahead:
"
+
labels
[
la
]
+
"
(
"
+
info
.
att
+
"
)
\n
"
+
"
Current lookahead:
"
+
labels
[
la
]
+
"
(
"
+
info
.
att
+
"
)
\n
"
+
"
Action:
"
+
act
+
"
\n\n
"
);
"
Action:
"
+
act
+
"
\n\n
"
);
if
(
la
==
-
1
)
if
(
la
==
-
1
)
...
@@ -461,19 +463,19 @@ var labels = new Array(
...
@@ -461,19 +463,19 @@ var labels = new Array(
vstack
.
push
(
rvstack
[
i
]
);
vstack
.
push
(
rvstack
[
i
]
);
}
}
la
=
__lex
(
info
);
la
=
__
NODEJS_
lex
(
info
);
}
}
if
(
act
==
25
)
if
(
act
==
25
)
{
{
if
(
_dbg_withtrace
)
if
(
NODEJS_
_dbg_withtrace
)
__dbg_print
(
"
\t
Error recovery failed, terminating parse process...
"
);
__
NODEJS_
dbg_print
(
"
\t
Error recovery failed, terminating parse process...
"
);
break
;
break
;
}
}
if
(
_dbg_withtrace
)
if
(
NODEJS_
_dbg_withtrace
)
__dbg_print
(
"
\t
Error recovery succeeded, continuing
"
);
__
NODEJS_
dbg_print
(
"
\t
Error recovery succeeded, continuing
"
);
}
}
/*
/*
...
@@ -485,29 +487,29 @@ var labels = new Array(
...
@@ -485,29 +487,29 @@ var labels = new Array(
//Shift
//Shift
if
(
act
>
0
)
if
(
act
>
0
)
{
{
if
(
_dbg_withtrace
)
if
(
NODEJS_
_dbg_withtrace
)
__dbg_print
(
"
Shifting symbol:
"
+
labels
[
la
]
+
"
(
"
+
info
.
att
+
"
)
"
);
__
NODEJS_
dbg_print
(
"
Shifting symbol:
"
+
labels
[
la
]
+
"
(
"
+
info
.
att
+
"
)
"
);
sstack
.
push
(
act
);
sstack
.
push
(
act
);
vstack
.
push
(
info
.
att
);
vstack
.
push
(
info
.
att
);
la
=
__lex
(
info
);
la
=
__
NODEJS_
lex
(
info
);
if
(
_dbg_withtrace
)
if
(
NODEJS_
_dbg_withtrace
)
__dbg_print
(
"
\t
New lookahead symbol:
"
+
labels
[
la
]
+
"
(
"
+
info
.
att
+
"
)
"
);
__
NODEJS_
dbg_print
(
"
\t
New lookahead symbol:
"
+
labels
[
la
]
+
"
(
"
+
info
.
att
+
"
)
"
);
}
}
//Reduce
//Reduce
else
else
{
{
act
*=
-
1
;
act
*=
-
1
;
if
(
_dbg_withtrace
)
if
(
NODEJS_
_dbg_withtrace
)
__dbg_print
(
"
Reducing by producution:
"
+
act
);
__
NODEJS_
dbg_print
(
"
Reducing by producution:
"
+
act
);
rval
=
void
(
0
);
rval
=
void
(
0
);
if
(
_dbg_withtrace
)
if
(
NODEJS_
_dbg_withtrace
)
__dbg_print
(
"
\t
Performing semantic action...
"
);
__
NODEJS_
dbg_print
(
"
\t
Performing semantic action...
"
);
switch
(
act
)
switch
(
act
)
{
{
...
@@ -595,8 +597,8 @@ switch( act )
...
@@ -595,8 +597,8 @@ switch( act )
if
(
_dbg_withtrace
)
if
(
NODEJS_
_dbg_withtrace
)
__dbg_print
(
"
\t
Popping
"
+
pop_tab
[
act
][
1
]
+
"
off the stack...
"
);
__
NODEJS_
dbg_print
(
"
\t
Popping
"
+
pop_tab
[
act
][
1
]
+
"
off the stack...
"
);
for
(
var
i
=
0
;
i
<
pop_tab
[
act
][
1
];
i
++
)
for
(
var
i
=
0
;
i
<
pop_tab
[
act
][
1
];
i
++
)
{
{
...
@@ -617,24 +619,24 @@ switch( act )
...
@@ -617,24 +619,24 @@ switch( act )
if
(
act
==
0
)
if
(
act
==
0
)
break
;
break
;
if
(
_dbg_withtrace
)
if
(
NODEJS_
_dbg_withtrace
)
__dbg_print
(
"
\t
Pushing non-terminal
"
+
labels
[
pop_tab
[
act
][
0
]
]
);
__
NODEJS_
dbg_print
(
"
\t
Pushing non-terminal
"
+
labels
[
pop_tab
[
act
][
0
]
]
);
sstack
.
push
(
go
);
sstack
.
push
(
go
);
vstack
.
push
(
rval
);
vstack
.
push
(
rval
);
}
}
if
(
_dbg_withtrace
)
if
(
NODEJS_
_dbg_withtrace
)
{
{
alert
(
_dbg_string
);
alert
(
NODEJS_
_dbg_string
);
_dbg_string
=
new
String
();
NODEJS_
_dbg_string
=
new
String
();
}
}
}
}
if
(
_dbg_withtrace
)
if
(
NODEJS_
_dbg_withtrace
)
{
{
__dbg_print
(
"
\n
Parse complete.
"
);
__
NODEJS_
dbg_print
(
"
\n
Parse complete.
"
);
alert
(
_dbg_string
);
alert
(
NODEJS_
_dbg_string
);
}
}
return
err_cnt
;
return
err_cnt
;
...
@@ -689,7 +691,7 @@ var error_offsets = [];
...
@@ -689,7 +691,7 @@ var error_offsets = [];
var
error_lookaheads
=
[];
var
error_lookaheads
=
[];
var
error_count
=
0
;
var
error_count
=
0
;
var
result
;
var
result
;
if
(
(
error_count
=
__parse
(
string
,
error_offsets
,
error_lookaheads
)
)
>
0
)
{
if
(
(
error_count
=
__
NODEJS_
parse
(
string
,
error_offsets
,
error_lookaheads
)
)
>
0
)
{
var
i
;
var
i
;
for
(
i
=
0
;
i
<
error_count
;
++
i
)
{
for
(
i
=
0
;
i
<
error_count
;
++
i
)
{
throw
new
Error
(
"
Parse error near
\"
"
+
throw
new
Error
(
"
Parse error near
\"
"
+
...
@@ -888,13 +890,17 @@ Object.defineProperty(scope.ComplexQueries,"query",{
...
@@ -888,13 +890,17 @@ Object.defineProperty(scope.ComplexQueries,"query",{
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
result_list
=
[],
result_list_tmp
=
[],
j
;
result_list
=
[],
result_list_tmp
=
[],
j
;
object_list
=
object_list
||
[];
object_list
=
object_list
||
[];
if
(
query
.
query
===
undefined
)
{
result_list
=
object_list
;
}
else
{
for
(
j
=
0
;
j
<
object_list
.
length
;
++
j
)
{
for
(
j
=
0
;
j
<
object_list
.
length
;
++
j
)
{
if
(
itemMatchesQuery
(
if
(
itemMatchesQuery
(
object_list
[
j
],
scope
.
ComplexQueries
.
parse
(
query
.
query
)
object_list
[
j
],
scope
.
ComplexQueries
.
parse
(
query
.
query
)
))
{
))
{
result_list
.
push
(
object_list
[
j
]);
result_list
.
push
(
object_list
[
j
]);
}
}
}
}
}
if
(
query
.
filter
)
{
if
(
query
.
filter
)
{
select
(
result_list
,
query
.
filter
.
select_list
||
[]);
select
(
result_list
,
query
.
filter
.
select_list
||
[]);
sort
(
result_list
,
query
.
filter
.
sort_on
||
[]);
sort
(
result_list
,
query
.
filter
.
sort_on
||
[]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment