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
70debda7
authored
Nov 27, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: remove unused code
parent
fc6bc985
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
8 additions
and
267 deletions
+8
-267
circle/dashboard/static/dashboard/dashboard.js
+8
-1
circle/dashboard/static/dashboard/group-details.js
+0
-36
circle/dashboard/static/dashboard/node-details.js
+0
-33
circle/dashboard/static/dashboard/node-list.js
+0
-45
circle/dashboard/static/dashboard/template-list.js
+0
-86
circle/dashboard/static/dashboard/vm-details.js
+0
-66
No files found.
circle/dashboard/static/dashboard/dashboard.js
View file @
70debda7
...
...
@@ -18,7 +18,7 @@ $(function () {
return
false
;
});
$
(
'.group-create, .node-create, .tx-tpl-ownership, .group-delete, .node-delete, .disk-remove'
).
click
(
function
(
e
)
{
$
(
'.group-create, .node-create, .tx-tpl-ownership, .group-delete, .node-delete, .disk-remove
, .template-delete, .delete-from-group
'
).
click
(
function
(
e
)
{
$
.
ajax
({
type
:
'GET'
,
url
:
$
(
this
).
prop
(
'href'
),
...
...
@@ -29,6 +29,13 @@ $(function () {
modal
.
on
(
'hidden.bs.modal'
,
function
()
{
modal
.
remove
();
});
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
if
(
xhr
.
status
===
403
)
{
addMessage
(
gettext
(
"Only the owners can delete the selected object."
),
"warning"
);
}
else
{
addMessage
(
gettext
(
"An error occurred. ("
)
+
xhr
.
status
+
")"
,
'danger'
)
}
}
});
return
false
;
...
...
circle/dashboard/static/dashboard/group-details.js
View file @
70debda7
...
...
@@ -28,39 +28,3 @@
$
(
".group-details-help-button"
).
click
(
function
()
{
$
(
".group-details-help"
).
stop
().
slideToggle
();
});
/* for Node removes buttons */
$
(
'.delete-from-group'
).
click
(
function
()
{
var
href
=
$
(
this
).
attr
(
'href'
);
var
tr
=
$
(
this
).
closest
(
'tr'
);
var
group
=
$
(
this
).
data
(
'group_pk'
);
var
member
=
$
(
this
).
data
(
'member_pk'
);
var
dir
=
window
.
location
.
pathname
.
indexOf
(
'list'
)
==
-
1
;
addModalConfirmation
(
removeMember
,
{
'url'
:
href
,
'data'
:
[],
'tr'
:
tr
,
'group_pk'
:
group
,
'member_pk'
:
member
,
'type'
:
"user"
,
'redirect'
:
dir
});
return
false
;
});
function
removeMember
(
data
)
{
$
.
ajax
({
type
:
'POST'
,
url
:
data
.
url
,
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
success
:
function
(
re
,
textStatus
,
xhr
)
{
data
.
tr
.
fadeOut
(
function
()
{
$
(
this
).
remove
();});
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
addMessage
(
'Uh oh :('
,
'danger'
);
}
});
}
circle/dashboard/static/dashboard/node-details.js
View file @
70debda7
...
...
@@ -30,20 +30,6 @@ $(function() {
$
(
".node-details-help"
).
stop
().
slideToggle
();
});
/* for Node removes buttons */
$
(
'.node-enable'
).
click
(
function
()
{
var
node_pk
=
$
(
this
).
data
(
'node-pk'
);
var
dir
=
window
.
location
.
pathname
.
indexOf
(
'list'
)
==
-
1
;
addModalConfirmation
(
changeNodeStatus
,
{
'url'
:
'/dashboard/node/status/'
+
node_pk
+
'/'
,
'data'
:
[],
'pk'
:
node_pk
,
'type'
:
"node"
,
'redirect'
:
dir
});
return
false
;
});
// remove trait
$
(
'.node-details-remove-trait'
).
click
(
function
()
{
var
to_remove
=
$
(
this
).
data
(
"trait-pk"
);
...
...
@@ -69,22 +55,3 @@ $(function() {
});
});
function
changeNodeStatus
(
data
)
{
$
.
ajax
({
type
:
'POST'
,
url
:
data
.
url
,
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
success
:
function
(
re
,
textStatus
,
xhr
)
{
if
(
!
data
.
redirect
)
{
selected
=
[];
addMessage
(
re
.
message
,
'success'
);
}
else
{
window
.
location
.
replace
(
'/dashboard'
);
}
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
addMessage
(
'Uh oh :('
,
'danger'
);
}
});
}
circle/dashboard/static/dashboard/node-list.js
View file @
70debda7
...
...
@@ -9,49 +9,4 @@ $(function() {
$
(
'.false'
).
closest
(
"tr"
).
addClass
(
'danger'
);
$
(
'.true'
).
closest
(
"tr"
).
removeClass
(
'danger'
);
}
function
statuschangeSuccess
(
tr
){
var
tspan
=
tr
.
children
(
'.enabled'
).
children
();
var
buttons
=
tr
.
children
(
'.actions'
).
children
(
'.btn-group'
).
children
(
'.dropdown-menu'
).
children
(
'li'
).
children
(
'.node-enable'
);
buttons
.
each
(
function
(
index
){
if
(
$
(
this
).
css
(
"display"
)
==
"block"
){
$
(
this
).
css
(
"display"
,
"none"
);
}
else
{
$
(
this
).
css
(
"display"
,
"block"
);
}
});
if
(
tspan
.
hasClass
(
"false"
)){
tspan
.
removeClass
(
"false"
);
tspan
.
addClass
(
"true"
);
tspan
.
text
(
"✔"
);
}
else
{
tspan
.
removeClass
(
"true"
);
tspan
.
addClass
(
"false"
);
tspan
.
text
(
"✘"
);
}
colortable
();
}
$
(
'#table_container'
).
on
(
'click'
,
'.node-enable'
,
function
()
{
var
tr
=
$
(
this
).
closest
(
"tr"
);
var
pk
=
$
(
this
).
attr
(
'data-node-pk'
);
var
url
=
$
(
this
).
attr
(
'href'
);
$
.
ajax
({
method
:
'POST'
,
url
:
url
,
data
:
{
'change_status'
:
''
},
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
success
:
function
(
data
,
textStatus
,
xhr
)
{
statuschangeSuccess
(
tr
);
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
addMessage
(
"Error!"
,
"danger"
);
}
});
return
false
;
});
});
circle/dashboard/static/dashboard/template-list.js
View file @
70debda7
$
(
function
()
{
/* for template removes buttons */
$
(
'.template-delete'
).
click
(
function
()
{
var
template_pk
=
$
(
this
).
data
(
'template-pk'
);
addModalConfirmationOrDisplayMessage
(
deleteTemplate
,
{
'url'
:
'/dashboard/template/delete/'
+
template_pk
+
'/'
,
'data'
:
[],
'template_pk'
:
template_pk
,
});
return
false
;
});
/* for lease removes buttons */
$
(
'.lease-delete'
).
click
(
function
()
{
var
lease_pk
=
$
(
this
).
data
(
'lease-pk'
);
addModalConfirmationOrDisplayMessage
(
deleteLease
,
{
'url'
:
'/dashboard/lease/delete/'
+
lease_pk
+
'/'
,
'data'
:
[],
'lease_pk'
:
lease_pk
,
});
return
false
;
});
/* template table sort */
var
ttable
=
$
(
".template-list-table"
).
stupidtable
();
...
...
@@ -43,67 +21,3 @@ $(function() {
event
.
preventDefault
();
});
});
// send POST request then delete the row in table
function
deleteTemplate
(
data
)
{
$
.
ajax
({
type
:
'POST'
,
url
:
data
.
url
,
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
success
:
function
(
re
,
textStatus
,
xhr
)
{
addMessage
(
re
.
message
,
'success'
);
$
(
'a[data-template-pk="'
+
data
.
template_pk
+
'"]'
).
closest
(
'tr'
).
fadeOut
(
function
()
{
$
(
this
).
remove
();
});
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
addMessage
(
'Uh oh :('
,
'danger'
);
}
});
}
// send POST request then delete the row in table
function
deleteLease
(
data
)
{
$
.
ajax
({
type
:
'POST'
,
url
:
data
.
url
,
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
success
:
function
(
re
,
textStatus
,
xhr
)
{
addMessage
(
re
.
message
,
'success'
);
$
(
'a[data-lease-pk="'
+
data
.
lease_pk
+
'"]'
).
closest
(
'tr'
).
fadeOut
(
function
()
{
$
(
this
).
remove
();
});
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
addMessage
(
'Uh oh :('
,
'danger'
);
}
});
}
function
addModalConfirmationOrDisplayMessage
(
func
,
data
)
{
$
.
ajax
({
type
:
'GET'
,
url
:
data
[
'url'
],
data
:
jQuery
.
param
(
data
[
'data'
]),
success
:
function
(
result
)
{
$
(
'body'
).
append
(
result
);
$
(
'#confirmation-modal'
).
modal
(
'show'
);
$
(
'#confirmation-modal'
).
on
(
'hidden.bs.modal'
,
function
()
{
$
(
'#confirmation-modal'
).
remove
();
});
$
(
'#confirmation-modal-button'
).
click
(
function
()
{
func
(
data
);
$
(
'#confirmation-modal'
).
modal
(
'hide'
);
});
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
if
(
xhr
.
status
===
403
)
{
addMessage
(
gettext
(
"Only the owners can delete the selected object."
),
"warning"
);
}
else
{
addMessage
(
gettext
(
"An error occurred. ("
)
+
xhr
.
status
+
")"
,
'danger'
)
}
}
});
}
circle/dashboard/static/dashboard/vm-details.js
View file @
70debda7
...
...
@@ -112,51 +112,6 @@ $(function() {
span
.
tooltip
();
});
/* change password confirmation */
$
(
"#vm-details-pw-change"
).
click
(
function
()
{
$
(
"#vm-details-pw-confirm"
).
fadeIn
();
return
false
;
});
/* change password */
$
(
".vm-details-pw-confirm-choice"
).
click
(
function
()
{
choice
=
$
(
this
).
data
(
"choice"
);
if
(
choice
)
{
pk
=
$
(
this
).
data
(
"vm"
);
$
.
ajax
({
type
:
'POST'
,
url
:
"/dashboard/vm/"
+
pk
+
"/"
,
data
:
{
'change_password'
:
'true'
},
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
success
:
function
(
re
,
textStatus
,
xhr
)
{
location
.
reload
();
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
if
(
xhr
.
status
==
500
)
{
addMessage
(
"Internal Server Error"
,
"danger"
);
}
else
{
addMessage
(
xhr
.
status
+
" Unknown Error"
,
"danger"
);
}
}
});
}
else
{
$
(
"#vm-details-pw-confirm"
).
fadeOut
();
}
return
false
;
});
/* add network button */
$
(
"#vm-details-network-add"
).
click
(
function
()
{
$
(
"#vm-details-network-add-form"
).
toggle
();
return
false
;
});
/* add disk button */
$
(
"#vm-details-disk-add"
).
click
(
function
()
{
$
(
"#vm-details-disk-add-for-form"
).
html
(
$
(
"#vm-details-disk-add-form"
).
html
());
return
false
;
});
/* rename */
$
(
"#vm-details-h1-name, .vm-details-rename-button"
).
click
(
function
()
{
$
(
"#vm-details-h1-name"
).
hide
();
...
...
@@ -297,27 +252,6 @@ $(function() {
});
function
removePort
(
data
)
{
$
.
ajax
({
type
:
'POST'
,
url
:
data
.
url
,
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
success
:
function
(
re
,
textStatus
,
xhr
)
{
$
(
"a[data-rule="
+
data
.
rule
+
"]"
).
each
(
function
()
{
$
(
this
).
closest
(
"tr"
).
fadeOut
(
500
,
function
()
{
$
(
this
).
remove
();
});
});
addMessage
(
re
.
message
,
"success"
);
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
}
});
}
function
decideActivityRefresh
()
{
var
check
=
false
;
/* if something is still spinning */
...
...
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