From e4321127243e4069f3ad22de26d3e05f12185985 Mon Sep 17 00:00:00 2001 From: Tlams Date: Thu, 15 Feb 2018 11:05:50 +0000 Subject: [PATCH] Somes changes --- README.md | 2 +- code/scripts/main/private/conf/config | 10 +-- code/scripts/main/startup.py | 6 +- code/web/www/pages/index.php | 120 ++------------------------ code/web/www/pages/js/main.js | 88 ++++--------------- 5 files changed, 33 insertions(+), 193 deletions(-) diff --git a/README.md b/README.md index 340a8a0..d1172ba 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ * Author : Tlams * Date : 2017/2018 * Status: Dev -* Object : Massive LXC CT / KVM deployment system and for Proxmox clusters. +* Object : Massive LXC CT / KVM deployment and management system for Proxmox clusters. * Information : This project is currently in active development. You shouldn't use in production mode, use at your risks ! diff --git a/code/scripts/main/private/conf/config b/code/scripts/main/private/conf/config index a2f312f..545fe43 100644 --- a/code/scripts/main/private/conf/config +++ b/code/scripts/main/private/conf/config @@ -1,8 +1,8 @@ [system] ; System configurations -user: hosting +user: hyperproxmox -; If not exist on start, the key is auto-generate. +; If not exist on start, the key will be auto-generate. key_pvt: private/keys/Ragnarok.pvt.key key_pub: private/keys/Ragnarok.pub.key @@ -10,7 +10,7 @@ key_pub: private/keys/Ragnarok.pub.key user: www-data [api]: -user: hosting_api +user: hyperproxmox [databases] ; Databases configurations @@ -45,11 +45,11 @@ walker_lock: /tmp/hyperproxmoxwalker.lock [logger] -; Active or not(True/False) +; Active or not(True/False - Case !) debug = True ; debug level 1: "INFO", 2: "WARNING", 3: "ERROR", 4: "CRITICAL", 5: "DEBUG" -debug_level = 5 +debug_level = 2 ; log output logs_dir = /var/log/hyperproxmox/ \ No newline at end of file diff --git a/code/scripts/main/startup.py b/code/scripts/main/startup.py index ec53f52..4f79447 100644 --- a/code/scripts/main/startup.py +++ b/code/scripts/main/startup.py @@ -75,14 +75,12 @@ if __name__ == "__main__": '/api/v1/instance', 'Instance', '/api/v1/instance/new', 'Instance', '/api/v1/instance/([0-9]+)', 'Instance', - '/api/v1/instance/([0-9]+)/status/([a-z]+)', 'Instance', + '/api/v1/instance/([a-z0-9]+)/status/(start|stop|status|restart|reset|shutdown)', 'Instance', '/api/v1/instance/([0-9]+)/package', 'package', '/api/v1/instance/([0-9]+)/vhost(?:/([0-9]+))', 'vhost', '/api/v1/instance/([0-9]+)/database(?:/([0-9]+))', 'database', - #  MAPPING NODES - '/api/v1/nodes(?:/([0-9]+))', 'node', # MAPPING SERVICES '/api/v1/service/([a-z]+)/instance/([0-9]+)/vhost(?:/([0-9]+))', 'service', @@ -90,7 +88,7 @@ if __name__ == "__main__": # AUTH '/api/v1/auth', 'Auth', - # MANAGEMENT + # MANAGEMENT CLUSTER '/api/v1/administration/cluster/(?:[0-9a-zA-Z\_\-]+)', 'Cluster', '/api/v1/administration/cluster/', 'Cluster', '/api/v1/administration/cluster/new', 'Cluster', diff --git a/code/web/www/pages/index.php b/code/web/www/pages/index.php index 8745f93..599254c 100755 --- a/code/web/www/pages/index.php +++ b/code/web/www/pages/index.php @@ -14,117 +14,15 @@ include(dirname(__DIR__).'/pages/includes/header.php');
-
- - -
+

+ - Author : Tlams
+ - Date : 2017/2018
+ - Status: Dev
+ - Object : Massive LXC CT / KVM deployment system and for Proxmox clusters.
+ Information : This project is currently in active development.
+ You shouldn't use in production mode, use at your risks !
+

+
You can play the status command to have an updated informations"; box.html('
'); - $('.selectaction').prop('selectedIndex',0); - // Je définis ma requête ajax + + $.ajax({ - - // Adresse à laquelle la requête est envoyée - url: 'requires/pveaction.php', - type : 'POST', - data : 'user=' + name.val() + '&password=' + password.val() + '&action=' + action.val() + '&vmid=' + vmid.val() + '&node=' + node.val(), - // Le délai maximun en millisecondes de traitement de la demande + url: 'requires/pveaction.php?id='+id.val()+'&action=status', + type : 'GET', timeout: 32000, - - // La fonction à apeller si la requête aboutie success: function (data) { - // Je charge les données dans box box.html('
Command return: '+data+'
'+ commandinfo +'
'); }, - - // La fonction à appeler si la requête n'a pas abouti error: function() { - // J'affiche un message d'erreur box.html('
Error: Command failed, try again or contact an true admin.
'); } - }); - - dialog.dialog( "close" ); - $("html, body").animate({ scrollTop: $(document).height() }, "slow"); } - dialog = $( "#dialog-form" ).dialog({ - autoOpen: false, - height: 250, - width: 350, - modal: true, - resizable: false, - buttons: { - "Send": sendrequest, - Cancel: function() { - dialog.dialog( "close" ); - } - }, - close: function() { - form[ 0 ].reset(); - allFields.removeClass( "ui-state-error" ); - $('.selectaction').prop('selectedIndex',0); - } - }); - - form = dialog.find( "form" ).on( "submit", function( event ) { - event.preventDefault(); - sendrequest(); - - }); - - $('.dataTables-vm').on('change', '.selectaction',function() { - var jsonout = JSON.parse(this.value.replace(/'/g, '"')); - if (jsonout["action"] != "none") { - - $('#action').val(jsonout["action"]); - $('#vmid').val(jsonout["vmid"]); - $('#node').val(jsonout["node"]); - dialog.dialog( "open" ); - } - }); - - - /* NODE NON GRATA */ function nongrataswitch(node, action) { @@ -258,12 +201,13 @@ $(document).ready(function() return false; // return false so the browser will not scroll your page }); /* NEWVM -- SEARCH NODES */ - - form = dialog.find( "form" ).on( "submit", function( event ) { - event.preventDefault(); - sendrequest(); - + + + $('#bbaction').on('click', function(event) { + event.preventDefault(); // To prevent following the link (optional) + sendrequest(); }); + function newvm() { // J'initialise le variable box