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
c9ef076d
Commit
c9ef076d
authored
Nov 21, 2013
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add 'Import' functionality.
parent
4bb4b06e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
0 deletions
+43
-0
dream/platform/__init__.py
dream/platform/__init__.py
+6
-0
dream/platform/static/index.html
dream/platform/static/index.html
+3
-0
dream/platform/static/src/dream_launcher.js
dream/platform/static/src/dream_launcher.js
+34
-0
No files found.
dream/platform/__init__.py
View file @
c9ef076d
...
...
@@ -38,6 +38,12 @@ def front_page():
return
redirect
(
url_for
(
'static'
,
filename
=
'index.html'
))
@
app
.
route
(
"/postJSONFile"
,
methods
=
[
"POST"
,
"OPTIONS"
])
def
postJSONFile
():
data
=
json
.
load
(
request
.
files
[
'file'
])
app
.
logger
.
debug
(
"postJSONFile:%r"
%
data
)
return
jsonify
(
data
)
@
app
.
route
(
"/positionGraph"
,
methods
=
[
"POST"
,
"OPTIONS"
])
def
positionGraph
():
"""Uses graphviz to position nodes of the graph.
...
...
dream/platform/static/index.html
View file @
c9ef076d
...
...
@@ -26,6 +26,9 @@
<a
id=
"layout_graph"
>
Layout Graph
</a>
<a
id=
"zoom_in"
>
Zoom +
</a>
<a
id=
"zoom_out"
>
Zoom -
</a>
<a
id=
"export"
>
Export
</a>
<a
id=
"import"
>
Import
</a>
<form
id=
"import_form"
style=
"display:none"
><input
id=
"import_file"
name=
"file"
type=
"file"
></input></form>
</div>
</div>
...
...
dream/platform/static/src/dream_launcher.js
View file @
c9ef076d
...
...
@@ -439,6 +439,40 @@
dream_instance
.
zoom_out
();
});
// Enable "Export" button
$
(
"
#export
"
).
button
().
click
(
function
(
e
)
{
alert
(
'
not yet implemented
'
);
});
// Enable "Import" button
$
(
"
#import
"
).
button
().
click
(
function
(
e
)
{
$
(
'
#import_file
'
).
click
();
});
$
(
"
#import_file
"
).
change
(
function
()
{
var
form
=
$
(
this
).
parent
(
'
form
'
)[
0
];
var
form_data
=
new
FormData
(
form
);
$
.
ajax
(
'
/postJSONFile
'
,
{
type
:
'
POST
'
,
contentType
:
false
,
processData
:
false
,
data
:
form_data
,
dataType
:
'
json
'
,
error
:
function
()
{
console
.
log
(
'
error
'
);
},
success
:
function
(
data
,
textStatus
,
jqXHR
)
{
form
.
reset
();
id_container
=
{};
dream_instance
.
clearAll
();
$
(
"
#json_output
"
).
val
(
JSON
.
stringify
(
data
));
loadData
(
data
);
}
});
return
false
;
});
// Redraw if the graph area or the window is resized
$
(
'
#main
'
).
resizable
().
resize
(
function
()
{
dream_instance
.
redraw
();
...
...
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