Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emulab
emulab-devel
Commits
3e765303
Commit
3e765303
authored
Nov 07, 2013
by
Leigh B Stoller
Committed by
Gary Wong
Jan 08, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Checkpoint.
parent
8b3e0385
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
235 additions
and
71 deletions
+235
-71
www/aptui/quickvm.css
www/aptui/quickvm.css
+5
-0
www/aptui/quickvm.php
www/aptui/quickvm.php
+116
-38
www/aptui/quickvm_status.php
www/aptui/quickvm_status.php
+4
-4
www/aptui/quickvm_sup.js
www/aptui/quickvm_sup.js
+110
-29
No files found.
www/aptui/quickvm.css
View file @
3e765303
...
...
@@ -50,6 +50,11 @@ body {
margin-left
:
auto
;
margin-right
:
auto
;
}
.align-center-inline
{
display
:
inline-block
;
margin-left
:
auto
;
margin-right
:
auto
;
}
/* Styles for svg diagrams */
.topomap
{
...
...
www/aptui/quickvm.php
View file @
3e765303
...
...
@@ -25,8 +25,9 @@ chdir("..");
include
(
"defs.php3"
);
include_once
(
"osinfo_defs.php"
);
include_once
(
"geni_defs.php"
);
chdir
(
"apt"
);
chdir
(
"apt
lbs
"
);
include
(
"quickvm_sup.php"
);
$dblink
=
GetDBLink
(
"sa"
);
#
# Verify page arguments.
...
...
@@ -34,35 +35,64 @@ include("quickvm_sup.php");
$optargs
=
OptionalPageArguments
(
"create"
,
PAGEARG_STRING
,
"username"
,
PAGEARG_STRING
,
"email"
,
PAGEARG_STRING
,
"
imageid
"
,
PAGEARG_STRING
,
"
profile
"
,
PAGEARG_STRING
,
"stuffing"
,
PAGEARG_STRING
,
"verify"
,
PAGEARG_STRING
,
"sshkey"
,
PAGEARG_STRING
);
"sshkey"
,
PAGEARG_STRING
,
"ajax_request"
,
PAGEARG_BOOLEAN
,
"ajax_method"
,
PAGEARG_STRING
,
"ajax_argument"
,
PAGEARG_STRING
);
#
# Deal with ajax requests.
#
if
(
isset
(
$ajax_request
))
{
if
(
$ajax_method
==
"getprofile"
)
{
$profile_name
=
addslashes
(
$ajax_argument
);
$query_result
=
DBQueryWarn
(
"select * from quickvm_rspecs "
.
"where name='
$profile_name
'"
,
$dblink
);
if
(
!
$query_result
||
!
mysql_num_rows
(
$query_result
))
{
SPITAJAX_ERROR
(
1
,
"No such profile!"
);
exit
();
}
$row
=
mysql_fetch_array
(
$query_result
);
SPITAJAX_RESPONSE
(
array
(
'rspec'
=>
$row
[
'rspec'
],
'name'
=>
$row
[
'name'
],
'description'
=>
$row
[
'description'
]));
}
exit
();
}
# Form defaults.
$username_default
=
"Pick a user name"
;
$email_default
=
"Your email address"
;
$sshkey_default
=
"Your SSH public key"
;
$imageid_default
=
"UBUNTU12-64-STD"
;
$profile_default
=
"UBUNTU12-64-STD"
;
$profile_array
=
array
();
$imageid_array
=
array
(
$imageid_default
=>
"UBUNTU 12.04 LTS"
,
"FBSD90-STD"
=>
"FreeBSD 9.0"
,
"FEDORA15-STD"
=>
"Fedora 15"
);
$query_result
=
DBQueryFatal
(
"select * from quickvm_rspecs"
,
$dblink
);
while
(
$row
=
mysql_fetch_array
(
$query_result
))
{
$profile_array
[
$row
[
"name"
]]
=
$row
[
"name"
];
}
function
SPITFORM
(
$username
,
$email
,
$sshkey
,
$
imageid
,
$newuser
,
$errors
)
function
SPITFORM
(
$username
,
$email
,
$sshkey
,
$
profile
,
$newuser
,
$errors
)
{
global
$TBBASE
,
$TBMAIL_OPS
;
global
$username_default
,
$email_default
,
$sshkey_default
;
global
$
imageid
_default
,
$
imageid
_array
;
global
$
profile
_default
,
$
profile
_array
;
$username_value
=
""
;
$email_value
=
""
;
$sshkey_value
=
""
;
$
imageid
_value
=
""
;
$
profile
_value
=
""
;
$username_error
=
""
;
$email_error
=
""
;
$sshkey_error
=
""
;
$
imageid
_error
=
""
;
$
profile
_error
=
""
;
$internal_error
=
null
;
if
(
isset
(
$username
)
&&
$username
!=
""
)
{
...
...
@@ -74,8 +104,8 @@ function SPITFORM($username, $email, $sshkey, $imageid, $newuser, $errors)
if
(
isset
(
$sshkey
)
&&
$sshkey
!=
""
)
{
$sshkey_value
=
CleanString
(
$sshkey
);
}
if
(
isset
(
$
imageid
)
&&
$imageid
!=
""
)
{
$
imageid
_value
=
CleanString
(
$
imageid
);
if
(
isset
(
$
profile
)
&&
$profile
!=
""
)
{
$
profile
_value
=
CleanString
(
$
profile
);
}
if
(
$errors
)
{
while
(
list
(
$name
,
$message
)
=
each
(
$errors
))
{
...
...
@@ -87,14 +117,14 @@ function SPITFORM($username, $email, $sshkey, $imageid, $newuser, $errors)
$email_error
=
$message
;
elseif
(
$name
==
"sshkey"
)
$sshkey_error
=
$message
;
elseif
(
$name
==
"
imageid
"
)
$
imageid
_error
=
$message
;
elseif
(
$name
==
"
profile
"
)
$
profile
_error
=
$message
;
elseif
(
$name
==
"internal"
)
{
$internal_error
=
$message
;
}
}
}
SPITHEADER
();
SPITHEADER
(
1
);
if
(
$internal_error
)
{
echo
"<center><h2>
$internal_error
</h2></center><br>
\n
"
;
...
...
@@ -133,18 +163,20 @@ function SPITFORM($username, $email, $sshkey, $imageid, $newuser, $errors)
<textarea id='sshkey' name='sshkey'
placeholder='
$sshkey_default
'
class='form-control'
rows=
5
cols=45>
$sshkey_value
</textarea>
rows=
4
cols=45>
$sshkey_value
</textarea>
<label
style='color: red'
for='sshkey'>
$sshkey_error
</label>
</div>
<div class='form-group'>
<select class='pull-left' name='imageid'>
<select class='pull-left' id='profile_name'
name='profile'
onChange='ShowProfile(0);'>
<option value=''>Select Profile</option>
\n
"
;
while
(
list
(
$id
,
$title
)
=
each
(
$
imageid
_array
))
{
while
(
list
(
$id
,
$title
)
=
each
(
$
profile
_array
))
{
$selected
=
""
;
if
(
$
imageid
_value
==
$id
)
if
(
$
profile
_value
==
$id
)
$selected
=
"selected"
;
echo
"<option
$selected
value='
$id
'>
$title
</option>
\n
"
;
...
...
@@ -152,7 +184,7 @@ function SPITFORM($username, $email, $sshkey, $imageid, $newuser, $errors)
echo
" </select>
<label
style='color: red'
for='
imageid'>
$imageid
_error
</label>
for='
profile'>
$profile
_error
</label>
</div>
<button class='btn btn-primary pull-right'
type='submit' name='create'>Create!
...
...
@@ -167,8 +199,8 @@ function SPITFORM($username, $email, $sshkey, $imageid, $newuser, $errors)
</div>
</div>
\n
"
;
if
(
0
)
{
echo
"<!-- This is the modal -->
if
(
1
)
{
echo
"<!-- This is the
user verify
modal -->
<div id='working' class='modal fade'>
<div class='modal-dialog'>
<div class='modal-content'>
...
...
@@ -208,7 +240,53 @@ function SPITFORM($username, $email, $sshkey, $imageid, $newuser, $errors)
}
echo
"</form>
\n
"
;
echo
"<!-- This is the topology view modal -->
<div id='quickvm_topomodal' class='modal fade'>
<div class='modal-dialog' id='showtopo_dialog'>
<div class='modal-content'>
<div class='modal-header'>
<button type='button' class='close' data-dismiss='modal'
aria-hidden='true'>×</button>
<span id='showtopo_title'></span>
</div>
<div class='modal-body'>
<!-- This topo diagram goes inside this div -->
<div class='panel panel-default'
id='showtopo_container'>
<div class='panel-body'>
<div id='showtopo_div'></div>
</div>
</div>
<div id='scrollright'
class='pull-right' style='cursor: pointer; "
.
"margin-bottom: 0px; margin-right: 5px;'>
<span class='glyphicon glyphicon-arrow-right'></span>
</div>
<div id='scrollleft'
class='pull-left' style='cursor: pointer; "
.
"margin-bottom: 0px; margin-right: 5px;'>
<span class='glyphicon glyphicon-arrow-left'></span>
</div>
</div>
<div class='modal-footer'>
<span class='pull-left' id='showtopo_description'></span>
<div class='pull-right'>
<button id='showtopo_select'
class='btn btn-primary btn-xs'
type='submit' name='select'>
Select</button>
</div>
</div>
</div>
</div>
</div>
\n
"
;
echo
"<SCRIPT LANGUAGE=JavaScript>
window.onload = InitProfileSelector;
</SCRIPT>
\n
"
;
echo
"<script src='d3.v3.js'></script>
\n
"
;
echo
"<SCRIPT LANGUAGE=JavaScript>
\n
"
;
if
(
$newuser
)
{
echo
"ShowModal('#working');
\n
"
;
}
...
...
@@ -272,18 +350,18 @@ elseif (User::LookupByUid($username)) {
$errors
[
"username"
]
=
"Already in use"
;
}
if
(
!
isset
(
$
imageid
)
||
$imageid
==
""
)
{
$errors
[
"
imageid
"
]
=
"No selection made"
;
if
(
!
isset
(
$
profile
)
||
$profile
==
""
)
{
$errors
[
"
profile
"
]
=
"No selection made"
;
}
elseif
(
!
array_key_exists
(
$
imageid
,
$imageid
_array
))
{
$errors
[
"
imageid
"
]
=
"Invalid Profile:
$
imageid
"
;
elseif
(
!
array_key_exists
(
$
profile
,
$profile
_array
))
{
$errors
[
"
profile
"
]
=
"Invalid Profile:
$
profile
"
;
}
elseif
(
!
OSinfo
::
LookupByName
(
$TBOPSPID
,
$imageid
))
{
$errors
[
"
imageid
"
]
=
"Nonexistant Profile:
$
imageid
"
;
elseif
(
!
in_array
(
$profile
,
$profile_array
))
{
$errors
[
"
profile
"
]
=
"Nonexistant Profile:
$
profile
"
;
}
if
(
count
(
$errors
))
{
SPITFORM
(
$username
,
$email
,
$sshkey
,
$
imageid
,
false
,
$errors
);
SPITFORM
(
$username
,
$email
,
$sshkey
,
$
profile
,
false
,
$errors
);
SPITFOOTER
();
return
;
}
...
...
@@ -310,13 +388,13 @@ else {
}
if
(
count
(
$errors
))
{
SPITFORM
(
$username
,
$email
,
$sshkey
,
$
imageid
,
false
,
$errors
);
SPITFORM
(
$username
,
$email
,
$sshkey
,
$
profile
,
false
,
$errors
);
SPITFOOTER
();
return
;
}
$args
[
"username"
]
=
$username
;
$args
[
"email"
]
=
$email
;
$args
[
"
imageid"
]
=
$imageid
;
$args
[
"
profile"
]
=
$profile
;
#
# See if user exists and is verified. We send email with a code, which
...
...
@@ -331,7 +409,7 @@ if (!$exists || !isset($_COOKIE['quickvm_authkey']) ||
$_COOKIE
[
'quickvm_authkey'
]
!=
$exists
->
auth_token
())
{
if
(
isset
(
$stuffing
)
&&
$stuffing
!=
""
)
{
if
(
!
(
isset
(
$verify
)
&&
$verify
==
$stuffing
))
{
SPITFORM
(
$username
,
$email
,
$sshkey
,
$
imageid
,
$stuffing
,
$errors
);
SPITFORM
(
$username
,
$email
,
$sshkey
,
$
profile
,
$stuffing
,
$errors
);
SPITFOOTER
();
return
;
}
...
...
@@ -355,7 +433,7 @@ if (!$exists || !isset($_COOKIE['quickvm_authkey']) ||
# New user, we create a new one.
$token
=
(
$exists
?
$exists
->
auth_token
()
:
true
);
SPITFORM
(
$username
,
$email
,
$sshkey
,
$
imageid
,
$token
,
$errors
);
SPITFORM
(
$username
,
$email
,
$sshkey
,
$
profile
,
$token
,
$errors
);
SPITFOOTER
();
return
;
}
...
...
@@ -388,7 +466,7 @@ else {
chmod
(
$xmlname
,
0666
);
}
if
(
count
(
$errors
))
{
SPITFORM
(
$username
,
$email
,
$sshkey
,
$
imageid
,
false
,
$errors
);
SPITFORM
(
$username
,
$email
,
$sshkey
,
$
profile
,
false
,
$errors
);
SPITFOOTER
();
return
;
}
...
...
@@ -417,7 +495,7 @@ if ($retval != 0) {
$errors
[
"internal"
]
=
"Transient error(4); please try again later."
;
}
}
SPITFORM
(
$username
,
$email
,
$sshkey
,
$
imageid
,
false
,
$errors
);
SPITFORM
(
$username
,
$email
,
$sshkey
,
$
profile
,
false
,
$errors
);
SPITFOOTER
();
return
;
}
...
...
@@ -426,14 +504,14 @@ unlink($xmlname);
$quickvm
=
QuickVM
::
LookupByName
(
$args
[
"name"
]);
if
(
!
$quickvm
)
{
$errors
[
"internal"
]
=
"Transient error(5); please try again later."
;
SPITFORM
(
$username
,
$email
,
$sshkey
,
$
imageid
,
false
,
$errors
);
SPITFORM
(
$username
,
$email
,
$sshkey
,
$
profile
,
false
,
$errors
);
SPITFOOTER
();
return
;
}
$creator
=
GeniUser
::
Lookup
(
"sa"
,
$quickvm
->
creator_uuid
());
if
(
!
$creator
)
{
$errors
[
"internal"
]
=
"Transient error(6); please try again later."
;
SPITFORM
(
$username
,
$email
,
$sshkey
,
$
imageid
,
false
,
$errors
);
SPITFORM
(
$username
,
$email
,
$sshkey
,
$
profile
,
false
,
$errors
);
SPITFOOTER
();
return
;
}
...
...
www/aptui/quickvm_status.php
View file @
3e765303
...
...
@@ -25,7 +25,7 @@ chdir("..");
include
(
"defs.php3"
);
include_once
(
"osinfo_defs.php"
);
include_once
(
"geni_defs.php"
);
chdir
(
"apt"
);
chdir
(
"apt
lbs
"
);
include
(
"quickvm_sup.php"
);
$ajax_request
=
0
;
...
...
@@ -326,11 +326,11 @@ echo "<!-- This is a modal -->
Watch for an email message that says its been done.
<form id='extend_request_form' role='form'>
<div class='row'>
<div class='col-lg-1
0
col-md-
6
'>
<div class='col-lg-1
2
col-md-
12
'>
<textarea id='why_extend' name='why_extend'
class='form-control'
placeholder='Tell us a good story please.'
class='align-center'
class='align-center
-inline
'
rows=5></textarea>
</div></div>
<br>
...
...
@@ -339,7 +339,7 @@ echo "<!-- This is a modal -->
type='submit' name='request'>Request Extension</button>
</form>
</div>
<div class='col-lg-5 col-md-5'>
<div class='col-lg-5 col-md-5
invisible
'>
To extend your experiment for more then another 24 hours,
you need an extension code. If you do not have a code then
you need not worry about it.
...
...
www/aptui/quickvm_sup.js
View file @
3e765303
...
...
@@ -14,7 +14,7 @@ function CallMethod(method, callback, uuid, arg)
{
return
$
.
ajax
({
// the URL for the request
url
:
"
quickvm_status.php
"
,
url
:
window
.
location
.
href
,
// the data to send (will be converted to a query string)
data
:
{
...
...
@@ -77,8 +77,7 @@ function StatusWatchCallBack(uuid, json)
}
$
(
"
#terminate_button
"
).
prop
(
"
disabled
"
,
false
);
$
(
"
#extend_button
"
).
prop
(
"
disabled
"
,
false
);
// ShowTopo(uuid);
ShowTopoNew
(
uuid
);
ShowTopo
(
uuid
);
}
else
if
(
status
==
'
failed
'
)
{
status_html
=
"
<font color=red>failed</font>
"
;
...
...
@@ -119,39 +118,108 @@ function Terminate(uuid, url)
function
ShowTopo
(
uuid
)
{
var
callback
=
function
(
json
)
{
if
(
json
.
value
==
""
)
{
return
;
}
console
.
log
(
json
.
value
);
var
html
=
"
<div>
"
+
json
.
value
+
"
</div>
"
;
var
xmlDoc
=
$
.
parseXML
(
json
.
value
);
var
xml
=
$
(
xmlDoc
);
var
topo
=
ConvertManifestToJSON
(
null
,
xml
);
console
.
log
(
topo
);
$
(
"
#showtopo_container
"
).
removeClass
(
"
invisible
"
);
maketopmap
(
"
#showtopo_div
"
,
$
(
"
#showtopo_div
"
).
width
()
-
30
,
300
,
topo
);
$
(
"
#showtopo_div
"
).
html
(
html
);
}
var
$xmlthing
=
CallMethod
(
"
gettopomap
"
,
null
,
uuid
,
null
);
console
.
log
(
uuid
);
var
$xmlthing
=
CallMethod
(
"
manifest
"
,
null
,
uuid
,
null
);
$xmlthing
.
done
(
callback
);
}
function
Show
TopoNew
(
uuid
)
function
Show
Profile
(
direction
)
{
var
profile
;
var
index
;
if
(
direction
)
{
var
max
=
$
(
'
#profile_name option
'
).
length
;
console
.
log
(
max
);
index
=
ShowProfile
.
index
+
direction
;
if
(
index
<
1
)
{
index
=
max
;
}
else
if
(
index
>=
max
)
{
index
=
1
;
}
profile
=
$
(
"
#profile_name :nth(
"
+
index
+
"
)
"
).
val
();
}
else
{
// Use this static variable to track current index
index
=
$
(
"
#profile_name
"
).
prop
(
"
selectedIndex
"
);
profile
=
$
(
'
#profile_name
'
).
val
();
}
ShowProfile
.
index
=
index
;
console
.
log
(
profile
);
console
.
log
(
index
);
var
callback
=
function
(
json
)
{
console
.
log
(
json
.
value
);
var
xmlDoc
=
$
.
parseXML
(
json
.
value
);
var
xmlDoc
=
$
.
parseXML
(
json
.
value
.
rspec
);
var
xml
=
$
(
xmlDoc
);
var
topo
=
ConvertManifestToJSON
(
xml
);
var
topo
=
ConvertManifestToJSON
(
profile
,
xml
);
console
.
log
(
topo
);
$
(
"
#showtopo_container
"
).
removeClass
(
"
invisible
"
);
ShowModal
(
"
#quickvm_topomodal
"
);
$
(
'
#showtopo_title
'
).
html
(
"
<h3>
"
+
profile
+
"
</h3>
"
);
$
(
'
#showtopo_description
'
).
html
(
json
.
value
.
description
);
maketopmap
(
"
#showtopo_div
"
,
$
(
"
#showtopo_di
v
"
).
w
idth
()
-
3
0
,
(
$
(
"
#showtopo_di
alog
"
).
outerW
idth
()
)
-
9
0
,
300
,
topo
);
}
var
$xmlthing
=
CallMethod
(
"
getprofile
"
,
null
,
0
,
profile
);
$xmlthing
.
done
(
callback
);
}
function
ShowProfileSlider
(
direction
)
{
console
.
log
(
direction
);
var
callback
=
function
(
json
)
{
console
.
log
(
json
.
value
);
var
xmlDoc
=
$
.
parseXML
(
json
.
value
.
rspec
);
var
xml
=
$
(
xmlDoc
);
var
topo
=
ConvertManifestToJSON
(
null
,
xml
);
console
.
log
(
topo
);
$
(
'
#showtopo_title
'
).
html
(
"
<h3>
"
+
json
.
value
.
name
+
"
</h3>
"
);
$
(
'
#showtopo_description
'
).
html
(
json
.
value
.
description
);
$
(
"
#slider_container
"
).
removeClass
(
"
invisible
"
);
maketopmap
(
"
#slider_div
"
,
(
$
(
"
#slider_div
"
).
outerWidth
())
-
90
,
200
,
topo
);
}
console
.
log
(
uuid
);
var
$xmlthing
=
CallMethod
(
"
manifest
"
,
null
,
uuid
,
null
);
var
$xmlthing
=
CallMethod
(
"
getprofile
"
,
null
,
0
,
null
);
$xmlthing
.
done
(
callback
);
}
function
InitProfileSelector
()
{
$
(
'
#scrollleft
'
).
click
(
function
()
{
ShowProfile
(
-
1
);
});
$
(
'
#scrollright
'
).
click
(
function
()
{
ShowProfile
(
1
);
});
$
(
'
#showtopo_select
'
).
click
(
function
()
{
HideModal
(
"
#quickvm_topomodal
"
);
profile
=
$
(
"
#profile_name :nth(
"
+
ShowProfile
.
index
+
"
)
"
).
val
();
$
(
'
#profile_name
'
).
val
(
profile
);
});
}
function
Setsshurl
(
uuid
)
{
var
callback
=
function
(
json
)
{
...
...
@@ -292,7 +360,7 @@ function StartResizeWatchdog(uuid)
// Must clear the div for the D3 library.
$
(
"
#showtopo_div
"
).
html
(
"
<div></div>
"
);
$
(
"
#showtopo_div
"
).
removeClass
(
"
invisible
"
);
ShowTopo
New
(
uuid
);
ShowTopo
(
uuid
);
}
//
...
...
@@ -396,14 +464,13 @@ function StartCountdownClock(when)
},
1000
);
}
var
foo
=
{
"
nodes
"
:
[{
"
name
"
:
"
node1
"
},
{
"
name
"
:
"
node2
"
}],
"
links
"
:
[{
"
source
"
:
0
,
"
target
"
:
1
,
"
value
"
:
"
foo
"
}]};
function
maketopmap
(
divname
,
width
,
height
,
json
)
{
$
(
divname
).
html
(
"
<div></div>
"
);
var
vis
=
d3
.
select
(
divname
).
append
(
"
svg:svg
"
)
.
attr
(
"
class
"
,
"
topomap
"
)
.
style
(
"
visibility
"
,
"
hidden
"
)
.
attr
(
"
width
"
,
width
)
.
attr
(
"
height
"
,
height
);
...
...
@@ -456,11 +523,10 @@ function maketopmap(divname, width, height, json)
d
.
y
+=
d3
.
event
.
dy
;
// this is the key to make it work together with updating
// both px,py,x,y on d !
tick
();
tick
(
null
);
}
function
dragend
(
d
,
i
)
{
console
.
log
(
d
);
// of course set the node to fixed so the force doesn't
// include the node in its auto positioning stuff
d
.
fixed
=
true
;
...
...
@@ -488,7 +554,13 @@ function maketopmap(divname, width, height, json)
.
attr
(
"
dy
"
,
"
.35em
"
)
.
text
(
function
(
d
)
{
return
d
.
name
});
function
tick
()
{
function
tick
(
e
)
{
if
(
e
&&
e
.
alpha
<
0.05
)
{
console
.
log
(
"
Cooled
"
);
vis
.
style
(
"
visibility
"
,
"
visible
"
)
force
.
stop
();
return
;
}
if
(
0
)
{
node
.
attr
(
"
x
"
,
function
(
d
)
{
...
...
@@ -522,15 +594,22 @@ function maketopmap(divname, width, height, json)
};
force
.
on
(
"
tick
"
,
tick
);
}(
json
);
return
topo
;
}
// Avoid recalc of the layout if we already have seen it. Stash
// json here and return it if we have it.
var
saved
=
new
Object
();
//
// Convert a manifest in XML to a JSON object of nodes and links.
//
function
ConvertManifestToJSON
(
xml
)
function
ConvertManifestToJSON
(
name
,
xml
)
{
if
(
name
&&
saved
[
name
])
{
return
saved
[
name
];
}
var
json
=
{
"
nodes
"
:
[],
"
links
"
:
[],
...
...
@@ -560,7 +639,7 @@ function ConvertManifestToJSON(xml)
console
.
log
(
"
Oops, a lan
"
);
}
else
{
var
ifacerefs
=
$
(
xml
).
find
(
"
interface_ref
"
);
var
ifacerefs
=
$
(
this
).
find
(
"
interface_ref
"
);
var
source
=
ifacerefs
[
0
];
var
target
=
ifacerefs
[
1
];
...
...
@@ -593,6 +672,8 @@ function ConvertManifestToJSON(xml)
});
}
});
if
(
name
)
{
saved
[
name
]
=
json
;
}
return
json
;
}
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