refactor(core): Move the chat link (no-changelog) (#22812)

This commit is contained in:
Jaakko Husso
2025-12-05 15:01:54 +02:00
committed by GitHub
parent 28c3018c95
commit 1d952014d8
2 changed files with 22 additions and 11 deletions

View File

@@ -28,7 +28,6 @@ import {
EXPERIMENT_TEMPLATES_DATA_QUALITY_KEY,
} from '@/app/constants';
import { EXTERNAL_LINKS } from '@/app/constants/externalLinks';
import { CHAT_VIEW } from '@/features/ai/chatHub/constants';
import { hasPermission } from '@/app/utils/rbac/permissions';
import { useCloudPlanStore } from '@/app/stores/cloudPlan.store';
import { useRootStore } from '@n8n/stores/useRootStore';
@@ -117,16 +116,6 @@ const mainMenuItems = computed<IMenuItem[]>(() => [
icon: 'cloud',
available: settingsStore.isCloudDeployment && hasPermission(['instanceOwner']),
},
{
id: 'chat',
icon: 'message-circle',
label: 'Chat',
position: 'bottom',
route: { to: { name: CHAT_VIEW } },
available:
settingsStore.isChatFeatureEnabled &&
hasPermission(['rbac'], { rbac: { scope: 'chatHub:message' } }),
},
{
// Link to in-app pre-built agent templates, available experiment is enabled
id: 'templates',

View File

@@ -9,8 +9,10 @@ import { useI18n } from '@n8n/i18n';
import { computed, onBeforeMount, onBeforeUnmount } from 'vue';
import { useProjectsStore } from '../projects.store';
import type { ProjectListItem } from '../projects.types';
import { CHAT_VIEW } from '@/features/ai/chatHub/constants';
import { N8nButton, N8nHeading, N8nMenuItem, N8nTooltip } from '@n8n/design-system';
import { hasPermission } from '@/app/utils/rbac/permissions';
type Props = {
collapsed: boolean;
@@ -29,6 +31,11 @@ const usersStore = useUsersStore();
const isCreatingProject = computed(() => globalEntityCreation.isCreatingProject.value);
const displayProjects = computed(() => globalEntityCreation.displayProjects.value);
const isFoldersFeatureEnabled = computed(() => settingsStore.isFoldersFeatureEnabled);
const isChatLinkAvailable = computed(
() =>
settingsStore.isChatFeatureEnabled &&
hasPermission(['rbac'], { rbac: { scope: 'chatHub:message' } }),
);
const hasMultipleVerifiedUsers = computed(
() => usersStore.allUsers.filter((user) => !user.isPendingUser).length > 1,
);
@@ -87,6 +94,14 @@ const activeTabId = computed(() => {
);
});
const chat = computed<IMenuItem>(() => ({
id: 'chat',
icon: 'message-circle',
label: 'Chat',
position: 'bottom',
route: { to: { name: CHAT_VIEW } },
}));
async function onSourceControlPull() {
// Update myProjects for the sidebar display
await projectsStore.getMyProjects();
@@ -128,6 +143,13 @@ onBeforeUnmount(() => {
:active="activeTabId === 'shared'"
data-test-id="project-shared-menu-item"
/>
<N8nMenuItem
v-if="isChatLinkAvailable"
:item="chat"
:compact="props.collapsed"
:active="activeTabId === 'chat'"
data-test-id="project-chat-menu-item"
/>
</div>
<N8nHeading
v-if="!props.collapsed && projectsStore.isTeamProjectFeatureEnabled"