1 |
6c9cb54a
|
Jan Pašek
|
|
2 |
|
|
// Component representing an instance in certificate listing
|
3 |
e75db9cd
|
Jan Pašek
|
Vue.component("certificate-item",{
|
4 |
6c9cb54a
|
Jan Pašek
|
// certificate = certificate to be displayed by the list item
|
5 |
b556270c
|
Jan Pašek
|
props: ["certificate"],
|
6 |
|
|
template: "<tr>"+
|
7 |
81e73700
|
Jan Pašek
|
"<td class='align-middle'><a :href='certificateURL' class='font-weight-bold'>{{ certificate.CN }}</a></td>"+
|
8 |
3e6d1ec5
|
Jan Pašek
|
"<td class='align-middle'>{{ formattedNotBefore }}</td>"+
|
9 |
|
|
"<td class='align-middle'>{{ formattedNotAfter }}</td>"+
|
10 |
b556270c
|
Jan Pašek
|
"<td class='align-middle'>" +
|
11 |
|
|
" <div v-if='certificate.usage.CA'>CA</div>" +
|
12 |
|
|
" <div v-if='certificate.usage.authentication'>authentication</div>" +
|
13 |
|
|
" <div v-if='certificate.usage.digitalSignature'>digital signature</div>" +
|
14 |
|
|
" <div v-if='certificate.usage.SSL'>SSL/TLS</div>" +
|
15 |
|
|
"</td>"+
|
16 |
|
|
"<td class='align-middle'><button v-on:click='onCertificateDownload()'>Download certificate</button></td>"+
|
17 |
3e6d1ec5
|
Jan Pašek
|
"<td class='align-middle'><button v-on:click='onChainOfTrustDownload()'>Download chain</button></td>"+
|
18 |
|
|
"<td class='align-middle'><button v-on:click='onRootDownload()'>Download root</button></td>"+
|
19 |
|
|
"<td class='align-middle'><button v-on:click='onPrivateKeyDownload()'>Download key</button></td>"+
|
20 |
81e73700
|
Jan Pašek
|
"<td v-if='certificate.issuer.id !== certificate.id' class='align-middle'><a :href='issuerURL' class='font-weight-bold'>{{ certificate.issuer.CN }}</a></td>"+
|
21 |
|
|
"<td v-if='certificate.issuer.id === certificate.id' class='align-middle'><a :href='issuerURL' class='font-weight-light'>self-signed</a></td>"+
|
22 |
b556270c
|
Jan Pašek
|
"</tr>",
|
23 |
81e73700
|
Jan Pašek
|
computed: {
|
24 |
|
|
certificateURL: function () {
|
25 |
|
|
return "/static/certificate.html?id=" + this.certificate.id;
|
26 |
|
|
},
|
27 |
|
|
issuerURL: function () {
|
28 |
|
|
return "/static/certificate.html?id=" + this.certificate.issuer.id;
|
29 |
3e6d1ec5
|
Jan Pašek
|
},
|
30 |
|
|
formattedNotAfter: function () {
|
31 |
|
|
return this.certificate.notAfter.substring(0, 16);
|
32 |
|
|
},
|
33 |
|
|
formattedNotBefore: function () {
|
34 |
|
|
return this.certificate.notBefore.substring(0, 16);
|
35 |
81e73700
|
Jan Pašek
|
}
|
36 |
|
|
},
|
37 |
b556270c
|
Jan Pašek
|
methods: {
|
38 |
6c9cb54a
|
Jan Pašek
|
// Get the certificate PEM data from the server and downloads it to users computer
|
39 |
b556270c
|
Jan Pašek
|
onCertificateDownload: function () {
|
40 |
3e6d1ec5
|
Jan Pašek
|
onCertificateDownload(this.certificate.id);
|
41 |
|
|
},
|
42 |
|
|
onPrivateKeyDownload: function () {
|
43 |
|
|
onPrivateKeyDownload(this.certificate.id);
|
44 |
|
|
},
|
45 |
|
|
onChainOfTrustDownload: function () {
|
46 |
|
|
onCertificateChainDownload(this.certificate.id);
|
47 |
|
|
},
|
48 |
|
|
onRootDownload: function () {
|
49 |
|
|
onCertificateRootDownload(this.certificate.id);
|
50 |
b556270c
|
Jan Pašek
|
},
|
51 |
|
|
}
|
52 |
|
|
});
|
53 |
|
|
|
54 |
6c9cb54a
|
Jan Pašek
|
// Component representing an item in select of available CAs
|
55 |
b556270c
|
Jan Pašek
|
Vue.component("ca-select-item", {
|
56 |
6c9cb54a
|
Jan Pašek
|
// Certificate authority to be represented by the option
|
57 |
b556270c
|
Jan Pašek
|
props: ["ca"],
|
58 |
|
|
template: "<option v-bind:value='ca.id'>{{ ca.CN }}</option>"
|
59 |
56b36ca7
|
Jan Pašek
|
});
|
60 |
|
|
|
61 |
|
|
// Component representing a certificate issued by displayed CA
|
62 |
|
|
Vue.component("issued-by-list-item", {
|
63 |
|
|
props: ["certificate"],
|
64 |
|
|
template: "<tr class='align-middle text-center'>"+
|
65 |
|
|
"<td class='align-middle'><a :href='certificateURL' class='font-weight-bold'>{{ certificate.CN }}</a></td>"+
|
66 |
|
|
"<td class='align-middle'>" +
|
67 |
|
|
" <div v-if='certificate.usage.CA'>CA</div>" +
|
68 |
|
|
" <div v-if='certificate.usage.authentication'>authentication</div>" +
|
69 |
|
|
" <div v-if='certificate.usage.digitalSignature'>digital signature</div>" +
|
70 |
|
|
" <div v-if='certificate.usage.SSL'>SSL/TLS</div>" +
|
71 |
|
|
"</td>"+
|
72 |
|
|
"</tr>",
|
73 |
|
|
computed: {
|
74 |
|
|
certificateURL: function () {
|
75 |
|
|
return "/static/certificate.html?id=" + this.certificate.id;
|
76 |
|
|
}
|
77 |
|
|
}
|
78 |
b556270c
|
Jan Pašek
|
});
|