Skip to content

Dashboard search, display most recent dashboards first, display who created dashboard#259

Open
vkarpov15 wants to merge 1 commit into
mainfrom
vkarpov15/dashboards
Open

Dashboard search, display most recent dashboards first, display who created dashboard#259
vkarpov15 wants to merge 1 commit into
mainfrom
vkarpov15/dashboards

Conversation

@vkarpov15
Copy link
Copy Markdown
Member

Fix #253

image

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
studio Ready Ready Preview, Comment Jun 4, 2026 7:53pm

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5acddb8729

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

await authorize('Dashboard.getDashboards', roles);

const dashboards = await Dashboard.find();
const dashboards = await Dashboard.find().sort({ createdAt: -1, _id: -1 }).lean();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Sort legacy dashboards after deriving createdAt

For legacy dashboards that do not have createdAt, the schema derives and persists createdAt only in the post-find hook, but this MongoDB sort has already happened by then. In a mixed collection, a recently created legacy dashboard with no createdAt sorts below every dashboard that has any createdAt value, so the dashboard list is not actually newest-first until after that document has been backfilled by a prior request.

Useful? React with 👍 / 👎.

await authorize('Dashboard.createDashboard', roles);

const dashboard = await Dashboard.create({ title, code });
console.log('Test', params)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Remove creation parameter logging

Every dashboard creation now logs the full params object, which includes the dashboard code and the authenticated user's details when running with an API key. In production this can leak proprietary dashboard scripts or user PII into server logs, and the log line appears unrelated to the returned result.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the Dashboards UX and metadata by adding client-side search, ordering dashboards with the most recently created first, and persisting/displaying additional dashboard metadata (creator info and last evaluation time). It also adds/updates tests to validate the new sorting and persistence behavior.

Changes:

  • Add dashboard list search UI with match highlighting and empty-state messaging.
  • Sort dashboards newest-first and persist lastEvaluatedAt on evaluation completion.
  • Store creator metadata (createdById + createdBy) when dashboards are created, with new test coverage.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
test/Dashboard.getDashboards.test.js Adds tests for newest-first ordering, legacy createdAt derivation, and creator persistence.
test/Dashboard.getDashboard.results.test.js Verifies lastEvaluatedAt is persisted to the dashboard when evaluations complete.
frontend/src/dashboards/dashboards.js Adds search state, filtering, highlighting helpers, date/user formatting, and inserts new dashboards at the top.
frontend/src/dashboards/dashboards.html Adds the search input, “no matches” state, switches list rendering to filtered dashboards, and displays metadata fields.
express.js Propagates initiating user info into request internals for downstream actions.
backend/next.js Propagates initiating user info into action params for Next.js deployments.
backend/netlify.js Propagates initiating user info into action params for Netlify deployments.
backend/db/dashboardSchema.js Adds creator + evaluation fields and attempts legacy createdAt backfill via a query post-hook.
backend/actions/Dashboard/getDashboards.js Sorts dashboards by newest first and returns lean objects.
backend/actions/Dashboard/getDashboard.js Updates dashboard lastEvaluatedAt when an evaluation finishes.
backend/actions/Dashboard/createDashboard.js Persists creator fields when creating a new dashboard.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +34 to +38
await this.model.db.model('__Studio_Dashboard').updateOne(
{ _id: dashboard._id },
{ createdAt: dashboard._id.getTimestamp() },
{ overwriteImmutable: true }
);
Comment on lines +31 to +38
console.log('Test', params)

const dashboard = await Dashboard.create({
title,
code,
createdById: initiatedById,
createdBy: params.initiatedBy
});
Comment on lines +18 to +28
filteredDashboards() {
const searchText = this.searchText.trim().toLowerCase();
if (!searchText) {
return this.dashboards;
}

return this.dashboards.filter(dashboard => {
return (dashboard.title || '').toLowerCase().includes(searchText) ||
(dashboard.description || '').toLowerCase().includes(searchText);
});
}
Comment on lines +88 to +91
<div v-show="dashboard.createdBy">
<dt class="font-medium text-content-secondary">Created By</dt>
<dd class="truncate">{{ dashboard.createdBy?.name }}</dd>
</div>
Comment thread express.js
req._internals.initiatedById = user._id;
req._internals.roles = roles;
req._internals.$workspaceId = workspace._id;
req._internals.initiatedBy = user;
Comment thread backend/next.js
params.roles = roles;
params.userId = user._id;
params.initiatedById = user._id;
params.initiatedBy = user;
Comment thread backend/netlify.js
params.roles = roles;
params.userId = user._id;
params.initiatedById = user._id;
params.initiatedBy = user;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dashboard search

2 participants