mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-09 12:40:59 +00:00
Merge remote-tracking branch 'origin/master' into deploy/prod-tooltip-2390
This commit is contained in:
@@ -543,33 +543,19 @@ function NavItems({
|
|||||||
if (config.id === 'add-extension' && !canManageResources) {
|
if (config.id === 'add-extension' && !canManageResources) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const quota =
|
|
||||||
config.id === 'add-extension'
|
|
||||||
? quotaStatus.extensions
|
|
||||||
: UNLIMITED_QUOTA;
|
|
||||||
// Non-entity entries (e.g. monitoring and the extension market) render as plain links.
|
// Non-entity entries (e.g. monitoring and the extension market) render as plain links.
|
||||||
return (
|
return (
|
||||||
<SidebarMenuItem key={config.id}>
|
<SidebarMenuItem key={config.id}>
|
||||||
<WorkspaceQuotaTooltip
|
<SidebarMenuButton
|
||||||
quota={quota}
|
isActive={selectedChild?.id === config.id}
|
||||||
resource={config.name}
|
onClick={() => onChildClick(config)}
|
||||||
side="right"
|
tooltip={config.name}
|
||||||
>
|
>
|
||||||
<SidebarMenuButton
|
{config.icon}
|
||||||
isActive={selectedChild?.id === config.id}
|
<span className="cursor-pointer select-none">
|
||||||
onClick={() => {
|
{config.name}
|
||||||
if (!quota.disabled) onChildClick(config);
|
</span>
|
||||||
}}
|
</SidebarMenuButton>
|
||||||
disabled={quota.disabled}
|
|
||||||
aria-disabled={quota.disabled}
|
|
||||||
tooltip={quota.disabled ? undefined : config.name}
|
|
||||||
>
|
|
||||||
{config.icon}
|
|
||||||
<span className="cursor-pointer select-none">
|
|
||||||
{config.name}
|
|
||||||
</span>
|
|
||||||
</SidebarMenuButton>
|
|
||||||
</WorkspaceQuotaTooltip>
|
|
||||||
</SidebarMenuItem>
|
</SidebarMenuItem>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export function WorkspaceQuotaTooltip({
|
|||||||
{children}
|
{children}
|
||||||
</span>
|
</span>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipContent side={side} className="max-w-72 text-center">
|
<TooltipContent side={side} className="max-w-72 text-left">
|
||||||
{message}
|
{message}
|
||||||
</TooltipContent>
|
</TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|||||||
+1
-1
@@ -399,7 +399,7 @@ export default function PluginMarketCardComponent({
|
|||||||
<TooltipProvider delayDuration={200}>
|
<TooltipProvider delayDuration={200}>
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger asChild>{cardContent}</TooltipTrigger>
|
<TooltipTrigger asChild>{cardContent}</TooltipTrigger>
|
||||||
<TooltipContent side="top" className="max-w-72 text-center">
|
<TooltipContent side="top" className="max-w-72 text-left">
|
||||||
{installDisabledTooltip}
|
{installDisabledTooltip}
|
||||||
</TooltipContent>
|
</TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ test('quota-reached create actions are disabled and explain the current limit',
|
|||||||
await expect(botCreate).toBeDisabled();
|
await expect(botCreate).toBeDisabled();
|
||||||
await expect(pipelineCreate).toBeDisabled();
|
await expect(pipelineCreate).toBeDisabled();
|
||||||
await expect(knowledgeCreate).toBeDisabled();
|
await expect(knowledgeCreate).toBeDisabled();
|
||||||
await expect(addExtension).toBeDisabled();
|
await expect(addExtension).toBeEnabled();
|
||||||
|
|
||||||
const botQuotaTrigger = botCreate.locator('..');
|
const botQuotaTrigger = botCreate.locator('..');
|
||||||
await botQuotaTrigger.hover();
|
await botQuotaTrigger.hover();
|
||||||
@@ -136,7 +136,8 @@ test('quota-reached create actions are disabled and explain the current limit',
|
|||||||
),
|
),
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
|
|
||||||
await page.goto('/home/add-extension');
|
await addExtension.click();
|
||||||
|
await expect(page).toHaveURL(/\/home\/add-extension$/);
|
||||||
const manualAdd = page.getByRole('button', { name: 'Manual Add' });
|
const manualAdd = page.getByRole('button', { name: 'Manual Add' });
|
||||||
await expect(manualAdd).toBeDisabled();
|
await expect(manualAdd).toBeDisabled();
|
||||||
await manualAdd.locator('..').hover();
|
await manualAdd.locator('..').hover();
|
||||||
|
|||||||
@@ -63,7 +63,13 @@ test('sidebar quota-disables create controls and renders a tooltip', () => {
|
|||||||
assert.match(tooltip, /limitation\.createDisabledTooltip/);
|
assert.match(tooltip, /limitation\.createDisabledTooltip/);
|
||||||
assert.match(tooltip, /limitation\.quotaLoadingTooltip/);
|
assert.match(tooltip, /limitation\.quotaLoadingTooltip/);
|
||||||
assert.match(tooltip, /tabIndex=\{0\}/);
|
assert.match(tooltip, /tabIndex=\{0\}/);
|
||||||
|
assert.match(tooltip, /max-w-72 text-left/);
|
||||||
|
assert.doesNotMatch(tooltip, /text-center/);
|
||||||
assert.match(source, /config\.id === 'add-extension'/);
|
assert.match(source, /config\.id === 'add-extension'/);
|
||||||
|
assert.doesNotMatch(
|
||||||
|
source,
|
||||||
|
/config\.id === 'add-extension'\s*\?\s*quotaStatus\.extensions/,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('add-extension page disables all install entry points at the quota', () => {
|
test('add-extension page disables all install entry points at the quota', () => {
|
||||||
@@ -80,6 +86,8 @@ test('add-extension page disables all install entry points at the quota', () =>
|
|||||||
assert.match(card, /installDisabled/);
|
assert.match(card, /installDisabled/);
|
||||||
assert.match(card, /disabled=\{installDisabled\}/);
|
assert.match(card, /disabled=\{installDisabled\}/);
|
||||||
assert.match(card, /TooltipContent/);
|
assert.match(card, /TooltipContent/);
|
||||||
|
assert.match(card, /max-w-72 text-left/);
|
||||||
|
assert.doesNotMatch(card, /max-w-72 text-center/);
|
||||||
assert.match(recommendations, /installDisabled=\{installDisabled\}/);
|
assert.match(recommendations, /installDisabled=\{installDisabled\}/);
|
||||||
assert.match(
|
assert.match(
|
||||||
recommendations,
|
recommendations,
|
||||||
|
|||||||
Reference in New Issue
Block a user