From d84c8fb03e18294dad45b84e1475aaf67b4748c4 Mon Sep 17 00:00:00 2001 From: "Robert M. Learney" <39194639+rmlearney-digicatapult@users.noreply.github.com> Date: Fri, 15 Nov 2024 16:24:11 +0000 Subject: [PATCH 1/2] Shrink docker image from 530MB -> 250MB (#242) --- Dockerfile | 12 +++++------- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 16da64c3..d8c6c910 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1.11 -FROM node:current-alpine AS builder +FROM node:lts-alpine AS builder WORKDIR /veritable-ui @@ -32,20 +32,18 @@ ENV NODE_ENV=${NODE_ENV} RUN npx playwright install --with-deps - CMD ["npm", "run", "test:playwright"] - -# service -FROM node:current-alpine AS service +# Service +FROM node:lts-alpine AS service WORKDIR /veritable-ui -RUN apk add --update coreutils curl +RUN apk add --no-cache coreutils curl RUN npm -g install npm@10.x.x COPY package*.json ./ -RUN npm ci --omit-dev +RUN npm ci --omit=dev COPY public ./public COPY knexfile.js ./ diff --git a/package-lock.json b/package-lock.json index 47e1cc20..ff77b812 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "veritable-ui", - "version": "0.14.16", + "version": "0.14.17", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "veritable-ui", - "version": "0.14.16", + "version": "0.14.17", "license": "Apache-2.0", "dependencies": { "@digicatapult/tsoa-oauth-express": "^0.1.69", diff --git a/package.json b/package.json index fa973f2a..9ac3dde2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "veritable-ui", - "version": "0.14.16", + "version": "0.14.17", "description": "UI for Veritable", "main": "src/index.ts", "type": "module", From 31beb0bcddf4bf9f1596c59568d5aef32d8630bb Mon Sep 17 00:00:00 2001 From: Ellenn-A <58051865+Ellenn-A@users.noreply.github.com> Date: Fri, 15 Nov 2024 16:49:44 +0000 Subject: [PATCH 2/2] Feat/fixing inconsistencies (#240) Co-authored-by: dc-autobot[bot] <181364585+dc-autobot[bot]@users.noreply.github.com> --- package-lock.json | 4 ++-- package.json | 2 +- public/styles/shared.css | 4 +++- .../credentials/__tests__/index.test.ts | 6 +++--- src/controllers/credentials/index.ts | 2 +- .../connection/__tests__/connection.test.ts.snap | 8 ++++---- src/views/connection/connection.tsx | 4 ++-- src/views/credentials/__tests__/fixtures.ts | 8 ++++---- .../credentials/__tests__/index.test.ts.snap | 10 +++++----- src/views/credentials/index.tsx | 16 ++++++++++++---- .../homepage/__tests__/homepage.test.ts.snap | 2 +- src/views/homepage/homepage.tsx | 2 +- 12 files changed, 39 insertions(+), 29 deletions(-) diff --git a/package-lock.json b/package-lock.json index ff77b812..06a17d9e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "veritable-ui", - "version": "0.14.17", + "version": "0.14.18", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "veritable-ui", - "version": "0.14.17", + "version": "0.14.18", "license": "Apache-2.0", "dependencies": { "@digicatapult/tsoa-oauth-express": "^0.1.69", diff --git a/package.json b/package.json index 9ac3dde2..5d250800 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "veritable-ui", - "version": "0.14.17", + "version": "0.14.18", "description": "UI for Veritable", "main": "src/index.ts", "type": "module", diff --git a/public/styles/shared.css b/public/styles/shared.css index 91fab54b..c96bc9e9 100644 --- a/public/styles/shared.css +++ b/public/styles/shared.css @@ -154,7 +154,9 @@ background-repeat: no-repeat; background-position: center; } - +#connection-search-input { + min-width: 210px; +} .search-window { border-color: var(--text-color-sub); border-radius: 5px; diff --git a/src/controllers/credentials/__tests__/index.test.ts b/src/controllers/credentials/__tests__/index.test.ts index 941cd339..6f51e1a7 100644 --- a/src/controllers/credentials/__tests__/index.test.ts +++ b/src/controllers/credentials/__tests__/index.test.ts @@ -23,7 +23,7 @@ describe('CredentialsController', () => { const result = await controller.listCredentials(req).then(toHTMLString) expect(result).to.equal( - 'listCredentials_issuer-done-DIGITAL CATAPULT-Supplier credentials-holder-done-DIGITAL CATAPULT-Supplier credentials-issuer-done-CARE ONUS LTD-Supplier credentials-holder-done-CARE ONUS LTD-Supplier credentials_listCredentials' + 'listCredentials_issuer-done-DIGITAL CATAPULT-Supplier credential-holder-done-DIGITAL CATAPULT-Supplier credential-issuer-done-CARE ONUS LTD-Supplier credential-holder-done-CARE ONUS LTD-Supplier credential_listCredentials' ) }) @@ -103,7 +103,7 @@ describe('CredentialsController', () => { const res = await controller.listCredentials(req, '').then(toHTMLString) expect(res).to.equal( - 'listCredentials_issuer-done-CARE ONUS LTD-Supplier credentials-holder-done-CARE ONUS LTD-Supplier credentials_listCredentials' + 'listCredentials_issuer-done-CARE ONUS LTD-Supplier credential-holder-done-CARE ONUS LTD-Supplier credential_listCredentials' ) }) @@ -114,7 +114,7 @@ describe('CredentialsController', () => { const res = await controller.listCredentials(req, '').then(toHTMLString) expect(res).to.equal( - 'listCredentials_issuer-done-DIGITAL CATAPULT-Supplier credentials-holder-done-DIGITAL CATAPULT-Supplier credentials_listCredentials' + 'listCredentials_issuer-done-DIGITAL CATAPULT-Supplier credential-holder-done-DIGITAL CATAPULT-Supplier credential_listCredentials' ) }) }) diff --git a/src/controllers/credentials/index.ts b/src/controllers/credentials/index.ts index 5547cce6..1d10a526 100644 --- a/src/controllers/credentials/index.ts +++ b/src/controllers/credentials/index.ts @@ -56,7 +56,7 @@ export class CredentialsController extends HTMLController { const result = { companyName: connection.company_name, - type: 'Supplier credentials' as const, + type: 'Supplier credential' as const, ...credential, } req.log.debug('Credential found %s: %j', credential.id, result) diff --git a/src/views/connection/__tests__/connection.test.ts.snap b/src/views/connection/__tests__/connection.test.ts.snap index 871e7ef9..8edfc742 100644 --- a/src/views/connection/__tests__/connection.test.ts.snap +++ b/src/views/connection/__tests__/connection.test.ts.snap @@ -1,9 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`ConnectionTemplates listPage should escape html in name 1`] = `"Veritable - Connections

Connections

Connections
Company NameStatusActions
<div>I own you</div>
Connected
Send Query
"`; +exports[`ConnectionTemplates listPage should escape html in name 1`] = `"Veritable - Connections

Connections

Connections
Company NameStatusActions
<div>I own you</div>
Connected
Send Query
"`; -exports[`ConnectionTemplates listPage should render multiple with each status 1`] = `"Veritable - Connections

Connections

Connections
Company NameStatusActions
Company A
Disconnected
Disconnected
Company B
Invite Sent
Waiting for Response
Company C
Verification Code Required
Complete Verification
Company D
Connected
Send Query
Company E
Verification Code Required
Complete Verification
Company F
Waiting for Response
Waiting for Response
"`; +exports[`ConnectionTemplates listPage should render multiple with each status 1`] = `"Veritable - Connections

Connections

Connections
Company NameStatusActions
Company A
Disconnected
Disconnected
Company B
Invite Sent
Waiting for Response
Company C
Verification Code Required
Complete Verification
Company D
Connected
Send Query
Company E
Verification Code Required
Complete Verification
Company F
Waiting for Response
Waiting for Response
"`; -exports[`ConnectionTemplates listPage should render with no connections 1`] = `"Veritable - Connections

Connections

Connections
Company NameStatusActions
No Connections for that search query. Try again or add a new connection
"`; +exports[`ConnectionTemplates listPage should render with no connections 1`] = `"Veritable - Connections

Connections

Connections
Company NameStatusActions
No Connections for that search query. Try again or add a new connection
"`; -exports[`ConnectionTemplates listPage should render with single connection 1`] = `"Veritable - Connections

Connections

Connections
Company NameStatusActions
Company A
Disconnected
Disconnected
"`; +exports[`ConnectionTemplates listPage should render with single connection 1`] = `"Veritable - Connections

Connections

Connections
Company NameStatusActions
Company A
Disconnected
Disconnected
"`; diff --git a/src/views/connection/connection.tsx b/src/views/connection/connection.tsx index bf033b6a..28c56a38 100644 --- a/src/views/connection/connection.tsx +++ b/src/views/connection/connection.tsx @@ -55,7 +55,7 @@ export default class ConnectionTemplates { title="Veritable - Connections" heading="Connections" activePage="connections" - headerLinks={[{ name: 'Connections', url: '#' }]} + headerLinks={[{ name: 'Connection Management', url: '#' }]} // htmx props hx-get="/connection" hx-trigger="every 10s" @@ -65,7 +65,7 @@ export default class ConnectionTemplates { hx-include="#connection-search-input" >
- Connections Summary + Connection Management Veritable - Credentials

Credential Management

Credential Management
New Credential
Credentials
Company NameCredential TypeDirectionCrendetial statusActions
DIGITAL CATAPULTSupplier credentials

Given

Completed
View Credential
CARE ONUS LTDSupplier credentials

Received

Completed
View Credential
"`; +exports[`CredentialsTemplates listPage credentials case insensitive searches filters based on lower case input 1`] = `"Veritable - Credentials

Credential Management

Credential Management
New Credential
Credentials
Company NameCredential TypeRelationshipStatusActions
DIGITAL CATAPULTSupplier credential

Sender

Completed
View Credential
CARE ONUS LTDSupplier credential

Recipient

Completed
View Credential
"`; -exports[`CredentialsTemplates listPage credentials case insensitive searches filters based on upper case input 1`] = `"Veritable - Credentials

Credential Management

Credential Management
New Credential
Credentials
Company NameCredential TypeDirectionCrendetial statusActions
DIGITAL CATAPULTSupplier credentials

Given

Completed
View Credential
CARE ONUS LTDSupplier credentials

Received

Completed
View Credential
"`; +exports[`CredentialsTemplates listPage credentials case insensitive searches filters based on upper case input 1`] = `"Veritable - Credentials

Credential Management

Credential Management
New Credential
Credentials
Company NameCredential TypeRelationshipStatusActions
DIGITAL CATAPULTSupplier credential

Sender

Completed
View Credential
CARE ONUS LTDSupplier credential

Recipient

Completed
View Credential
"`; -exports[`CredentialsTemplates listPage renders alice's credentials 1`] = `"Veritable - Credentials

Credential Management

Credential Management
New Credential
Credentials
Company NameCredential TypeDirectionCrendetial statusActions
DIGITAL CATAPULTSupplier credentials

Given

Completed
View Credential
CARE ONUS LTDSupplier credentials

Received

Completed
View Credential
"`; +exports[`CredentialsTemplates listPage renders alice's credentials 1`] = `"Veritable - Credentials

Credential Management

Credential Management
New Credential
Credentials
Company NameCredential TypeRelationshipStatusActions
DIGITAL CATAPULTSupplier credential

Sender

Completed
View Credential
CARE ONUS LTDSupplier credential

Recipient

Completed
View Credential
"`; -exports[`CredentialsTemplates listPage renders bob's credentials 1`] = `"Veritable - Credentials

Credential Management

Credential Management
New Credential
Credentials
Company NameCredential TypeDirectionCrendetial statusActions
CARE ONUS LTDSupplier credentials

Given

Completed
View Credential
DIGITAL CATAPULTSupplier credentials

Received

Completed
View Credential
"`; +exports[`CredentialsTemplates listPage renders bob's credentials 1`] = `"Veritable - Credentials

Credential Management

Credential Management
New Credential
Credentials
Company NameCredential TypeRelationshipStatusActions
CARE ONUS LTDSupplier credential

Sender

Completed
View Credential
DIGITAL CATAPULTSupplier credential

Recipient

Completed
View Credential
"`; -exports[`CredentialsTemplates listPage renders with no credentials 1`] = `"Veritable - Credentials

Credential Management

Credential Management
New Credential
Credentials
Company NameCredential TypeDirectionCrendetial statusActions
No Credentials found
"`; +exports[`CredentialsTemplates listPage renders with no credentials 1`] = `"Veritable - Credentials

Credential Management

Credential Management
New Credential
Credentials
Company NameCredential TypeRelationshipStatusActions
No Credentials found
"`; diff --git a/src/views/credentials/index.tsx b/src/views/credentials/index.tsx index c0272f7c..cbe3e9fe 100644 --- a/src/views/credentials/index.tsx +++ b/src/views/credentials/index.tsx @@ -4,7 +4,7 @@ import { credentialStatusToClass, LinkButton, Page } from '../common.js' import type { Credential } from '../../models/veritableCloudagent/internal.js' -export type ExtendedCredential = Credential & { companyName: string; type: 'Supplier credentials' } +export type ExtendedCredential = Credential & { companyName: string; type: 'Supplier credential' } @singleton() export default class CredentialListTemplates { @@ -13,9 +13,9 @@ export default class CredentialListTemplates { private roleToDirection = (role: Credential['role']): JSX.Element => { switch (role) { case 'holder': - return

Received

+ return

Recipient

case 'issuer': - return

Given

+ return

Sender

default: return

unknown

} @@ -31,6 +31,14 @@ export default class CredentialListTemplates { } public listPage = (credentials: ExtendedCredential[], search: string = '') => { + // function adjustInputWidth(input: any) { + // const span = document.getElementById('width-span') + + // // span.textContent = input.value || input.placeholder + + // return '200px' + // } + return ( - {['Company Name', 'Credential Type', 'Direction', 'Crendetial status', 'Actions'].map((name: string) => ( + {['Company Name', 'Credential Type', 'Relationship', 'Status', 'Actions'].map((name: string) => (
{Html.escapeHtml(name || 'unknown')} diff --git a/src/views/homepage/__tests__/homepage.test.ts.snap b/src/views/homepage/__tests__/homepage.test.ts.snap index f38525cc..5f398e7b 100644 --- a/src/views/homepage/__tests__/homepage.test.ts.snap +++ b/src/views/homepage/__tests__/homepage.test.ts.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`HomepageTemplates should render homepage 1`] = `"Veritable - Homepage

Homepage

"`; +exports[`HomepageTemplates should render homepage 1`] = `"Veritable - Homepage

Homepage

"`; diff --git a/src/views/homepage/homepage.tsx b/src/views/homepage/homepage.tsx index 15681d21..42632d26 100644 --- a/src/views/homepage/homepage.tsx +++ b/src/views/homepage/homepage.tsx @@ -10,7 +10,7 @@ export default class HomepageTemplates { title="Veritable - Homepage" heading="Homepage" activePage="categories" - headerLinks={[{ name: '', url: '/' }]} + headerLinks={[]} stylesheets={['homepage.css']} >