Skip to content

Commit

Permalink
DEVPROD-5290, DEVPROD-5299: Represent SkippedLines with a range inste…
Browse files Browse the repository at this point in the history
…ad of a list (#134)
  • Loading branch information
SupaJoon authored May 30, 2024
1 parent 3ee629d commit 9dd3eff
Show file tree
Hide file tree
Showing 33 changed files with 400 additions and 163 deletions.
8 changes: 4 additions & 4 deletions apps/parsley/cypress/integration/ansiLogs/ansi_filtering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe("Filtering", () => {
"contain",
`filters=010${filter1},001${filter2}`,
);
cy.get("[data-cy^='collapsed-row-']").should("not.exist");
cy.get("[data-cy^='skipped-lines-row-']").should("not.exist");
});
});

Expand Down Expand Up @@ -187,7 +187,7 @@ describe("Filtering", () => {
"contain",
`filters=010${filter1},001${filter2}`,
);
cy.get("[data-cy^='collapsed-row-']").should("not.exist");
cy.get("[data-cy^='skipped-lines-row-']").should("not.exist");
});
});
});
Expand All @@ -199,7 +199,7 @@ describe("Filtering", () => {
beforeEach(() => {
cy.resetDrawerState();
cy.visit(`${logLink}?filters=100${filter}`);
cy.get("[data-cy^='collapsed-row-']").should("exist");
cy.get("[data-cy^='skipped-lines-row-']").should("exist");
});

it("should be able to edit a filter", () => {
Expand All @@ -221,7 +221,7 @@ describe("Filtering", () => {
cy.get(`[aria-label="Delete filter"]`).click();
});
cy.location("search").should("not.contain", "filters");
cy.get("[data-cy^='collapsed-row-']").should("not.exist");
cy.get("[data-cy^='skipped-lines-row-']").should("not.exist");
});
});
});
12 changes: 6 additions & 6 deletions apps/parsley/cypress/integration/ansiLogs/ansi_logView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,36 +166,36 @@ describe("expanding collapsed rows", () => {
cy.dataCy("log-row-3").should("not.exist");
cy.dataCy("log-row-4").should("not.exist");

cy.dataCy("collapsed-row-1-4").within(() => {
cy.dataCy("skipped-lines-row-1-4").within(() => {
cy.contains("All").click();
});

cy.dataCy("collapsed-row-1-4").should("not.exist");
cy.dataCy("skipped-lines-row-1-4").should("not.exist");
cy.dataCy("log-row-1").should("be.visible");
cy.dataCy("log-row-2").should("be.visible");
cy.dataCy("log-row-3").should("be.visible");
cy.dataCy("log-row-4").should("be.visible");
});

it("should be able to see what rows have been expanded in the drawer", () => {
cy.dataCy("collapsed-row-1-4").within(() => {
cy.dataCy("skipped-lines-row-1-4").within(() => {
cy.contains("All").click();
});
cy.toggleDrawer();
cy.dataCy("expanded-row-1-to-4").should("be.visible");
});

it("should be possible to re-collapse rows through the drawer", () => {
cy.dataCy("collapsed-row-1-4").within(() => {
cy.dataCy("skipped-lines-row-1-4").within(() => {
cy.contains("All").click();
});
cy.dataCy("collapsed-row-1-4").should("not.exist");
cy.dataCy("skipped-lines-row-1-4").should("not.exist");

cy.toggleDrawer();
cy.dataCy("expanded-row-1-to-4").within(() => {
cy.get(`[aria-label="Delete range"]`).click();
});
cy.dataCy("collapsed-row-1-4").should("exist");
cy.dataCy("skipped-lines-row-1-4").should("exist");
});
});

Expand Down
4 changes: 2 additions & 2 deletions apps/parsley/cypress/integration/ansiLogs/ansi_searching.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ describe("Searching", () => {

it("should be able to search on filtered content", () => {
cy.addFilter("installation");
cy.get("[data-cy^='collapsed-row-']").should("exist");
cy.get("[data-cy^='collapsed-row-']").should("have.length", 3);
cy.get("[data-cy^='skipped-lines-row-']").should("exist");
cy.get("[data-cy^='skipped-lines-row-']").should("have.length", 3);

cy.addSearch("info");
cy.dataCy("search-count").should("be.visible");
Expand Down
2 changes: 1 addition & 1 deletion apps/parsley/cypress/integration/project_filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe("project filters", () => {
"contain",
"111%28NETWORK%257CASIO%257CEXECUTOR%257CCONNPOOL%257CREPL_HB%29",
);
cy.get("[data-cy^='collapsed-row-']").should("exist");
cy.get("[data-cy^='skipped-lines-row-']").should("exist");
});

it("should disable checkbox if filter is already applied", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,35 +213,35 @@ describe("expanding collapsed rows", () => {
cy.dataCy("log-row-2").should("not.exist");
cy.dataCy("log-row-3").should("not.exist");

cy.dataCy("collapsed-row-1-3").within(() => {
cy.dataCy("skipped-lines-row-1-3").within(() => {
cy.contains("All").click();
});

cy.dataCy("collapsed-row-1-3").should("not.exist");
cy.dataCy("skipped-lines-row-1-3").should("not.exist");
cy.dataCy("log-row-1").should("be.visible");
cy.dataCy("log-row-2").should("be.visible");
cy.dataCy("log-row-3").should("be.visible");
});

it("should be able to see what rows have been expanded in the drawer", () => {
cy.dataCy("collapsed-row-1-3").within(() => {
cy.dataCy("skipped-lines-row-1-3").within(() => {
cy.contains("All").click();
});
cy.toggleDrawer();
cy.dataCy("expanded-row-1-to-3").should("be.visible");
});

it("should be possible to re-collapse rows through the drawer", () => {
cy.dataCy("collapsed-row-1-3").within(() => {
cy.dataCy("skipped-lines-row-1-3").within(() => {
cy.contains("All").click();
});
cy.dataCy("collapsed-row-1-3").should("not.exist");
cy.dataCy("skipped-lines-row-1-3").should("not.exist");

cy.toggleDrawer();
cy.dataCy("expanded-row-1-to-3").within(() => {
cy.get(`[aria-label="Delete range"]`).click();
});
cy.dataCy("collapsed-row-1-3").should("exist");
cy.dataCy("skipped-lines-row-1-3").should("exist");
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe("Filtering", () => {
"contain",
`filters=010${filter1},001${filter2}`,
);
cy.get("[data-cy^='collapsed-row-']").should("not.exist");
cy.get("[data-cy^='skipped-lines-row-']").should("not.exist");
});
});

Expand Down Expand Up @@ -187,7 +187,7 @@ describe("Filtering", () => {
"contain",
`filters=010${filter1},001${filter2}`,
);
cy.get("[data-cy^='collapsed-row-']").should("not.exist");
cy.get("[data-cy^='skipped-lines-row-']").should("not.exist");
});
});
});
Expand All @@ -199,7 +199,7 @@ describe("Filtering", () => {
beforeEach(() => {
cy.resetDrawerState();
cy.visit(`${logLink}?filters=100${filter}`);
cy.get("[data-cy^='collapsed-row-']").should("exist");
cy.get("[data-cy^='skipped-lines-row-']").should("exist");
});

it("should be able to edit a filter", () => {
Expand All @@ -221,7 +221,7 @@ describe("Filtering", () => {
cy.get(`[aria-label="Delete filter"]`).click();
});
cy.location("search").should("not.contain", "filters");
cy.get("[data-cy^='collapsed-row-']").should("not.exist");
cy.get("[data-cy^='skipped-lines-row-']").should("not.exist");
});
});
});
12 changes: 6 additions & 6 deletions apps/parsley/cypress/integration/resmokeLogs/resmoke_logView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,35 +213,35 @@ describe("expanding collapsed rows", () => {
cy.dataCy("log-row-2").should("not.exist");
cy.dataCy("log-row-3").should("not.exist");

cy.dataCy("collapsed-row-1-3").within(() => {
cy.dataCy("skipped-lines-row-1-3").within(() => {
cy.contains("All").click();
});

cy.dataCy("collapsed-row-1-3").should("not.exist");
cy.dataCy("skipped-lines-row-1-3").should("not.exist");
cy.dataCy("log-row-1").should("be.visible");
cy.dataCy("log-row-2").should("be.visible");
cy.dataCy("log-row-3").should("be.visible");
});

it("should be able to see what rows have been expanded in the drawer", () => {
cy.dataCy("collapsed-row-1-3").within(() => {
cy.dataCy("skipped-lines-row-1-3").within(() => {
cy.contains("All").click();
});
cy.toggleDrawer();
cy.dataCy("expanded-row-1-to-3").should("be.visible");
});

it("should be possible to re-collapse rows through the drawer", () => {
cy.dataCy("collapsed-row-1-3").within(() => {
cy.dataCy("skipped-lines-row-1-3").within(() => {
cy.contains("All").click();
});
cy.dataCy("collapsed-row-1-3").should("not.exist");
cy.dataCy("skipped-lines-row-1-3").should("not.exist");

cy.toggleDrawer();
cy.dataCy("expanded-row-1-to-3").within(() => {
cy.get(`[aria-label="Delete range"]`).click();
});
cy.dataCy("collapsed-row-1-3").should("exist");
cy.dataCy("skipped-lines-row-1-3").should("exist");
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ describe("Searching", () => {

it("should be able to search on filtered content", () => {
cy.addFilter("conn49");
cy.get("[data-cy^='collapsed-row-']").should("exist");
cy.get("[data-cy^='collapsed-row-']").should("have.length", 7);
cy.get("[data-cy^='skipped-lines-row-']").should("exist");
cy.get("[data-cy^='skipped-lines-row-']").should("have.length", 7);

cy.addSearch("NETWORK");
cy.dataCy("search-count").should("be.visible");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ describe("bookmarks bar", () => {
renderWithRouterMatch(
<BookmarksBar
lineCount={5}
processedLogLines={[[0, 1, 2], 3, 4]}
processedLogLines={[
{ range: { end: 3, start: 0 }, rowType: "SkippedLines" },
3,
4,
]}
scrollToLine={scrollToLine}
/>,
{
Expand Down
3 changes: 2 additions & 1 deletion apps/parsley/src/components/BookmarksBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ import Popconfirm from "components/Popconfirm";
import { QueryParams } from "constants/queryParams";
import { size, zIndex } from "constants/tokens";
import { useQueryParam } from "hooks/useQueryParam";
import { ProcessedLogLines } from "types/logs";
import { findLineIndex } from "utils/findLineIndex";

const { gray, green, red } = palette;

interface BookmarksBarProps {
failingLine?: number;
lineCount: number;
processedLogLines: (number | number[])[];
processedLogLines: ProcessedLogLines;
scrollToLine: (scrollIndex: number) => void;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ProcessedLogLines } from "types/logs";
import { getLinesInProcessedLogLinesFromSelectedLines } from "./utils";

describe("getLinesInProcessedLogLinesFromSelectedLines", () => {
Expand All @@ -20,7 +21,13 @@ describe("getLinesInProcessedLogLinesFromSelectedLines", () => {
expect(result).toStrictEqual([2, 3]);
});
it("should not return collapsed lines", () => {
const processedLogLines = [1, 2, [3], 4, 5];
const processedLogLines: ProcessedLogLines = [
1,
2,
{ range: { end: 4, start: 3 }, rowType: "SkippedLines" },
4,
5,
];
const selectedLines = { endingLine: 4, startingLine: 2 };
const result = getLinesInProcessedLogLinesFromSelectedLines(
processedLogLines,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ProcessedLogLines, SelectedLineRange } from "types/logs";
import { isCollapsedRow } from "utils/collapsedRow";
import { findLineIndex } from "utils/findLineIndex";
import { isCollapsedRow } from "utils/logRowTypes";

const getLinesInProcessedLogLinesFromSelectedLines = (
processedLogLines: ProcessedLogLines,
Expand Down
10 changes: 5 additions & 5 deletions apps/parsley/src/components/LogRow/RowRenderer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { LogRenderingTypes } from "constants/enums";
import { useLogContext } from "context/LogContext";
import { useHighlightParam } from "hooks/useHighlightParam";
import { ProcessedLogLines } from "types/logs";
import { isCollapsedRow } from "utils/collapsedRow";
import { isSkippedLinesRow } from "utils/logRowTypes";
import AnsiRow from "../AnsiRow";
import CollapsedRow from "../CollapsedRow";
import ResmokeRow from "../ResmokeRow";
import SkippedLinesRow from "../SkippedLinesRow";

type RowRendererFunction = (props: {
processedLogLines: ProcessedLogLines;
Expand Down Expand Up @@ -55,12 +55,12 @@ const ParsleyRow: RowRendererFunction = ({ processedLogLines }) => {

const result = (index: number) => {
const processedLogLine = processedLogLines[index];
if (isCollapsedRow(processedLogLine)) {
if (isSkippedLinesRow(processedLogLine)) {
return (
<CollapsedRow
collapsedLines={processedLogLine}
<SkippedLinesRow
expandLines={expandLines}
lineIndex={index}
range={processedLogLine.range}
/>
);
}
Expand Down
Loading

0 comments on commit 9dd3eff

Please sign in to comment.