Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
93b78ecd
authored
Feb 01, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: js fixes for vm create network add
parent
dd0f3dc2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
9 deletions
+16
-9
circle/dashboard/static/dashboard/vm-create.js
+16
-9
No files found.
circle/dashboard/static/dashboard/vm-create.js
View file @
93b78ecd
...
...
@@ -99,10 +99,11 @@ function vmCreateLoaded() {
/* build up network list */
$
(
'#vm-create-network-add-
select
option'
).
each
(
function
()
{
$
(
'#vm-create-network-add-
vlan
option'
).
each
(
function
()
{
vlans
.
push
({
'name'
:
$
(
this
).
text
(),
'pk'
:
parseInt
(
$
(
this
).
val
())
'name'
:
$
(
this
).
text
().
replace
(
"unmanaged -"
,
""
).
replace
(
"managed -"
,
""
),
'pk'
:
parseInt
(
$
(
this
).
val
()),
'managed'
:
$
(
this
).
text
().
indexOf
(
"mana"
)
==
0
,
});
});
...
...
@@ -236,8 +237,11 @@ function vmCreateTemplateChange(new_this) {
$
(
"#vm-create-network-add-vlan"
).
find
(
'option'
).
prop
(
'selected'
,
false
);
$
(
'#vm-create-disk-add-form'
).
find
(
'option'
).
prop
(
'selected'
,
false
);
/* clear the network select */
$
(
"#vm-create-network-add-select"
).
html
(
''
);
/* append vlans from InterfaceTemplates */
$
(
'#vm-create-network-list'
).
html
(
''
);
$
(
'#vm-create-network-list'
).
html
(
""
);
var
added_vlans
=
[]
for
(
var
n
=
0
;
n
<
data
[
'network'
].
length
;
n
++
)
{
nn
=
data
[
'network'
][
n
]
...
...
@@ -253,11 +257,10 @@ function vmCreateTemplateChange(new_this) {
$
(
'#vm-create-network-add-select'
).
html
(
''
);
// this is working because the vlans array already has the icon's hex code
for
(
var
i
=
0
;
i
<
vlans
.
length
;
i
++
)
if
(
added_vlans
.
indexOf
(
vlans
[
i
].
pk
)
==
-
1
)
$
(
'#vm-create-network-add-select'
).
append
(
$
(
'<option>'
,
{
value
:
vlans
[
i
].
pk
,
text
:
vlans
[
i
].
name
}));
if
(
added_vlans
.
indexOf
(
vlans
[
i
].
pk
)
==
-
1
)
{
var
html
=
'<option data-managed="'
+
(
vlans
[
i
].
managed
?
1
:
0
)
+
'" value="'
+
vlans
[
i
].
pk
+
'">'
+
vlans
[
i
].
name
+
'</option>'
;
$
(
'#vm-create-network-add-select'
).
append
(
html
);
}
/* enable the network add button if there are not added vlans */
if
(
added_vlans
.
length
!=
vlans
.
length
)
{
...
...
@@ -267,6 +270,10 @@ function vmCreateTemplateChange(new_this) {
$
(
'#vm-create-network-add-button'
).
attr
(
'disabled'
,
true
);
}
/* if there are no added vlans print it out */
if
(
added_vlans
.
length
<
1
)
{
$
(
'#vm-create-network-list'
).
html
(
"Not added to any network!"
);
}
/* append disks */
$
(
'#vm-create-disk-list'
).
html
(
''
);
...
...
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