Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
33f3812e
Commit
33f3812e
authored
May 15, 2014
by
Leigh B Stoller
Browse files
Clean up a bunch of button enable/disable stuff.
parent
6e9457c0
Changes
1
Hide whitespace changes
Inline
Side-by-side
www/aptui/js/status.js
View file @
33f3812e
...
...
@@ -56,7 +56,7 @@ function ($, sup, moment)
event
.
preventDefault
();
sup
.
HideModal
(
'
#terminate_modal
'
);
Button
Disable
();
Disable
Buttons
();
var
callback
=
function
(
json
)
{
// This is considered the home page, for now.
...
...
@@ -130,7 +130,7 @@ function ($, sup, moment)
StartResizeWatchdog
()
StatusWatchCallBack
.
active
=
1
;
}
Button
Enable
();
Enable
Buttons
();
}
else
if
(
status
==
'
failed
'
)
{
bgtype
=
"
bg-danger
"
;
...
...
@@ -143,19 +143,20 @@ function ($, sup, moment)
$
(
"
#quickvm_progress
"
).
addClass
(
"
progress-bar-danger
"
);
$
(
"
#quickvm_progress_bar
"
).
width
(
"
100%
"
);
}
ButtonDisable
();
DisableButtons
();
EnableButton
(
"
terminate
"
);
}
else
if
(
status
==
'
imaging
'
)
{
bgtype
=
"
bg-warning
"
;
statustext
=
"
Your experiment is busy while we copy your disk
"
;
statustext
=
"
Your experiment is busy while we copy your disk
"
;
status_html
=
"
<font color=red>imaging</font>
"
;
Button
Disable
();
Disable
Buttons
();
}
else
if
(
status
==
'
terminating
'
||
status
==
'
terminated
'
)
{
status_html
=
"
<font color=red>
"
+
status
+
"
</font>
"
;
bgtype
=
"
bg-danger
"
;
statustext
=
"
Your experiment has been terminated!
"
;
Button
Disable
();
Disable
Buttons
();
StartCountdownClock
.
stop
=
1
;
}
$
(
"
#statusmessage
"
).
html
(
statustext
);
...
...
@@ -174,29 +175,42 @@ function ($, sup, moment)
//
// Enable/Disable buttons.
//
function
Button
Enable
()
function
Enable
Buttons
()
{
ButtonState
(
1
);
EnableButton
(
"
terminate
"
);
EnableButton
(
"
extend
"
);
EnableButton
(
"
snapshot
"
);
}
function
Button
Disable
()
function
Disable
Buttons
()
{
ButtonState
(
0
);
DisableButton
(
"
terminate
"
);
DisableButton
(
"
extend
"
);
DisableButton
(
"
snapshot
"
);
}
function
ButtonState
(
enable
)
function
EnableButton
(
button
)
{
ButtonState
(
button
,
1
);
}
function
DisableButton
(
button
)
{
ButtonState
(
button
,
0
);
}
function
ButtonState
(
button
,
enable
)
{
if
(
button
==
"
terminate
"
)
button
=
"
#terminate_button
"
;
else
if
(
button
==
"
extend
"
)
button
=
"
#extend_button
"
;
else
if
(
button
==
"
snapshot
"
&&
nodecount
==
1
)
button
=
"
#snapshot_button
"
;
else
return
;
if
(
enable
)
{
$
(
"
#terminate_button
"
).
prop
(
"
disabled
"
,
false
);
$
(
"
#extend_button
"
).
prop
(
"
disabled
"
,
false
);
if
(
nodecount
==
1
)
{
$
(
"
#snapshot_button
"
).
prop
(
"
disabled
"
,
false
);
}
$
(
button
).
removeAttr
(
"
disabled
"
);
}
else
{
$
(
"
#terminate_button
"
).
prop
(
"
disabled
"
,
true
);
$
(
"
#extend_button
"
).
prop
(
"
disabled
"
,
true
);
if
(
nodecount
==
1
)
{
$
(
"
#snapshot_button
"
).
prop
(
"
disabled
"
,
true
);
}
$
(
button
).
attr
(
"
disabled
"
,
"
disabled
"
);
}
}
...
...
@@ -584,6 +598,7 @@ function ($, sup, moment)
// single node experiments can do this.
if
(
nodecount
==
1
)
{
$
(
"
#snapshot_button
"
).
removeClass
(
"
invisible
"
);
EnableButton
(
"
snapshot
"
);
}
// And start up ssh for single node topologies.
...
...
Write
Preview
Supports
Markdown
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