Projekt

Obecné

Profil

Stáhnout (3.06 KB) Statistiky
| Větev: | Tag: | Revize:
1

    
2
    var certificateDetailsApp = new Vue({
3
        el: "#certificate-detailed-view-content",
4
        data: {
5
            id: null,
6
            certificate: {
7
                subject: {
8
                    C: "",
9
                    ST: "",
10
                    L: "",
11
                    CN: "",
12
                    O: "",
13
                    OU: "",
14
                    emailAddress: "",
15
                },
16
                notBefore: "",
17
                notAfter: "",
18
                usage: {
19
                    CA: false,
20
                    authentication: false,
21
                    digitalSignature: false,
22
                    SSL: false,
23
                },
24
                CA: null,
25
            },
26
            errorMessage: "",
27
            successMessage: "",
28
        },
29
        computed: {
30
            startDate: function () {
31
                return this.certificate.notBefore.substr(0, 16);
32
            },
33
            endDate: function () {
34
                return this.certificate.notAfter.substr(0, 16);
35
            },
36
            issuerURL: function () {
37
                return "/static/certificate.html?id=" + this.certificate.CA;
38
            },
39
            crlEndpoint: function () {
40
                return "/api/crl/" + this.certificate.CA;
41
            },
42
            ocspEndpoint: function () {
43
                return "/api/ocsp/" + this.certificate.CA;
44
            }
45
        },
46
        watch: {
47

    
48
        },
49
        methods: {
50
            onCertificateDownload: function () {
51
                onCertificateDownload(this.id);
52
            },
53
            onRootDownload: function () {
54
                onCertificateRootDownload(this.id);
55
            },
56
            onChainDownload: function () {
57
                onCertificateChainDownload(this.id);
58
            },
59
            onPublicKeyDownload: function () {
60
                onPublicKeyDownload(this.id);
61
            },
62
            onPrivateKeyDownload: function () {
63
                onPrivateKeyDownload(this.id);
64
            },
65
            onRevoke: function () {
66

    
67
            },
68
            onDelete: function () {
69

    
70
            }
71
        }
72
    });
73

    
74
    // get details of the selected certificate
75
    const params = window.location.search;
76
    if (params !== "") {
77
        const urlParams = new URLSearchParams(params);
78
        if (urlParams.get("id") != null) {
79
            const id = urlParams.get("id");
80
            certificateDetailsApp.id = id;
81
            axios.get(API_URL + "certificates/"+id+"/details")
82
                .then(function (response) {
83
                    if (response.data["success"])
84
                        certificateDetailsApp.certificate = response.data["data"];
85
                })
86
                .catch(function (error) {
87
                    alert("There should be some error reaction");
88
                    // TODO error reaction -> display fault window
89
                });
90
        } else {
91
            alert("There should be some error reaction");
92
            // TODO error reaction -> display fault window
93
        }
94
    } else {
95
        alert("There should be some error reaction");
96
        // TODO error reaction -> display fault window
97
    }
(5-5/11)