-
Notifications
You must be signed in to change notification settings - Fork 195
feat: show project Go to Settings for credential queries #2526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: show project Go to Settings for credential queries #2526
Conversation
|
This PR was not deployed automatically as @HarshMN2345 does not have access to the Railway project. In order to get automatic PR deploys, please add @HarshMN2345 to your workspace on Railway. |
ConsoleProject ID: Tip Appwrite has a Discord community with over 16 000 members. |
WalkthroughThis pull request enhances the project search functionality and improves text truncation parameter handling. The projects searcher now detects credential-related query terms to short-circuit to Settings navigation, retrieves API endpoints for richer searchable context, and implements tokenized filtering across project name, ID, region, and endpoint fields. Simultaneously, the truncateText action is extended to accept optional text parameters, allowing callers to provide initial text and updates without relying solely on node.textContent, with regionEndpoint updated to pass region names to the action. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Areas requiring extra attention:
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/lib/commandCenter/searchers/projects.ts (1)
56-70: Consider usingmapinstead offlatMapfor clarity.Since each project produces exactly one navigation item, using
mapinstead offlatMapwould be more direct and slightly more efficient.- .flatMap((project) => { + .map((project) => { const href = `${base}/project-${project.region}-${project.$id}`; const label = project.name; - return [ - { - label, - callback: () => { - goto(href); - }, - group: 'projects' - } - ]; + return { + label, + callback: () => { + goto(href); + }, + group: 'projects' + }; });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/lib/commandCenter/searchers/projects.ts(1 hunks)src/lib/components/id.svelte(2 hunks)src/lib/components/regionEndpoint.svelte(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/lib/commandCenter/searchers/projects.ts (3)
src/routes/(console)/project-[region]-[project]/store.ts (1)
project(11-11)src/lib/stores/sdk.ts (2)
sdk(153-176)getApiEndpoint(47-59)src/lib/stores/organization.ts (1)
organization(62-62)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: build
- GitHub Check: e2e
🔇 Additional comments (2)
src/lib/components/regionEndpoint.svelte (1)
41-41: LGTM! Correctly leverages updatedtruncateTextsignature.Passing
region?.nameexplicitly to the action enables proper reactive truncation when the region changes, and the optional chaining safely handles undefined cases.src/lib/components/id.svelte (1)
32-33: LGTM! Backward-compatible enhancement for explicit text management.The optional parameters enable callers to explicitly provide text for truncation while maintaining backward compatibility with existing usage that relies on
node.textContent. Theupdatemethod correctly receives new text values from Svelte's action lifecycle when parameters change.Also applies to: 73-74
| export function truncateText(node: HTMLElement, text?: string) { | ||
| let originalText = text ?? node.textContent; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this needed? 🤔
actions should always work with elements and usually shouldnt have a new context passed 👍🏻
| const q = query.toLowerCase().trim(); | ||
| const wantsCredentials = | ||
| q.includes('endpoint') || | ||
| q.includes('api key') || | ||
| q.includes('api-key') || | ||
| q.includes('apikey') || | ||
| q.includes('project id') || | ||
| q.includes('project-id') || | ||
| q === 'id' || | ||
| q.endsWith(' id') || | ||
| q.startsWith('end') || | ||
| q.includes('api end') || | ||
| (q.includes('api') && q.includes('end')); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can make this simpler:
const keywords = [
'endpoint',
'api key',
'api-key',
'apikey',
'project id',
'project-id',
'api end'
];
const wantsCredentials = keywords.some(k => q.includes(k));something like this maybe
| } as const; | ||
| .filter((project) => { | ||
| const endpoint = getApiEndpoint(project.region); | ||
| const searchable = [project.name, project.$id, project.region, endpoint] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i dont think we need the endpoint here 👍🏻
| .flatMap((project) => { | ||
| const href = `${base}/project-${project.region}-${project.$id}`; | ||
|
|
||
| const label = project.name; | ||
|
|
||
| return [ | ||
| { | ||
| label, | ||
| callback: () => { | ||
| goto(href); | ||
| }, | ||
| group: 'projects' | ||
| } | ||
| ]; | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| .flatMap((project) => { | |
| const href = `${base}/project-${project.region}-${project.$id}`; | |
| const label = project.name; | |
| return [ | |
| { | |
| label, | |
| callback: () => { | |
| goto(href); | |
| }, | |
| group: 'projects' | |
| } | |
| ]; | |
| }); | |
| .map((project) => { | |
| const href = `${base}/project-${project.region}-${project.$id}`; | |
| const label = project.name; | |
| return { | |
| label, | |
| callback: () => { | |
| goto(href); | |
| }, | |
| group: 'projects' | |
| }; | |
| }); |
why flatmap over map?
What does this PR do?
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)
Related PRs and Issues
(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)
Have you read the Contributing Guidelines on issues?
(Write your answer here.)
Summary by CodeRabbit
New Features
Improvements