Permalink
Browse files

Added new machine states of VBox 3.1.

git-svn-id: http://vboxweb.googlecode.com/svn/trunk@93 729376a8-6c6b-11de-afdd-bb9f892af8c1
  • Loading branch information...
1 parent 7c94fc4 commit af1bbb89787aa776db08952aa9c9cdcf88cb1194 vboxweb committed Dec 18, 2009
Showing with 90 additions and 56 deletions.
  1. +73 −39 www/static/js/vboxGlobal.js
  2. +2 −2 www/static/js/vboxVMListView.js
  3. +15 −15 www/static/js/vboxVMToolbar.js
View
@@ -23,20 +23,30 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
-VMState =
+MachineState =
{
PoweredOff: 1,
Saved: 2,
- Aborted: 3,
- Running: 4,
- Paused: 5,
- Stuck: 6,
- Starting: 7,
- Stopping: 8,
- Saving: 9,
- Restoring: 10,
- Discarding: 11,
- SettingUp: 12
+ Teleported: 3,
+ Aborted: 4,
+ Running: 5,
+ Paused: 6,
+ Stuck: 7,
+ Teleporting: 8,
+ LiveSnapshotting: 9,
+ Starting: 10,
+ Stopping: 11,
+ Saving: 12,
+ Restoring: 13,
+ TeleportingPausedVM: 14,
+ TeleportingIn: 15,
+ RestoringSnapshot: 16,
+ DeletingSnapshot: 17,
+ SettingUp: 18,
+ FirstOnline: 5,
+ LastOnline: 13,
+ FirstTransient: 8,
+ LastTransient: 18
};
var vboxGlobal = Class.create(
@@ -99,73 +109,97 @@ var vboxGlobal = Class.create(
return strDevice;
},
- vmStateIcon: function (state)
+ machineStateIcon: function (state)
{
var strBasePath = "/images/vbox/";
var strIcon = "state_powered_off_16px.png";
+ var strNoIcon = "state_running_16px.png";
switch (state)
{
- case 1: strIcon = "state_powered_off_16px.png"; break;
- case 2: strIcon = "state_saved_16px.png"; break;
- case 3: strIcon = "state_aborted_16px.png"; break;
- case 4: strIcon = "state_running_16px.png"; break;
- case 5: strIcon = "state_paused_16px.png"; break;
- case 6: strIcon = "state_stuck_16px.png"; break;
- case 7: strIcon = "state_running_16px.png"; break;
- case 8: strIcon = "state_running_16px.png"; break;
- case 9: strIcon = "state_saving_16px.png"; break;
- case 10: strIcon = "state_restoring_16px.png"; break;
- case 11: strIcon = "state_discarding_16px.png"; break;
- case 12: strIcon = "settings_16px.png"; break;
-
+ case MachineState.PoweredOff: strIcon = "state_powered_off_16px.png"; break;
+ case MachineState.Saved: strIcon = "state_saved_16px.png"; break;
+ case MachineState.Teleported: strIcon = strNoIcon; break;
+ case MachineState.Aborted: strIcon = "state_aborted_16px.png"; break;
+ case MachineState.Running: strIcon = "state_running_16px.png"; break;
+ case MachineState.Paused: strIcon = "state_paused_16px.png"; break;
+ case MachineState.Stuck: strIcon = "state_stuck_16px.png"; break;
+ case MachineState.Teleporting: strIcon = strNoIcon; break;
+ case MachineState.LiveSnapshotting: strIcon = strNoIcon; break;
+ case MachineState.Starting: strIcon = strNoIcon; break;
+ case MachineState.Stopping: strIcon = strNoIcon; break;
+ case MachineState.Saving: strIcon = "state_discarding_16px.png"; break;
+ case MachineState.Restoring: strIcon = "settings_16px.png"; break;
+ case MachineState.TeleportingPausedVM: strIcon = strNoIcon; break;
+ case MachineState.TeleportingIn: strIcon = strNoIcon; break;
+ case MachineState.RestoringSnapshot: strIcon = strNoIcon; break;
+ case MachineState.DeletingSnapshot: "discarding_16px.png"; break;
+ case MachineState.SettingUp: strIcon = strNoIcon; break;
default:
break;
}
return strBasePath + strIcon;
},
- vmStateDescription: function(state)
+ machineStateDescription: function(state)
{
/** @todo use an array instead of this huge switch statement */
var strState = tr("Unknown");
switch(state)
{
- case VMState.PoweredOff:
+ case MachineState.PoweredOff:
strState = tr("Powered Off");
break;
- case VMState.Saved:
+ case MachineState.Saved:
strState = tr("Saved");
break;
- case VMState.Aborted:
+ case MachineState.Teleported:
+ strState = tr("Teleported");
+ break;
+ case MachineState.Aborted:
strState = tr("Aborted");
break;
- case VMState.Running:
+ case MachineState.Running:
strState = tr("Running");
break;
- case VMState.Paused:
+ case MachineState.Paused:
strState = tr("Paused");
break;
- case VMState.Stuck:
+ case MachineState.Stuck:
strState = tr("Stuck");
break;
- case VMState.Starting:
+ case MachineState.Teleporting:
+ strState = tr("Teleporting");
+ break;
+ case MachineState.LiveSnapshotting:
+ strState = tr("LiveSnapshotting");
+ break;
+ case MachineState.Starting:
strState = tr("Starting");
break;
- case VMState.Stopping:
+ case MachineState.Stopping:
strState = tr("Stopping");
break;
- case VMState.Saving:
+ case MachineState.Saving:
strState = tr("Saving");
break;
- case VMState.Restoring:
+ case MachineState.Restoring:
strState = tr("Restoring");
break;
- case VMState.Discarding:
- strState = tr("Discarding");
+ case MachineState.TeleportingPausedVM:
+ strState = tr("Teleporting Paused");
+ break;
+ case MachineState.TeleportingIn:
+ strState = tr("Teleporting In");
+ break;
+ case MachineState.RestoringSnapshot:
+ strState = tr("Restoring Snapshot");
+ break;
+ case MachineState.DeletingSnapshot:
+ strState = tr("Deleting Snapshot");
break;
- case VMState.SettingUp:
+ case MachineState.SettingUp:
strState = tr("Setting Up");
break;
default:
@@ -220,8 +220,8 @@ var vboxVMListView = Class.create(
'</td>'+
'<td width="100%" nowrap="nowrap" class="vmlist-entry-vmname">'+
'<b>' + curItem.name() + '</b><br/>' +
- '<img alt="" class="vmlist-entry-stateicon" src="' + vbGlobal.vmStateIcon(curItem.state()) + '"/>&nbsp;' +
- vbGlobal.vmStateDescription(curItem.state()) +
+ '<img alt="" class="vmlist-entry-stateicon" src="' + vbGlobal.machineStateIcon(curItem.state()) + '"/>&nbsp;' +
+ vbGlobal.machineStateDescription(curItem.state()) +
'</td>'+
'</tr>'+
'</table>'+
@@ -71,21 +71,21 @@ var vboxVMToolbar = Class.create(
break;
case "toolbar-button-start-pause":
- if (state == VMState.Running)
+ if (state == MachineState.Running)
vbGlobal.mVirtualBox.pauseVM(id);
- else if (state == VMState.Paused)
+ else if (state == MachineState.Paused)
vbGlobal.mVirtualBox.resumeVM(id);
else
vbGlobal.mVirtualBox.startVM(id);
break;
case "toolbar-button-stop-discard":
- if (state == VMState.Running ||
- state == VMState.Paused)
+ if (state == MachineState.Running ||
+ state == MachineState.Paused)
{
vboxDialogs.showPowerOffDialog();
}
- else if (state == VMState.Saved)
+ else if (state == MachineState.Saved)
{
log("Discard VM not implemented!");
}
@@ -113,8 +113,8 @@ var vboxVMToolbar = Class.create(
var state = curItem.state();
/* settings can only be changed for powered off and aborted VMs */
- if (state == VMState.PoweredOff ||
- state == VMState.Aborted)
+ if (state == MachineState.PoweredOff ||
+ state == MachineState.Aborted)
{
jQuery("#toolbar-button-vm-settings-span").html('<img id="toolbar-button-settings" src="/images/vbox/vm_settings_32px.png" alt=""/>');
jQuery("#toolbar-button-settings").qtip({ content: 'Change settings of selected virtual machine' });
@@ -123,15 +123,15 @@ var vboxVMToolbar = Class.create(
jQuery("#toolbar-button-vm-settings-span").html('<img src="/images/vbox/vm_settings_disabled_32px.png" alt=""/>');
/* powered off / aborted, paused and saved VMs can be started */
- if (state == VMState.PoweredOff ||
- state == VMState.Aborted ||
- state == VMState.Saved ||
- state == VMState.Paused)
+ if (state == MachineState.PoweredOff ||
+ state == MachineState.Aborted ||
+ state == MachineState.Saved ||
+ state == MachineState.Paused)
{
jQuery("#toolbar-button-vm-start-span").html('<img id="toolbar-button-start-pause" src="/images/vbox/vm_start_32px.png" alt=""/">');
jQuery("#toolbar-button-start-pause").qtip({ content: 'Start currently selected virtual machine' });
}
- else if (state == VMState.Running)
+ else if (state == MachineState.Running)
{
jQuery("#toolbar-button-vm-start-span").html('<img id="toolbar-button-start-pause" src="/images/vbox/vm_pause_32px.png" alt=""/>');
jQuery("#toolbar-button-start-pause").qtip({ content: 'Pause the currently selected virtual machine' });
@@ -140,13 +140,13 @@ var vboxVMToolbar = Class.create(
jQuery("#toolbar-button-vm-start-span").html('<img src="/images/vbox/vm_start_disabled_32px.png" alt=""/>');
/* saved VMs can be discarded */
- if (state == VMState.Saved)
+ if (state == MachineState.Saved)
{
jQuery("#toolbar-button-vm-stop-span").html('<img id="toolbar-button-stop-discard" src="/images/vbox/vm_discard_32px.png" alt=""/>');
jQuery("#toolbar-button-stop-discard").qtip({ content: 'Discard the saved state of the currently selected virtual machine' });
}
- else if (state == VMState.Running ||
- state == VMState.Paused)
+ else if (state == MachineState.Running ||
+ state == MachineState.Paused)
{
jQuery("#toolbar-button-vm-stop-span").html('<img id="toolbar-button-stop-discard" src="/images/vbox/vm_poweroff_32px.png" alt=""/>');
jQuery("#toolbar-button-stop-discard").qtip({ content: 'Power down the currently selected virtual machine' });

0 comments on commit af1bbb8

Please sign in to comment.