1 |
e75db9cd
|
Jan Pašek
|
Vue.component("certificate-item",{
|
2 |
|
|
props: ["certificate"],
|
3 |
|
|
template: "<tr>"+
|
4 |
|
|
"<td class='align-middle'>{{ certificate.CN }}</td>"+
|
5 |
|
|
"<td class='align-middle'>{{ certificate.notBefore }}</td>"+
|
6 |
|
|
"<td class='align-middle'>{{ certificate.notAfter }}</td>"+
|
7 |
|
|
"<td class='align-middle'>" +
|
8 |
|
|
" <div v-if='certificate.usage.CA'>CA</div>" +
|
9 |
|
|
" <div v-if='certificate.usage.authentication'>authentication</div>" +
|
10 |
|
|
" <div v-if='certificate.usage.digitalSignature'>digital signature</div>" +
|
11 |
|
|
" <div v-if='certificate.usage.SSL'>SSL/TLS</div>" +
|
12 |
|
|
"</td>"+
|
13 |
|
|
"<td class='align-middle'><button v-on:click='onCertificateDownload()'>Download certificate</button></td>"+
|
14 |
|
|
"<td class='align-middle'><button>Download chain of trust</button></td>"+
|
15 |
|
|
"<td class='align-middle'><button>Download chain root</button></td>"+
|
16 |
|
|
"</tr>",
|
17 |
|
|
methods: {
|
18 |
|
|
onCertificateDownload: function () {
|
19 |
|
|
var id = this.certificate.id;
|
20 |
|
|
axios.get("https://virtserver.swaggerhub.com/janpasek97/X509_management/1.0.0/api/certificates/" + id)
|
21 |
|
|
.then(function (response) {
|
22 |
|
|
if(response.data["success"]) {
|
23 |
|
|
download(id + ".crt", response.data["data"])
|
24 |
|
|
}
|
25 |
|
|
else
|
26 |
|
|
console.log("Error occurred while downloading the certificate") // TODO more action may be required
|
27 |
|
|
})
|
28 |
|
|
.catch(function (error) {
|
29 |
|
|
console.log(error);
|
30 |
|
|
});
|
31 |
|
|
}
|
32 |
|
|
}
|
33 |
|
|
});
|