Revize b556270c
Přidáno uživatelem Jan Pašek před asi 4 roky(ů)
static/js/components.js | ||
---|---|---|
1 | 1 |
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 v-on:click='onCertificateChainDownload()'>Download chain of trust</button></td>"+ |
|
15 |
"<td class='align-middle'><button v-on:click='onCertificateRootDownload()'>Download chain root</button></td>"+ |
|
16 |
"</tr>", |
|
17 |
methods: { |
|
18 |
onCertificateDownload: function () { |
|
19 |
var id = this.certificate.id; |
|
20 |
axios.get(API_URL + "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 |
onCertificateChainDownload: function () { |
|
33 |
var id = this.certificate.id; |
|
34 |
axios.get(API_URL + "certificates/" + id + "/chain") |
|
35 |
.then(function (response) { |
|
36 |
if(response.data["success"]) { |
|
37 |
download(id + "_chain.crt", response.data["data"]) |
|
38 |
} |
|
39 |
else |
|
40 |
console.log("Error occurred while downloading the certificate's chain of trust") // TODO more action may be required |
|
41 |
}) |
|
42 |
.catch(function (error) { |
|
43 |
console.log(error); |
|
44 |
}); |
|
45 |
}, |
|
46 |
onCertificateRootDownload: function () { |
|
47 |
var id = this.certificate.id; |
|
48 |
axios.get(API_URL + "certificates/" + id + "/root") |
|
49 |
.then(function (response) { |
|
50 |
if(response.data["success"]) { |
|
51 |
download(id + "_root.crt", response.data["data"]) |
|
52 |
} |
|
53 |
else |
|
54 |
console.log("Error occurred while downloading the certificate's root CA") // TODO more action may be required |
|
55 |
}) |
|
56 |
.catch(function (error) { |
|
57 |
console.log(error); |
|
58 |
}); |
|
59 |
} |
|
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 v-on:click='onCertificateChainDownload()'>Download chain of trust</button></td>"+ |
|
15 |
"<td class='align-middle'><button v-on:click='onCertificateRootDownload()'>Download chain root</button></td>"+ |
|
16 |
"</tr>", |
|
17 |
methods: { |
|
18 |
onCertificateDownload: function () { |
|
19 |
var id = this.certificate.id; |
|
20 |
axios.get(API_URL + "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 |
onCertificateChainDownload: function () { |
|
33 |
var id = this.certificate.id; |
|
34 |
axios.get(API_URL + "certificates/" + id + "/chain") |
|
35 |
.then(function (response) { |
|
36 |
if(response.data["success"]) { |
|
37 |
download(id + "_chain.crt", response.data["data"]) |
|
38 |
} |
|
39 |
else |
|
40 |
console.log("Error occurred while downloading the certificate's chain of trust") // TODO more action may be required |
|
41 |
}) |
|
42 |
.catch(function (error) { |
|
43 |
console.log(error); |
|
44 |
}); |
|
45 |
}, |
|
46 |
onCertificateRootDownload: function () { |
|
47 |
var id = this.certificate.id; |
|
48 |
axios.get(API_URL + "certificates/" + id + "/root") |
|
49 |
.then(function (response) { |
|
50 |
if(response.data["success"]) { |
|
51 |
download(id + "_root.crt", response.data["data"]) |
|
52 |
} |
|
53 |
else |
|
54 |
console.log("Error occurred while downloading the certificate's root CA") // TODO more action may be required |
|
55 |
}) |
|
56 |
.catch(function (error) { |
|
57 |
console.log(error); |
|
58 |
}); |
|
60 | 59 |
} |
61 |
}); |
|
60 |
} |
|
61 |
}); |
|
62 |
|
|
63 |
Vue.component("ca-select-item", { |
|
64 |
props: ["ca"], |
|
65 |
template: "<option v-bind:value='ca.id'>{{ ca.CN }}</option>" |
|
66 |
}); |
Také k dispozici: Unified diff
Re #8475 - Create certificate, available CA selection