Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 6d850d19

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

Re #8583 Certificate creation - creation success alert using Bootstrap

Zobrazit rozdíly:

static/index.html
3 3
<head>
4 4
    <meta charset="UTF-8">
5 5
    <title>X.509 Certificate Management</title>
6
    <link rel="stylesheet" href="/static/css/app.css">
6 7
    <link rel="stylesheet" href="/static/css/bootstrap.min.css">
7 8
</head>
8 9
<body>
......
11 12
            <h1 class="ml-2 d-inline-block">Certificate Listing</h1>
12 13
            <a class="btn btn-success ml-4 mb-3" href="/static/create_certificate.html">Create certificate</a>
13 14
        </div>
14

  
15
        <div class="alert alert-success" v-if="successMessage !== ''" role="alert" v-cloak>
16
            {{ successMessage }}
17
        </div>
15 18
        <table class="table table-striped table-hover text-center">
16 19
            <thead class="thead-dark">
17 20
                <tr>
static/js/create_certificate.js
71 71
                        .then(function (response) {
72 72
                            // on success return to index page
73 73
                            if(response.data["success"]) {
74
                                alert("Certificate was successfully created.");
75
                                window.location.href = "/static/index.html";
74
                                window.location.href = "/static/index.html?success=Certificate+successfully+created";
76 75
                            }
77 76
                            // on error display server response message
78 77
                            else {
79
                                alert(response.data["data"]);
78
                                createCertificateApp.showError(response.data["data"]);
80 79
                            }
81 80
                        })
82 81
                        .catch(function (error) {
static/js/index.js
4 4
        el: "#certificateListingPage",
5 5
        data: {
6 6
            // list of all certificates to be displayed in the list
7
            certificates: []
7
            certificates: [],
8
            successMessage: ''
9
        },
10
        mounted: function () {
11
            const params = window.location.search;
12
            if (params !== "") {
13
                const urlParams = new URLSearchParams(params);
14
                if (urlParams.get("success") != null) this.successMessage = urlParams.get("success");
15
            }
8 16
        }
9 17
    });
10 18

  

Také k dispozici: Unified diff