Files
openpanel/templates/tabler/services/ftp.html
2024-10-25 01:44:26 +02:00

177 lines
7.3 KiB
HTML

{% extends 'base.html' %}
{% block content %}
<!-- Page header -->
<div class="page-header mt-0 d-print-none">
<div class="container-xl">
<div class="row g-2 align-items-center">
<div class="col">
<!-- Page pre-title -->
<div class="page-pretitle">
Services
</div>
<h2 class="page-title">
FTP Accounts and Configuration
</h2>
</div>
<!-- Page title actions -->
<div class="col-auto ms-auto mt-0 d-print-none">
<div class="btn-list">
<span class="d-none">
<div class="input-icon">
<span class="input-icon-addon">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"></path><path d="M21 21l-6 -6"></path></svg>
</span>
<input type="text" id="userSearchInput" class="form-control" placeholder="Search FTP accounts" aria-label="Search email accounts">
</div>
</span>
<button id="addPlanButton" class="d-none btn btn-primary" type="button" data-bs-toggle="modal" data-bs-target="#modal-report"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 5l0 14"></path><path d="M5 12l14 0"></path></svg>New Account</button>
Status: <b>{{ ftpserver_status }}</b>
</div>
</div>
</div>
</div>
</div>
{% if ftpserver_status == 'running' %}
<!-- status is running -->
{% if ftp_accounts %}
<!-- accounts exist -->
<div class="page-body">
<div class="">
<div class="row row-deck row-cards">
<div class="col-lg-12" id="domains">
<div class="card-body p-0">
<div id="table-default" class="table-responsive">
<table class="table table-vcenter card-table table-striped">
<thead>
<tr>
<th><button class="table-sort" data-sort="sort-id">Username</button></th>
<th><button class="table-sort" data-sort="sort-user">Owner</button></th>
<th><button class="table-sort" data-sort="sort-url">Path</button></th>
<th class="d-none">Configuration</th>
</tr>
</thead>
<tbody class="table-tbody">
{% for account in ftp_accounts %}
<tr>
<td class="text-secondary sort-url">{{ account.user }}</td>
<td class="text-secondary sort-user"><a href="/users/{{ account.user.split('.')[-1] }}">{{ account.user.split('.')[-1] }}</a></td>
<td class="sort-id">{{ account.path }}</td>
<td class="d-none"><a href="/emails/client/{{ account.user }}" data-domain="{{ account.user }}"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-folder-cog"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12.5 19h-7.5a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2h4l3 3h7a2 2 0 0 1 2 2v3" /><path d="M19.001 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" /><path d="M19.001 15.5v1.5" /><path d="M19.001 21v1.5" /><path d="M22.032 17.25l-1.299 .75" /><path d="M17.27 20l-1.3 .75" /><path d="M15.97 17.25l1.3 .75" /><path d="M20.733 20l1.3 .75" /></svg> View FTP Client Settings</a></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
{% else %}
<!-- no accounts found -->
<div class="page page-center">
<div class="container-tight py-4">
<div class="empty">
<div class="empty-header">No FTP accounts</div>
<p class="empty-title">FTP server is running but there are not FTP accounts created yet.</p>
<p class="empty-subtitle text-secondary">
To refresh the data run:
</p>
<div class="empty-action">
<pre>opencli ftp-users</pre>
</div>
</div>
</div>
</div>
{% endif %}
{% elif ftpserver_status == 'not_installed' %}
<!-- status not_installed -->
<div class="page page-center">
<div class="container-tight py-4">
<div class="empty">
<div class="empty-header">FTP server is not installed</div>
<p class="empty-title">FTP is not yet installed, please install it from terminal with the folowing command:</p>
<p class="d-none empty-subtitle text-secondary">
</p>
<div class="empty-action">
<pre>cd /root && docker compose up -d openadmin_ftp</pre>
</div>
</div>
</div>
</div>
{% elif ftpserver_status == 'stopped' %}
<!-- status is stopped -->
<div class="page page-center">
<div class="container-tight py-4">
<div class="empty">
<div class="empty-header">FTP server is not running</div>
<p class="empty-title">FTP is currently stopped.</p>
<p class="d-none empty-subtitle text-secondary">
</p>
<div class="empty-action">
<a href="/service/start/openadmin_ftp" id="start_ftpserver" class="btn btn-primary>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-player-play"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M7 4v16l13 -8z" /></svg>
Click to start FTP server
</a>
</div>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', () => {
const startMailServerButton = document.getElementById('start_ftpserver');
startMailServerButton.addEventListener('click', (event) => {
event.preventDefault(); // Prevent the default link behavior
fetch(startMailServerButton.href, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
})
.then(response => {
if (response.ok) {
window.location.reload();
} else {
console.error('Failed to start ftp server:', response.statusText);
}
})
.catch(error => {
console.error('Error during AJAX request:', error);
});
});
});
</script>
{% else %}
<!-- status is unknown -->
FTP server status not detected!
{% endif %}
{% endblock %}