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
46577a1b
authored
Oct 24, 2013
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: vm create no js compatibility
parent
6dbc55fb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
24 deletions
+43
-24
circle/dashboard/static/dashboard/dashboard.js
+17
-9
circle/dashboard/templates/dashboard/vm-create.html
+26
-15
No files found.
circle/dashboard/static/dashboard/dashboard.js
View file @
46577a1b
...
@@ -38,6 +38,10 @@ $(function () {
...
@@ -38,6 +38,10 @@ $(function () {
$
(
"a[href="
+
window
.
location
.
hash
+
"]"
).
tab
(
'show'
);
$
(
"a[href="
+
window
.
location
.
hash
+
"]"
).
tab
(
'show'
);
vmCreateLoaded
();
vmCreateLoaded
();
/* no js compatibility */
$
(
'.no-js-hidden'
).
show
();
$
(
'.js-hidden'
).
hide
();
});
});
function
vmCreateTemplateChange
(
new_this
)
{
function
vmCreateTemplateChange
(
new_this
)
{
...
@@ -59,6 +63,7 @@ function vmCreateTemplateChange(new_this) {
...
@@ -59,6 +63,7 @@ function vmCreateTemplateChange(new_this) {
$
(
'#vm-create-network-list'
).
append
(
$
(
'#vm-create-network-list'
).
append
(
vmCreateNetworkLabel
(
nn
.
vlan_pk
,
nn
.
vlan
,
nn
.
managed
)
vmCreateNetworkLabel
(
nn
.
vlan_pk
,
nn
.
vlan
,
nn
.
managed
)
);
);
$
(
'#vm-create-network-add-form option[value="'
+
nn
.
vlan_pk
+
'|'
+
(
nn
.
managed
?
'1'
:
'0'
)
+
'"]'
).
prop
(
'selected'
,
true
);
}
}
}
}
}
}
...
@@ -98,6 +103,7 @@ function vmCreateLoaded() {
...
@@ -98,6 +103,7 @@ function vmCreateLoaded() {
$
(
'#vm-create-network-list'
).
append
(
$
(
'#vm-create-network-list'
).
append
(
vmCreateNetworkLabel
(
option
.
val
(),
option
.
text
(),
managed
>
0
?
true
:
false
)
vmCreateNetworkLabel
(
option
.
val
(),
option
.
text
(),
managed
>
0
?
true
:
false
)
);
);
$
(
'#vm-create-network-add-form option[value="'
+
vlan_pk
+
'|'
+
(
managed
?
'1'
:
'0'
)
+
'"]'
).
prop
(
'selected'
,
true
);
$
(
'option:selected'
,
$
(
'#vm-create-network-add-select'
)).
remove
();
$
(
'option:selected'
,
$
(
'#vm-create-network-add-select'
)).
remove
();
/* add dummy text if no more networks are available */
/* add dummy text if no more networks are available */
...
@@ -113,22 +119,24 @@ function vmCreateLoaded() {
...
@@ -113,22 +119,24 @@ function vmCreateLoaded() {
// event for network remove button (icon, X)
// event for network remove button (icon, X)
// TODO still not the right place
// TODO still not the right place
$
(
'body'
).
on
(
'click'
,
'.vm-create-remove-network'
,
function
()
{
$
(
'body'
).
on
(
'click'
,
'.vm-create-remove-network'
,
function
()
{
console
.
log
(
$
(
'#vm-create-network-add-select option'
).
length
);
var
value
=
(
$
(
this
).
parent
(
'span'
).
prop
(
'id'
)).
replace
(
'vlan-'
,
''
).
split
(
'|'
);
if
(
$
(
'#vm-create-network-add-select option'
)[
0
].
value
==
-
1
)
{
var
vlan_pk
=
value
[
0
];
$
(
'#vm-create-network-add-button'
).
attr
(
'disabled'
,
false
);
var
managed
=
value
[
1
];
$
(
'#vm-create-network-add-select'
).
html
(
''
);
$
(
this
).
parent
(
'span'
).
fadeOut
(
500
,
function
()
{
}
if
(
$
(
'#vm-create-network-add-select option'
)[
0
].
value
==
-
1
)
{
$
(
'#vm-create-network-add-button'
).
attr
(
'disabled'
,
false
);
var
vlan_pk
=
(
$
(
this
).
parent
(
'span'
).
prop
(
'id'
)).
replace
(
'vlan-'
,
''
);
$
(
'#vm-create-network-add-select'
).
html
(
''
);
$
(
this
).
parent
(
'span'
).
fadeOut
(
500
,
function
()
{
}
$
(
this
).
remove
();
$
(
this
).
remove
();
var
vlan_name
=
$
(
this
).
text
();
var
vlan_name
=
$
(
this
).
text
();
$
(
'#vm-create-network-add-select'
).
append
(
$
(
'<option>'
,
{
$
(
'#vm-create-network-add-select'
).
append
(
$
(
'<option>'
,
{
value
:
vlan_pk
,
value
:
vlan_pk
+
"|"
+
managed
,
text
:
vlan_name
text
:
vlan_name
}));
}));
$
(
'#vm-create-network-add-form option[value="'
+
vlan_pk
+
'|'
+
(
managed
?
'1'
:
'0'
)
+
'"]'
).
prop
(
'selected'
,
false
);
if
(
$
(
'#vm-create-network-list'
).
children
(
'span'
).
length
<
1
)
{
if
(
$
(
'#vm-create-network-list'
).
children
(
'span'
).
length
<
1
)
{
$
(
'#vm-create-network-list'
).
append
(
'Not added to any network!'
);
$
(
'#vm-create-network-list'
).
append
(
'Not added to any network!'
);
}
}
...
...
circle/dashboard/templates/dashboard/vm-create.html
View file @
46577a1b
...
@@ -70,24 +70,35 @@
...
@@ -70,24 +70,35 @@
color
:
black
/*#d9534f*/
;
color
:
black
/*#d9534f*/
;
text-decoration
:
none
;
text-decoration
:
none
;
}
}
.no-js-hidden
{
display
:
none
;
}
</style>
</style>
<div
class=
"col-sm-8"
style=
"padding-top: 3px;"
>
<div
class=
"col-sm-8"
style=
"padding-top: 3px;"
>
<h3
id=
"vm-create-network-list"
>
<select
class=
"form-control js-hidden"
id=
"vm-create-network-add-form"
multiple
>
Not added to any network!
<option
value=
"1|1"
>
vmnet2 - managed
</option>
</h3>
<option
value=
"2|0"
>
PUB
</option>
<h3
id=
"vm-create-network-add"
>
<option
value=
"3|0"
>
OFF
</option>
<div
class=
"input-group"
style=
"max-width: 300px;"
>
</select>
<select
class=
"form-control"
id=
"vm-create-network-add-select"
>
<div
class=
"no-js-hidden"
>
<option
value=
"1|1"
>
vmnet2
</option>
<h3
id=
"vm-create-network-list"
class=
"no-js-hidden"
>
<option
value=
"2|0"
>
PUB
</option>
Not added to any network!
<option
value=
"3|0"
>
OFF
</option>
</h3>
</select>
<h3
id=
"vm-create-network-add"
>
<div
class=
"input-group-btn"
>
<div
class=
"input-group"
style=
"max-width: 300px;"
>
<!--<input type="submit" value="Add to network" class="btn btn-success"/>-->
<select
class=
"form-control"
id=
"vm-create-network-add-select"
>
<a
href=
"#"
id=
"vm-create-network-add-button"
class=
"btn btn-success"
><i
class=
"icon-plus-sign"
></i></a>
<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"/>-->
<a
href=
"#"
id=
"vm-create-network-add-button"
class=
"btn btn-success"
><i
class=
"icon-plus-sign"
></i></a>
</div>
</div>
</div>
</
div
>
</
h3
>
</
h3
>
</
div
>
</div>
</div>
</div>
</div>
</div>
</div>
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