Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
- app/pve.js | 418 +++++++++++++++++++++++++++++++++++++++++++++++++++++
+ app/pve.js | 427 +++++++++++++++++++++++++++++++++++++++++++++++++++++
app/ui.js | 66 +++++++--
vnc.html | 10 +-
- 3 files changed, 480 insertions(+), 14 deletions(-)
+ 3 files changed, 489 insertions(+), 14 deletions(-)
create mode 100644 app/pve.js
diff --git a/app/pve.js b/app/pve.js
new file mode 100644
-index 0000000..e2c37fb
+index 0000000..e3c7758
--- /dev/null
+++ b/app/pve.js
-@@ -0,0 +1,418 @@
+@@ -0,0 +1,427 @@
+/*
+ * PVE Utility functions for noVNC
+ * Copyright (C) 2017 Proxmox GmbH
+ url: baseUrl + "/status/" + cmd,
+ method: 'POST',
+ failure: function(msg) {
-+ me.UI.showStatus(msg, 'warning');
++ if (cmd === 'start' && msg.match(/already running/) !== null) {
++ // we wanted to start, but it was already running, so
++ // reload anyway
++ me.UI.showStatus("VM command '" + cmd +"' successful", 'normal');
++ setTimeout(function() {
++ location.reload();
++ }, 1000);
++ } else {
++ me.UI.showStatus(msg, 'warning');
++ }
+ },
+ success: function() {
+ me.UI.showStatus("VM command '" + cmd +"' successful", 'normal');
1 file changed, 7 insertions(+)
diff --git a/app/pve.js b/app/pve.js
-index e2c37fb..9cf4b09 100644
+index e3c7758..446b85d 100644
--- a/app/pve.js
+++ b/app/pve.js
@@ -11,6 +11,7 @@ export default function PVEUI(UI){
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/pve.js b/app/pve.js
-index 9cf4b09..0ab825a 100644
+index 446b85d..dfff1b0 100644
--- a/app/pve.js
+++ b/app/pve.js
@@ -45,7 +45,7 @@ export default function PVEUI(UI){
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/app/pve.js b/app/pve.js
-index 0ab825a..486bd5c 100644
+index dfff1b0..4774e3a 100644
--- a/app/pve.js
+++ b/app/pve.js
-@@ -293,15 +293,15 @@ PVEUI.prototype = {
+@@ -302,15 +302,15 @@ PVEUI.prototype = {
// show/hide the buttons
document.getElementById('noVNC_disconnect_button')
}
// add command logic
-@@ -326,7 +326,7 @@ PVEUI.prototype = {
+@@ -335,7 +335,7 @@ PVEUI.prototype = {
me.pve_vm_command(item.cmd);
};
} else {
1 file changed, 7 insertions(+)
diff --git a/app/pve.js b/app/pve.js
-index 486bd5c..042eb7c 100644
+index 4774e3a..583a406 100644
--- a/app/pve.js
+++ b/app/pve.js
@@ -12,6 +12,7 @@ export default function PVEUI(UI){
this.lastFBWidth = undefined;
this.lastFBHeight = undefined;
this.sizeUpdateTimer = undefined;
-@@ -304,6 +305,12 @@ PVEUI.prototype = {
+@@ -313,6 +314,12 @@ PVEUI.prototype = {
.classList.add('pve_hidden');
}
3 files changed, 99 insertions(+), 2 deletions(-)
diff --git a/app/pve.js b/app/pve.js
-index 042eb7c..9da23ed 100644
+index 583a406..8144fdb 100644
--- a/app/pve.js
+++ b/app/pve.js
-@@ -311,6 +311,11 @@ PVEUI.prototype = {
+@@ -320,6 +320,11 @@ PVEUI.prototype = {
.classList.add('pve_hidden');
}
// add command logic
var commandArray = [
{ cmd: 'start', kvm: 1, lxc: 1},
-@@ -359,8 +364,8 @@ PVEUI.prototype = {
+@@ -368,8 +373,8 @@ PVEUI.prototype = {
return { width: ow, height: oh };
},
me.API2Request({
url: me.url,
method: 'POST',
-@@ -382,6 +387,31 @@ PVEUI.prototype = {
+@@ -391,6 +396,31 @@ PVEUI.prototype = {
});
},