From 06325759b47a0021cf5004cdad682e946dea07a6 Mon Sep 17 00:00:00 2001 From: Ben Roberts Date: Tue, 20 Dec 2011 00:43:16 +0000 Subject: [PATCH] Add first draft admin interface This exposes information on Services/Sites/Incidents, but does not yet permit any changes. Admin page also links to future user management pages. --- source/webui/pages/admin.php | 11 ++++ source/webui/pages/admin/incident.php | 29 ++++++++ source/webui/pages/admin/service.php | 19 ++++++ source/webui/pages/admin/site.php | 25 +++++++ source/webui/templates/admin.tpl | 38 ++++++++++- source/webui/templates/admin/incident.tpl | 80 +++++++++++++++++++++++ source/webui/templates/admin/service.tpl | 50 ++++++++++++++ source/webui/templates/admin/site.tpl | 55 ++++++++++++++++ 8 files changed, 306 insertions(+), 1 deletion(-) create mode 100644 source/webui/pages/admin.php create mode 100644 source/webui/pages/admin/incident.php create mode 100644 source/webui/pages/admin/service.php create mode 100644 source/webui/pages/admin/site.php create mode 100644 source/webui/templates/admin/incident.tpl create mode 100644 source/webui/templates/admin/service.tpl create mode 100644 source/webui/templates/admin/site.tpl diff --git a/source/webui/pages/admin.php b/source/webui/pages/admin.php new file mode 100644 index 0000000..0a46c19 --- /dev/null +++ b/source/webui/pages/admin.php @@ -0,0 +1,11 @@ +auth(); + +$services = StatusBoard_Service::all(); +$this->smarty->assign('services', $services); + +$users = $auth->listUsers(); +$this->smarty->assign('users', $users); +?> \ No newline at end of file diff --git a/source/webui/pages/admin/incident.php b/source/webui/pages/admin/incident.php new file mode 100644 index 0000000..12ff4dd --- /dev/null +++ b/source/webui/pages/admin/incident.php @@ -0,0 +1,29 @@ +request(); + +$service_id = $request->get('service', 'Sihnon_Exception_InvalidParameters'); +$site_id = $request->get('site', 'Sihnon_Exception_InvalidParameters'); +$incident_id = $request->get('id', 'Sihnon_Exception_InvalidParameters'); + +$service = null; +$site = null; +$incident = null; + +try { + $service = StatusBoard_Service::fromId($service_id); + $site = StatusBoard_Site::fromId($site_id); + $incident = StatusBoard_Incident::fromId($incident_id); +} catch (Sihnon_Exception_ResultCountMismatch $e) { + StatusBoard_Page::redirect('errors/404'); +} + +$statuses = $incident->statusChanges(); + +$this->smarty->assign('service', $service); +$this->smarty->assign('site', $site); +$this->smarty->assign('incident', $incident); +$this->smarty->assign('statuses', $statuses); + +?> \ No newline at end of file diff --git a/source/webui/pages/admin/service.php b/source/webui/pages/admin/service.php new file mode 100644 index 0000000..560c11c --- /dev/null +++ b/source/webui/pages/admin/service.php @@ -0,0 +1,19 @@ +request(); + +$service_id = $request->get('id', 'Sihnon_Exception_InvalidParameters'); +$service = null; +try { + $service = StatusBoard_Service::fromId($service_id); +} catch (Sihnon_Exception_ResultCountMismatch $e) { + StatusBoard_Page::redirect('errors/404'); +} + +$sites = $service->sites(); + +$this->smarty->assign('service', $service); +$this->smarty->assign('sites', $sites); + +?> \ No newline at end of file diff --git a/source/webui/pages/admin/site.php b/source/webui/pages/admin/site.php new file mode 100644 index 0000000..48fbbbb --- /dev/null +++ b/source/webui/pages/admin/site.php @@ -0,0 +1,25 @@ +request(); + +$service_id = $request->get('service', 'Sihnon_Exception_InvalidParameters'); +$site_id = $request->get('id', 'Sihnon_Exception_InvalidParameters'); + +$service = null; +$site = null; + +try { + $service = StatusBoard_Service::fromId($service_id); + $site = StatusBoard_Site::fromId($site_id); +} catch (Sihnon_Exception_ResultCountMismatch $e) { + StatusBoard_Page::redirect('errors/404'); +} + +$open_incidents = $site->openIncidents(); + +$this->smarty->assign('service', $service); +$this->smarty->assign('site', $site); +$this->smarty->assign('open_incidents', $open_incidents); + +?> \ No newline at end of file diff --git a/source/webui/templates/admin.tpl b/source/webui/templates/admin.tpl index 30404ce..3997870 100644 --- a/source/webui/templates/admin.tpl +++ b/source/webui/templates/admin.tpl @@ -1 +1,37 @@ -TODO \ No newline at end of file +

Services

+ +

+ Click on a Service to edit its properties, or access any of the sites defined under it. +

+ +{if $services} +
+ {foreach from=$services item=service} +
{$service->name|escape:html}
+
{$service->description|escape:html}
+ {/foreach} +
+{else} + You haven't created any services yet. Create some with the button below. +{/if} + +
+ +
+ + +

Users and Permissions

+ +

+ Click on a User to edit its properties. +

+ + + +
+ +
\ No newline at end of file diff --git a/source/webui/templates/admin/incident.tpl b/source/webui/templates/admin/incident.tpl new file mode 100644 index 0000000..aa387af --- /dev/null +++ b/source/webui/templates/admin/incident.tpl @@ -0,0 +1,80 @@ +

Incident {$incident->reference|escape:html}

+ +
+
+
+
+
+ Edit Incident + +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+   +
+
+
+
+
+
+ +
+
+
+
+ Change Status + +
+ +
+ +
+
+ +
+
+   +
+
+
+
+
+
+
+ +

Status Changes

+ + + + + + + + {foreach from=$statuses item=status} + + + + + {/foreach} + +
Date/TimeStatus
+ {StatusBoard_DateTime::fuzzyTime($status->ctime)}
+ {$status->ctime|date_format:'y-m-d h:i:s'} +
{StatusBoard_Status::name($status->status)}
diff --git a/source/webui/templates/admin/service.tpl b/source/webui/templates/admin/service.tpl new file mode 100644 index 0000000..72f8e70 --- /dev/null +++ b/source/webui/templates/admin/service.tpl @@ -0,0 +1,50 @@ +

Service {$service->name|escape:html}

+ +
+
+
+
+
+ Edit Service + +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+   +
+
+
+
+
+
+
+ +

Sites

+ +{if $sites} +
+ {foreach from=$sites item=site} +
{$site->name|escape:html}
+
{$site->description|escape:html}
+ {/foreach} +
+{else} + You haven't created any sites for this service yet. Create some with the button below. +{/if} + +
+ +
\ No newline at end of file diff --git a/source/webui/templates/admin/site.tpl b/source/webui/templates/admin/site.tpl new file mode 100644 index 0000000..6f7be54 --- /dev/null +++ b/source/webui/templates/admin/site.tpl @@ -0,0 +1,55 @@ +

Site {$site->name|escape:html}

+ +
+
+
+
+
+ Edit Site + +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+   +
+
+
+
+
+
+
+ +

Open Incidents

+ +{if $open_incidents} +
+ {foreach from=$open_incidents item=incident} +
+ {$incident->reference|escape:html} + ({StatusBoard_Status::name($incident->currentStatus())}) +
+
+ {$incident->description|truncate|escape:html} +
+ {/foreach} +
+{else} + There are no open incidents for this site . If you need to open one, use the button below. +{/if} + +
+ +
\ No newline at end of file