From 5704114f696f046d87b159ede832a69f187fa582 Mon Sep 17 00:00:00 2001 From: smnws <117300309+smnws@users.noreply.github.com> Date: Tue, 20 Jun 2023 18:31:35 +0200 Subject: [PATCH 1/2] getContainerList() now returns only the current entry for each unique (name, pod_id) combination every pod_id is unique over the whole lifetime of a cluster and every container name can be assigned once in a pod Signed-off-by: smnws <117300309+smnws@users.noreply.github.com> --- Explorer/src/lib/db.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Explorer/src/lib/db.ts b/Explorer/src/lib/db.ts index b12e6e6..4d461e1 100644 --- a/Explorer/src/lib/db.ts +++ b/Explorer/src/lib/db.ts @@ -70,7 +70,17 @@ export async function getContainerDetails( export async function getContainerList(): Promise { const res = await pool.query( - "SELECT * FROM containers order by timestamp DESC" + // returns entry with the last timestamp for every unique (name, pod_id) + `SELECT + * + FROM ( + SELECT + *, + RANK() OVER (PARTITION BY name, pod_id ORDER BY timestamp DESC) AS rank + FROM + containers) t + WHERE + t.rank = 1` ); const containers: ContainerData[] = res.rows; return containers; From 1dd5a646d5bea86495b9342c270bba97004ffb58 Mon Sep 17 00:00:00 2001 From: smnws <117300309+smnws@users.noreply.github.com> Date: Tue, 20 Jun 2023 18:51:26 +0200 Subject: [PATCH 2/2] fix: use port 3000 for cypress Port 3000, as the default for the Explorer, should be used The use of baseUrl simplifies future modifications to the Explorer URL Signed-off-by: smnws <117300309+smnws@users.noreply.github.com> --- Explorer/cypress.config.ts | 1 + Explorer/cypress/e2e/cypress_test.cy.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Explorer/cypress.config.ts b/Explorer/cypress.config.ts index 36d70cf..cdb64a8 100644 --- a/Explorer/cypress.config.ts +++ b/Explorer/cypress.config.ts @@ -2,6 +2,7 @@ import { defineConfig } from "cypress"; export default defineConfig({ e2e: { + baseUrl: "http://localhost:3000", setupNodeEvents(/*on, config*/) { // implement node event listeners here }, diff --git a/Explorer/cypress/e2e/cypress_test.cy.js b/Explorer/cypress/e2e/cypress_test.cy.js index 0f6430c..c6abff4 100644 --- a/Explorer/cypress/e2e/cypress_test.cy.js +++ b/Explorer/cypress/e2e/cypress_test.cy.js @@ -1,7 +1,7 @@ describe("Navigation", () => { it("should navigate to the about page", () => { // Start from cypress_test_1 - cy.visit("http://localhost:3001/cypress_test/cypress_test_1"); + cy.visit("/cypress_test/cypress_test_1"); // Find a link with an href attribute containing "cypress_test_2" and click it cy.get('a[href*="cypress_test_2"]').click();