Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6dbc55fb
authored
Oct 24, 2013
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: handle managed networks in vm create
parent
210e6c32
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
5 deletions
+20
-5
circle/dashboard/static/dashboard/dashboard.js
+17
-2
circle/dashboard/templates/dashboard/vm-create.html
+3
-3
No files found.
circle/dashboard/static/dashboard/dashboard.js
View file @
6dbc55fb
...
...
@@ -86,24 +86,39 @@ function vmCreateLoaded() {
vmCreateTemplateChange
(
this
);
});
/* add network */
$
(
'#vm-create-network-add-button'
).
click
(
function
()
{
var
option
=
$
(
'#vm-create-network-add-select :selected'
);
if
(
option
.
val
()
>
0
)
{
var
o
=
option
.
val
().
split
(
'|'
);
var
vlan_pk
=
o
[
0
];
var
managed
=
o
[
1
];
if
(
$
(
'#vm-create-network-list'
).
children
(
'span'
).
length
<
1
)
{
$
(
'#vm-create-network-list'
).
html
(
''
);
}
$
(
'#vm-create-network-list'
).
append
(
vmCreateNetworkLabel
(
option
.
val
(),
option
.
text
(),
tru
e
)
vmCreateNetworkLabel
(
option
.
val
(),
option
.
text
(),
managed
>
0
?
true
:
fals
e
)
);
$
(
'option:selected'
,
$
(
'#vm-create-network-add-select'
)).
remove
();
/* add dummy text if no more networks are available */
if
(
$
(
'#vm-create-network-add-select option'
).
length
<
1
)
{
$
(
'#vm-create-network-add-button'
).
attr
(
'disabled'
,
true
);
$
(
'#vm-create-network-add-select'
).
html
(
'<option value="-1">We are out of <options> hehe</option>'
);
}
return
false
;
});
/* remove network */
// event for network remove button (icon, X)
// TODO still not the right place
$
(
'body'
).
on
(
'click'
,
'.vm-create-remove-network'
,
function
()
{
console
.
log
(
$
(
'#vm-create-network-add-select option'
).
length
);
if
(
$
(
'#vm-create-network-add-select option'
)[
0
].
value
==
-
1
)
{
$
(
'#vm-create-network-add-button'
).
attr
(
'disabled'
,
false
);
$
(
'#vm-create-network-add-select'
).
html
(
''
);
}
var
vlan_pk
=
(
$
(
this
).
parent
(
'span'
).
prop
(
'id'
)).
replace
(
'vlan-'
,
''
);
$
(
this
).
parent
(
'span'
).
fadeOut
(
500
,
function
()
{
$
(
this
).
remove
();
...
...
circle/dashboard/templates/dashboard/vm-create.html
View file @
6dbc55fb
...
...
@@ -78,9 +78,9 @@
<h3
id=
"vm-create-network-add"
>
<div
class=
"input-group"
style=
"max-width: 300px;"
>
<select
class=
"form-control"
id=
"vm-create-network-add-select"
>
<option
value=
"1"
>
vmnet2
</option>
<option
value=
"2"
>
PUB
</option>
<option
value=
"3"
>
OFF
</option>
<option
value=
"1
|1
"
>
vmnet2
</option>
<option
value=
"2
|0
"
>
PUB
</option>
<option
value=
"3
|0
"
>
OFF
</option>
</select>
<div
class=
"input-group-btn"
>
<!--<input type="submit" value="Add to network" class="btn btn-success"/>-->
...
...
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