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
64aae882
Commit
64aae882
authored
Jun 25, 2013
by
Sebastien Robin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gui prototype: enable back dialog and allow to delete elements
parent
e48e1586
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
109 additions
and
5 deletions
+109
-5
DREAM/dream/dream/platform/static/index.html
DREAM/dream/dream/platform/static/index.html
+17
-0
DREAM/dream/dream/platform/static/src/dream_launcher.js
DREAM/dream/dream/platform/static/src/dream_launcher.js
+2
-1
DREAM/dream/dream/platform/static/src/jsonPlumb.js
DREAM/dream/dream/platform/static/src/jsonPlumb.js
+90
-4
No files found.
DREAM/dream/dream/platform/static/index.html
View file @
64aae882
...
...
@@ -67,6 +67,9 @@
<script
type=
"text/javascript"
src=
"lib/jquery-1.8.1-min.js"
></script>
<script
type=
"text/javascript"
src=
"lib/jquery-ui-1.8.23-min.js"
></script>
<script
type=
"text/javascript"
src=
"lib/jquery.ui.touch-punch.min.js"
></script>
<script
type=
"text/javascript"
src=
"lib/md5.js"
></script>
<script
type=
"text/javascript"
src=
"lib/jio.js"
></script>
<script
type=
"text/javascript"
src=
"lib/jio.localstorage.js"
></script>
<!-- /DEP -->
<!-- JS -->
...
...
@@ -102,6 +105,20 @@
<script
src=
"lib/jsPlumb/jquery.jsPlumb.js"
></script>
<!-- /JS -->
<div
id=
"dialog-form"
title=
"Change Througput"
>
<p
class=
"validateTips"
>
All form fields are required.
</p>
<form>
<fieldset>
<label
for=
"Throughput"
>
Throughput
</label>
<input
type=
"text"
name=
"throughput"
id=
"throughput"
class=
"text ui-widget-content ui-corner-all"
/>
</fieldset>
</form>
</div>
<!-- demo code -->
<script
src=
"src/dream.js"
></script>
<script
src=
"src/jsonPlumb.js"
></script>
...
...
DREAM/dream/dream/platform/static/src/dream_launcher.js
View file @
64aae882
...
...
@@ -2,7 +2,7 @@
"
use strict
"
;
jsPlumb
.
bind
(
"
ready
"
,
function
()
{
var
graph_data
=
{},
dream_instance
,
available_people
=
{},
people_list
,
i
,
i_length
,
updateWorkerCount
,
json_plumb_configuration
=
{};
i
,
i_length
,
updateWorkerCount
,
json_plumb_configuration
=
{}
,
jio
;
graph_data
.
throughput
=
0
;
graph_data
.
box_list
=
[
{
id
:
'
window1
'
,
title
:
'
attach1
'
,
throughput
:
30
,
target_list
:
[
'
window2
'
],
coordinate
:
{
top
:
5
,
left
:
5
}},
...
...
@@ -17,6 +17,7 @@
{
id
:
'
window10
'
,
title
:
'
tests
'
,
throughput
:
28
,
target_list
:
[
'
window11
'
],
coordinate
:
{
top
:
20
,
left
:
45
}},
{
id
:
'
window11
'
,
title
:
'
packaging
'
,
throughput
:
27
,
coordinate
:
{
top
:
20
,
left
:
55
}},
];
jio
=
new
jIO
.
newJio
({
type
:
"
local
"
,
username
:
"
dream
"
,
applicationname
:
"
dream
"
});
/*json_plumb_configuration["Dream.Queue"] = {
"id": "DummyQ",
"name": "DummyQ",
...
...
DREAM/dream/dream/platform/static/src/jsonPlumb.js
View file @
64aae882
...
...
@@ -14,7 +14,7 @@
DragOptions
:
{
cursor
:
'
pointer
'
,
zIndex
:
2000
},
EndpointStyles
:
[{
fillStyle
:
'
#225588
'
},
{
fillStyle
:
'
#558822
'
}],
PaintStyle
:
{
strokeStyle
:
"
#736AFF
"
,
lineWidth
:
2
},
HoverPaintStyle
:
{
strokeStyle
:
"
#42a62c
"
,
lineWidth
:
2
},
HoverPaintStyle
:
{
strokeStyle
:
"
#42a62c
"
,
lineWidth
:
4
},
Endpoint
:
[
"
Dot
"
,
{
radius
:
2
}
],
ConnectionOverlays
:
[
[
"
Arrow
"
,
{
...
...
@@ -112,6 +112,67 @@
priv
.
updateJsonOutput
();
};
priv
.
removeElement
=
function
(
element_id
)
{
jsPlumb
.
removeAllEndpoints
(
$
(
"
#
"
+
element_id
));
$
(
"
#
"
+
element_id
).
remove
();
delete
(
priv
.
element_container
[
element_id
]);
};
priv
.
initDialog
=
function
(
title
,
element_id
)
{
// code to allow changing values on connections. For now we assume
// that it is throughput. But we will need more generic code
var
throughput
=
$
(
"
#throughput
"
),
allFields
=
$
(
[]
).
add
(
throughput
),
tips
=
$
(
"
.validateTips
"
);
$
(
function
()
{
$
(
"
input[type=submit]
"
)
.
button
()
.
click
(
function
(
event
)
{
event
.
preventDefault
();
});
});
$
(
"
#dialog-form
"
).
dialog
({
autoOpen
:
false
,
height
:
300
,
width
:
350
,
modal
:
true
,
title
:
title
||
""
,
buttons
:
{
Cancel
:
function
()
{
$
(
this
).
dialog
(
"
close
"
);
},
Delete
:
function
()
{
console
.
log
(
"
Going to delete $(this)
"
,
$
(
this
));
priv
.
removeElement
(
element_id
);
$
(
this
).
dialog
(
"
close
"
);
},
"
Validate
"
:
function
()
{
var
bValid
=
true
,
i
,
i_length
,
box
;
allFields
.
removeClass
(
"
ui-state-error
"
);
bValid
=
bValid
&&
checkRegexp
(
throughput
,
/^
([
0-9
])
+$/
,
"
Througput must be integer.
"
);
if
(
bValid
)
{
// Update the model with new value
i_length
=
model
.
box_list
.
length
;
for
(
i
=
0
;
i
<
i_length
;
i
++
)
{
box
=
model
.
box_list
[
i
];
if
(
box
.
id
===
priv
.
box_id
)
{
box
.
throughput
=
parseInt
(
throughput
.
val
(),
10
);
}
}
priv
.
updateModel
();
$
(
this
).
dialog
(
"
close
"
);
}
},
},
close
:
function
()
{
allFields
.
val
(
""
).
removeClass
(
"
ui-state-error
"
);
}
});
};
Object
.
defineProperty
(
that
,
"
start
"
,
{
configurable
:
false
,
enumerable
:
false
,
...
...
@@ -129,13 +190,24 @@
"
confidenceLevel
"
:
"
0.95
"
},
};
priv
.
graph_selection
=
{};
priv
.
initJsPlumb
();
//
priv.initDialog();
priv
.
initDialog
();
//priv.displayGraph();
//priv.refreshModelRegularly();
}
});
Object
.
defineProperty
(
that
,
"
removeElement
"
,
{
configurable
:
false
,
enumerable
:
false
,
writable
:
false
,
value
:
function
(
element_id
)
{
console
.
log
(
"
going to remove element
"
,
element_id
);
priv
.
removeElement
(
element_id
);
}
});
Object
.
defineProperty
(
that
,
"
newElement
"
,
{
configurable
:
false
,
enumerable
:
false
,
...
...
@@ -157,6 +229,19 @@
// Initial DEMO code : make all the window divs draggable
jsPlumb
.
draggable
(
jsPlumb
.
getSelector
(
"
.window
"
),
{
grid
:
[
20
,
20
]
});
console
.
log
(
"
window selector
"
,
jsPlumb
.
getSelector
(
"
.window
"
));
jsPlumb
.
getSelector
(
"
#
"
+
element
.
id
).
bind
(
'
click
'
,
function
()
{
console
.
log
(
"
bind click on window
"
,
$
(
this
));
//$("#dialog-form").attr("title", "bar");
$
(
"
#dialog-form
"
).
dialog
(
"
destroy
"
)
;
priv
.
initDialog
(
element
.
id
,
element
.
id
);
$
(
"
#dialog-form
"
).
dialog
(
"
open
"
);
});
/*container.find('.vmail').bind('click', function() {
var id = $(this).attr('id').replace("pm_","");
getPM(id);
}); */
// Add endPoint to allow drawing connections
var
color
=
"
#00f
"
;
var
gradient_color
=
"
#09098e
"
;
...
...
@@ -206,6 +291,7 @@
return
that
;
};
var
JsonPlumbNamespace
=
(
function
()
{
var
that
=
{};
...
...
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