Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio-main
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Hardik Juneja
jio-main
Commits
544ba866
Commit
544ba866
authored
Mar 31, 2014
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard supports parrallel actions
parent
2ef6bd5d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
78 deletions
+42
-78
examples/jio_dashboard.html
examples/jio_dashboard.html
+42
-78
No files found.
examples/jio_dashboard.html
View file @
544ba866
...
@@ -50,16 +50,16 @@
...
@@ -50,16 +50,16 @@
</tr>
</tr>
<tr>
<tr>
<td
colspan=
"2"
style=
"text-align: center;"
>
<td
colspan=
"2"
style=
"text-align: center;"
>
<button
onclick=
"
post(
)"
>
post
</button>
<button
onclick=
"
command('post'
)"
>
post
</button>
<button
onclick=
"
put(
)"
>
put
</button>
<button
onclick=
"
command('put'
)"
>
put
</button>
<button
onclick=
"
get(
)"
>
get
</button>
<button
onclick=
"
command('get'
)"
>
get
</button>
<button
onclick=
"
window.remove(
)"
>
remove
</button>
<button
onclick=
"
command('remove'
)"
>
remove
</button>
-
<button
onclick=
"
putAttachment(
)"
>
putAttachment
</button>
-
<button
onclick=
"
command('putAttachment'
)"
>
putAttachment
</button>
<button
onclick=
"
getAttachment(
)"
>
getAttachment
</button>
<button
onclick=
"
command('getAttachment'
)"
>
getAttachment
</button>
<button
onclick=
"
removeAttachment(
)"
>
removeAttachment
</button>
<button
onclick=
"
command('removeAttachment'
)"
>
removeAttachment
</button>
-
<button
onclick=
"
allDocs(
)"
>
allDocs
</button>
-
<button
onclick=
"
command('allDocs'
)"
>
allDocs
</button>
-
<button
onclick=
"c
heck(
)"
>
check
</button>
-
<button
onclick=
"c
ommand('check'
)"
>
check
</button>
<button
onclick=
"
repair(
)"
>
repair
</button>
<button
onclick=
"
command('repair'
)"
>
repair
</button>
</td>
</td>
</tr>
</tr>
<tr>
<tr>
...
@@ -284,90 +284,54 @@ function logAnswer(begin_date, val) {
...
@@ -284,90 +284,54 @@ function logAnswer(begin_date, val) {
return
val
;
return
val
;
}
}
function
command
(
method
,
num
)
{
function
command
(
method
)
{
var
begin_date
=
Date
.
now
(),
doc
=
{},
opts
=
{}
;
var
doc
=
{},
opts
=
{},
lock
,
n
,
jio
;
if
(
!
my_jio
)
{
if
(
!
my_jio
)
{
error
(
'
no jio set
'
);
error
(
'
no jio set
'
);
return
;
return
;
}
}
doc
=
select
(
'
#metadata
'
).
value
;
jio
=
my_jio
;
opts
=
select
(
"
#options
"
).
value
;
if
(
num
!==
undefined
)
{
doc
=
doc
.
replace
(
/
\\
u0000/g
,
num
);
opts
=
opts
.
replace
(
/
\\
u0000/g
,
num
);
}
doc
=
JSON
.
parse
(
doc
);
opts
=
JSON
.
parse
(
opts
);
log
(
method
+
'
\n
doc:
'
+
JSON
.
stringify
(
doc
,
null
,
"
"
)
+
'
\n
opts:
'
+
JSON
.
stringify
(
opts
,
null
,
"
"
));
if
(
method
===
"
allDocs
"
)
{
return
my_jio
.
allDocs
(
opts
).
then
(
logAnswer
.
bind
(
null
,
begin_date
),
logError
.
bind
(
null
,
begin_date
)
);
}
else
{
return
my_jio
[
method
](
doc
,
opts
).
then
(
logAnswer
.
bind
(
null
,
begin_date
),
logError
.
bind
(
null
,
begin_date
)
);
}
}
function
doCommandNTimes
(
method
,
i
)
{
var
n
=
0
,
lock
,
promise_list
=
[];
i
=
i
>
0
?
i
:
0
;
n
=
parseInt
(
select
(
"
#times
"
).
value
,
10
);
n
=
parseInt
(
select
(
"
#times
"
).
value
,
10
);
lock
=
select
(
"
#times-lock
"
).
checked
;
lock
=
select
(
"
#times-lock
"
).
checked
;
if
(
!
lock
)
{
if
(
!
lock
)
{
select
(
"
#times
"
).
value
=
"
1
"
;
select
(
"
#times
"
).
value
=
"
1
"
;
}
}
if
(
!
isFinite
(
n
))
{
if
(
!
isFinite
(
n
))
{
n
=
1
;
n
=
1
;
}
}
return
command
(
method
,
++
i
).
then
(
function
(
answer
)
{
if
(
i
<
n
)
{
return
doCommandNTimes
(
method
,
i
);
}
return
answer
;
});
}
function
post
()
{
doc
=
select
(
"
#metadata
"
).
value
;
return
doCommandNTimes
(
"
post
"
);
opts
=
select
(
"
#options
"
).
value
;
}
function
put
()
{
return
jIO
.
util
.
range
(
n
,
function
(
index
)
{
return
doCommandNTimes
(
"
put
"
);
var
param
=
doc
,
options
=
opts
,
begin
=
Date
.
now
(),
promise
;
}
function
get
()
{
param
=
param
.
replace
(
/
\\
u0000/g
,
index
);
return
doCommandNTimes
(
"
get
"
);
options
=
options
.
replace
(
/
\\
u0000/g
,
index
);
}
function
remove
()
{
param
=
JSON
.
parse
(
param
);
return
doCommandNTimes
(
"
remove
"
);
options
=
JSON
.
parse
(
options
);
}
function
putAttachment
()
{
if
(
method
===
"
allDocs
"
)
{
return
doCommandNTimes
(
"
putAttachment
"
);
log
(
method
+
"
\n
opts:
"
+
JSON
.
stringify
(
options
,
null
,
"
"
));
}
promise
=
jio
.
allDocs
(
options
);
function
getAttachment
()
{
}
else
{
return
doCommandNTimes
(
"
getAttachment
"
);
log
(
method
+
"
\n
doc:
"
+
JSON
.
stringify
(
param
,
null
,
"
"
)
+
}
"
\n
opts:
"
+
JSON
.
stringify
(
options
,
null
,
"
"
));
function
removeAttachment
()
{
promise
=
jio
[
method
](
param
,
options
);
return
doCommandNTimes
(
"
removeAttachment
"
);
}
}
function
allDocs
()
{
return
promise
.
return
doCommandNTimes
(
"
allDocs
"
);
then
(
logAnswer
.
bind
(
null
,
begin
),
logError
.
bind
(
null
,
begin
));
}
}).
then
(
null
,
function
(
e
)
{
function
check
()
{
error
(
e
.
toString
());
return
doCommandNTimes
(
"
check
"
);
});
}
function
repair
()
{
return
doCommandNTimes
(
"
repair
"
);
}
}
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
...
...
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