Revize a13b1c2d
Přidáno uživatelem Jan Pašek před téměř 4 roky(ů)
static/js/index.js | ||
---|---|---|
5 | 5 |
var certificateListingApp = new Vue({ |
6 | 6 |
el: "#certificateListingPage", |
7 | 7 |
data: { |
8 |
certificatesPerPage: 2, |
|
8 |
certificatesPerPage: 20,
|
|
9 | 9 |
hasNextPage: false, |
10 | 10 |
hasPreviousPage: false, |
11 | 11 |
currentPage: 1, |
12 | 12 |
loading: true, |
13 | 13 |
// list of all certificates to be displayed in the list |
14 | 14 |
certificates: [], |
15 |
successMessage: '' |
|
15 |
successMessage: '', |
|
16 |
filtering: { |
|
17 |
type: { |
|
18 |
RootCA: false, |
|
19 |
IntermediateCA: false, |
|
20 |
EndCertificate: false, |
|
21 |
}, |
|
22 |
usage: { |
|
23 |
CA: false, |
|
24 |
authentication: false, |
|
25 |
digitalSignature: false, |
|
26 |
SSL: false, |
|
27 |
}, |
|
28 |
CN: "", |
|
29 |
} |
|
16 | 30 |
}, |
17 | 31 |
methods: { |
18 | 32 |
onNextPage: async function () { |
19 | 33 |
this.currentPage++; |
20 | 34 |
await this.loadPage(this.currentPage, this.certificatesPerPage); |
21 | 35 |
}, |
36 |
reloadData: async function() { |
|
37 |
await this.loadPage(this.currentPage, this.certificatesPerPage); |
|
38 |
}, |
|
22 | 39 |
onPreviousPage: async function () { |
23 | 40 |
this.currentPage--; |
24 | 41 |
await this.loadPage(this.currentPage, this.certificatesPerPage); |
... | ... | |
26 | 43 |
loadPage: async function (page, perPage) { |
27 | 44 |
// download a list of all available certificates and display them in the table |
28 | 45 |
try { |
46 |
var params = { |
|
47 |
page: page - 1, |
|
48 |
per_page: perPage |
|
49 |
}; |
|
50 |
var filtering = this.getFilterParameter(); |
|
51 |
if (filtering != null) params.filtering = filtering; |
|
29 | 52 |
const response = await axios.get(API_URL + "certificates", { |
30 |
params: { |
|
31 |
page: page - 1, |
|
32 |
per_page: perPage |
|
33 |
} |
|
53 |
params: params |
|
34 | 54 |
}); |
35 | 55 |
if (response.data["success"]) { |
36 | 56 |
this.certificates = []; |
... | ... | |
42 | 62 |
console.log(error); |
43 | 63 |
} |
44 | 64 |
}, |
65 |
getFilterParameter: function () { |
|
66 |
var type = []; |
|
67 |
if (this.filtering.type.EndCertificate) type.push("end"); |
|
68 |
if (this.filtering.type.RootCA) type.push("root"); |
|
69 |
if (this.filtering.type.IntermediateCA) type.push("inter"); |
|
70 |
|
|
71 |
var usage = []; |
|
72 |
if (this.filtering.usage.CA) usage.push("CA"); |
|
73 |
if (this.filtering.usage.SSL) usage.push("SSL"); |
|
74 |
if (this.filtering.usage.digitalSignature) usage.push("digitalSignature"); |
|
75 |
if (this.filtering.usage.authentication) usage.push("authentication"); |
|
76 |
|
|
77 |
var filtering = {}; |
|
78 |
if (usage.length > 0) filtering.usage = usage; |
|
79 |
if (type.length > 0) filtering.type = type; |
|
80 |
|
|
81 |
if (this.filtering.CN.length > 0) filtering.CN = this.filtering.CN; |
|
82 |
|
|
83 |
if (this.filtering.hasOwnProperty("type") || |
|
84 |
this.filtering.hasOwnProperty("usage") || |
|
85 |
this.filtering.hasOwnProperty("CN")) |
|
86 |
return filtering; |
|
87 |
else |
|
88 |
return null; |
|
89 |
}, |
|
90 |
clearFilters: async function () { |
|
91 |
this.filtering = { |
|
92 |
type: { |
|
93 |
RootCA: false, |
|
94 |
IntermediateCA: false, |
|
95 |
EndCertificate: false, |
|
96 |
}, |
|
97 |
usage: { |
|
98 |
CA: false, |
|
99 |
authentication: false, |
|
100 |
digitalSignature: false, |
|
101 |
SSL: false, |
|
102 |
}, |
|
103 |
CN: "", |
|
104 |
} |
|
105 |
await this.reloadData(); |
|
106 |
}, |
|
45 | 107 |
checkIfNextPage: async function(page, perPage) { |
46 | 108 |
try { |
47 | 109 |
const response = await axios.get(API_URL + "certificates", { |
Také k dispozici: Unified diff
Re #8706 - Certificate list filtering