Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: kirkrodrigues <[email protected]>
  • Loading branch information
davemarco and kirkrodrigues authored Sep 27, 2024
1 parent cf096fa commit 99f4003
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion new-log-viewer/src/components/Editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const Editor = () => {
case ACTION_NAME.PREV_PAGE:
case ACTION_NAME.NEXT_PAGE:
case ACTION_NAME.LAST_PAGE:
loadPageAction(ACTION_NAME.LAST_PAGE);
loadPageAction(actionName);
break;
case ACTION_NAME.PAGE_TOP:
goToPositionAndCenter(editor, {lineNumber: 1, column: 1});
Expand Down
3 changes: 0 additions & 3 deletions new-log-viewer/src/contexts/StateContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@ const StateContextProvider = ({children}: StateContextProviderProps) => {
setLogData(args.logs);
pageNumRef.current = args.pageNum;
beginLineNumToLogEventNumRef.current = args.beginLineNumToLogEventNum;

// Assume page data always provides a valid log event num. i.e. non null and
// inside range.
updateWindowUrlHashParams({
logEventNum: args.logEventNum,
});
Expand Down
6 changes: 4 additions & 2 deletions new-log-viewer/src/services/fileManager/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ const getRange = (
// Clamp ending index using total number of events.
const endLogEventNum: number = Math.min(numEvents, beginLogEventNum + pageSize - 1);

return [beginLogEventNum,
endLogEventNum];
return [
beginLogEventNum,
endLogEventNum,
];
};

/**
Expand Down
4 changes: 2 additions & 2 deletions new-log-viewer/src/typings/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ enum LOG_EVENT_ANCHOR {
/**
* Enum of cursors used for locating some log event and navigating across pages.
* - LAST_EVENT: the last event
* - EVENT_NUM: a specific log event number
* - EVENT_NUM: a specific log event
* - TIMESTAMP: the first event that has a timestamp >= the given value
* - PAGE_NUM: the first or last event on the given page
*/
Expand All @@ -34,7 +34,7 @@ type CursorArgMap = {
[CURSOR_CODE.LAST_EVENT]: null;
[CURSOR_CODE.EVENT_NUM]: { logEventNum: number };
[CURSOR_CODE.TIMESTAMP]: { timestamp: number };
[CURSOR_CODE.PAGE_NUM]: { pageNum: number, logEventAnchor: LOG_EVENT_ANCHOR};
[CURSOR_CODE.PAGE_NUM]: { pageNum: number, logEventAnchor: LOG_EVENT_ANCHOR };
};

type CursorType = {
Expand Down
2 changes: 1 addition & 1 deletion new-log-viewer/src/utils/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as monaco from "monaco-editor/esm/vs/editor/editor.api.js";
import {STATE_DEFAULT} from "../contexts/StateContextProvider";
import {Nullable} from "../typings/common";
import {LOG_EVENT_ANCHOR} from "../typings/worker";
import {clamp} from "../utils/math";
import {clamp} from "./math";


enum ACTION_NAME {
Expand Down

0 comments on commit 99f4003

Please sign in to comment.