mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-09 15:10:27 +00:00
Completed first-found updates for the account creation view.
This commit is contained in:
parent
8c6fc5e262
commit
0e67366c5f
@ -1,211 +1,247 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% set active_page = "admin_accounts" %}
|
{% set active_page = "admin_accounts" %}
|
||||||
|
{% if create %}
|
||||||
{% block title %}
|
{% set action_label = 'Create' %}
|
||||||
<title>
|
{% set form_action = url_for('admin.edit_account') %}
|
||||||
Edit Account - {{ SITE_NAME }}
|
{% else %}
|
||||||
</title>
|
{% set action_label = 'Edit' %}
|
||||||
{% endblock %}
|
{% set form_action = url_for('admin.edit_account', account_name=account.name) %}
|
||||||
|
{% endif %}
|
||||||
|
{% block title %}<title>{{ action_label }} Account - {{ SITE_NAME }}</title>{% endblock %}
|
||||||
|
|
||||||
{% block dashboard_stat %}
|
{% block dashboard_stat %}
|
||||||
<div class="content-header">
|
<div class="content-header">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row mb-2">
|
<div class="row mb-2">
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<h1 class="m-0 text-dark">
|
<h1 class="m-0 text-dark">{{ action_label }} Account</h1>
|
||||||
{% if create %}Add Account{% else %}Edit Account{% endif %}
|
</div>
|
||||||
<small>{% if create %}Account{% else %}{{ account.name }}{% endif %}</small>
|
<div class="col-sm-6">
|
||||||
</h1>
|
<ol class="breadcrumb float-sm-right">
|
||||||
|
<li class="breadcrumb-item"><a href="{{ url_for('dashboard.dashboard') }}">Home</a></li>
|
||||||
|
<li class="breadcrumb-item"><a href="{{ url_for('admin.manage_account') }}">Accounts</a></li>
|
||||||
|
<li class="breadcrumb-item active">{{ action_label }} Account</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
|
||||||
<ol class="breadcrumb float-sm-right">
|
|
||||||
<li class="breadcrumb-item"><a href="{{ url_for('dashboard.dashboard') }}">Home</a></li>
|
|
||||||
<li class="breadcrumb-item"><a href="{{ url_for('admin.manage_account') }}">Accounts</a></li>
|
|
||||||
<li class="breadcrumb-item active">{% if create %}Add Account{% else %}Edit Account: {{ account.name }}{% endif %}</li>
|
|
||||||
</ol>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<section class="content">
|
<section class="content">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">
|
<div class="col-12 col-sm-6 col-lg-4">
|
||||||
<div class="card">
|
<form role="form" method="post" action="{{ form_action }}">
|
||||||
<div class="card-header">
|
<input type="hidden" name="_csrf_token" value="{{ csrf_token() }}">
|
||||||
<h3 class="card-title">{% if create %}Add{% else %}Edit{% endif %} Account</h3>
|
<input type="hidden" name="create" value="{{ create }}">
|
||||||
</div>
|
<div class="card card-outline card-primary shadow">
|
||||||
<form role="form" method="post" action="{% if create %}{{ url_for('admin.edit_account') }}{% else %}{{ url_for('admin.edit_account', account_name=account.name) }}{% endif %}">
|
<div class="card-header">
|
||||||
<input type="hidden" name="_csrf_token" value="{{ csrf_token() }}">
|
<h3 class="card-title">Account Editor</h3>
|
||||||
<input type="hidden" name="create" value="{{ create }}">
|
</div>
|
||||||
<div class="card-body">
|
<!-- /.card-header -->
|
||||||
{% if error %}
|
<div class="card-body">
|
||||||
<div class="alert alert-danger alert-dismissible">
|
{% if error %}
|
||||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
<div class="alert alert-danger alert-dismissible">
|
||||||
<h4><i class="fa-solid fa-ban"></i> Error!</h4>
|
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">
|
||||||
{{ error }}
|
×
|
||||||
</div>
|
</button>
|
||||||
<span class="help-block">{{ error }}</span>
|
<h4><i class="fa-solid fa-ban"></i> Error!</h4>
|
||||||
{% endif %}
|
{{ error }}
|
||||||
<div class="form-group has-feedback {% if invalid_accountname or duplicate_accountname %}has-error{% endif %}">
|
</div>
|
||||||
<label class="control-label" for="accountname">Name</label>
|
<span class="help-block">{{ error }}</span>
|
||||||
<input type="text" class="form-control" placeholder="Account Name (required)"
|
{% endif %}
|
||||||
name="accountname" {% if account %}value="{{ account.name }}" {% endif %}
|
<div
|
||||||
{% if not create %}disabled{% endif %} required>
|
class="form-group has-feedback {% if invalid_accountname or duplicate_accountname %}has-error{% endif %}">
|
||||||
<span class="form-control-feedback"></span>
|
<label class="control-label" for="accountname">Name</label>
|
||||||
{% if invalid_accountname %}
|
<input type="text" class="form-control" placeholder="Account Name (required)"
|
||||||
<span class="help-block text-danger">Cannot be blank and must only contain alphanumeric
|
name="accountname" id="accountname"
|
||||||
|
{% if account %}value="{{ account.name }}" {% endif %}
|
||||||
|
{% if not create %}disabled{% endif %} required>
|
||||||
|
<span class="form-control-feedback"></span>
|
||||||
|
{% if invalid_accountname %}
|
||||||
|
<span class="help-block text-danger">Cannot be blank and must only contain alphanumeric
|
||||||
characters{% if SETTING.get('account_name_extra_chars') %}, dots, hyphens or underscores{% endif %}.
|
characters{% if SETTING.get('account_name_extra_chars') %}, dots, hyphens or underscores{% endif %}.
|
||||||
</span>
|
</span>
|
||||||
{% elif duplicate_accountname %}
|
{% elif duplicate_accountname %}
|
||||||
<span class="help-block text-danger">Account name already in use.</span>
|
<span class="help-block text-danger">Account name already in use.</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group has-feedback">
|
<div class="form-group has-feedback">
|
||||||
<label class="control-label" for="accountdescription">Description</label>
|
<label class="control-label" for="accountdescription">Description</label>
|
||||||
<input type="text" class="form-control" placeholder="Account Description (optional)"
|
<input type="text" class="form-control" placeholder="Account Description (optional)"
|
||||||
name="accountdescription" {% if account %}value="{{ account.description }}" {% endif %}>
|
name="accountdescription" id="accountdescription"
|
||||||
<span class="orm-control-feedback"></span>
|
{% if account %}value="{{ account.description }}" {% endif %}>
|
||||||
</div>
|
<span class="orm-control-feedback"></span>
|
||||||
<div class="form-group has-feedback">
|
</div>
|
||||||
<label class="control-label" for="accountcontact">Contact Person</label>
|
<div class="form-group has-feedback">
|
||||||
<input type="text" class="form-control" placeholder="Contact Person (optional)"
|
<label class="control-label" for="accountcontact">Contact Person</label>
|
||||||
name="accountcontact" {% if account %}value="{{ account.contact }}" {% endif %}>
|
<input type="text" class="form-control" placeholder="Contact Person (optional)"
|
||||||
<span class="form-control-feedback"></span>
|
name="accountcontact" id="accountcontact"
|
||||||
</div>
|
{% if account %}value="{{ account.contact }}" {% endif %}>
|
||||||
<div class="form-group has-feedback">
|
<span class="form-control-feedback"></span>
|
||||||
<label class="control-label" for="accountmail">Mail Address</label>
|
</div>
|
||||||
<input type="email" class="form-control" placeholder="Mail Address (optional)"
|
<div class="form-group has-feedback">
|
||||||
name="accountmail" {% if account %}value="{{ account.mail }}" {% endif %}>
|
<label class="control-label" for="accountmail">Mail Address</label>
|
||||||
<span class="form-control-feedback"></span>
|
<input type="email" class="form-control" placeholder="Mail Address (optional)"
|
||||||
</div>
|
name="accountmail" id="accountmail"
|
||||||
|
{% if account %}value="{{ account.mail }}" {% endif %}>
|
||||||
|
<span class="form-control-feedback"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /.card-body -->
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title">Access Control</h3>
|
||||||
|
</div>
|
||||||
|
<!-- /.card-header -->
|
||||||
|
<div class="card-body">
|
||||||
|
<p>Users on the right have access to manage records in all domains
|
||||||
|
associated with the account.
|
||||||
|
</p>
|
||||||
|
<p>Click on users to move between columns.</p>
|
||||||
|
<div class="form-group col-2">
|
||||||
|
<select multiple="multiple" class="form-control" id="account_multi_user"
|
||||||
|
name="account_multi_user">
|
||||||
|
{% for user in users %}
|
||||||
|
<option {% if user.id in account_user_ids|default([]) %}selected{% endif %}
|
||||||
|
value="{{ user.username }}">{{ user.username }}
|
||||||
|
</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /.card-body -->
|
||||||
|
<div class="card-body">
|
||||||
|
<p>Domains on the right are associated with the account. Red marked domain names are
|
||||||
|
already associated with other accounts.
|
||||||
|
Moving already associated domains to this account will overwrite the previous
|
||||||
|
associated account.
|
||||||
|
</p>
|
||||||
|
<p>Hover over the red domain names to show the associated account. Click on domains to
|
||||||
|
move between columns.</p>
|
||||||
|
<div class="form-group col-2">
|
||||||
|
<select multiple="multiple" class="form-control" id="account_domains"
|
||||||
|
name="account_domains">
|
||||||
|
{% for domain in domains %}
|
||||||
|
{% if account != None and domain.account_id != None and account.id != domain.account_id %}
|
||||||
|
{% with account_id=domain.account_id %}
|
||||||
|
<option style="color: red" data-toggle="tooltip"
|
||||||
|
title="Associated with: {{ accounts[account_id].name }}"
|
||||||
|
value="{{ domain.name }}">
|
||||||
|
{{ domain.name }}
|
||||||
|
</option>
|
||||||
|
{% endwith %}
|
||||||
|
{% else %}
|
||||||
|
<option {% if account.id == domain.account_id %}selected{% endif %}
|
||||||
|
value="{{ domain.name }}">
|
||||||
|
{{ domain.name }}
|
||||||
|
</option>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /.card-body -->
|
||||||
|
<div class="card-footer">
|
||||||
|
<button type="button" class="btn btn-secondary float-left" title="Cancel"
|
||||||
|
onclick="window.location.href='{{ url_for('admin.manage_account') }}'">
|
||||||
|
Cancel
|
||||||
|
</button>
|
||||||
|
<button type="submit" class="btn btn-primary float-right"
|
||||||
|
title="{{ action_label }} Account">
|
||||||
|
{{ action_label }} Account
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<!-- /.card-footer -->
|
||||||
|
</div>
|
||||||
|
<!-- /.card -->
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<!-- /.col -->
|
||||||
|
|
||||||
|
<div class="col-12 col-sm-6 col-lg-8">
|
||||||
|
<div class="card card-outline card-secondary shadow">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title">Account Editor Help</h3>
|
||||||
|
</div>
|
||||||
|
<!-- /.card-header -->
|
||||||
|
<div class="card-body">
|
||||||
|
<p>
|
||||||
|
An account allows grouping of domains belonging to a particular entity, such as a
|
||||||
|
customer or
|
||||||
|
department.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
A domain can be assigned to an account upon domain creation or through the domain
|
||||||
|
administration
|
||||||
|
page.
|
||||||
|
</p>
|
||||||
|
<p>Fill in all the fields to the in the form to the left.</p>
|
||||||
|
<p>
|
||||||
|
<strong>Name</strong> is an account identifier. It will be lowercase and can contain
|
||||||
|
alphanumeric
|
||||||
|
characters{% if SETTING.get('account_name_extra_chars') %}, dots, hyphens and
|
||||||
|
underscores (no space or other special character is allowed)
|
||||||
|
{% else %} (no extra character is allowed){% endif %}.<br/>
|
||||||
|
<strong>Description</strong> is a user-friendly name for this account.<br/>
|
||||||
|
<strong>Contact person</strong> is the name of a contact person at the account.<br/>
|
||||||
|
<strong>Mail Address</strong> is an e-mail address for the contact person.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<!-- /.card-body -->
|
||||||
|
</div>
|
||||||
|
<!-- /.card -->
|
||||||
|
</div>
|
||||||
|
<!-- /.col -->
|
||||||
</div>
|
</div>
|
||||||
<div class="card-header">
|
<!-- /.row -->
|
||||||
<h3 class="card-title">Access Control</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<p>Users on the right have access to manage records in all domains
|
|
||||||
associated with the account.
|
|
||||||
</p>
|
|
||||||
<p>Click on users to move between columns.</p>
|
|
||||||
<div class="form-group col-2">
|
|
||||||
<select multiple="multiple" class="form-control" id="account_multi_user"
|
|
||||||
name="account_multi_user">
|
|
||||||
{% for user in users %}
|
|
||||||
<option {% if user.id in account_user_ids|default([]) %}selected{% endif %}
|
|
||||||
value="{{ user.username }}">{{ user.username }}
|
|
||||||
</option>
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<p>Domains on the right are associated with the account. Red marked domain names are already associated with other accounts.
|
|
||||||
Moving already associated domains to this account will overwrite the previous associated account.
|
|
||||||
</p>
|
|
||||||
<p>Hover over the red domain names to show the associated account. Click on domains to move between columns.</p>
|
|
||||||
<div class="form-group col-2">
|
|
||||||
<select multiple="multiple" class="form-control" id="account_domains" name="account_domains">
|
|
||||||
{% for domain in domains %}
|
|
||||||
{% if account != None and domain.account_id != None and account.id != domain.account_id %}
|
|
||||||
{% with account_id=domain.account_id %}
|
|
||||||
<option style="color: red" data-toggle="tooltip" title="Associated with: {{ accounts[account_id].name }}" value="{{ domain.name }}">
|
|
||||||
{{ domain.name }}
|
|
||||||
</option>
|
|
||||||
{% endwith %}
|
|
||||||
{% else %}
|
|
||||||
<option {% if account.id == domain.account_id %}selected{% endif %} value="{{ domain.name }}">
|
|
||||||
{{ domain.name }}
|
|
||||||
</option>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-footer">
|
|
||||||
<button type="button" class="btn btn-secondary float-left" onclick="window.location.href='{{ url_for('admin.manage_account') }}'">
|
|
||||||
Cancel
|
|
||||||
</button>
|
|
||||||
<button type="submit" class="btn btn-primary float-right">
|
|
||||||
{% if create %}Create{% else %}Update{% endif %} Account
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<!-- /.container-fluid -->
|
||||||
<div class="col-8">
|
</section>
|
||||||
<div class="card">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title">Help with creating a new account</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<p>
|
|
||||||
An account allows grouping of domains belonging to a particular entity, such as a customer or
|
|
||||||
department.
|
|
||||||
<br />
|
|
||||||
A domain can be assigned to an account upon domain creation or through the domain administration
|
|
||||||
page.
|
|
||||||
</p>
|
|
||||||
<p>Fill in all the fields to the in the form to the left.</p>
|
|
||||||
<p>
|
|
||||||
<strong>Name</strong> is an account identifier. It will be lowercased and can contain alphanumeric
|
|
||||||
characters{% if SETTING.get('account_name_extra_chars') %}, dots, hyphens and underscores (no space or other special character is allowed)
|
|
||||||
{% else %} (no extra character is allowed){% endif %}.<br />
|
|
||||||
<strong>Description</strong> is a user friendly name for this account.<br />
|
|
||||||
<strong>Contact person</strong> is the name of a contact person at the account.<br />
|
|
||||||
<strong>Mail Address</strong> is an e-mail address for the contact person.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block extrascripts %}
|
{% block extrascripts %}
|
||||||
<script>
|
<script>
|
||||||
function addMultiSelect(id, placeholder) {
|
function addMultiSelect(id, placeholder) {
|
||||||
$(id).multiSelect({
|
$(id).multiSelect({
|
||||||
selectableHeader: `<input type='text' class='search-input' autocomplete='off' placeholder='${placeholder}'>`,
|
selectableHeader: `<input type='text' class='search-input' autocomplete='off' placeholder='${placeholder}'>`,
|
||||||
selectionHeader: `<input type='text' class='search-input' autocomplete='off' placeholder='${placeholder}'>`,
|
selectionHeader: `<input type='text' class='search-input' autocomplete='off' placeholder='${placeholder}'>`,
|
||||||
afterInit: function (ms) {
|
afterInit: function (ms) {
|
||||||
var that = this,
|
var that = this,
|
||||||
$selectableSearch = that.$selectableUl.prev(),
|
$selectableSearch = that.$selectableUl.prev(),
|
||||||
$selectionSearch = that.$selectionUl.prev(),
|
$selectionSearch = that.$selectionUl.prev(),
|
||||||
selectableSearchString = '#' + that.$container.attr('id') + ' .ms-elem-selectable:not(.ms-selected)',
|
selectableSearchString = '#' + that.$container.attr('id') + ' .ms-elem-selectable:not(.ms-selected)',
|
||||||
selectionSearchString = '#' + that.$container.attr('id') + ' .ms-elem-selection.ms-selected';
|
selectionSearchString = '#' + that.$container.attr('id') + ' .ms-elem-selection.ms-selected';
|
||||||
|
|
||||||
that.qs1 = $selectableSearch.quicksearch(selectableSearchString)
|
that.qs1 = $selectableSearch.quicksearch(selectableSearchString)
|
||||||
.on('keydown', function (e) {
|
.on('keydown', function (e) {
|
||||||
if (e.which === 40) {
|
if (e.which === 40) {
|
||||||
that.$selectableUl.focus();
|
that.$selectableUl.focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
that.qs2 = $selectionSearch.quicksearch(selectionSearchString)
|
that.qs2 = $selectionSearch.quicksearch(selectionSearchString)
|
||||||
.on('keydown', function (e) {
|
.on('keydown', function (e) {
|
||||||
if (e.which == 40) {
|
if (e.which == 40) {
|
||||||
that.$selectionUl.focus();
|
that.$selectionUl.focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
afterSelect: function () {
|
afterSelect: function () {
|
||||||
this.qs1.cache();
|
this.qs1.cache();
|
||||||
this.qs2.cache();
|
this.qs2.cache();
|
||||||
},
|
},
|
||||||
afterDeselect: function () {
|
afterDeselect: function () {
|
||||||
this.qs1.cache();
|
this.qs1.cache();
|
||||||
this.qs2.cache();
|
this.qs2.cache();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
addMultiSelect("#account_multi_user", "Username")
|
|
||||||
addMultiSelect("#account_domains", "Domain")
|
addMultiSelect("#account_multi_user", "Username")
|
||||||
</script>
|
addMultiSelect("#account_domains", "Domain")
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
Reference in New Issue
Block a user