Skip to content
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
14c1b46
mongocdc prototype functionality
AVMatthews Apr 9, 2025
a16c7db
merged main
AVMatthews Apr 9, 2025
56b1bf9
first round of linting and reorganization of the server
AVMatthews Apr 10, 2025
dd08d56
just mongo framework server
AVMatthews Apr 10, 2025
a4e9f0f
fix build issue
AVMatthews Apr 10, 2025
1b29ad2
fix file changes
AVMatthews Apr 10, 2025
e30e019
fix file changes
AVMatthews Apr 10, 2025
e37d2d2
fix package.json
AVMatthews Apr 10, 2025
655024b
build: update package-lock.json to include socket.io and related depe…
junhaoliao Apr 10, 2025
2945389
chore: move MongoReplicaServerPlugin and related source files into a …
junhaoliao Apr 10, 2025
e64a375
fix(app): Register MongoReplicaServer only if not in test environment.
junhaoliao Apr 10, 2025
cc24dd2
fix: instead of returning callback(), invoke the callback then return.
junhaoliao Apr 10, 2025
98643f0
fix: update CollectionInitPayload type definition to inline object st…
junhaoliao Apr 11, 2025
61fb259
refactor: use # for labelling private properties.
junhaoliao Apr 11, 2025
8626745
reorder
junhaoliao Apr 11, 2025
738f4a4
refactor: define event handler types and update listener signatures
junhaoliao Apr 11, 2025
f8d58b6
refactor: update event handler types and listener implementations for…
junhaoliao Apr 11, 2025
e1f3f55
refactor: remove unused collection::find::toArray listener and its ha…
junhaoliao Apr 11, 2025
d9e409e
refactor: change #mongoDb to readonly for better immutability
junhaoliao Apr 11, 2025
5dc6052
Documentation and add subscriber count the watcher map
AVMatthews Apr 12, 2025
c7c49ba
linting
AVMatthews Apr 12, 2025
fdf6286
reorganize, debounce updates, enable multiple finds per collection
AVMatthews Apr 21, 2025
440e459
Fix live updated from watcher and improve unsubscribe process
AVMatthews Apr 26, 2025
24d2bdc
refactor and fix missing updates
AVMatthews Apr 30, 2025
d56bd8a
linting fix
AVMatthews Apr 30, 2025
a0377cf
remove duplicate waatcher listener
AVMatthews Apr 30, 2025
9324170
latest updates
May 5, 2025
fcf11d7
merge main
May 5, 2025
72dd825
fix lint
May 5, 2025
3133b09
latest
May 5, 2025
1562c3f
coderabbit
May 5, 2025
d13f0b7
latest
May 8, 2025
672f9a7
fix lint
May 8, 2025
e590394
fix
May 8, 2025
297b2fc
fix python lint
May 8, 2025
8324ed5
Merge branch 'main' into dmServer
davemarco May 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding @haiqi96 here since the package scripts are changed

@davemarco davemarco May 8, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@haiqi96 , we added an issue to remove this change in the future. But I did test that it works.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not elegant but I don't think it's really an issue.

Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ def start_log_viewer_webui(
container_log_viewer_webui_dir = CONTAINER_CLP_HOME / "var" / "www" / "log-viewer-webui"
node_path = str(container_log_viewer_webui_dir / "server" / "node_modules")
settings_json_path = (
get_clp_home() / "var" / "www" / "log-viewer-webui" / "server" / "dist" / "settings.json"
get_clp_home() / "var" / "www" / "log-viewer-webui" / "server" / "dist" / "server" / "settings.json"
)

validate_log_viewer_webui_config(clp_config, settings_json_path)
Expand Down Expand Up @@ -1027,7 +1027,7 @@ def start_log_viewer_webui(

node_cmd = [
str(CONTAINER_CLP_HOME / "bin" / "node-22"),
str(container_log_viewer_webui_dir / "server" / "dist" / "src" / "main.js"),
str(container_log_viewer_webui_dir / "server" / "dist" / "server" / "src" / "main.js"),
]
cmd = container_cmd + node_cmd
subprocess.run(cmd, stdout=subprocess.DEVNULL, check=True)
Expand Down
84 changes: 84 additions & 0 deletions components/log-viewer-webui/common/index.ts

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

linking #822 here as a future action item (just as a note; we will refactor this with npm workspaces in a separate PR)

Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/**
* Unique ID for each active unique query. Multiple clients can subscribe to the same ID if the
* queries are identical. The ID is also used to represent the socket room, and MongoDB
* change stream.
*/
type QueryId = number;

/**
* Error response to event.
*/
interface Err {
error: string;
queryId?: QueryId;
}

/**
* Success response to event.
*/
interface Success<T> {
data: T;
}

/**
* Event response.
*/
type Response<T> = Err | Success<T>;
Comment thread
davemarco marked this conversation as resolved.
Resolved


/**
* Events that the client can emit to the server.
*/
type ClientToServerEvents = {
"disconnect": () => void;
"collection::init": (
requestArgs: {
collectionName: string;
},
callback: (res: Response<void>) => void
) => void;
"collection::find::subscribe": (
requestArgs: {
query: object;
options: object;
},
callback: (res: Response<{queryId: QueryId; initialDocuments: object[]}>) => void) => void;
Comment on lines +41 to +45

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Use Record<string, unknown> instead of object for stronger typing

object allows values like null, which is unlikely a valid MongoDB query/options object and defeats type-safety. Replacing the two object occurrences with Record<string, unknown> keeps the shape open while preventing accidental null/primitive inputs.

-        requestArgs: {
-            query: object;
-            options: object;
+        requestArgs: {
+            query: Record<string, unknown>;
+            options: Record<string, unknown>;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
requestArgs: {
query: object;
options: object;
},
callback: (res: Response<{queryId: QueryId; initialDocuments: object[]}>) => void) => void;
requestArgs: {
query: Record<string, unknown>;
options: Record<string, unknown>;
},
callback: (res: Response<{queryId: QueryId; initialDocuments: object[]}>) => void) => void;

"collection::find::unsubscribe": (
requestArgs: {
queryId: QueryId;
}
) => Promise<void>;
};

/**
* Events that the server can emit to the client.
*/
interface ServerToClientEvents {
"collection::find::update": (respArgs: {
queryId: QueryId;
data: object[];
}) => void;
}

/**
* Empty but required by Socket IO.
*/
interface InterServerEvents {
}

Comment thread
davemarco marked this conversation as resolved.
Resolved
/**
* Collection associated with each socket connection.
*/
interface SocketData {
collectionName?: string;
}

export {
ClientToServerEvents,
Err,
InterServerEvents,
Response,
ServerToClientEvents,
SocketData,
QueryId
};
2 changes: 2 additions & 0 deletions components/log-viewer-webui/server/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const EslintConfig = [
{
ignores: [
"dist/",
"yscope-log-viewer/dist/",
"client/dist/",
"node_modules/",
],
},
Expand Down
Loading