1 |
a3b708c2
|
Jan Pašek
|
var createCertificateApp = new Vue({
|
2 |
|
|
el: "#create-certificate-content",
|
3 |
|
|
data: {
|
4 |
b556270c
|
Jan Pašek
|
authorities: [{id: 5, CN: "Test"}],
|
5 |
|
|
selectedCA: null,
|
6 |
|
|
selectedCAData: {
|
7 |
a3b708c2
|
Jan Pašek
|
CN: "",
|
8 |
|
|
C: "",
|
9 |
|
|
L: "",
|
10 |
|
|
ST: "",
|
11 |
|
|
O: "",
|
12 |
|
|
OU: "",
|
13 |
|
|
emailAddress: ""
|
14 |
|
|
}
|
15 |
b556270c
|
Jan Pašek
|
},
|
16 |
|
|
watch: {
|
17 |
|
|
selectedCA: function (val, oldVal) {
|
18 |
|
|
if (val === "null" || val == null) {
|
19 |
|
|
createCertificateApp.selectedCAData = {
|
20 |
|
|
CN: "",
|
21 |
|
|
C: "",
|
22 |
|
|
L: "",
|
23 |
|
|
ST: "",
|
24 |
|
|
O: "",
|
25 |
|
|
OU: "",
|
26 |
|
|
emailAddress: ""
|
27 |
|
|
};
|
28 |
|
|
}
|
29 |
|
|
else {
|
30 |
|
|
axios.get(API_URL + "certificates/" + val + "/details")
|
31 |
|
|
.then(function (response) {
|
32 |
|
|
if (response.data["success"]) {
|
33 |
|
|
createCertificateApp.selectedCAData = response.data["data"]["subject"];
|
34 |
|
|
}
|
35 |
|
|
else
|
36 |
|
|
console.log("Error occurred while fetching CA details");
|
37 |
|
|
})
|
38 |
|
|
.catch(function (error) {
|
39 |
|
|
console.log(error);
|
40 |
|
|
});
|
41 |
|
|
}
|
42 |
|
|
}
|
43 |
|
|
}
|
44 |
|
|
});
|
45 |
|
|
|
46 |
|
|
axios.get(API_URL+"certificates", {
|
47 |
|
|
params: {
|
48 |
|
|
filtering: {
|
49 |
|
|
CA: true
|
50 |
|
|
}
|
51 |
|
|
}
|
52 |
|
|
})
|
53 |
|
|
.then(function (response) {
|
54 |
|
|
if (response.data["success"]) {
|
55 |
|
|
createCertificateApp.authorities = response.data["data"];
|
56 |
a3b708c2
|
Jan Pašek
|
}
|
57 |
b556270c
|
Jan Pašek
|
else
|
58 |
|
|
console.log("Error occurred while fetching list of available certificate authorities");
|
59 |
|
|
})
|
60 |
|
|
.catch(function (error) {
|
61 |
|
|
console.log(error);
|
62 |
a3b708c2
|
Jan Pašek
|
});
|