</ul>
<div class="page-header">
- <h1>{{ _("Mirror") }}: {{ mirror.hostname }}</h1>
+ <h2>{{ _("Delete mirror: %s") % mirror.hostname }}</h2>
</div>
- <div class="row">
- <div class="span6 offset3">
- <p>
- {{ _("You are going to delete the mirror <strong>%s</strong>.") % mirror.hostname }}
- </p>
+ <p>
+ {{ _("You are going to delete the mirror %s.") % mirror.hostname }}
+ </p>
- <div class="btn-toolbar">
- <div class="btn-group pull-right">
- <a class="btn btn-danger" href="/mirror/{{ mirror.hostname }}/delete?confirmed=1">
- {{ _("Delete %s") % mirror.hostname }}
- </a>
- <a class="btn" href="/mirror/{{ mirror.hostname }}">{{ _("Cancel") }}</a>
- </div>
- </div>
- </div>
+ <div class="btn-toolbar pull-right">
+ <a class="btn btn-danger" href="/mirror/{{ mirror.hostname }}/delete?confirmed=1">
+ {{ _("Delete %s") % mirror.hostname }}
+ </a>
+ <a class="btn" href="/mirror/{{ mirror.hostname }}">{{ _("Cancel") }}</a>
</div>
+
+ <br class="clear">
{% end block %}
</li>
</ul>
+ {% if current_user and current_user.has_perm("manage_mirrors") %}
+ <div class="btn-group pull-right">
+ <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
+ {{ _("Actions") }} <span class="caret"></span>
+ </a>
+ <ul class="dropdown-menu">
+ <li>
+ <a href="/mirror/{{ mirror.hostname }}/edit">
+ <i class="icon-edit"></i>
+ {{ _("Edit settings") }}
+ </a>
+ </li>
+
+ <li class="divider"></li>
+ <li>
+ <a href="/mirror/{{ mirror.hostname }}/delete">
+ <i class="icon-trash"></i>
+ {{ _("Delete mirror") }}
+ </a>
+ </li>
+ </ul>
+ </div>
+ {% end %}
+
<div class="page-header">
- <h1>
+ <h2>
{{ _("Mirror: %s") % mirror.hostname }}
<small>{{ _("hosted by %s") % mirror.owner }}</small>
- </h1>
+ </h2>
</div>
<div class="row">
- <div class="span5">
- <table class="table">
+ <div class="span6">
+ <table class="table table-striped table-hover">
<tbody>
<tr>
<td>{{ _("Hostname") }}</td>
</tbody>
</table>
- <h2>{{ _("Status information") }}</h2>
- <table class="table">
+ <h3>{{ _("Status information") }}</h3>
+ <table class="table table-striped table-hover">
<tbody>
<tr>
<td>{{ _("Status") }}</td>
</tr>
</tbody>
</table>
-
- {% if current_user and current_user.has_perm("manage_mirrors") %}
- <div class="btn-toolbar">
- <div class="btn-group pull-right">
- <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
- {{ _("Action") }}
- <span class="caret"></span>
- </a>
- <ul class="dropdown-menu">
- <li>
- <a href="/mirror/{{ mirror.hostname }}/edit">
- <i class="icon-edit"></i>
- {{ _("Edit settings") }}
- </a>
- </li>
-
- <li class="divider"></li>
- <li>
- <a href="/mirror/{{ mirror.hostname }}/delete">
- <i class="icon-trash"></i>
- {{ _("Delete mirror") }}
- </a>
- </li>
- </ul>
- </div>
- </div>
- {% end %}
</div>
- <div class="span7">
- <h2>{{ _("Map") }}</h2>
-
+ <div class="span6">
{% if mirror.longitude and mirror.latitude %}
- <p>
- {{ _("The location of the mirror server is estimated by the IP address.") }}
- </p>
- <iframe width="525" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"
+ <iframe width="100%" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"
src="http://www.openstreetmap.org/export/embed.html?bbox={{ mirror.longitude - 4 }},{{ mirror.latitude - 4 }},{{ mirror.longitude + 4 }},{{ mirror.latitude + 4 }}&layer=mapquest&marker={{ mirror.latitude }},{{ mirror.longitude }}" style="border: 1px solid black">
</iframe>
<p>
-
© <a href="http://www.openstreetmap.org/" target="_blank">OpenStreetMap</a> contributors, CC-BY-SA
</p>
+ <p class="muted">
+ {{ _("The location of the mirror server is estimated by the IP address.") }}
+ </p>
{% else %}
- {{ _("The location of the mirror server could not be estimated.") }}
+ <p class="muted">
+ {{ _("The location of the mirror server could not be estimated.") }}
+ </p>
{% end %}
</div>
</div>
+
+ {% if log %}
+ <h3>{{ _("Log") }}</h3>
+ {% module Log(log) %}
+ {% end %}
{% end block %}
{% extends "base.html" %}
-{% block title %}{{ _("Edit mirror %s") % mirror.hostname }}{% end block %}
+{% block title %}{{ _("Manage mirror %s") % mirror.hostname }}{% end block %}
{% block body %}
<ul class="breadcrumb">
</ul>
<div class="page-header">
- <h1>{{ _("Edit mirror: %s") % mirror.hostname }}</h1>
+ <h2>{{ _("Manage mirror: %s") % mirror.hostname }}</h2>
</div>
- <div class="row">
- <div class="span6 offset3">
- <form class="form-horizontal" method="POST" action="">
- {% raw xsrf_form_html() %}
- <fieldset>
- <div class="control-group">
- <label class="control-label" for="name">{{ _("Hostname") }}</label>
- <div class="controls">
- <input type="text" class="input-xlarge" id="name" name="name" value="{{ mirror.hostname }}">
+ <form class="form-horizontal" method="POST" action="">
+ {% raw xsrf_form_html() %}
+ <fieldset>
+ <div class="control-group">
+ <label class="control-label" for="name">{{ _("Hostname") }}</label>
+ <div class="controls">
+ <input type="text" class="input-xlarge" id="name" name="name" value="{{ mirror.hostname }}">
- <p class="help-block">
- {{ _("The canonical hostname.") }}
- </p>
- </div>
- </div>
+ <p class="help-block">
+ {{ _("The canonical hostname.") }}
+ </p>
+ </div>
+ </div>
- <div class="control-group">
- <label class="control-label" for="enabled">{{ _("Enabled") }}</label>
- <div class="controls">
- <label class="checkbox">
- <input type="checkbox" id="enabled" name="enabled" {% if mirror.enabled %}checked="checked"{% end %}>
- {{ _("Only enabled mirrors will be pushed out to the clients.") }}
- </label>
- </div>
- </div>
- </fieldset>
+ <div class="control-group">
+ <label class="control-label" for="enabled">{{ _("Enabled") }}</label>
+ <div class="controls">
+ <label class="checkbox">
+ <input type="checkbox" id="enabled" name="enabled" {% if mirror.enabled %}checked="checked"{% end %}>
+ {{ _("Only enabled mirrors will be pushed out to the clients.") }}
+ </label>
+ </div>
+ </div>
+ </fieldset>
- <fieldset>
- <legend>{{ _("Contact information") }}</legend>
+ <fieldset>
+ <legend>{{ _("Contact information") }}</legend>
- <div class="control-group">
- <label class="control-label" for="owner">{{ _("Owner") }}</label>
- <div class="controls">
- <input type="text" class="input-xlarge" id="owner" name="owner" value="{{ mirror.owner }}">
+ <div class="control-group">
+ <label class="control-label" for="owner">{{ _("Owner") }}</label>
+ <div class="controls">
+ <input type="text" class="input-xlarge" id="owner" name="owner" value="{{ mirror.owner }}">
- <p class="help-block">
- {{ _("The owner of the mirror server.") }}
- </p>
- </div>
- </div>
+ <p class="help-block">
+ {{ _("The owner of the mirror server.") }}
+ </p>
+ </div>
+ </div>
- <div class="control-group">
- <label class="control-label" for="contact">{{ _("Contact address") }}</label>
- <div class="controls">
- <input type="text" class="input-xlarge" id="contact" name="contact" value="{{ mirror.contact }}">
+ <div class="control-group">
+ <label class="control-label" for="contact">{{ _("Contact address") }}</label>
+ <div class="controls">
+ <input type="text" class="input-xlarge" id="contact" name="contact" value="{{ mirror.contact }}">
- <p class="help-block">
- {{ _("An email address to contact an administrator of the mirror.") }}
- <br />
- <em>{{ _("This won't be made public.") }}</em>
- </p>
- </div>
- </div>
+ <p class="help-block">
+ {{ _("An email address to contact an administrator of the mirror.") }}
+ <br>
+ <em>{{ _("This won't be made public.") }}</em>
+ </p>
+ </div>
+ </div>
- <div class="form-actions">
- <button type="submit" class="btn btn-primary">{{ _("Save changes") }}</button>
- <a class="btn" href="/mirror/{{ mirror.hostname }}">{{ _("Cancel") }}</a>
- </div>
- </fieldset>
- </form>
- </div>
- </div>
+ <div class="form-actions">
+ <button type="submit" class="btn btn-primary">{{ _("Save changes") }}</button>
+ <a class="btn" href="/mirror/{{ mirror.hostname }}">{{ _("Cancel") }}</a>
+ </div>
+ </fieldset>
+ </form>
{% end block %}
</li>
</ul>
+ {% if current_user and current_user.has_perm("manage_mirrors") %}
+ <div class="btn-group pull-right">
+ <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
+ {{ _("Actions") }} <span class="caret"></span>
+ </a>
+ <ul class="dropdown-menu">
+ <li>
+ <a href="/mirror/new">
+ <i class="icon-asterisk"></i> {{ _("Add new mirror") }}
+ </a>
+ </li>
+ </ul>
+ </div>
+ {% end %}
+
<div class="page-header">
- <h1>
- {{ _("Mirrors") }}
- <small>({{ len(mirrors) }})</small>
- </h1>
+ <h2>{{ _("Mirrors") }}</h2>
</div>
- <div class="row">
- <div class="span12">
- <p>
- {{ _("On this page, you will see a list of all mirror servers.") }}
- </p>
+ <p>
+ {{ _("On this page, you will see a list of all mirror servers.") }}
+ </p>
- {% if mirrors %}
- <table class="table table-striped table-hover">
- <thead>
- <tr>
- <th> </th>
- <th>{{ _("Hostname") }}</th>
- <th>{{ _("Owner") }}</th>
- <th>{{ _("Status") }}</th>
- <th>{{ _("Last check") }}</th>
- </tr>
- </thead>
- <tbody>
- {% for mirror in mirrors %}
- <tr>
- <td>
- [{{ mirror.country_code }}]
- </td>
- <td>
- <a href="/mirror/{{ mirror.hostname }}">
- {{ mirror.hostname }}
- </a>
- </td>
- <td>
- {{ mirror.owner or _("N/A") }}
- </td>
- <td>
- {{ mirror.check_status }}
- </td>
- <td>
- {% if mirror.last_check %}
- {{ format_date(mirror.last_check, relative=True) }}
- {% else %}
- {{ _("Unknown") }}
- {% end %}
- </td>
- </tr>
- {% end %}
- </tbody>
- </table>
- {% else %}
- <div class="alert alert-block">
- <h4 class="alert-heading">{{ _("No mirrors") }}</h4>
- {{ _("There are no mirrors configured, yet.") }}
- </div>
- {% end %}
- </div>
- </div>
+ {% if mirrors %}
+ <table class="table table-striped table-hover">
+ <thead>
+ <tr>
+ <th>{{ _("Hostname") }} / {{ _("Owner") }}</th>
+ <th></th>
+ <th>{{ _("Last check") }}</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for mirror in mirrors %}
+ <tr>
+ <td>
+ <a href="/mirror/{{ mirror.hostname }}">
+ {{ mirror.hostname }}
+ </a>
+ <p class="muted">
+ {{ mirror.owner or _("N/A") }}
+ </p>
+ </td>
+ <td>
+ [{{ mirror.country_code }}] -
- {% if current_user and current_user.has_perm("manage_mirrors") %}
- <div class="row">
- <div class="span12">
- <a class="btn pull-right" href="/mirror/new">
- <i class="icon-star"></i>
- {{ _("Add new mirror") }}
- </a>
- </div>
- </div>
+ {% if mirror.check_status == "UP" %}
+ <span class="text-success">
+ {{ _("Up") }}
+ </span>
+ {% elif mirror.check_status == "DOWN" %}
+ <span class="text-error">
+ {{ _("Down") }}
+ </span>
+ {% else %}
+ <span class="muted">
+ {{ _("Unknown") }}
+ </span>
+ {% end %}
+ </td>
+
+ <td>
+ {% if mirror.last_check %}
+ {{ format_date(mirror.last_check, relative=True) }}
+ {% else %}
+ {{ _("N/A") }}
+ {% end %}
+ </td>
+ </tr>
+ {% end %}
+ </tbody>
+ </table>
+ {% else %}
+ <p class="muted">
+ {{ _("There are no mirrors configured, yet.") }}
+ </p>
{% end %}
- <div class="row">
- <div class="span12">
- <h2>{{ _("Log") }}</h2>
- {% module Log(log) %}
- </div>
- </div>
+ {% if log %}
+ <h2>{{ _("Log") }}</h2>
+ {% module Log(log) %}
+ {% end %}
{% end block %}
{% extends "base.html" %}
-{% block title %}{{ _("Create new mirror") }}{% end block %}
+{% block title %}{{ _("Add new mirror") }}{% end block %}
{% block body %}
<ul class="breadcrumb">
</ul>
<div class="page-header">
- <h1>
- {{ _("Create a new mirror") }}
- </h1>
+ <h2>{{ _("Add a new mirror") }}</h2>
</div>
- <div class="row">
- <div class="span6 offset3">
- <form class="form-horizontal" method="POST" action="">
- {% raw xsrf_form_html() %}
- <fieldset>
- <div class="control-group {% if hostname_missing %}error{% end %}">
- <label class="control-label" for="name">{{ _("Hostname") }}</label>
- <div class="controls">
- <input type="text" class="input-xlarge" id="name" name="name" value="{{ _hostname }}">
-
- <p class="help-block">
- {{ _("Enter the canonical hostname of the mirror.") }}
- </p>
- </div>
- </div>
-
- <div class="control-group {% if path_invalid %}error{% end %}">
- <label class="control-label" for="name">{{ _("Path") }}</label>
- <div class="controls">
- <input type="text" class="input-xlarge" id="path" name="path" value="{{ path }}">
-
- <p class="help-block">
- {{ _("The path to the files on the server.") }}
- </p>
- </div>
- </div>
-
- <div class="form-actions">
- <button type="submit" class="btn btn-primary">{{ _("Create new mirror") }}</button>
- </div>
- </fieldset>
- </form>
- </div>
- </div>
+ <form class="form-horizontal" method="POST" action="">
+ {% raw xsrf_form_html() %}
+ <fieldset>
+ <div class="control-group {% if hostname_missing %}error{% end %}">
+ <label class="control-label" for="name">{{ _("Hostname") }}</label>
+ <div class="controls">
+ <input type="text" class="input-xlarge" id="name" name="name"
+ {% if _hostname %}value="{{ _hostname }}"{% end %}>
+
+ <p class="help-block">
+ {{ _("Enter the canonical hostname of the mirror.") }}
+ </p>
+ </div>
+ </div>
+
+ <div class="control-group {% if path_invalid %}error{% end %}">
+ <label class="control-label" for="name">{{ _("Path") }}</label>
+ <div class="controls">
+ <input type="text" class="input-xlarge" id="path" name="path"
+ {% if path %}value="{{ path }}"{% end %}>
+
+ <p class="help-block">
+ {{ _("The path to the files on the server.") }}
+ </p>
+ </div>
+ </div>
+
+ <div class="form-actions">
+ <button type="submit" class="btn btn-primary">{{ _("Create new mirror") }}</button>
+ </div>
+ </fieldset>
+ </form>
{% end block %}
}
# Get recent log messages.
- kwargs["log"] = self.pakfire.mirrors.get_history(limit=10)
+ kwargs["log"] = self.pakfire.mirrors.get_history(limit=5)
self.render("mirrors-list.html", **kwargs)
if not mirror:
raise tornado.web.HTTPError(404, "Could not find mirror: %s" % hostname)
- self.render("mirrors-detail.html", mirror=mirror)
+ log = self.pakfire.mirrors.get_history(mirror=mirror, limit=10)
+
+ self.render("mirrors-detail.html", mirror=mirror, log=log)
class MirrorActionHandler(BaseHandler):
})
return self.get(**errors)
- print hostname, path
-
mirror = backend.mirrors.Mirror.create(self.pakfire, hostname, path,
user=self.current_user)
assert mirror
enabled = self.get_argument("enabled", None)
if enabled:
- mirror.set_status("enabled")
+ mirror.set_status("enabled", user=self.current_user)
else:
- mirror.set_status("disabled")
+ mirror.set_status("disabled", user=self.current_user)
mirror.hostname = hostname
mirror.path = path