Skip to content

Commit d2048e5

Browse files
committed
Add ___domain names to certificates table
1 parent d121de8 commit d2048e5

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

backend/internal/entity/user/methods.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
func GetByID(id uint) (Model, error) {
1313
var m Model
1414
err := m.LoadByID(id)
15+
m.generateGravatar()
1516
return m, err
1617
}
1718

frontend/src/components/SiteWrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { useEffect, ReactNode } from "react";
22

33
import { Box, Container, useToast } from "@chakra-ui/react";
44
import { useQueryClient } from "@tanstack/react-query";
5-
65
import { getSSEToken, SSEMessage } from "src/api/npm";
76
import { Footer, Navigation } from "src/components";
87
import { intl } from "src/locale";
@@ -26,6 +25,7 @@ function SiteWrapper({ children }: Props) {
2625
eventSource.onmessage = (e: any) => {
2726
const j: SSEMessage = JSON.parse(e.data);
2827
if (j) {
28+
console.log("SSE Message:", j);
2929
if (j.affects) {
3030
queryClient.invalidateQueries({ queryKey: [j.affects] });
3131
}

frontend/src/pages/Certificates/Table.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
ActionsFormatter,
99
CertificateStatusFormatter,
1010
CertificateTypeFormatter,
11+
DomainsFormatter,
1112
GravatarFormatter,
1213
IDFormatter,
1314
MonospaceFormatter,
@@ -59,7 +60,14 @@ function Table({
5960
Cell: MonospaceFormatter(),
6061
},
6162
{
62-
Header: intl.formatMessage({ id: "column.validation-type" }),
63+
Header: intl.formatMessage({ id: "column.___domain-names" }),
64+
accessor: "domainNames",
65+
sortable: true,
66+
Filter: TextFilter,
67+
Cell: DomainsFormatter(),
68+
},
69+
{
70+
Header: intl.formatMessage({ id: "column.type" }),
6371
accessor: "type",
6472
sortable: true,
6573
Cell: CertificateTypeFormatter(),

test/cypress/e2e/api/Certificates.cy.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,14 @@ describe('Certificates endpoints', () => {
3737
it('Should be able to get a certificate', function() {
3838
cy.task('backendApiGet', {
3939
token: token,
40-
path: '/api/certificates/' + certID
40+
path: '/api/certificates/' + certID + '?expand=user'
4141
}).then((data) => {
4242
// Check the swagger schema:
4343
cy.validateSwaggerSchema('get', 200, '/certificates/{certificateID}', data);
4444
expect(data.result).to.have.property('id', certID);
45+
expect(data.result).to.have.property('user');
46+
expect(data.result.user).to.have.property('gravatar_url');
47+
expect(data.result.user.gravatar_url).to.include('gravatar.com');
4548
});
4649
});
4750

@@ -63,12 +66,15 @@ describe('Certificates endpoints', () => {
6366
it('Should be able to get all certificates', function() {
6467
cy.task('backendApiGet', {
6568
token: token,
66-
path: '/api/certificates'
69+
path: '/api/certificates?expand=user'
6770
}).then((data) => {
6871
cy.validateSwaggerSchema('get', 200, '/certificates', data);
6972
expect(data).to.have.property('result');
7073
expect(data.result).to.have.property('items');
7174
expect(data.result.items.length).to.be.greaterThan(0);
75+
expect(data.result.items[0]).to.have.property('user');
76+
expect(data.result.items[0].user).to.have.property('gravatar_url');
77+
expect(data.result.items[0].user.gravatar_url).to.include('gravatar.com');
7278
});
7379
});
7480

0 commit comments

Comments
 (0)