Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f77df96f
authored
Apr 22, 2014
by
Oláh István Gergely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: add group listing method to js
parent
5d753e30
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
circle/dashboard/static/dashboard/dashboard.js
+45
-0
No files found.
circle/dashboard/static/dashboard/dashboard.js
View file @
f77df96f
...
...
@@ -224,6 +224,46 @@ $(function () {
}
});
/* search for groups */
var
my_groups
=
[]
$
(
"#dashboard-group-search-input"
).
keyup
(
function
(
e
)
{
// if my_groups is empty get a list of our groups
if
(
my_groups
.
length
<
1
)
{
$
.
ajaxSetup
(
{
"async"
:
false
}
);
$
.
get
(
"/dashboard/group/list/"
,
function
(
result
)
{
for
(
var
i
in
result
)
{
my_groups
.
push
({
'url'
:
result
[
i
].
url
,
'name'
:
result
[
i
].
name
.
toLowerCase
(),
});
}
});
$
.
ajaxSetup
(
{
"async"
:
true
}
);
}
input
=
$
(
"#dashboard-group-search-input"
).
val
().
toLowerCase
();
var
search_result
=
[]
var
html
=
''
;
for
(
var
i
in
my_groups
)
{
if
(
my_groups
[
i
].
name
.
indexOf
(
input
)
!=
-
1
)
{
search_result
.
push
(
my_groups
[
i
]);
}
}
for
(
var
i
=
0
;
i
<
5
&&
i
<
search_result
.
length
;
i
++
)
html
+=
generateGroupHTML
(
search_result
[
i
].
url
,
search_result
[
i
].
name
);
if
(
search_result
.
length
==
0
)
html
+=
'<div class="list-group-item">No result</div>'
;
$
(
"#dashboard-group-list"
).
html
(
html
);
// if there is only one result and ENTER is pressed redirect
if
(
e
.
keyCode
==
13
&&
search_result
.
length
==
1
)
{
window
.
location
.
href
=
search_result
[
0
].
url
;
}
if
(
e
.
keyCode
==
13
&&
search_result
.
length
>
1
&&
input
.
length
>
0
)
{
window
.
location
.
href
=
"/dashboard/group/list/?s="
+
input
;
}
});
/* notification message toggle */
$
(
document
).
on
(
'click'
,
".notification-message-subject"
,
function
()
{
$
(
".notification-message-text"
,
$
(
this
).
parent
()).
slideToggle
();
...
...
@@ -249,6 +289,11 @@ function generateVmHTML(pk, name, host, icon, _status, fav) {
'</a>'
;
}
function
generateuGroupHTML
(
name
,
url
,
icon
,
_status
,
fav
)
{
return
name
+
url
+
''
;
}
/* copare vm-s by fav, pk order */
function
compareVmByFav
(
a
,
b
)
{
if
(
a
.
fav
&&
b
.
fav
)
{
...
...
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