From a639e7155522da4338f4e01d7775a120a01da797 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Fri, 11 May 2012 03:00:58 +0200 Subject: [PATCH] Add container overview page --- frontend/locales/english.lng | 1 + frontend/module.admin.containers.php | 40 +++++++++++++++++++ frontend/module.admin.php | 1 + frontend/templates/admin.containers.tpl | 52 +++++++++++++++++++++++++ 4 files changed, 94 insertions(+) create mode 100644 frontend/module.admin.containers.php create mode 100644 frontend/templates/admin.containers.tpl diff --git a/frontend/locales/english.lng b/frontend/locales/english.lng index 2aecdd1..69c5c88 100644 --- a/frontend/locales/english.lng +++ b/frontend/locales/english.lng @@ -29,6 +29,7 @@ title-reinstall; Reinstall your VPS title-password; Set new root password title-console; Out-of-band console title-admin-userlist; User overview +title-admin-containerlist; Container overview title-admin-userinfo; User lookup header-admin-user-containers; Containers owned by this user diff --git a/frontend/module.admin.containers.php b/frontend/module.admin.containers.php new file mode 100644 index 0000000..dc73397 --- /dev/null +++ b/frontend/module.admin.containers.php @@ -0,0 +1,40 @@ +data as $row) + { + $sContainer = new Container($row); + + $sContainerList[] = array( + 'id' => $sContainer->sId, + 'hostname' => $sContainer->sHostname, + 'node' => $sContainer->sNode->sName, + 'node-hostname' => $sContainer->sNode->sHostname, + 'template' => $sContainer->sTemplate->sName, + 'diskspace' => number_format($sContainer->sDiskSpace / 1024), + 'diskspace-unit' => "GB", + 'guaranteed-ram' => $sContainer->sGuaranteedRam, + 'guaranteed-ram-unit' => "MB", + 'status' => $sContainer->sStatusText, + 'virtualization-type' => $sContainer->sVirtualizationType + ); + } +} + +$sPageContents = Templater::InlineRender("admin.containers", $locale->strings, array( + 'containers' => $sContainerList +)); diff --git a/frontend/module.admin.php b/frontend/module.admin.php index 2c4d46d..69c5026 100644 --- a/frontend/module.admin.php +++ b/frontend/module.admin.php @@ -30,6 +30,7 @@ try 0 => array( '^/admin/?$' => "module.admin.overview.php", '^/admin/users/?$' => "module.admin.users.php", + '^/admin/containers/?$' => "module.admin.containers.php", '^/admin/user/([0-9]+)/?$' => "module.admin.user.php" ) ); diff --git a/frontend/templates/admin.containers.tpl b/frontend/templates/admin.containers.tpl new file mode 100644 index 0000000..91ed983 --- /dev/null +++ b/frontend/templates/admin.containers.tpl @@ -0,0 +1,52 @@ +

<%!title-admin-containerlist>

+ + + + + + + + + + + <%foreach container in containers> + + + + + + + + + <%/foreach> +
<%!list-column-hostname><%!list-column-platform><%!list-column-disk><%!list-column-ram><%!list-column-template>
+ <%if container[status] == running> + <%!list-status-running> + <%/if><%if container[status] == stopped> + <%!list-status-stopped> + <%/if><%if container[status] == suspended> + <%!list-status-suspended> + <%/if> + + + <%?container[hostname]> + + + + <%if container[virtualization-type] == 1> + OpenVZ + <%/if><%if container[virtualization-type] == 2> + Xen PV + <%/if><%if container[virtualization-type] == 3> + Xen HVM + <%/if><%if container[virtualization-type] == 4> + KVM + <%/if> + + + <%?container[diskspace]> + <%?container[diskspace-unit]> + + <%?container[guaranteed-ram]> + <%?container[guaranteed-ram-unit]> + <%?container[template]>