Merge pull request #2996 from mailcow/revert-2989-patch-5

Revert "extend debug page to show assigned domain quota"
This commit is contained in:
André Peters 2019-10-02 19:40:26 +02:00 committed by GitHub
commit 0b0ab00a31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 43 additions and 88 deletions

View File

@ -206,7 +206,7 @@ class container_post(Resource):
def container_post__exec__system__df(self, container_id):
if 'dir' in request.json:
for container in docker_client.containers.list(filters={"id": container_id}):
df_return = container.exec_run(["/bin/bash", "-c", "/bin/df '" + request.json['dir'].replace("'", "'\\''") + "' | /usr/bin/tail -n1 | /usr/bin/tr -s [:blank:] | /usr/bin/tr ' ' ','"], user='nobody')
df_return = container.exec_run(["/bin/bash", "-c", "/bin/df -H '" + request.json['dir'].replace("'", "'\\''") + "' | /usr/bin/tail -n1 | /usr/bin/tr -s [:blank:] | /usr/bin/tr ' ' ','"], user='nobody')
if df_return.exit_code == 0:
return df_return.output.decode('utf-8').rstrip()
else:

View File

@ -45,13 +45,3 @@ tbody {
width: 15px;
height: 15px;
}
.disk_space {
margin-top: 20px;
}
.progress-bar-committed {
background-color: #B6E1F2;
}
.usage-info {
display: inline-block;
margin-right: 5px;
}

View File

