mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-18 23:07:02 +08:00
fix(core): handle uncaught ai flag (#8663)
This commit is contained in:
@@ -7,6 +7,7 @@ import { EditorOutlineViewer } from '@affine/core/components/blocksuite/outline-
|
|||||||
import { DocPropertySidebar } from '@affine/core/components/doc-properties/sidebar';
|
import { DocPropertySidebar } from '@affine/core/components/doc-properties/sidebar';
|
||||||
import { useAppSettingHelper } from '@affine/core/components/hooks/affine/use-app-setting-helper';
|
import { useAppSettingHelper } from '@affine/core/components/hooks/affine/use-app-setting-helper';
|
||||||
import { useDocMetaHelper } from '@affine/core/components/hooks/use-block-suite-page-meta';
|
import { useDocMetaHelper } from '@affine/core/components/hooks/use-block-suite-page-meta';
|
||||||
|
import { ServerConfigService } from '@affine/core/modules/cloud';
|
||||||
import { EditorService } from '@affine/core/modules/editor';
|
import { EditorService } from '@affine/core/modules/editor';
|
||||||
import { RecentDocsService } from '@affine/core/modules/quicksearch';
|
import { RecentDocsService } from '@affine/core/modules/quicksearch';
|
||||||
import { ViewService } from '@affine/core/modules/workbench/services/view';
|
import { ViewService } from '@affine/core/modules/workbench/services/view';
|
||||||
@@ -69,6 +70,7 @@ const DetailPageImpl = memo(function DetailPageImpl() {
|
|||||||
workspaceService,
|
workspaceService,
|
||||||
globalContextService,
|
globalContextService,
|
||||||
featureFlagService,
|
featureFlagService,
|
||||||
|
serverConfigService,
|
||||||
} = useServices({
|
} = useServices({
|
||||||
WorkbenchService,
|
WorkbenchService,
|
||||||
ViewService,
|
ViewService,
|
||||||
@@ -77,6 +79,7 @@ const DetailPageImpl = memo(function DetailPageImpl() {
|
|||||||
WorkspaceService,
|
WorkspaceService,
|
||||||
GlobalContextService,
|
GlobalContextService,
|
||||||
FeatureFlagService,
|
FeatureFlagService,
|
||||||
|
ServerConfigService,
|
||||||
});
|
});
|
||||||
const workbench = workbenchService.workbench;
|
const workbench = workbenchService.workbench;
|
||||||
const editor = editorService.editor;
|
const editor = editorService.editor;
|
||||||
@@ -104,6 +107,12 @@ const DetailPageImpl = memo(function DetailPageImpl() {
|
|||||||
|
|
||||||
const t = useI18n();
|
const t = useI18n();
|
||||||
|
|
||||||
|
const serverFeatures = useLiveData(
|
||||||
|
serverConfigService.serverConfig.features$
|
||||||
|
);
|
||||||
|
const enableAI =
|
||||||
|
serverFeatures?.copilot && featureFlagService.flags.enable_ai.value;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isActiveView) {
|
if (isActiveView) {
|
||||||
setActiveBlockSuiteEditor(editorContainer);
|
setActiveBlockSuiteEditor(editorContainer);
|
||||||
@@ -281,7 +290,7 @@ const DetailPageImpl = memo(function DetailPageImpl() {
|
|||||||
</div>
|
</div>
|
||||||
</ViewBody>
|
</ViewBody>
|
||||||
|
|
||||||
{featureFlagService.flags.enable_ai.value && (
|
{enableAI && (
|
||||||
<ViewSidebarTab
|
<ViewSidebarTab
|
||||||
tabId="chat"
|
tabId="chat"
|
||||||
icon={<AiIcon />}
|
icon={<AiIcon />}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
import { expect } from '@playwright/test';
|
import { expect } from '@playwright/test';
|
||||||
|
|
||||||
test('Click ai-land icon', async ({ page }) => {
|
test('Click ai-land icon', async ({ page }) => {
|
||||||
|
test.skip(process.env.CI !== undefined, 'Skip test in CI');
|
||||||
await openHomePage(page);
|
await openHomePage(page);
|
||||||
await waitForEditorLoad(page);
|
await waitForEditorLoad(page);
|
||||||
await clickNewPageButton(page);
|
await clickNewPageButton(page);
|
||||||
|
|||||||
@@ -220,9 +220,12 @@ test('check if added property is also in workspace settings', async ({
|
|||||||
}) => {
|
}) => {
|
||||||
await addCustomProperty(page, page, 'text');
|
await addCustomProperty(page, page, 'text');
|
||||||
await openWorkspaceProperties(page);
|
await openWorkspaceProperties(page);
|
||||||
await expect(
|
const settingModal = page.locator('[data-testid=setting-modal-content]');
|
||||||
page.locator('[data-testid=doc-property-manager-item]:has-text("Text")')
|
const item = settingModal.locator(
|
||||||
).toBeVisible();
|
'[data-testid=doc-property-manager-item]:has-text("Text")'
|
||||||
|
);
|
||||||
|
await item.waitFor({ state: 'attached' });
|
||||||
|
await expect(item).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('edit property name', async ({ page }) => {
|
test('edit property name', async ({ page }) => {
|
||||||
@@ -243,9 +246,12 @@ test('edit property name', async ({ page }) => {
|
|||||||
|
|
||||||
// check if the property name is also updated in workspace settings
|
// check if the property name is also updated in workspace settings
|
||||||
await openWorkspaceProperties(page);
|
await openWorkspaceProperties(page);
|
||||||
await expect(
|
const settingModal = page.locator('[data-testid=setting-modal-content]');
|
||||||
page.locator('[data-testid=doc-property-manager-item]:has-text("New Text")')
|
const item = settingModal.locator(
|
||||||
).toBeVisible();
|
'[data-testid=doc-property-manager-item]:has-text("New Text")'
|
||||||
|
);
|
||||||
|
await item.waitFor({ state: 'attached' });
|
||||||
|
await expect(item).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('delete property via property popup', async ({ page }) => {
|
test('delete property via property popup', async ({ page }) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user