Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4c5d80a1
authored
Feb 09, 2013
by
Dányi Bence
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webui: fancy confirm window added to vm actions
parent
90b2b09f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
8 deletions
+17
-8
one/static/cloud.js
+17
-8
No files found.
one/static/cloud.js
View file @
4c5d80a1
...
@@ -105,8 +105,17 @@ $(function() {
...
@@ -105,8 +105,17 @@ $(function() {
/**
/**
* Confirm pop-up window
* Confirm pop-up window
*/
*/
function
vm_confirm_popup
(
confirm_message
,
button_text
)
{
return
confirm
(
confirm_message
);
function
vm_confirm_popup
(
confirm_message
,
button_text
,
success
)
{
$
(
'#modal'
).
show
();
$
(
'#modal-container'
).
html
(
confirm_message
+
'<br /><input class="ok" type="button" value="'
+
button_text
+
'" style="float: left"/><input class="cancel" type="button" value="'
+
gettext
(
'Cancel'
)
+
'" style="float: right" />'
);
$
(
'#modal-container .ok'
).
click
(
function
()
{
$
(
'#modal'
).
hide
();
success
();
});
$
(
'#modal-container .cancel'
).
click
(
function
()
{
$
(
'#modal'
).
hide
();
});
}
}
/**
/**
* Manage VM State (STOP)
* Manage VM State (STOP)
...
@@ -114,9 +123,9 @@ $(function() {
...
@@ -114,9 +123,9 @@ $(function() {
function
stop_vm
(
id
,
name
)
{
function
stop_vm
(
id
,
name
)
{
confirm_message
=
interpolate
(
gettext
(
"Are you sure stopping %s?"
),
[
name
])
confirm_message
=
interpolate
(
gettext
(
"Are you sure stopping %s?"
),
[
name
])
if
(
vm_confirm_popup
(
confirm_message
,
gettext
(
"Stop"
))
)
{
vm_confirm_popup
(
confirm_message
,
gettext
(
"Stop"
),
function
(
)
{
manage_vm
(
id
,
"stop"
)
manage_vm
(
id
,
"stop"
)
}
}
);
}
}
/**
/**
* Manage VM State (DELETE)
* Manage VM State (DELETE)
...
@@ -124,9 +133,9 @@ $(function() {
...
@@ -124,9 +133,9 @@ $(function() {
function
delete_vm
(
id
,
name
)
{
function
delete_vm
(
id
,
name
)
{
confirm_message
=
interpolate
(
gettext
(
"Are you sure deleting %s?"
),
[
name
])
confirm_message
=
interpolate
(
gettext
(
"Are you sure deleting %s?"
),
[
name
])
if
(
vm_confirm_popup
(
confirm_message
,
gettext
(
"Delete"
))
)
{
vm_confirm_popup
(
confirm_message
,
gettext
(
"Delete"
),
function
(
)
{
manage_vm
(
id
,
"delete"
)
manage_vm
(
id
,
"delete"
)
}
}
)
}
}
/**
/**
* Manage VM State (RESET)
* Manage VM State (RESET)
...
@@ -134,9 +143,9 @@ $(function() {
...
@@ -134,9 +143,9 @@ $(function() {
function
restart_vm
(
id
,
name
)
{
function
restart_vm
(
id
,
name
)
{
confirm_message
=
interpolate
(
gettext
(
"Are you sure restarting %s?"
),
[
name
])
confirm_message
=
interpolate
(
gettext
(
"Are you sure restarting %s?"
),
[
name
])
if
(
vm_confirm_popup
(
confirm_message
,
gettext
(
"Restart"
))
)
{
vm_confirm_popup
(
confirm_message
,
gettext
(
"Restart"
),
function
(
)
{
manage_vm
(
id
,
"restart"
)
manage_vm
(
id
,
"restart"
)
}
}
)
}
}
/**
/**
* Manage VM State (RESUME)
* Manage VM State (RESUME)
...
...
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