mirror of
https://github.com/n8n-io/n8n.git
synced 2025-12-05 19:27:26 -06:00
refactor(core): Move the chat link (no-changelog) (#22812)
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user