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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
9155a413
authored
Apr 28, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: vm list select with ordering
parent
391680e9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
11 deletions
+26
-11
circle/dashboard/static/dashboard/vm-list.js
+26
-11
No files found.
circle/dashboard/static/dashboard/vm-list.js
View file @
9155a413
...
@@ -17,14 +17,14 @@ $(function() {
...
@@ -17,14 +17,14 @@ $(function() {
if
(
ctrlDown
)
{
if
(
ctrlDown
)
{
setRowColor
(
$
(
this
));
setRowColor
(
$
(
this
));
if
(
!
$
(
this
).
hasClass
(
'vm-list-selected'
))
{
if
(
!
$
(
this
).
hasClass
(
'vm-list-selected'
))
{
selected
.
splice
(
selected
.
indexOf
(
$
(
this
).
index
()),
1
);
selected
.
splice
(
getSelectedIndex
(
$
(
this
).
index
()),
1
);
}
else
{
}
else
{
selected
.
push
(
$
(
this
).
index
()
);
selected
.
push
(
{
'index'
:
$
(
this
).
index
(),
'vm'
:
$
(
this
).
data
(
"vm-pk"
)}
);
}
}
retval
=
false
;
retval
=
false
;
}
else
if
(
shiftDown
)
{
}
else
if
(
shiftDown
)
{
if
(
selected
.
length
>
0
)
{
if
(
selected
.
length
>
0
)
{
start
=
selected
[
selected
.
length
-
1
]
+
1
;
start
=
selected
[
selected
.
length
-
1
]
[
'index'
]
+
1
;
end
=
$
(
this
).
index
();
end
=
$
(
this
).
index
();
if
(
start
>
end
)
{
if
(
start
>
end
)
{
...
@@ -32,8 +32,9 @@ $(function() {
...
@@ -32,8 +32,9 @@ $(function() {
}
}
for
(
var
i
=
start
;
i
<=
end
;
i
++
)
{
for
(
var
i
=
start
;
i
<=
end
;
i
++
)
{
if
(
selected
.
indexOf
(
i
)
<
0
)
{
var
vm
=
$
(
".vm-list-table tbody tr"
).
eq
(
i
).
data
(
"vm-pk"
);
selected
.
push
(
i
);
if
(
!
isAlreadySelected
(
vm
))
{
selected
.
push
({
'index'
:
i
,
'vm'
:
vm
});
setRowColor
(
$
(
'.vm-list-table tbody tr'
).
eq
(
i
));
setRowColor
(
$
(
'.vm-list-table tbody tr'
).
eq
(
i
));
}
}
}
}
...
@@ -42,7 +43,7 @@ $(function() {
...
@@ -42,7 +43,7 @@ $(function() {
}
else
{
}
else
{
$
(
'.vm-list-selected'
).
removeClass
(
'vm-list-selected'
);
$
(
'.vm-list-selected'
).
removeClass
(
'vm-list-selected'
);
$
(
this
).
addClass
(
'vm-list-selected'
);
$
(
this
).
addClass
(
'vm-list-selected'
);
selected
=
[
$
(
this
).
index
()
];
selected
=
[
{
'index'
:
$
(
this
).
index
(),
'vm'
:
$
(
this
).
data
(
"vm-pk"
)}
];
}
}
// reset btn disables
// reset btn disables
...
@@ -61,7 +62,7 @@ $(function() {
...
@@ -61,7 +62,7 @@ $(function() {
$
(
'#vm-list-group-migrate'
).
click
(
function
()
{
$
(
'#vm-list-group-migrate'
).
click
(
function
()
{
console
.
log
(
collectIds
(
selected
));
// pass?
});
});
$
(
'.vm-list-details'
).
popover
({
$
(
'.vm-list-details'
).
popover
({
...
@@ -131,8 +132,9 @@ $(function() {
...
@@ -131,8 +132,9 @@ $(function() {
$
(
'#vm-list-group-select-all'
).
click
(
function
()
{
$
(
'#vm-list-group-select-all'
).
click
(
function
()
{
$
(
'.vm-list-table tbody tr'
).
each
(
function
()
{
$
(
'.vm-list-table tbody tr'
).
each
(
function
()
{
var
index
=
$
(
this
).
index
();
var
index
=
$
(
this
).
index
();
if
(
selected
.
indexOf
(
index
)
<
0
)
{
var
vm
=
$
(
this
).
data
(
"vm-pk"
);
selected
.
push
(
index
);
if
(
!
isAlreadySelected
(
vm
))
{
selected
.
push
({
'index'
:
index
,
'vm'
:
vm
});
$
(
this
).
addClass
(
'vm-list-selected'
);
$
(
this
).
addClass
(
'vm-list-selected'
);
}
}
});
});
...
@@ -177,11 +179,24 @@ $(function() {
...
@@ -177,11 +179,24 @@ $(function() {
$
(
".vm-list-table thead th"
).
css
(
"cursor"
,
"pointer"
);
$
(
".vm-list-table thead th"
).
css
(
"cursor"
,
"pointer"
);
});
});
function
isAlreadySelected
(
vm
)
{
for
(
var
i
=
0
;
i
<
selected
.
length
;
i
++
)
if
(
selected
[
i
].
vm
==
vm
)
return
true
;
return
false
;
}
function
getSelectedIndex
(
index
)
{
for
(
var
i
=
0
;
i
<
selected
.
length
;
i
++
)
if
(
selected
[
i
].
index
==
index
)
return
i
;
return
-
1
;
}
function
collectIds
(
rows
)
{
function
collectIds
(
rows
)
{
var
ids
=
[];
var
ids
=
[];
for
(
var
i
=
0
;
i
<
rows
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
rows
.
length
;
i
++
)
{
var
div
=
$
(
'td:first-child div'
,
$
(
'.vm-list-table tbody tr'
).
eq
(
rows
[
i
]));
ids
.
push
(
rows
[
i
].
vm
);
ids
.
push
(
div
.
prop
(
'id'
).
replace
(
'vm-'
,
''
));
}
}
return
ids
;
return
ids
;
}
}
...
...
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