Skip to content

Commit 71d216d

Browse files
authored
Merge pull request #475 from easyops-cn/steve/sidebar
fix(): space objects settings
2 parents e648ff5 + 636e3ab commit 71d216d

File tree

7 files changed

+47
-9
lines changed

7 files changed

+47
-9
lines changed
Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
11
构件 `ai-portal.chat-panel`
22

3+
## 介绍
4+
5+
弹出式 AI 对话面板,提供一个模态框样式的聊天界面,支持与 AI 助手进行对话交互。
6+
37
## Examples
48

59
### Basic
610

711
```yaml preview
8-
brick: ai-portal.chat-panel
9-
properties:
10-
textContent: Hello world
12+
- brick: eo-button
13+
properties:
14+
themeVariant: elevo
15+
textContent: 打开对话面板
16+
events:
17+
click:
18+
target: "#chatPanel"
19+
method: open
20+
- brick: ai-portal.chat-panel
21+
properties:
22+
id: chatPanel
23+
width: 600
24+
height: 800
25+
panelTitle: AI 助手
26+
placeholder: 请输入您的问题...
1127
```

bricks/ai-portal/src/chat-panel/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ const { defineElement, property, method } = createDecorators();
5959

6060
export interface ChatPanelProps {
6161
panelTitle?: string;
62-
mode?: "drawer" | "modal" | "fullscreen";
6362
width?: string | number;
6463
height?: string | number;
6564
placeholder?: string;
@@ -69,7 +68,7 @@ export interface ChatPanelProps {
6968
const ChatPanelComponent = forwardRef(LegacyChatPanelComponent);
7069

7170
/**
72-
* 弹出式对话面板,支持三种显示模式:抽屉、弹窗、全屏
71+
* 弹出式对话面板。
7372
*/
7473
export
7574
@defineElement("ai-portal.chat-panel", {

bricks/ai-portal/src/elevo-sidebar/SpaceNav.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ import { K, t } from "./i18n.js";
55
import { WrappedIcon, WrappedIconButton, WrappedLink } from "./bricks.js";
66
import { NavLink } from "./NavLink.js";
77
import type { SidebarLink } from "./interfaces.js";
8-
import { ADD_ICON } from "./constants.js";
8+
import { ADD_ICON, SETTINGS_ICON } from "./constants.js";
9+
import { getHistory } from "@next-core/runtime";
910

1011
export interface SpaceNavProps {
1112
returnUrl: string;
13+
introUrl: string;
1214
spaceDetail: {
1315
instanceId: string;
1416
name: string;
@@ -24,6 +26,7 @@ export interface SpaceNavComponentProps extends SpaceNavProps {
2426

2527
export function SpaceNav({
2628
returnUrl,
29+
introUrl,
2730
spaceDetail,
2831
spaceObjects,
2932
spaceServiceflows,
@@ -45,7 +48,7 @@ export function SpaceNav({
4548
</WrappedLink>
4649
<div className="divider" />
4750
<div className="history" ref={rootRef}>
48-
{spaceObjects?.length ? (
51+
{spaceObjects ? (
4952
<div
5053
className={classNames("section", { collapsed: objectsCollapsed })}
5154
>
@@ -54,7 +57,16 @@ export function SpaceNav({
5457
title={t(K.BUSINESS_OBJECTS)}
5558
collapsed={objectsCollapsed}
5659
onToggle={() => setObjectsCollapsed((prev) => !prev)}
57-
/>
60+
>
61+
<WrappedIconButton
62+
icon={SETTINGS_ICON}
63+
variant="mini-light"
64+
tooltip={t(K.BUSINESS_OBJECTS_SETTINGS)}
65+
tooltipHoist={true}
66+
className="button"
67+
onClick={() => getHistory().push(introUrl)}
68+
/>
69+
</SectionTitle>
5870
<ul className="items">
5971
{spaceObjects.map((obj, index) => (
6072
<li key={index}>
@@ -75,7 +87,7 @@ export function SpaceNav({
7587
</ul>
7688
</div>
7789
) : null}
78-
{spaceServiceflows?.length ? (
90+
{spaceServiceflows ? (
7991
<div
8092
className={classNames("section", {
8193
collapsed: serviceflowsCollapsed,

bricks/ai-portal/src/elevo-sidebar/constants.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,8 @@ export const ADD_ICON: GeneralIconProps = {
44
lib: "fa",
55
icon: "plus",
66
};
7+
8+
export const SETTINGS_ICON: GeneralIconProps = {
9+
lib: "lucide",
10+
icon: "settings",
11+
};

bricks/ai-portal/src/elevo-sidebar/i18n.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export enum K {
1919
SERVICEFLOWS = "SERVICEFLOWS",
2020
COLLABORATION_SPACES = "COLLABORATION_SPACES",
2121
CREATE_SERVICEFLOW = "CREATE_SERVICEFLOW",
22+
BUSINESS_OBJECTS_SETTINGS = "BUSINESS_OBJECTS_SETTINGS",
2223
}
2324

2425
const en: Locale = {
@@ -40,6 +41,7 @@ const en: Locale = {
4041
[K.SERVICEFLOWS]: "Serviceflows",
4142
[K.COLLABORATION_SPACES]: "Collaboration spaces",
4243
[K.CREATE_SERVICEFLOW]: "Create serviceflow",
44+
[K.BUSINESS_OBJECTS_SETTINGS]: "Business objects settings",
4345
};
4446

4547
const zh: Locale = {
@@ -61,6 +63,7 @@ const zh: Locale = {
6163
[K.SERVICEFLOWS]: "业务流",
6264
[K.COLLABORATION_SPACES]: "协作空间",
6365
[K.CREATE_SERVICEFLOW]: "创建业务流",
66+
[K.BUSINESS_OBJECTS_SETTINGS]: "业务对象设置",
6467
};
6568

6669
export const NS = "bricks/ai-portal/elevo-sidebar";

bricks/ai-portal/src/elevo-sidebar/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ import { NavLink } from "./NavLink.js";
3838
import type { SidebarLink } from "./interfaces.js";
3939
import { SpaceNav, type SpaceNavProps } from "./SpaceNav.js";
4040

41+
export type { SidebarLink, SpaceNavProps };
42+
4143
initializeI18n(NS, locales);
4244

4345
const SIDEBAR_ICON: GeneralIconProps = {

bricks/ai-portal/src/jsx.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ declare global {
191191
onProjectActionClick?: (
192192
event: CustomEvent<ProjectActionClickDetail>
193193
) => void;
194+
onAddServiceflow?: (event: CustomEvent<void>) => void;
194195
onPersonalActionClick?: (
195196
event: CustomEvent<PersonalActionClickDetail>
196197
) => void;

0 commit comments

Comments
 (0)