Projekt

Obecné

Profil

« Předchozí | Další » 

Revize b556270c

Přidáno uživatelem Jan Pašek před asi 4 roky(ů)

Re #8475 - Create certificate, available CA selection

Zobrazit rozdíly:

static/js/create_certificate.js
1 1
    var createCertificateApp = new Vue({
2 2
            el: "#create-certificate-content",
3 3
            data: {
4
                selectedCA: {
4
                authorities: [{id: 5, CN: "Test"}],
5
                selectedCA: null,
6
                selectedCAData: {
5 7
                    CN: "",
6 8
                    C:  "",
7 9
                    L:  "",
......
10 12
                    OU: "",
11 13
                    emailAddress: ""
12 14
                }
15
            },
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"];
13 56
            }
57
            else
58
                console.log("Error occurred while fetching list of available certificate authorities");
59
        })
60
        .catch(function (error) {
61
            console.log(error);
14 62
        });

Také k dispozici: Unified diff