Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
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
9f9a260f
authored
Oct 29, 2013
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: switch to a working slider
parent
543b883a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
350 additions
and
39 deletions
+350
-39
circle/dashboard/static/dashboard/bootstrap-slider/bootstrap-slider.js
+0
-0
circle/dashboard/static/dashboard/bootstrap-slider/less/slider.less
+105
-0
circle/dashboard/static/dashboard/bootstrap-slider/slider.css
+205
-0
circle/dashboard/static/dashboard/dashboard.js
+16
-26
circle/dashboard/static/dashboard/vm-create.js
+11
-3
circle/dashboard/templates/dashboard/base.html
+2
-3
circle/dashboard/templates/dashboard/vm-detail-resources.html
+11
-7
No files found.
circle/dashboard/static/dashboard/bootstrap-slider/bootstrap-slider.js
0 → 100644
View file @
9f9a260f
This diff is collapsed.
Click to expand it.
circle/dashboard/static/dashboard/bootstrap-slider/less/slider.less
0 → 100644
View file @
9f9a260f
/*!
* Slider for Bootstrap
*
* Copyright 2012 Stefan Petre
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
*/
.slider {
display: inline-block;
vertical-align: middle;
position: relative;
&.slider-horizontal {
width: 210px;
height: @baseLineHeight;
.slider-track {
height: @baseLineHeight/2;
width: 100%;
margin-top: -@baseLineHeight/4;
top: 50%;
left: 0;
}
.slider-selection {
height: 100%;
top: 0;
bottom: 0;
}
.slider-handle {
margin-left: -@baseLineHeight/2;
margin-top: -@baseLineHeight/4;
&.triangle {
border-width: 0 @baseLineHeight/2 @baseLineHeight/2 @baseLineHeight/2;
width: 0;
height: 0;
border-bottom-color: #0480be;
margin-top: 0;
}
}
}
&.slider-vertical {
height: 210px;
width: @baseLineHeight;
.slider-track {
width: @baseLineHeight/2;
height: 100%;
margin-left: -@baseLineHeight/4;
left: 50%;
top: 0;
}
.slider-selection {
width: 100%;
left: 0;
top: 0;
bottom: 0;
}
.slider-handle {
margin-left: -@baseLineHeight/4;
margin-top: -@baseLineHeight/2;
&.triangle {
border-width: @baseLineHeight/2 0 @baseLineHeight/2 @baseLineHeight/2;
width: 1px;
height: 1px;
border-left-color: #0480be;
margin-left: 0;
}
}
}
input {
display: none;
}
.tooltip-inner {
white-space: nowrap;
}
}
.slider-track {
position: absolute;
cursor: pointer;
#gradient > .vertical(#f5f5f5, #f9f9f9);
.box-shadow(inset 0 1px 2px rgba(0,0,0,.1));
.border-radius(@baseBorderRadius);
}
.slider-selection {
position: absolute;
#gradient > .vertical(#f9f9f9, #f5f5f5);
.box-shadow(inset 0 -1px 0 rgba(0,0,0,.15));
.box-sizing(border-box);
.border-radius(@baseBorderRadius);
}
.slider-handle {
position: absolute;
width: @baseLineHeight;
height: @baseLineHeight;
#gradient > .vertical(#149bdf, #0480be);
.box-shadow(~"inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05)");
opacity: 0.8;
border: 0px solid transparent;
&.round {
.border-radius(@baseLineHeight);
}
&.triangle {
background: transparent none;
}
}
\ No newline at end of file
circle/dashboard/static/dashboard/bootstrap-slider/slider.css
0 → 100644
View file @
9f9a260f
/*!
* Slider for Bootstrap
*
* Copyright 2012 Stefan Petre
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
*/
.slider
{
display
:
inline-block
;
vertical-align
:
middle
;
position
:
relative
;
}
.slider.slider-horizontal
{
width
:
210px
;
height
:
20px
;
}
.slider.slider-horizontal
.slider-track
{
height
:
10px
;
width
:
100%
;
margin-top
:
-5px
;
top
:
50%
;
left
:
0
;
}
.slider.slider-horizontal
.slider-selection
{
height
:
100%
;
top
:
0
;
bottom
:
0
;
}
.slider.slider-horizontal
.slider-handle
{
margin-left
:
-10px
;
margin-top
:
-5px
;
}
.slider.slider-horizontal
.slider-handle.triangle
{
border-width
:
0
10px
10px
10px
;
width
:
0
;
height
:
0
;
border-bottom-color
:
#0480be
;
margin-top
:
0
;
}
.slider.slider-vertical
{
height
:
210px
;
width
:
20px
;
}
.slider.slider-vertical
.slider-track
{
width
:
10px
;
height
:
100%
;
margin-left
:
-5px
;
left
:
50%
;
top
:
0
;
}
.slider.slider-vertical
.slider-selection
{
width
:
100%
;
left
:
0
;
top
:
0
;
bottom
:
0
;
}
.slider.slider-vertical
.slider-handle
{
margin-left
:
-5px
;
margin-top
:
-10px
;
}
.slider.slider-vertical
.slider-handle.triangle
{
border-width
:
10px
0
10px
10px
;
width
:
1px
;
height
:
1px
;
border-left-color
:
#0480be
;
margin-left
:
0
;
}
.slider
input
{
display
:
none
;
}
.slider
.tooltip-inner
{
white-space
:
nowrap
;
}
.slider-track
{
position
:
absolute
;
cursor
:
pointer
;
background-color
:
#f7f7f7
;
background-image
:
-moz-linear-gradient
(
top
,
#f5f5f5
,
#f9f9f9
);
background-image
:
-webkit-gradient
(
linear
,
0
0
,
0
100%
,
from
(
#f5f5f5
),
to
(
#f9f9f9
));
background-image
:
-webkit-linear-gradient
(
top
,
#f5f5f5
,
#f9f9f9
);
background-image
:
-o-linear-gradient
(
top
,
#f5f5f5
,
#f9f9f9
);
background-image
:
linear-gradient
(
to
bottom
,
#f5f5f5
,
#f9f9f9
);
background-repeat
:
repeat-x
;
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorstr
=
'#fff5f5f5'
,
endColorstr
=
'#fff9f9f9'
,
GradientType
=
0
);
-webkit-box-shadow
:
inset
0
1px
2px
rgba
(
0
,
0
,
0
,
0.1
);
-moz-box-shadow
:
inset
0
1px
2px
rgba
(
0
,
0
,
0
,
0.1
);
box-shadow
:
inset
0
1px
2px
rgba
(
0
,
0
,
0
,
0.1
);
-webkit-border-radius
:
4px
;
-moz-border-radius
:
4px
;
border-radius
:
4px
;
}
.slider-selection
{
position
:
absolute
;
background-color
:
#f7f7f7
;
background-image
:
-moz-linear-gradient
(
top
,
#f9f9f9
,
#f5f5f5
);
background-image
:
-webkit-gradient
(
linear
,
0
0
,
0
100%
,
from
(
#f9f9f9
),
to
(
#f5f5f5
));
background-image
:
-webkit-linear-gradient
(
top
,
#f9f9f9
,
#f5f5f5
);
background-image
:
-o-linear-gradient
(
top
,
#f9f9f9
,
#f5f5f5
);
background-image
:
linear-gradient
(
to
bottom
,
#f9f9f9
,
#f5f5f5
);
background-repeat
:
repeat-x
;
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorstr
=
'#fff9f9f9'
,
endColorstr
=
'#fff5f5f5'
,
GradientType
=
0
);
-webkit-box-shadow
:
inset
0
-1px
0
rgba
(
0
,
0
,
0
,
0.15
);
-moz-box-shadow
:
inset
0
-1px
0
rgba
(
0
,
0
,
0
,
0.15
);
box-shadow
:
inset
0
-1px
0
rgba
(
0
,
0
,
0
,
0.15
);
-webkit-box-sizing
:
border-box
;
-moz-box-sizing
:
border-box
;
box-sizing
:
border-box
;
-webkit-border-radius
:
4px
;
-moz-border-radius
:
4px
;
border-radius
:
4px
;
}
.slider-handle
{
position
:
absolute
;
width
:
20px
;
height
:
20px
;
background-color
:
#0e90d2
;
background-image
:
-moz-linear-gradient
(
top
,
#149bdf
,
#0480be
);
background-image
:
-webkit-gradient
(
linear
,
0
0
,
0
100%
,
from
(
#149bdf
),
to
(
#0480be
));
background-image
:
-webkit-linear-gradient
(
top
,
#149bdf
,
#0480be
);
background-image
:
-o-linear-gradient
(
top
,
#149bdf
,
#0480be
);
background-image
:
linear-gradient
(
to
bottom
,
#149bdf
,
#0480be
);
background-repeat
:
repeat-x
;
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorstr
=
'#ff149bdf'
,
endColorstr
=
'#ff0480be'
,
GradientType
=
0
);
-webkit-box-shadow
:
inset
0
1px
0
rgba
(
255
,
255
,
255
,
.2
),
0
1px
2px
rgba
(
0
,
0
,
0
,
.05
);
-moz-box-shadow
:
inset
0
1px
0
rgba
(
255
,
255
,
255
,
.2
),
0
1px
2px
rgba
(
0
,
0
,
0
,
.05
);
box-shadow
:
inset
0
1px
0
rgba
(
255
,
255
,
255
,
.2
),
0
1px
2px
rgba
(
0
,
0
,
0
,
.05
);
opacity
:
0.8
;
border
:
0px
solid
transparent
;
}
.slider-handle.round
{
-webkit-border-radius
:
20px
;
-moz-border-radius
:
20px
;
border-radius
:
20px
;
}
.slider-handle.triangle
{
background
:
transparent
none
;
}
/* custom */
.slider-handle
,
.slider-handle
:hover
{
background-color
:
#3071a9
;
opacity
:
1
;
width
:
8px
;
height
:
26px
;
margin-top
:
-4px
!important
;
margin-left
:
-6px
!important
;
border-radius
:
0px
;
-moz-border-radius
:
0px
;
-webkit-border-radius
:
0px
;
text-shadow
:
0
1px
0
#fff
;
background-image
:
-webkit-gradient
(
linear
,
left
0%
,
left
100%
,
from
(
#428bca
),
to
(
#3071a9
));
background-image
:
-webkit-linear-gradient
(
top
,
#428bca
,
0%
,
#3071a9
,
100%
);
background-image
:
-moz-linear-gradient
(
top
,
#428bca
0%
,
#3071a9
100%
);
background-image
:
linear-gradient
(
to
bottom
,
#428bca
0%
,
#3071a9
100%
);
background-repeat
:
repeat-x
;
border-color
:
#2d6ca2
;
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorstr
=
'#ff428bca'
,
endColorstr
=
'#ff3071a9'
,
GradientType
=
0
);
}
.slider-handle
:hover
{
background
:
#428bca
;
background-image
:
none
;
border-color
:
#2d6ca2
;
}
.slider-track
,
.slider-selection
{
height
:
20px
!important
;
background
:
#ccc
;
background
:
-webkit-linear-gradient
(
top
,
#bbb
,
#ddd
);
background
:
-moz-linear-gradient
(
top
,
#bbb
,
#ddd
);
background
:
linear-gradient
(
top
,
#bbb
,
#ddd
);
-webkit-box-shadow
:
inset
0
2px
4px
rgba
(
0
,
0
,
0
,
0.1
);
-moz-box-shadow
:
inset
0
2px
4px
rgba
(
0
,
0
,
0
,
0.1
);
box-shadow
:
inset
0
2px
4px
rgba
(
0
,
0
,
0
,
0.1
);
-webkit-border-radius
:
4px
;
-moz-border-radius
:
4px
;
border-radius
:
4px
;
border
:
1px
solid
#aaa
;
}
.slider-selection
{
background-color
:
#8DCA09
;
background
:
-webkit-linear-gradient
(
top
,
#8DCA09
,
#72A307
);
background
:
-moz-linear-gradient
(
top
,
#8DCA09
,
#72A307
);
background
:
linear-gradient
(
top
,
#8DCA09
,
#72A307
);
border-color
:
#496805
;
}
.vm-slider
{
width
:
300px
;
}
.output
{
padding-left
:
10px
;
font-weight
:
bold
;
}
circle/dashboard/static/dashboard/dashboard.js
View file @
9f9a260f
...
...
@@ -38,37 +38,27 @@ $(function () {
if
(
window
.
location
.
hash
)
$
(
"a[href="
+
window
.
location
.
hash
+
"]"
).
tab
(
'show'
);
vmCreateLoaded
();
addSliderMiscs
();
});
function
addSliderMiscs
()
{
$
(
"[data-slider]"
).
each
(
function
()
{
if
(
$
(
this
).
css
(
'display'
)
!=
"none"
)
$
(
this
).
simpleSlider
();
$
(
'.vm-slider'
).
each
(
function
()
{
$
(
"<span>"
).
addClass
(
"output"
).
html
(
$
(
this
).
val
()).
insertAfter
(
$
(
this
));
});
$
(
'.vm-slider'
).
slider
()
.
on
(
'slide'
,
function
(
e
)
{
$
(
this
).
val
(
e
.
value
);
$
(
this
).
parent
(
'div'
).
nextAll
(
"span"
).
html
(
e
.
value
)
});
//slider only has background with this ...
//var js = document.createElement('script');
//js.src = '/static/dashboard/loopj-jquery-simple-slider-fa64f59/js/simple-slider.min.js';
//document.getElementsByTagName('head')[0].appendChild(js);
$
(
"[data-slider]"
)
.
each
(
function
()
{
var
input
=
$
(
this
);
$
(
"<span>"
)
.
addClass
(
"output"
)
.
html
(
$
(
this
).
val
())
.
insertAfter
(
input
);
})
.
bind
(
"slider:ready slider:changed"
,
function
(
event
,
data
)
{
$
(
this
)
.
nextAll
(
".output:first"
)
.
html
(
data
.
value
.
toFixed
(
3
));
});
refreshSliders
();
}
$
(
"[data-mark]"
).
each
(
function
()
{
var
value
=
$
(
this
).
attr
(
'data-mark'
).
parseFloat
();
});
// ehhh
function
refreshSliders
()
{
$
(
'.vm-slider'
).
each
(
function
()
{
$
(
this
).
val
(
$
(
this
).
slider
().
data
(
'slider'
).
getValue
());
$
(
this
).
parent
(
'div'
).
nextAll
(
"span"
).
html
(
$
(
this
).
val
());
});
}
circle/dashboard/static/dashboard/vm-create.js
View file @
9f9a260f
var
vlans
=
[];
var
disks
=
[];
$
(
function
()
{
vmCreateLoaded
();
});
function
vmCreateLoaded
()
{
// temporarily disable for testing
//$('.vm-create-advanced').hide();
...
...
@@ -178,9 +183,12 @@ function vmCreateTemplateChange(new_this) {
success
:
function
(
data
,
textStatus
,
xhr
)
{
if
(
xhr
.
status
==
200
)
{
// set sliders
$
(
'#cpu-priority-slider'
).
simpleSlider
(
"setValue"
,
data
[
'priority'
]);
$
(
'#cpu-count-slider'
).
simpleSlider
(
"setValue"
,
data
[
'num_cores'
]);
$
(
'#ram-slider'
).
simpleSlider
(
"setValue"
,
data
[
'ram_size'
]);
$
(
'#vm-cpu-priority-slider'
).
slider
(
"setValue"
,
data
[
'priority'
]);
$
(
'#vm-cpu-count-slider'
).
slider
(
"setValue"
,
data
[
'num_cores'
]);
$
(
'#vm-ram-size-slider'
).
slider
(
"setValue"
,
data
[
'ram_size'
]);
/* slider doesn't have change event ........................ */
refreshSliders
();
/* clear selections */
$
(
'select[id^="vm-create-network-add"], select[id$="managed"]'
).
find
(
'option'
).
prop
(
'selected'
,
false
);
...
...
circle/dashboard/templates/dashboard/base.html
View file @
9f9a260f
...
...
@@ -15,9 +15,8 @@
<link
rel=
"stylesheet"
href=
"//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css"
>
<link
href=
"//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css"
rel=
"stylesheet"
>
<script
src=
"{{ STATIC_URL }}dashboard/js/jquery.knob.js"
></script>
<link
href=
"{{ STATIC_URL }}dashboard/loopj-jquery-simple-slider-fa64f59/css/simple-slider.css"
rel=
"stylesheet"
>
<script
src=
"{{ STATIC_URL }}dashboard/loopj-jquery-simple-slider-fa64f59/js/simple-slider.min.js"
></script>
<script
src=
"{{ STATIC_URL}}dashboard/bootstrap-slider/bootstrap-slider.js"
></script>
<link
rel=
"stylesheet"
href=
"{{ STATIC_URL }}dashboard/bootstrap-slider/slider.css"
/>
<link
href=
"{{ STATIC_URL }}dashboard/dashboard.css"
rel=
"stylesheet"
>
<script
src=
"{{ STATIC_URL }}dashboard/dashboard.js"
></script>
</head>
...
...
circle/dashboard/templates/dashboard/vm-detail-resources.html
View file @
9f9a260f
<p
class=
"row"
>
<div
class=
"col-sm-3"
>
<label
for=
"cpu-priority-slider"
><i
class=
"icon-trophy"
></i>
CPU priority
</label>
<label
for=
"
vm-
cpu-priority-slider"
><i
class=
"icon-trophy"
></i>
CPU priority
</label>
</div>
<div
class=
"col-sm-9"
>
<input
type=
"text"
data-slider=
"true"
data-slider-highlight=
"true"
data-slider-snap=
"true"
data-slider-range=
"0,100"
data-slider-step=
"1"
id=
"cpu-priority-slider"
value=
"{{ instance.priority }}"
>
<input
type=
"text"
id=
"vm-cpu-priority-slider"
class=
"vm-slider"
value=
"{{ instance.priority }}"
data-slider-min=
"0"
data-slider-max=
"100"
data-slider-step=
"1"
data-slider-value=
"{{ instance.priority }}"
data-slider-orientation=
"horizontal"
data-slider-handle=
"square"
data-slider-tooltip=
"hide"
/>
</div>
</p>
...
...
@@ -14,7 +13,7 @@
<label
for=
"cpu-count-slider"
><i
class=
"icon-cogs"
></i>
CPU count
</label>
</div>
<div
class=
"col-sm-9"
>
<input
type=
"text"
value=
"{{ instance.num_cores }}"
data-slider=
"true"
data-slider-highlight=
"true"
data-slider-range=
"0,8"
data-slider-snap=
"true"
data-slider-step=
"1"
id=
"cpu-count-slider"
>
<input
type=
"text"
id=
"vm-cpu-count-slider"
class=
"vm-slider"
value=
" {{ instance.num_cores }}"
data-slider-min=
"0"
data-slider-max=
"8"
data-slider-step=
"1"
data-slider-value=
"{{ instance.num_cores }}"
data-slider-orientation=
"horizontal"
data-slider-handle=
"square"
data-slider-tooltip=
"hide"
/>
</div>
</p>
...
...
@@ -23,8 +22,13 @@
<div
class=
"col-sm-3"
>
<label
for=
"ram-slider"
><i
class=
"icon-ticket"
></i>
RAM amount
</label>
</div>
<div
class=
"col-sm-9"
>
<input
type=
"text"
data-slider=
"true"
data-slider-highlight=
"true"
id=
"ram-slider"
data-slider-range=
"128,4096"
data-slider-snap=
"true"
data-slider-step=
"128"
value=
"{{ instance.ram_size }}"
>
MiB
</div>
<div
class=
"col-sm-9"
>
<input
type=
"text"
id=
"vm-ram-size-slider"
class=
"vm-slider"
value=
"{{ instance.ram_size }}"
data-slider-min=
"128"
data-slider-max=
"4096"
data-slider-step=
"128"
data-slider-value=
"{{ instance.ram_size }}"
data-slider-orientation=
"horizontal"
data-slider-handle=
"square"
data-slider-tooltip=
"hide"
/>
MiB
</div>
</p>
{% block extra_js %}
<style>
label
{
padding-top
:
6px
;}
</style>
{% endblock %}
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