Skip to content

Commit abf990a

Browse files
authored
fix: add profile arn in user profile subcommand and dashboard (#1430)
* add arn in subcommand * add a description arn in select item * linter
1 parent 9f1a6da commit abf990a

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

crates/q_cli/src/cli/user.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,10 @@ async fn select_profile_interactive(whoami: bool) -> Result<()> {
411411
)?);
412412
}
413413

414-
let mut items: Vec<String> = profiles.iter().map(|p| p.profile_name.clone()).collect();
414+
let mut items: Vec<String> = profiles
415+
.iter()
416+
.map(|p| format!("{} (arn: {})", p.profile_name, p.arn))
417+
.collect();
415418
let active_profile: Option<Profile> = fig_settings::state::get("api.codewhisperer.profile")?;
416419

417420
if let Some(default_idx) = active_profile

packages/dashboard-app/src/components/ui/select.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ SelectLabel.displayName = SelectPrimitive.Label.displayName;
7474

7575
const SelectItem = React.forwardRef<
7676
React.ElementRef<typeof SelectPrimitive.Item>,
77-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
78-
>(({ className, children, ...props }, ref) => (
77+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item> & {
78+
description?: string;
79+
}
80+
>(({ className, children, description, ...props }, ref) => (
7981
<SelectPrimitive.Item
8082
ref={ref}
8183
className={cn(
@@ -91,6 +93,11 @@ const SelectItem = React.forwardRef<
9193
</span>
9294

9395
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
96+
{description && (
97+
<span className="pl-1 text-xs text-muted-foreground break-all">
98+
{description}
99+
</span>
100+
)}
94101
</SelectPrimitive.Item>
95102
));
96103
SelectItem.displayName = SelectPrimitive.Item.displayName;

packages/dashboard-app/src/pages/settings/preferences.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,11 @@ export default function Page() {
113113
<SelectContent>
114114
{profiles &&
115115
profiles.map((p) => (
116-
<SelectItem key={p.arn} value={p.arn}>
116+
<SelectItem
117+
key={p.arn}
118+
value={p.arn}
119+
description={p.arn}
120+
>
117121
{p.profileName}
118122
</SelectItem>
119123
))}

0 commit comments

Comments
 (0)