Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 81e73700

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

Re #8583 - Improved certificate listing

Zobrazit rozdíly:

static/index.html
22 22
                    <th class="align-middle" scope="col" colspan="2">Validity</th>
23 23
                    <th class="align-middle" scope="col" rowspan="2">Usage</th>
24 24
                    <th class="align-middle" scope="col" rowspan="2">Certificate</th>
25
                    <th class="align-middle" scope="col" rowspan="2">Trust chain</th>
26
                    <th class="align-middle" scope="col" rowspan="2">Chain root</th>
25
                    <th class="align-middle" scope="col" rowspan="2">Issuer</th>
27 26
                </tr>
28 27
                <tr>
29 28
                    <th scope="col">Start</th>
static/js/components.js
4 4
    // certificate = certificate to be displayed by the list item
5 5
    props: ["certificate"],
6 6
    template: "<tr>"+
7
                "<td class='align-middle'>{{ certificate.CN }}</td>"+
7
                "<td class='align-middle'><a :href='certificateURL' class='font-weight-bold'>{{ certificate.CN }}</a></td>"+
8 8
                "<td class='align-middle'>{{ certificate.notBefore }}</td>"+
9 9
                "<td class='align-middle'>{{ certificate.notAfter }}</td>"+
10 10
                "<td class='align-middle'>" +
......
14 14
                "   <div v-if='certificate.usage.SSL'>SSL/TLS</div>" +
15 15
                "</td>"+
16 16
                "<td class='align-middle'><button v-on:click='onCertificateDownload()'>Download certificate</button></td>"+
17
                "<td class='align-middle'><button v-on:click='onCertificateChainDownload()'>Download chain of trust</button></td>"+
18
                "<td class='align-middle'><button v-on:click='onCertificateRootDownload()'>Download chain root</button></td>"+
17
                "<td v-if='certificate.issuer.id !== certificate.id' class='align-middle'><a :href='issuerURL' class='font-weight-bold'>{{ certificate.issuer.CN }}</a></td>"+
18
                "<td v-if='certificate.issuer.id === certificate.id'  class='align-middle'><a :href='issuerURL' class='font-weight-light'>self-signed</a></td>"+
19 19
            "</tr>",
20
    computed: {
21
        certificateURL: function () {
22
            return "/static/certificate.html?id=" + this.certificate.id;
23
        },
24
        issuerURL: function () {
25
            return "/static/certificate.html?id=" + this.certificate.issuer.id;
26
        }
27
    },
20 28
    methods: {
21 29
        // Get the certificate PEM data from the server and downloads it to users computer
22 30
        onCertificateDownload: function () {
static/js/index.js
12 12
            if (params !== "") {
13 13
                const urlParams = new URLSearchParams(params);
14 14
                if (urlParams.get("success") != null) this.successMessage = urlParams.get("success");
15

  
16
                const nextURL = '/static/index.html';
17
                const nextTitle = 'X.509 Certificate Management';
18
                const nextState = { additionalInformation: 'Updated the URL with JS' };
19

  
20
                // This will create a new entry in the browser's history, without reloading
21
                window.history.pushState(nextState, nextTitle, nextURL);
22

  
23
                // This will replace the current entry in the browser's history, without reloading
24
                window.history.replaceState(nextState, nextTitle, nextURL);
15 25
            }
16 26
        }
17 27
    });
......
21 31
        .then(function (response) {
22 32
            if (response.data["success"])
23 33
                response.data["data"].forEach(item => certificateListingApp.certificates.push(item))
24
            else
25
                console.log("Error occured while loading certificate list") // TODO more action may be required
26 34
        })
27 35
        .catch(function (error) {
28 36
            console.log(error);

Také k dispozici: Unified diff