@ -43,11 +43,6 @@ else {
<?php
$exec_fields = array('cmd' => 'system', 'task' => 'df', 'dir' => '/var/vmail');
$vmail_df = explode(',', json_decode(docker('post', 'dovecot-mailcow', 'exec', $exec_fields), true));
$used_percent = substr($vmail_df[4], 0, -1);
$quota_stats = mailbox('get','quota_stats');
$quotaPercent1 = round(($quota_stats['total_quota']/$vmail_df[3])*100);
$quotaPercent2 = round((($quota_stats['total_quota']-$quota_stats['used_bytes'])/$vmail_df[3])*100);
$quotaPercent2 = ($quotaPercent2+$used_percent>100) ? 100-$used_percent : $quotaPercent2;
?>
<div role="tabpanel" class="tab-pane active" id="tab-containers">
<div class="panel panel-default">
@ -58,15 +53,12 @@ else {
<div class="row">
<div class="col-sm-3">
<p>/var/vmail on <?=$vmail_df[0];?></p>
<p class="disk_space"><?=$lang['debug']['disk_space'];?> <?=formatBytes($vmail_df[3]*1024);?></p>
<p><?=$vmail_df[2];?> / <?=$vmail_df[1];?> (<?=$vmail_df[4];?>)</p>
</div>
<div class="col-sm-9">
<div class="progress">
<div class="progress-bar progress-bar-info" role="progressbar" style="width:<?=$used_percent;?>%"></div>
<div class="progress-bar progress-bar-committed" role="progressbar" style="width:<?=$quotaPercent2;?>%"></div>
<div class="progress-bar progress-bar-info" role="progressbar" style="width:<?=$vmail_df[4];?>"></div>
</div>
<p><span class="container-indicator label usage-info progress-bar-info">&nbsp;</span> <?=$lang['debug']['disk_used'];?> <?=formatBytes($vmail_df[2]*1024);?> (<?=$used_percent;?>%)</p>
<p><span class="container-indicator label usage-info progress-bar-committed">&nbsp;</span> <?=$lang['debug']['total_quota'];?> <?=formatBytes($quota_stats['total_quota']*1024);?> (<?=$quotaPercent1;?>%)</p>
</div>
</div>
</div>
@ -352,6 +344,7 @@ $lang_admin = json_encode($lang['admin']);
echo "var lang = ". $lang_admin . ";\n";
echo "var csrf_token = '". $_SESSION['CSRF']['TOKEN'] . "';\n";
echo "var log_pagination_size = '". $LOG_PAGINATION_SIZE . "';\n";
?>
</script>
<?php

View File

@ -3254,24 +3254,6 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
}
return $resourcedata;
break;
case 'quota_stats':
$quotadata = array();
if ($_SESSION['mailcow_cc_role'] != "admin") {
return false;
}
$stmt = $pdo->query("SELECT SUM(`quota2`.`bytes`) AS `bytes`
FROM `mailbox`, `quota2`, `domain`
WHERE `mailbox`.`kind` NOT REGEXP 'location|thing|group'
AND `mailbox`.`username` = `quota2`.`username`
AND `domain`.`domain` = `mailbox`.`domain`
AND `domain`.`active` = 1");
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$quotadata['used_bytes'] = $row['bytes']/1024;
$stmt = $pdo->query("SELECT SUM(`quota`) AS `quota` FROM `domain` WHERE `active`=1");
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$quotadata['total_quota'] = $row['quota']*1024;
return $quotadata;
break;
}
break;
case 'delete':

View File

@ -149,8 +149,8 @@ $lang['success']['sogo_profile_reset'] = "ActiveSync Gerät des Benutzers %s wur
$lang['success']['resource_removed'] = 'Ressource %s wurde entfernt';
$lang['warning']['cannot_delete_self'] = 'Kann derzeit eingeloggten Benutzer nicht entfernen';
$lang['warning']['no_active_admin'] = 'Kann letzten aktiven Administrator nicht deaktivieren';
$lang['danger']['max_quota_in_use'] = 'Mailbox-Speicherplatzlimit muss größer oder gleich %d MiB sein';
$lang['danger']['domain_quota_m_in_use'] = 'Domain-Speicherplatzlimit muss größer oder gleich %d MiB sein';
$lang['danger']['max_quota_in_use'] = 'Mailbox Speicherplatzlimit muss größer oder gleich %d MiB sein';
$lang['danger']['domain_quota_m_in_use'] = 'Domain Speicherplatzlimit muss größer oder gleich %d MiB sein';
$lang['danger']['mailboxes_in_use'] = 'Maximale Anzahl an Mailboxen muss größer oder gleich %d sein';
$lang['danger']['aliases_in_use'] = 'Maximale Anzahl an Aliassen muss größer oder gleich %d sein';
$lang['danger']['sender_acl_invalid'] = 'Sender ACL %s ist ungültig';
@ -375,7 +375,7 @@ $lang['edit']['mailbox'] = 'Mailbox bearbeiten';
$lang['edit']['description'] = 'Beschreibung';
$lang['edit']['max_aliases'] = 'Max. Aliasse';
$lang['edit']['max_quota'] = 'Max. Größe per Mailbox (MiB)';
$lang['edit']['domain_quota'] = 'Domain-Speicherplatz gesamt (MiB)';
$lang['edit']['domain_quota'] = 'Domain Speicherplatz gesamt (MiB)';
$lang['edit']['backup_mx_options'] = 'Backup MX Optionen';
$lang['edit']['relay_domain'] = 'Diese Domain relayen';
$lang['edit']['relay_all'] = 'Alle Empfänger-Adressen relayen';
@ -474,7 +474,7 @@ $lang['add']['description'] = 'Beschreibung';
$lang['add']['max_aliases'] = 'Max. mögliche Aliasse';
$lang['add']['max_mailboxes'] = 'Max. mögliche Mailboxen';
$lang['add']['mailbox_quota_m'] = 'Max. Speicherplatz pro Mailbox (MiB)';
$lang['add']['domain_quota_m'] = 'Domain-Speicherplatz gesamt (MiB)';
$lang['add']['domain_quota_m'] = 'Domain Speicherplatz gesamt (MiB)';
$lang['add']['backup_mx_options'] = 'Backup MX Optionen';
$lang['add']['relay_all'] = 'Alle Empfänger-Adressen relayen';
$lang['add']['relay_domain'] = 'Relay Domain';
@ -793,13 +793,6 @@ $lang['debug']['solr_last_modified'] = 'Zuletzt geändert';
$lang['debug']['solr_size'] = 'Größe';
$lang['debug']['solr_docs'] = 'Dokumente';
$lang['debug']['disk_usage'] = 'Festplattenauslastung';
$lang['debug']['containers_info'] = "Container-Informationen";
$lang['debug']['disk_space'] = "Verfügbarer Speicherplatz:";
$lang['debug']['disk_used'] = "Von Mailboxen belegter Speicherplatz:";
$lang['debug']['total_quota'] = "Zugewiesener Domain-Speicherplatz:";
$lang['quarantine']['release_body'] = "Die ursprüngliche Nachricht wurde als EML-Datei im Anhang hinterlegt.";
$lang['danger']['release_send_failed'] = "Die Nachricht konnte nicht versendet werden: %s";
$lang['quarantine']['release_subject'] = "Potentiell schädliche Nachricht aus Quarantäne: %s";

View File

@ -822,10 +822,6 @@ $lang['debug']['disk_usage'] = 'Disk usage';
$lang['debug']['containers_info'] = "Container information";
$lang['debug']['restart_container'] = 'Restart';
$lang['debug']['disk_space'] = "Available disk space:";
$lang['debug']['disk_used'] = "Disk space occupied by mailboxes:";
$lang['debug']['total_quota'] = "Total amount of assigned domain quota:";
$lang['quarantine']['release_body'] = "We have attached your message as eml file to this message.";
$lang['danger']['release_send_failed'] = "Message could not be released: %s";
$lang['quarantine']['release_subject'] = "Potentially damaging quarantine item %s";
@ -921,3 +917,4 @@ $lang['mailbox']['alias_domain_backupmx'] = 'Alias domain inactive for relay dom
$lang['danger']['extra_acl_invalid'] = 'External sender address "%s" is invalid';
$lang['danger']['extra_acl_invalid_domain'] = 'External sender "%s" uses an invalid domain';