mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
security/acme-client: show acme status for each certificate in GUI
This commit is contained in:
committed by
Franco Fichtner
parent
3d097bfb78
commit
bf0d83a6b7
+1
-1
@@ -203,7 +203,7 @@ class CertificatesController extends ApiControllerBase
|
||||
$grid = new UIModelGrid($mdlAcme->certificates->certificate);
|
||||
return $grid->fetchBindRequest(
|
||||
$this->request,
|
||||
array("enabled", "name", "altNames", "description"),
|
||||
array("enabled", "name", "altNames", "description", "lastUpdate", "statusCode", "statusLastUpdate"),
|
||||
"name"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -224,6 +224,18 @@
|
||||
<lastUpdate type="IntegerField">
|
||||
<Required>N</Required>
|
||||
</lastUpdate>
|
||||
<!-- hidden field; status of last operation -->
|
||||
<statusCode type="IntegerField">
|
||||
<Required>N</Required>
|
||||
<!-- XXX: enable once data migration is working -->
|
||||
<!-- <default>100</default> -->
|
||||
<MinimumValue>100</MinimumValue>
|
||||
<MaximumValue>1000</MaximumValue>
|
||||
</statusCode>
|
||||
<!-- hidden field; timestamp for statusCode -->
|
||||
<statusLastUpdate type="IntegerField">
|
||||
<Required>N</Required>
|
||||
</statusLastUpdate>
|
||||
</certificate>
|
||||
</certificates>
|
||||
<validations>
|
||||
|
||||
@@ -69,6 +69,50 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
} else {
|
||||
return "<span style=\"cursor: pointer;\" class=\"fa fa-square-o command-toggle\" data-value=\"0\" data-row-id=\"" + row.uuid + "\"></span>";
|
||||
}
|
||||
},
|
||||
"certdate": function (column, row) {
|
||||
if (row.lastUpdate == "" || row.lastUpdate == undefined) {
|
||||
return "pending";
|
||||
} else {
|
||||
var certdate = new Date(row.lastUpdate*1000);
|
||||
return certdate.toLocaleString();
|
||||
}
|
||||
},
|
||||
"certstatus": function (column, row) {
|
||||
if (row.statusCode == "" || row.statusCode == undefined) {
|
||||
// fallback to lastUpdate value (unset if cert was never issued/imported)
|
||||
if (row.lastUpdate == "" || row.lastUpdate == undefined) {
|
||||
return "never";
|
||||
} else {
|
||||
return "OK";
|
||||
}
|
||||
} else if (row.statusCode == "100") {
|
||||
return "never";
|
||||
} else if (row.statusCode == "200") {
|
||||
return "OK";
|
||||
} else if (row.statusCode == "250") {
|
||||
return "OK (renewed)";
|
||||
} else if (row.statusCode == "400") {
|
||||
return "failed";
|
||||
} else if (row.statusCode == "500") {
|
||||
return "internal error";
|
||||
} else {
|
||||
return "unknown";
|
||||
}
|
||||
},
|
||||
"certstatusdate": function (column, row) {
|
||||
if (row.statusLastUpdate == "" || row.statusCode == undefined) {
|
||||
// fallback to lastUpdate value
|
||||
if (row.lastUpdate == "" || row.lastUpdate == undefined) {
|
||||
return "unknown";
|
||||
} else {
|
||||
var legacydate = new Date(row.lastUpdate*1000);
|
||||
return legacydate.toLocaleString();
|
||||
}
|
||||
} else {
|
||||
var statusdate = new Date(row.statusLastUpdate*1000);
|
||||
return statusdate.toLocaleString();
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
@@ -339,6 +383,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
<th data-column-id="name" data-type="string">{{ lang._('Certificate Name') }}</th>
|
||||
<th data-column-id="altNames" data-type="string">{{ lang._('Multi-Domain (SAN)') }}</th>
|
||||
<th data-column-id="description" data-type="string">{{ lang._('Description') }}</th>
|
||||
<th data-column-id="lastUpdate" data-type="string" data-formatter="certdate">{{ lang._('Issue/Renewal Date') }}</th>
|
||||
<th data-column-id="statusCode" data-type="string" data-formatter="certstatus">{{ lang._('Last Acme Status') }}</th>
|
||||
<th data-column-id="statusLastUpdate" data-type="string" data-formatter="certstatusdate">{{ lang._('Last Acme Run') }}</th>
|
||||
<th data-column-id="commands" data-width="11em" data-formatter="commands" data-sortable="false">{{ lang._('Commands') }}</th>
|
||||
<th data-column-id="uuid" data-type="string" data-identifier="true" data-visible="false">{{ lang._('ID') }}</th>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user