136 lines
3.9 KiB
HTML
136 lines
3.9 KiB
HTML
{% extends "base_logged.html" %}
|
|
{% block page %}
|
|
<div id="page-wrapper">
|
|
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
<h1>Module <small>Roles</small></h1>
|
|
<ol class="breadcrumb">
|
|
<li><a href="{{ url_for('index') }}"><i class="fa fa-dashboard"></i> SaltPad</a></li>
|
|
<li class="active"><i class="fa fa-check-square"></i> Role {{rjson["name"]}}</li>
|
|
</ol>
|
|
</div>
|
|
</div><!-- /.row -->
|
|
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
<h2>Maintainers</h2>
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered table-hover tablesorter" id="maintainers">
|
|
<thead>
|
|
<tr>
|
|
<th>Maintainer</th>
|
|
{% if is_mnt %}
|
|
<th>Remove</th>
|
|
{% endif %}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for maintainer in rjson["maintainer"] %}
|
|
<tr>
|
|
<td>{{ maintainer }}</td>
|
|
<td>
|
|
{% if is_mnt %}
|
|
<button type="button" onclick="remRoleMaintainer('{{ maintainer }}');" class="btn btn-default">remove {{ maintainer }}</button>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div>
|
|
{% if is_mnt%}
|
|
<input type="text" name="maintainer" id="maintainer_add"/>
|
|
<button type="button" onclick="addMaintainer();" class="btn btn-default">add maintainer</button>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-12">
|
|
<h2>Servers</h2>
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered table-hover tablesorter" id="servers">
|
|
<thead>
|
|
<tr>
|
|
<th>Server</th>
|
|
{% if is_mnt %}
|
|
<th>Remove</th>
|
|
{% endif %}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for server in rjson["servers"] %}
|
|
<tr>
|
|
<td><a href="{{ url_for('server_display',server=server) }}">{{ server }}</a></td>
|
|
<td>
|
|
{% if is_mnt %}
|
|
<button type="button" onclick="remServerRole('{{ server }}');" class="btn btn-default">remove {{ server }}</button>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div>
|
|
{% if is_mnt %}
|
|
<select id="cmb_add_server">
|
|
{% for server in aservers %}
|
|
<option value="{{ server }}">{{ server }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
<button type="button" onclick="addServerRole();" class="btn btn-default">add server</button>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
{% for category in rjson %}
|
|
{% if category != "maintainer" and category != "servers" and category != "name" %}
|
|
<div class="col-lg-12">
|
|
<h2>{{ category }}</h2>
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered table-hover tablesorter" id="servers">
|
|
<thead>
|
|
<tr>
|
|
<th>{{ category }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr><td>
|
|
<pre>{% for line in rjson[category] %}
|
|
{{ line }}{% endfor %}</pre>
|
|
</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div>
|
|
<a href="{{ url_for(category,role=rjson["name"]) }}">{% if is_mnt %}Edit{% else %}View{% endif %} {{ category }}</a>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
|
|
</div>
|
|
</div><!-- /.row -->
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
<script type="text/javascript">
|
|
var roles = [];
|
|
{% for role in roles %}
|
|
roles.push('{{rjson["role"]}}');
|
|
{% endfor %}
|
|
function addServerRole(){
|
|
var txt = document.getElementById("cmb_add_role").value;
|
|
window.location = "{{ url_for('role_add_server',role=role,server="")}}"+txt;
|
|
}
|
|
function remServerRole(server){
|
|
window.location = "{{ url_for('role_rem_server',role=role,server="")}}"+server;
|
|
}
|
|
function addServerRole(){
|
|
var txt = document.getElementById("cmb_add_role").value;
|
|
window.location = "{{ url_for('role_add_server',role=role,server="")}}"+txt;
|
|
}
|
|
</script>
|
|
{% endblock %}
|