Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
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
dream
Commits
3e9f4a0d
Commit
3e9f4a0d
authored
Feb 25, 2015
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Input_viewResultComparison: New widget to show results and compare order lateness
parent
e4980345
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
138 additions
and
0 deletions
+138
-0
dream/platform/src/dream/Input_viewResultComparison.html
dream/platform/src/dream/Input_viewResultComparison.html
+18
-0
dream/platform/src/dream/Input_viewResultComparison.js
dream/platform/src/dream/Input_viewResultComparison.js
+120
-0
No files found.
dream/platform/src/dream/Input_viewResultComparison.html
0 → 100644
View file @
3e9f4a0d
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
Result List
</title>
<script
src=
"../<%= copy.rsvp.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"../<%= copy.renderjs.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"../<%= copy.handlebars.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"mixin_gadget.js"
type=
"text/javascript"
></script>
<script
src=
"Input_viewResultComparison.js"
type=
"text/javascript"
></script>
</head>
<body>
<div
data-gadget-url=
"../handsontable/index.html"
data-gadget-scope=
"tableeditor"
></div>
</body>
</html>
dream/platform/src/dream/Input_viewResultComparison.js
0 → 100644
View file @
3e9f4a0d
/*global rJS, RSVP, initGadgetMixin, jQuery */
/*jslint loopfunc: true */
/*jslint nomen: true */
(
function
(
window
,
rJS
,
RSVP
,
initGadgetMixin
,
$
)
{
"
use strict
"
;
var
gadget_klass
=
rJS
(
window
);
initGadgetMixin
(
gadget_klass
);
gadget_klass
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
aq_getAttachment
"
,
"
jio_getAttachment
"
)
.
declareAcquiredMethod
(
"
whoWantsToDisplayThisResult
"
,
"
whoWantsToDisplayThisResult
"
)
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
,
order_lateness
=
{};
this
.
props
.
jio_key
=
options
.
id
;
return
gadget
.
aq_getAttachment
({
"
_id
"
:
gadget
.
props
.
jio_key
,
"
_attachment
"
:
"
body.json
"
})
.
push
(
undefined
,
function
(
error
)
{
if
(
error
.
status_code
===
404
)
{
// Simulation not yet generated
return
JSON
.
stringify
([]);
}
throw
error
;
})
.
push
(
function
(
sim_json
)
{
var
result
=
JSON
.
parse
(
sim_json
).
result
,
result_list
=
[],
document_list
=
[],
i
;
if
(
result
&&
result
.
result_list
)
{
document_list
=
result
.
result_list
;
}
for
(
i
=
0
;
i
<
document_list
.
length
;
i
+=
1
)
{
result_list
.
push
(
RSVP
.
all
([
gadget
.
whoWantsToDisplayThisResult
(
gadget
.
props
.
jio_key
,
i
),
document_list
[
i
]
]));
}
return
RSVP
.
all
(
result_list
);
})
.
push
(
function
(
result_list
)
{
var
i
,
link
,
result
,
calculateOrderLateness
=
function
(
order_id
)
{
var
order
=
result
.
order_lateness
[
order_id
];
order
.
link
=
link
;
if
(
!
order_lateness
[
order_id
]){
order_lateness
[
order_id
]
=
[];
}
order_lateness
[
order_id
].
push
(
order
);
};
for
(
i
=
0
;
i
<
result_list
.
length
;
i
++
)
{
link
=
result_list
[
i
][
0
];
result
=
result_list
[
i
][
1
];
Object
.
keys
(
result
.
order_lateness
).
forEach
(
calculateOrderLateness
);
}
return
gadget
.
getDeclaredGadget
(
"
tableeditor
"
);
})
.
push
(
function
(
tableeditor
)
{
var
i
,
data
=
[],
colHeaders
=
[
"
Project
"
],
columns
=
[{
data
:
0
}];
Object
.
keys
(
order_lateness
).
forEach
(
function
(
order_id
)
{
var
order
=
order_lateness
[
order_id
];
order
.
unshift
(
order_id
);
data
.
push
(
order
);
});
function
orderHtmlRenderer
(
instance
,
td
,
row
,
col
,
prop
,
value
,
cellProperties
)
{
var
a
,
color
=
"
yellow
"
;
if
(
value
.
delay
<
.
5
)
{
color
=
"
green
"
;
}
if
(
value
.
delay
>
.
5
)
{
color
=
"
red
"
;
}
$
(
td
).
css
({
"
background-color
"
:
color
});
a
=
$
(
"
<a>
"
).
attr
(
"
href
"
,
value
.
link
)
.
text
(
value
.
completionDate
+
"
\n
"
+
(
value
.
delay
||
0
).
toFixed
(
0
))
.
css
({
color
:
"
black
"
,
"
text-shadow
"
:
"
none
"
});
a
.
appendTo
(
td
);
return
td
;
}
for
(
i
=
1
;
i
<
data
[
0
].
length
;
i
+=
1
)
{
colHeaders
.
push
(
"
Solution #
"
+
i
);
columns
.
push
({
data
:
i
,
renderer
:
orderHtmlRenderer
})
}
return
tableeditor
.
render
(
JSON
.
stringify
(
data
),
{
colHeaders
:
colHeaders
,
columns
:
columns
,
readOnly
:
true
}
);
});
})
.
declareMethod
(
"
startService
"
,
function
()
{
var
gadget
=
this
;
return
this
.
getDeclaredGadget
(
"
tableeditor
"
)
.
push
(
function
(
tableeditor
)
{
return
tableeditor
.
startService
();
});
});
}(
window
,
rJS
,
RSVP
,
initGadgetMixin
,
jQuery
));
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