Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
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() {
...
@@ -99,10 +99,11 @@ function vmCreateLoaded() {
/* build up network list */
/* build up network list */
$
(
'#vm-create-network-add-
select
option'
).
each
(
function
()
{
$
(
'#vm-create-network-add-
vlan
option'
).
each
(
function
()
{
vlans
.
push
({
vlans
.
push
({
'name'
:
$
(
this
).
text
(),
'name'
:
$
(
this
).
text
().
replace
(
"unmanaged -"
,
""
).
replace
(
"managed -"
,
""
),
'pk'
:
parseInt
(
$
(
this
).
val
())
'pk'
:
parseInt
(
$
(
this
).
val
()),
'managed'
:
$
(
this
).
text
().
indexOf
(
"mana"
)
==
0
,
});
});
});
});
...
@@ -236,8 +237,11 @@ function vmCreateTemplateChange(new_this) {
...
@@ -236,8 +237,11 @@ function vmCreateTemplateChange(new_this) {
$
(
"#vm-create-network-add-vlan"
).
find
(
'option'
).
prop
(
'selected'
,
false
);
$
(
"#vm-create-network-add-vlan"
).
find
(
'option'
).
prop
(
'selected'
,
false
);
$
(
'#vm-create-disk-add-form'
).
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 */
/* append vlans from InterfaceTemplates */
$
(
'#vm-create-network-list'
).
html
(
''
);
$
(
'#vm-create-network-list'
).
html
(
""
);
var
added_vlans
=
[]
var
added_vlans
=
[]
for
(
var
n
=
0
;
n
<
data
[
'network'
].
length
;
n
++
)
{
for
(
var
n
=
0
;
n
<
data
[
'network'
].
length
;
n
++
)
{
nn
=
data
[
'network'
][
n
]
nn
=
data
[
'network'
][
n
]
...
@@ -253,11 +257,10 @@ function vmCreateTemplateChange(new_this) {
...
@@ -253,11 +257,10 @@ function vmCreateTemplateChange(new_this) {
$
(
'#vm-create-network-add-select'
).
html
(
''
);
$
(
'#vm-create-network-add-select'
).
html
(
''
);
// this is working because the vlans array already has the icon's hex code
// this is working because the vlans array already has the icon's hex code
for
(
var
i
=
0
;
i
<
vlans
.
length
;
i
++
)
for
(
var
i
=
0
;
i
<
vlans
.
length
;
i
++
)
if
(
added_vlans
.
indexOf
(
vlans
[
i
].
pk
)
==
-
1
)
if
(
added_vlans
.
indexOf
(
vlans
[
i
].
pk
)
==
-
1
)
{
$
(
'#vm-create-network-add-select'
).
append
(
$
(
'<option>'
,
{
var
html
=
'<option data-managed="'
+
(
vlans
[
i
].
managed
?
1
:
0
)
+
'" value="'
+
vlans
[
i
].
pk
+
'">'
+
vlans
[
i
].
name
+
'</option>'
;
value
:
vlans
[
i
].
pk
,
$
(
'#vm-create-network-add-select'
).
append
(
html
);
text
:
vlans
[
i
].
name
}
}));
/* enable the network add button if there are not added vlans */
/* enable the network add button if there are not added vlans */
if
(
added_vlans
.
length
!=
vlans
.
length
)
{
if
(
added_vlans
.
length
!=
vlans
.
length
)
{
...
@@ -267,6 +270,10 @@ function vmCreateTemplateChange(new_this) {
...
@@ -267,6 +270,10 @@ function vmCreateTemplateChange(new_this) {
$
(
'#vm-create-network-add-button'
).
attr
(
'disabled'
,
true
);
$
(
'#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 */
/* append disks */
$
(
'#vm-create-disk-list'
).
html
(
''
);
$
(
'#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