agaric-coop/box/provisioning/templates/dashboard.html.j2

393 lines
14 KiB
Text
Raw Permalink Normal View History

<!DOCTYPE html>
<head>
<title>Drupal VM</title>
<meta charset="utf-8">
<link rel="shortcut icon" href="//cdn.rawgit.com/geerlingguy/drupalvm.github.io/master/favicon.ico" type="image/vnd.microsoft.icon" />
<style>
.section-host {
font-family: monospace;
list-style-type: none;
padding: 0;
margin: 0;
}
/* minor fallback styling for when loaded without an internet connection */
.panel, .jumbotron, .well {
margin-bottom: 20px;
}
td, th {
padding: 8px;
}
</style>
</head>
<body>
{# Sets vagrant IP if equals 0.0.0.0 #}
{%- if vagrant_ip == '0.0.0.0' -%}
{%- set vagrant_ip = ansible_all_ipv4_addresses[1] -%}
{%- endif -%}
{# Returns the hosts server name based on the document root #}
{%- macro getServernameFromDocroot(path) -%}
{%- if drupalvm_webserver == 'apache' -%}
{%- for host in apache_vhosts -%}
{%- if host.documentroot == path -%}
{{ host.servername }}
{%- endif -%}
{%- endfor -%}
{%- elif drupalvm_webserver == 'nginx' -%}
{%- for host in nginx_vhosts -%}
{%- if host.root == path -%}
{{ host.server_name }}
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{%- endmacro -%}
{%- macro printSite(servername, docroot) -%}
{%- if docroot not in _devtool_docroots -%}
<tr>
<td><a href="http://{{ servername }}">{{ servername }}</a></td>
<td><code>{{ docroot }}</code></td>
{% if configure_drush_aliases %}
<td><code>drush @{{ vagrant_machine_name }}.{{ servername }}</code></td>
{% endif %}
</tr>
{% endif %}
{%- endmacro %}
{%- macro printHostsEntry(ip, servername) -%}
{%- if servername != ip -%}
<li>{{ ip }} {{ servername }}</li>
{%- endif -%}
{%- endmacro %}
{%- macro sectionHost() -%}
<ul class="section-host">
{% if drupalvm_webserver == 'apache' -%}
{%- for host in apache_vhosts -%}
{{ printHostsEntry(vagrant_ip, host.servername) }}
{% if host.serveralias is defined -%}
{%- for alias in host.serveralias.split() -%}
{{ printHostsEntry(vagrant_ip, alias) }}
{%- endfor -%}
{%- endif %}
{%- endfor -%}
{%- elif drupalvm_webserver == 'nginx' -%}
{%- for host in nginx_vhosts -%}
{% for server_name in host.server_name.split(' ') -%}
{{ printHostsEntry(vagrant_ip, server_name) }}
{%- endfor %}
{% if host.server_name_redirect is defined -%}
{%- for server_name in host.server_name_redirect.split(' ') -%}
{{ printHostsEntry(vagrant_ip, server_name) }}
{%- endfor -%}
{%- endif %}
{%- endfor -%}
{%- endif %}
</ul>
{%- endmacro -%}
{%- macro sectionSiteList() -%}
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Hostname</th>
<th>Document Root</th>
{% if configure_drush_aliases -%}
<th>Drush alias*</th>
{%- endif %}
</tr>
</thead>
<tbody>
{% if drupalvm_webserver == 'apache' -%}
{%- for host in apache_vhosts -%}
{%- if host.documentroot is defined -%}
{{ printSite(host.servername, host.documentroot) }}
{%- endif -%}
{%- endfor -%}
{%- elif drupalvm_webserver == 'nginx' -%}
{%- for host in nginx_vhosts -%}
{%- if host.root is defined -%}
{%- for hostname in host.server_name.split() -%}
{{ printSite(hostname, host.root) }}
{%- endfor -%}
{%- endif -%}
{%- endfor -%}
{%- endif %}
<tr><td colspan=3><small>*Note: If Ansible isn't installed on your host, Drush aliases are only created inside the VM.</small></td></tr>
</tbody>
</table>
</div>
{%- endmacro -%}
{%- macro sectionDevelopmentTools() -%}
<div class="table-responsive">
<table class="table">
{% if not installed_extras -%}
<tr>
<td>There are no development tools installed inside the VM.</td>
</tr>
{%- endif -%}
{% if 'adminer' in installed_extras -%}
{% macro servername() %}{{ getServernameFromDocroot(adminer_install_dir) }}/{{ adminer_install_filename }}{% endmacro %}
{%- if servername() != "/{{ adminer_install_filename }}" -%}
<tr>
<th>Adminer</th>
<td><a href="http://{{ servername() }}">{{ servername() }}</a>
</br>
<a href="http://{{ servername() }}" class="btn btn-success btn-xs" role="button">Open</a>
<a href="http://docs.drupalvm.com/en/latest/extras/mysql/#connect-using-adminer" target="_blank" class="btn btn-info btn-xs" role="button">Documentation</a>
</td>
</tr>
{%- endif -%}
{%- endif %}
{% if 'mailhog' in installed_extras -%}
{% macro servername() %}{{ vagrant_hostname }}:8025{% endmacro %}
{%- if servername() != ":8025" -%}
<tr>
<th>MailHog</th>
<td><a href="http://{{ servername() }}">{{ servername() }}</a>
</br>
<a href="http://{{ servername() }}" class="btn btn-success btn-xs" role="button">Open</a>
<a href="http://docs.drupalvm.com/en/latest/extras/mailhog/" target="_blank" class="btn btn-info btn-xs" role="button">Documentation</a>
</td>
</tr>
{%- endif -%}
{%- endif %}
{% if 'pimpmylog' in installed_extras -%}
{% macro servername() %}{{ getServernameFromDocroot(pimpmylog_install_dir) }}{% endmacro %}
{%- if servername() -%}
<tr>
<th>PimpMyLog</th>
<td><a href="http://{{ servername() }}">{{ servername() }}</a>
</br>
<a href="http://{{ servername() }}" class="btn btn-success btn-xs" role="button">Open</a>
<a href="http://docs.drupalvm.com/en/latest/extras/pimpmylog/" target="_blank" class="btn btn-info btn-xs" role="button">Documentation</a>
</td>
</tr>
{%- endif -%}
{%- endif %}
{% if 'solr' in installed_extras -%}
{% macro servername() %}{{ vagrant_hostname }}:{{ solr_port }}/solr/{% endmacro %}
<tr>
<th>Solr</th>
<td><a href="http://{{ servername() }}">{{ servername() }}</a>
</br>
<a href="http://{{ servername() }}" class="btn btn-success btn-xs" role="button">Open</a>
<a href="http://docs.drupalvm.com/en/latest/extras/solr/" target="_blank" class="btn btn-info btn-xs" role="button">Documentation</a>
</td>
</tr>
{%- endif %}
{% if 'xhprof' in installed_extras -%}
{% macro servername() %}{{ getServernameFromDocroot(php_xhprof_html_dir) }}{% endmacro %}
{%- if servername() -%}
<tr>
<th>XHProf</th>
<td><a href="http://{{ servername() }}">{{ servername() }}</a>
</br>
<a href="http://{{ servername() }}" class="btn btn-success btn-xs" role="button">Open</a>
<a href="http://docs.drupalvm.com/en/latest/extras/xhprof/" target="_blank" class="btn btn-info btn-xs" role="button">Documentation</a>
</td>
</tr>
{%- endif -%}
{%- endif %}
</table>
</div>
{%- endmacro -%}
{%- macro sectionPhpInformation() -%}
<div class="table-responsive">
<table class="table">
<tr>
<th>PHP Version</th>
<td><code>{{ php_version }}</code></td>
</tr>
<tr>
<th>Webserver</th>
<td><code>{{ drupalvm_webserver|capitalize }}</code></td>
</tr>
<tr>
<th>Memory limit</th>
<td><code>{{ php_memory_limit }}</code></td>
</tr>
<tr>
<th>PHP-FPM enabled</th>
<td><code>{{ 'yes' if php_enable_php_fpm else 'no' }}</code></td>
</tr>
<tr><td colspan=2><small><a href="/server-info.php">View more details in the server's phpinfo() report</a>.</small></td></tr>
</table>
</div>
{%- endmacro -%}
{%- macro sectionDatabaseConnection() -%}
<div class="table-responsive">
<table class="table">
<tr>
<th>MySQL Hostname</th>
<td><code>127.0.0.1</code></td>
</tr>
<tr>
<th>MySQL Port</th>
<td><code>{{ mysql_port }}</code></td>
</tr>
<tr>
<th>MySQL Username</th>
<td><code>{{ mysql_root_username }}</code></td>
</tr>
<tr>
<th>MySQL Password</th>
<td><code>{{ mysql_root_password }}</code></td>
</tr>
<tr>
<th>SSH Hostname</th>
<td><code>{{ vagrant_ip }}</code></td>
</tr>
<tr>
<th>SSH Username</th>
<td><code>{{ vagrant_user }}</code></td>
</tr>
<tr>
<th>SSH Private Key</th>
<td><code>~/.vagrant.d/insecure_private_key</code></td>
</tr>
</table>
</div>
{%- endmacro -%}
{%- macro sectionDatabaseList() -%}
<div class="table-responsive">
<table class="table table-striped table-hover">
<tbody>
{% for database in mysql_databases -%}
{% if 'adminer' in installed_extras -%}
<tr>
<td>
<a href="http://{{ getServernameFromDocroot(adminer_install_dir) }}/{{ adminer_install_filename }}?username={{ mysql_root_username }}&db={{ database.name }}" class="btn btn-success btn-xs" role="button">{{ database.name }}</a>
</td>
</tr>
{% else -%}
<tr>
<td>{{ database.name }}</td>
</tr>
{%- endif %}
{%- endfor %}
</tbody>
</table>
</div>
{%- endmacro -%}
{%- macro SectionDatabaseListLabel() -%}
{% if 'adminer' in installed_extras -%}
Databases using Adminer
{% else -%}
Databases
{%- endif %}
{%- endmacro -%}
{%- macro sectionDatabaseUserList() -%}
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Username</th>
<th>Password</th>
</tr>
</thead>
<tbody>
{% for user in mysql_users -%}
<tr>
<td><code>{{ user.name }}</code></td>
<td><code>{{ user.password }}</code></td>
</tr>
{%- endfor %}
</tbody>
</table>
</div>
{%- endmacro -%}
<div class="container">
<div class="row">
<div class="col-md-12">
<section class="jumbotron text-center">
<a href="https://www.drupalvm.com/"><img src="http://docs.drupalvm.com/en/latest/images/drupal-vm-logo.png" alt="Drupal VM" title="Welcome to Drupal VM" class="img-responsive center-block"></a>
<p><a href="https://github.com/geerlingguy/drupal-vm">Drupal VM</a> is a VM for local Drupal development, built with Vagrant + Ansible.</p>
<p><a class="btn btn-primary btn-lg" href="http://docs.drupalvm.com/en/latest/" role="button">Read the documentation</a></p>
</section>
</div>
</div>
<div class="row">
<div class="col-md-9">
<section class="panel panel-default">
<div class="panel-heading">Your sites</div>
<div class="panel-body">
{{ sectionSiteList() }}
</div>
</section>
</div>
<div class="col-md-3">
<section class="panel panel-default">
<div class="panel-heading"> {{ SectionDatabaseListLabel() }}</div>
<div class="panel-body">
{{ sectionDatabaseList() }}
{{ sectionDatabaseUserList() }}
</div>
</section>
</div>
</div>
<div class="row">
<div class="col-md-3">
<section class="panel panel-default">
<div class="panel-heading">PHP information</div>
<div class="panel-body">
{{ sectionPhpInformation() }}
</div>
</section>
</div>
<div class="col-md-6">
<section class="panel panel-default">
<div class="panel-heading">MySQL connection information</div>
<div class="panel-body">
{{ sectionDatabaseConnection() }}
</div>
</section>
</div>
<div class="col-md-3">
<section class="panel panel-default">
<div class="panel-heading">Development tools</div>
<div class="panel-body">
{{ sectionDevelopmentTools() }}
</div>
</section>
</div>
</div>
<div class="row">
<div class="col-md-12">
<section class="panel panel-default">
<div class="panel-heading">/etc/hosts</div>
<div class="panel-body">
<section class="well small">
{{ sectionHost() }}
</section>
<small>Unless you're using the <a href="https://github.com/cogitatio/vagrant-hostsupdater" target="_blank">vagrant-hostsupdater</a> or <a href="https://github.com/smdahlen/vagrant-hostmanager" target="_blank">vagrant-hostmanager</a> plugin, add the lines above to your host machine's hosts file.</small>
</div>
</section>
</div>
</div>
</div>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
</body>
</html>