Projekt

Obecné

Profil

Stáhnout (2.66 KB) Statistiky
| Větev: | Tag: | Revize:
1 7a423499 Jan Pašek
2
    var certificateDetailsApp = new Vue({
3
        el: "#certificate-detailed-view-content",
4
        data: {
5 780c6d9c Jan Pašek
            id: null,
6 7a423499 Jan Pašek
            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
        },
27
        computed: {
28
            startDate: function () {
29
                return this.certificate.notBefore.substr(0, 16);
30
            },
31
            endDate: function () {
32
                return this.certificate.notAfter.substr(0, 16);
33
            }
34
        },
35
        watch: {
36
37
        },
38
        methods: {
39
            onCertificateDownload: function () {
40 780c6d9c Jan Pašek
                onCertificateDownload(this.id);
41 7a423499 Jan Pašek
            },
42
            onRootDownload: function () {
43 780c6d9c Jan Pašek
                onCertificateRootDownload(this.id);
44 7a423499 Jan Pašek
            },
45
            onChainDownload: function () {
46 780c6d9c Jan Pašek
                onCertificateChainDownload(this.id);
47 7a423499 Jan Pašek
            },
48
            onPublicKeyDownload: function () {
49 780c6d9c Jan Pašek
                onPublicKeyDownload(this.id);
50 7a423499 Jan Pašek
            },
51
            onPrivateKeyDownload: function () {
52 780c6d9c Jan Pašek
                onPrivateKeyDownload(this.id);
53 7a423499 Jan Pašek
            },
54
            onRevoke: function () {
55
56
            },
57
            onDelete: function () {
58
59
            }
60
        }
61
    });
62
63
    // get details of the selected certificate
64
    const params = window.location.search;
65
    if (params !== "") {
66
        const urlParams = new URLSearchParams(params);
67
        if (urlParams.get("id") != null) {
68
            const id = urlParams.get("id");
69 780c6d9c Jan Pašek
            certificateDetailsApp.id = id;
70 7a423499 Jan Pašek
            axios.get(API_URL + "certificates/"+id+"/details")
71
                .then(function (response) {
72
                    if (response.data["success"])
73
                        certificateDetailsApp.certificate = response.data["data"];
74
                })
75
                .catch(function (error) {
76
                    alert("There should be some error reaction");
77
                    // TODO error reaction -> display fault window
78
                });
79
        } else {
80
            alert("There should be some error reaction");
81
            // TODO error reaction -> display fault window
82
        }
83
    } else {
84
        alert("There should be some error reaction");
85
        // TODO error reaction -> display fault window
86
    }