This is an automated email from the ASF dual-hosted git repository.
voidmatcha pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zeppelin.git
The following commit(s) were added to refs/heads/master by this push:
new 2127bde97a [ZEPPELIN-6775] Show the Assistant conversation list's
empty state only after a successful load
2127bde97a is described below
commit 2127bde97a90ca170641d450a8e12d6302061fe0
Author: Minho Jang <[email protected]>
AuthorDate: Thu Nov 26 23:04:30 2026 +0900
[ZEPPELIN-6775] Show the Assistant conversation list's empty state only
after a successful load
### What is this PR for?
The AI Assistant conversation list starts with no rows, so it can show **No
conversations yet.** alongside the loading indicator or an error. Neither state
tells the user whether the list is actually empty.
The panel model now supplies the list's data and load state.
`ConversationList` uses that state to render loading, errors, retry, and empty
results. Empty and no-match messages wait for a successful response, but
locally created conversations remain visible while the first request is pending.
### What type of PR is it?
Bug Fix
### What is the Jira issue?
* https://issues.apache.org/jira/browse/ZEPPELIN-6775
### How should this be tested?
From `zeppelin-web-angular/projects/zeppelin-react`, run:
```bash
npm test -- ConversationList.spec.tsx AssistantConversationPanel.spec.tsx
useAssistantPanel.spec.tsx
```
With the initial list response delayed, open the conversation list and
verify that it shows loading without an empty message. If the first request
fails, verify that the error and **Retry** appear and that the empty message
stays hidden while retrying. A successful empty response should show **No
conversations yet.**; a successful non-empty response should show the returned
conversations.
### Questions:
* Does the license files need to update? No.
* Is there breaking changes for older versions? No.
* Does this needs documentation? No.
Closes #5621 from miinhho/ZEPPELIN-6775-assistant-list-empty-state.
Signed-off-by: YONGJAE LEE <[email protected]>
---
.../assistant/model/conversationListState.ts | 21 ++++
.../entities/assistant/ui/ConversationList.css.ts | 18 ++-
.../assistant/ui/ConversationList.spec.tsx | 92 ++++++++++++----
.../assistant/ui/ConversationList.stories.tsx | 5 +-
.../src/entities/assistant/ui/ConversationList.tsx | 122 +++++++++++++--------
.../model/assistantPanelModel.ts | 56 ++++++----
.../model/assistantPanelState.ts | 5 +-
.../model/useAssistantPanel.spec.tsx | 57 +++++-----
.../ui/AssistantConversationPanel.css.ts | 58 +---------
.../ui/AssistantConversationPanel.spec.tsx | 73 +++++++++++-
.../ui/AssistantConversationPanel.tsx | 43 ++------
.../ui/ConversationMessages.tsx | 5 +-
.../ui/DeleteConversationDialog.tsx | 7 +-
.../ui/assistant-theme/AssistantScope.css.ts | 40 +++++++
14 files changed, 379 insertions(+), 223 deletions(-)
diff --git
a/zeppelin-web-angular/projects/zeppelin-react/src/entities/assistant/model/conversationListState.ts
b/zeppelin-web-angular/projects/zeppelin-react/src/entities/assistant/model/conversationListState.ts
new file mode 100644
index 0000000000..a79b9a35c4
--- /dev/null
+++
b/zeppelin-web-angular/projects/zeppelin-react/src/entities/assistant/model/conversationListState.ts
@@ -0,0 +1,21 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import type { AssistantConversation } from './assistantContract';
+
+export interface ConversationListState {
+ readonly conversations: readonly AssistantConversation[];
+ /** A successful response has been applied, independent of local rows or the
latest request. */
+ readonly hasLoaded: boolean;
+ readonly loading: boolean;
+ readonly error: string | undefined;
+}
diff --git
a/zeppelin-web-angular/projects/zeppelin-react/src/entities/assistant/ui/ConversationList.css.ts
b/zeppelin-web-angular/projects/zeppelin-react/src/entities/assistant/ui/ConversationList.css.ts
index 5dead331bb..9583ce0be8 100644
---
a/zeppelin-web-angular/projects/zeppelin-react/src/entities/assistant/ui/ConversationList.css.ts
+++
b/zeppelin-web-angular/projects/zeppelin-react/src/entities/assistant/ui/ConversationList.css.ts
@@ -11,7 +11,7 @@
*/
import { style } from '@vanilla-extract/css';
-import { vars, visuallyHidden } from
'@/shared/ui/assistant-theme/AssistantScope.css';
+import { vars, visuallyHidden, warning } from
'@/shared/ui/assistant-theme/AssistantScope.css';
export { visuallyHidden };
@@ -99,6 +99,22 @@ export const rowMeta = style({
fontSize: vars.fontSizeXs
});
+export const listError = style([
+ warning,
+ {
+ display: 'flex',
+ flexWrap: 'wrap',
+ alignItems: 'center',
+ justifyContent: 'flex-end',
+ gap: vars.space2
+ }
+]);
+
+export const listErrorMessage = style({
+ flex: '1 1 13rem',
+ minWidth: 0
+});
+
export const empty = style({
padding: vars.space4,
textAlign: 'center',
diff --git
a/zeppelin-web-angular/projects/zeppelin-react/src/entities/assistant/ui/ConversationList.spec.tsx
b/zeppelin-web-angular/projects/zeppelin-react/src/entities/assistant/ui/ConversationList.spec.tsx
index 855e56c527..fb52525444 100644
---
a/zeppelin-web-angular/projects/zeppelin-react/src/entities/assistant/ui/ConversationList.spec.tsx
+++
b/zeppelin-web-angular/projects/zeppelin-react/src/entities/assistant/ui/ConversationList.spec.tsx
@@ -13,6 +13,7 @@
import { render, screen, fireEvent, within } from '@testing-library/react';
import { describe, expect, it, vi } from 'vitest';
import type { AssistantConversation } from '../model/assistantContract';
+import type { ConversationListState } from '../model/conversationListState';
import { ConversationList } from './ConversationList';
const NOW = new Date(2026, 9, 15, 12).getTime();
@@ -34,13 +35,21 @@ const conversations: AssistantConversation[] = [
conversation('c', 'Shared analysis', at(9, 9), false)
];
+const resolvedList = (conversations: readonly AssistantConversation[]):
ConversationListState => ({
+ conversations,
+ hasLoaded: true,
+ loading: false,
+ error: undefined
+});
+
const noop = () => {};
describe('ConversationList', () => {
it('shows an empty-list message when there are no conversations', () => {
render(
<ConversationList
- conversations={[]}
+ listState={resolvedList([])}
+ onRetry={noop}
onSelect={noop}
onCreate={noop}
onDelete={noop}
@@ -54,7 +63,8 @@ describe('ConversationList', () => {
it('shows a different message for a search with no matches', () => {
render(
<ConversationList
- conversations={conversations}
+ listState={resolvedList(conversations)}
+ onRetry={noop}
onSelect={noop}
onCreate={noop}
onDelete={noop}
@@ -71,7 +81,8 @@ describe('ConversationList', () => {
it('shows the no-match message for an empty list passed while searching', ()
=> {
render(
<ConversationList
- conversations={[]}
+ listState={resolvedList([])}
+ onRetry={noop}
onSelect={noop}
onCreate={noop}
onDelete={noop}
@@ -83,10 +94,31 @@ describe('ConversationList', () => {
expect(screen.getByRole('status').textContent).toBe('No conversations
match your search.');
});
+ it.each([
+ { loading: true, error: undefined },
+ { loading: false, error: 'Could not refresh conversations.' }
+ ])('keeps the last successful rows and search available when
loading=$loading, error=$error', request => {
+ render(
+ <ConversationList
+ listState={{ ...resolvedList(conversations), ...request }}
+ onRetry={noop}
+ onSelect={noop}
+ onCreate={noop}
+ onDelete={noop}
+ onSearchTermChange={noop}
+ now={NOW}
+ />
+ );
+ expect(screen.getByRole('button', { name: 'Draft a query' })).toBeTruthy();
+ fireEvent.change(screen.getByRole('textbox', { name: 'Search
conversations' }), { target: { value: 'missing' } });
+ expect(screen.getByText('No conversations match your
search.')).toBeTruthy();
+ });
+
it('filters by title, case-insensitively and trimmed', () => {
render(
<ConversationList
- conversations={conversations}
+ listState={resolvedList(conversations)}
+ onRetry={noop}
onSelect={noop}
onCreate={noop}
onDelete={noop}
@@ -105,7 +137,8 @@ describe('ConversationList', () => {
const onSearchTermChange = vi.fn();
render(
<ConversationList
- conversations={conversations}
+ listState={resolvedList(conversations)}
+ onRetry={noop}
onSelect={noop}
onCreate={noop}
onDelete={noop}
@@ -120,7 +153,8 @@ describe('ConversationList', () => {
it('marks the selected conversation', () => {
render(
<ConversationList
- conversations={conversations}
+ listState={resolvedList(conversations)}
+ onRetry={noop}
selectedId="a"
onSelect={noop}
onCreate={noop}
@@ -138,7 +172,8 @@ describe('ConversationList', () => {
const onSelect = vi.fn();
render(
<ConversationList
- conversations={conversations}
+ listState={resolvedList(conversations)}
+ onRetry={noop}
onSelect={onSelect}
onCreate={noop}
onDelete={noop}
@@ -154,7 +189,8 @@ describe('ConversationList', () => {
const onDelete = vi.fn();
render(
<ConversationList
- conversations={conversations}
+ listState={resolvedList(conversations)}
+ onRetry={noop}
onSelect={noop}
onCreate={noop}
onDelete={onDelete}
@@ -169,7 +205,8 @@ describe('ConversationList', () => {
it('shows a fallback title for a missing or empty title', () => {
render(
<ConversationList
- conversations={[conversation('x', undefined, at(10, 9)),
conversation('y', '', at(10, 9))]}
+ listState={resolvedList([conversation('x', undefined, at(10, 9)),
conversation('y', '', at(10, 9))])}
+ onRetry={noop}
onSelect={noop}
onCreate={noop}
onDelete={noop}
@@ -184,7 +221,8 @@ describe('ConversationList', () => {
it('matches an untitled conversation by its fallback title', () => {
render(
<ConversationList
- conversations={[...conversations, conversation('x', '', at(10, 9))]}
+ listState={resolvedList([...conversations, conversation('x', '',
at(10, 9))])}
+ onRetry={noop}
onSelect={noop}
onCreate={noop}
onDelete={noop}
@@ -202,7 +240,8 @@ describe('ConversationList', () => {
it('marks a read-only conversation and no other', () => {
render(
<ConversationList
- conversations={conversations}
+ listState={resolvedList(conversations)}
+ onRetry={noop}
onSelect={noop}
onCreate={noop}
onDelete={noop}
@@ -217,7 +256,8 @@ describe('ConversationList', () => {
it('offers no delete button for a read-only conversation', () => {
render(
<ConversationList
- conversations={conversations}
+ listState={resolvedList(conversations)}
+ onRetry={noop}
onSelect={noop}
onCreate={noop}
onDelete={noop}
@@ -232,7 +272,8 @@ describe('ConversationList', () => {
const onCreate = vi.fn();
render(
<ConversationList
- conversations={conversations}
+ listState={resolvedList(conversations)}
+ onRetry={noop}
onSelect={noop}
onCreate={onCreate}
onDelete={noop}
@@ -247,7 +288,8 @@ describe('ConversationList', () => {
it('splits today from earlier conversations, each under its own section', ()
=> {
render(
<ConversationList
- conversations={conversations}
+ listState={resolvedList(conversations)}
+ onRetry={noop}
onSelect={noop}
onCreate={noop}
onDelete={noop}
@@ -266,10 +308,11 @@ describe('ConversationList', () => {
it('splits at local midnight', () => {
render(
<ConversationList
- conversations={[
+ listState={resolvedList([
conversation('x', 'After midnight', at(15, 0, 1)),
conversation('y', 'Before midnight', at(14, 23, 59))
- ]}
+ ])}
+ onRetry={noop}
onSelect={noop}
onCreate={noop}
onDelete={noop}
@@ -285,7 +328,8 @@ describe('ConversationList', () => {
it('hides a section heading when that section is empty', () => {
render(
<ConversationList
- conversations={[conversations[0]]}
+ listState={resolvedList([conversations[0]])}
+ onRetry={noop}
onSelect={noop}
onCreate={noop}
onDelete={noop}
@@ -300,7 +344,8 @@ describe('ConversationList', () => {
it('shows a relative time for a today conversation and none for an earlier
one', () => {
render(
<ConversationList
- conversations={conversations}
+ listState={resolvedList(conversations)}
+ onRetry={noop}
onSelect={noop}
onCreate={noop}
onDelete={noop}
@@ -315,11 +360,12 @@ describe('ConversationList', () => {
it('formats a relative time as now, minutes, or hours', () => {
render(
<ConversationList
- conversations={[
+ listState={resolvedList([
conversation('x', 'Seconds ago', at(15, 11, 59, 40)),
conversation('y', 'Minutes ago', at(15, 11, 55)),
conversation('z', 'Hours ago', at(15, 9))
- ]}
+ ])}
+ onRetry={noop}
onSelect={noop}
onCreate={noop}
onDelete={noop}
@@ -335,7 +381,8 @@ describe('ConversationList', () => {
it('drops section headings while searching', () => {
render(
<ConversationList
- conversations={conversations}
+ listState={resolvedList(conversations)}
+ onRetry={noop}
onSelect={noop}
onCreate={noop}
onDelete={noop}
@@ -351,7 +398,8 @@ describe('ConversationList', () => {
it('does not match by date, only by title', () => {
render(
<ConversationList
- conversations={conversations}
+ listState={resolvedList(conversations)}
+ onRetry={noop}
onSelect={noop}
onCreate={noop}
onDelete={noop}
diff --git
a/zeppelin-web-angular/projects/zeppelin-react/src/entities/assistant/ui/ConversationList.stories.tsx
b/zeppelin-web-angular/projects/zeppelin-react/src/entities/assistant/ui/ConversationList.stories.tsx
index e04499ed1e..6b338dbc78 100644
---
a/zeppelin-web-angular/projects/zeppelin-react/src/entities/assistant/ui/ConversationList.stories.tsx
+++
b/zeppelin-web-angular/projects/zeppelin-react/src/entities/assistant/ui/ConversationList.stories.tsx
@@ -35,7 +35,8 @@ const meta = {
title: 'Assistant/ConversationList',
component: ConversationList,
args: {
- conversations,
+ listState: { conversations, hasLoaded: true, loading: false, error:
undefined },
+ onRetry: fn(),
onSelect: fn(),
onCreate: fn(),
onDelete: fn(),
@@ -51,7 +52,7 @@ export const TodayAndEarlier: Story = {};
export const Selected: Story = { args: { selectedId: 'a' } };
-export const Empty: Story = { args: { conversations: [] } };
+export const Empty: Story = { args: { listState: { ...meta.args.listState,
conversations: [] } } };
export const Search: Story = {
play: async ({ canvasElement, args }) => {
diff --git
a/zeppelin-web-angular/projects/zeppelin-react/src/entities/assistant/ui/ConversationList.tsx
b/zeppelin-web-angular/projects/zeppelin-react/src/entities/assistant/ui/ConversationList.tsx
index 7852919672..91ce2fc381 100644
---
a/zeppelin-web-angular/projects/zeppelin-react/src/entities/assistant/ui/ConversationList.tsx
+++
b/zeppelin-web-angular/projects/zeppelin-react/src/entities/assistant/ui/ConversationList.tsx
@@ -14,7 +14,9 @@ import { useState } from 'react';
import { DeleteOutlined, LockOutlined, PlusOutlined, SearchOutlined } from
'@ant-design/icons';
import { Button, Input } from 'antd';
import { isSameDay } from 'date-fns';
+import { action, note } from '@/shared/ui/assistant-theme/AssistantScope.css';
import type { AssistantConversation } from '../model/assistantContract';
+import type { ConversationListState } from '../model/conversationListState';
import { conversationTitle } from './conversationTitle';
import * as styles from './ConversationList.css';
@@ -32,7 +34,8 @@ const matchesSearch = (conversation: AssistantConversation,
needle: string) =>
conversationTitle(conversation).toLowerCase().includes(needle);
export interface ConversationListProps {
- conversations: AssistantConversation[];
+ listState: ConversationListState;
+ onRetry: () => void;
selectedId?: string;
onSelect: (conversationId: string) => void;
onCreate: () => void;
@@ -100,7 +103,8 @@ const ConversationRow = ({
};
export const ConversationList = ({
- conversations,
+ listState: { conversations, hasLoaded, loading, error },
+ onRetry,
selectedId,
onSelect,
onCreate,
@@ -109,15 +113,15 @@ export const ConversationList = ({
onSearchTermChange,
now = Date.now()
}: ConversationListProps) => {
- const [query, setQuery] = useState('');
- const needle = query.trim().toLowerCase();
+ const [searchTerm, setSearchTerm] = useState('');
+ const needle = searchTerm.trim().toLowerCase();
const searching = needle.length > 0;
const shown = searching ? conversations.filter(conversation =>
matchesSearch(conversation, needle)) : conversations;
const today = shown.filter(conversation => conversation.updatedAt &&
isSameDay(conversation.updatedAt, now));
const earlier = shown.filter(conversation => !today.includes(conversation));
const handleSearchChange = (value: string) => {
- setQuery(value);
+ setSearchTerm(value);
onSearchTermChange(value);
};
@@ -134,49 +138,73 @@ export const ConversationList = ({
);
return (
- <section aria-label="Conversations" className={styles.list}>
- <div className={styles.header}>
- <h3 className={styles.title}>Conversations</h3>
- <Button
- size="small"
- type="text"
- icon={<PlusOutlined />}
- aria-label="New conversation"
- disabled={newDisabled}
- onClick={onCreate}
- />
- </div>
- <div className={styles.search}>
- <Input
- allowClear
- prefix={<SearchOutlined aria-hidden="true" />}
- placeholder="Search conversations"
- aria-label="Search conversations"
- value={query}
- onChange={event => handleSearchChange(event.target.value)}
- />
- </div>
- {shown.length === 0 ? (
- <p className={styles.empty} role="status">
- {searching ? 'No conversations match your search.' : 'No
conversations yet.'}
+ <>
+ {loading && (
+ <p role="status" className={note}>
+ Loading conversations…
</p>
- ) : (
- <>
- {!searching && today.length > 0 && (
- <>
- <div className={styles.sectionLabel}>Today</div>
- <ul className={styles.items}>{today.map(conversation =>
row(conversation, true))}</ul>
- </>
- )}
- {!searching && earlier.length > 0 && (
- <>
- <div className={styles.sectionLabel}>Earlier</div>
- <ul className={styles.items}>{earlier.map(conversation =>
row(conversation, false))}</ul>
- </>
- )}
- {searching && <ul className={styles.items}>{shown.map(conversation
=> row(conversation, false))}</ul>}
- </>
)}
- </section>
+ {error && (
+ <div className={styles.listError}>
+ <div role="alert" className={styles.listErrorMessage}>
+ {error}
+ </div>
+ <button
+ type="button"
+ className={action}
+ aria-label="Retry loading conversations"
+ disabled={loading}
+ onClick={onRetry}
+ >
+ Retry
+ </button>
+ </div>
+ )}
+ <section aria-label="Conversations" className={styles.list}>
+ <div className={styles.header}>
+ <h3 className={styles.title}>Conversations</h3>
+ <Button
+ size="small"
+ type="text"
+ icon={<PlusOutlined />}
+ aria-label="New conversation"
+ disabled={newDisabled}
+ onClick={onCreate}
+ />
+ </div>
+ <div className={styles.search}>
+ <Input
+ allowClear
+ prefix={<SearchOutlined aria-hidden="true" />}
+ placeholder="Search conversations"
+ aria-label="Search conversations"
+ value={searchTerm}
+ onChange={event => handleSearchChange(event.target.value)}
+ />
+ </div>
+ {hasLoaded && shown.length === 0 && (
+ <p className={styles.empty} role="status">
+ {searching ? 'No conversations match your search.' : 'No
conversations yet.'}
+ </p>
+ )}
+ {shown.length > 0 && (
+ <>
+ {!searching && today.length > 0 && (
+ <>
+ <div className={styles.sectionLabel}>Today</div>
+ <ul className={styles.items}>{today.map(conversation =>
row(conversation, true))}</ul>
+ </>
+ )}
+ {!searching && earlier.length > 0 && (
+ <>
+ <div className={styles.sectionLabel}>Earlier</div>
+ <ul className={styles.items}>{earlier.map(conversation =>
row(conversation, false))}</ul>
+ </>
+ )}
+ {searching && <ul className={styles.items}>{shown.map(conversation
=> row(conversation, false))}</ul>}
+ </>
+ )}
+ </section>
+ </>
);
};
diff --git
a/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/model/assistantPanelModel.ts
b/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/model/assistantPanelModel.ts
index 431933aa1b..52954bd2e7 100644
---
a/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/model/assistantPanelModel.ts
+++
b/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/model/assistantPanelModel.ts
@@ -11,14 +11,20 @@
*/
import type { AssistantConversation } from
'@/entities/assistant/model/assistantContract';
+import type { ConversationListState } from
'@/entities/assistant/model/conversationListState';
import { AssistantConversationSession } from './assistantConversation';
import type { AssistantDataSource } from './assistantDataSource';
import type { AssistantDeletionResult, AssistantPanel } from
'./assistantPanelState';
+const INITIAL_CONVERSATION_LIST: ConversationListState = {
+ conversations: [],
+ hasLoaded: false,
+ loading: true,
+ error: undefined
+};
+
export class AssistantPanelModel {
- private conversations: AssistantConversation[] = [];
- private listLoading = true;
- private listError?: string;
+ private conversationList = INITIAL_CONVERSATION_LIST;
private selectedKey = 'draft:0';
private draftKey: string | undefined = 'draft:0';
@@ -70,8 +76,7 @@ export class AssistantPanelModel {
reopen(): void {
if (!this.closedWithRun) return;
this.closedWithRun = false;
- this.listLoading = true;
- this.listError = undefined;
+ this.conversationList = { ...this.conversationList, loading: true, error:
undefined };
this.publish();
this.refreshConversations();
}
@@ -87,9 +92,7 @@ export class AssistantPanelModel {
this.sessions.clear();
this.deleted.clear();
- this.conversations = [];
- this.listLoading = true;
- this.listError = undefined;
+ this.conversationList = INITIAL_CONVERSATION_LIST;
this.selectedKey = 'draft:0';
this.draftKey = 'draft:0';
this.draftSequence = 0;
@@ -102,7 +105,7 @@ export class AssistantPanelModel {
private async loadList(generation: number): Promise<void> {
const version = ++this.listVersion;
- const listedAtStart = new Set(this.conversations.map(conversation =>
conversation.id));
+ const listedAtStart = new
Set(this.conversationList.conversations.map(conversation => conversation.id));
try {
const conversations = await this.source.api.listConversations();
if (!this.active || this.generation !== generation || this.listVersion
!== version) return;
@@ -110,12 +113,11 @@ export class AssistantPanelModel {
const visible = conversations.filter(conversation =>
!this.deleted.has(conversation.id));
const refreshed = new Map(visible.map(conversation => [conversation.id,
conversation]));
// A list snapshot can omit conversations confirmed locally after its
request began.
- const createdDuringRequest = this.conversations.filter(
+ const createdDuringRequest = this.conversationList.conversations.filter(
conversation => !listedAtStart.has(conversation.id) &&
!refreshed.has(conversation.id)
);
const nextConversations = [...createdDuringRequest, ...visible];
nextConversations.sort((a, b) => (Date.parse(b.updatedAt) || 0) -
(Date.parse(a.updatedAt) || 0));
- this.conversations = nextConversations;
this.sessions.forEach(session => {
const id = session.snapshot.conversation?.id;
@@ -123,13 +125,15 @@ export class AssistantPanelModel {
if (conversation) session.updateConversation(conversation);
});
- this.listLoading = false;
- this.listError = undefined;
+ this.conversationList = { conversations: nextConversations, hasLoaded:
true, loading: false, error: undefined };
} catch (error) {
if (!this.active || this.generation !== generation || this.listVersion
!== version) return;
- this.listLoading = false;
- this.listError = error instanceof Error ? error.message : 'Could not
load conversations.';
+ this.conversationList = {
+ ...this.conversationList,
+ loading: false,
+ error: error instanceof Error ? error.message : 'Could not load
conversations.'
+ };
}
this.publish();
@@ -153,9 +157,9 @@ export class AssistantPanelModel {
};
readonly retryList = (): Promise<void> => {
- if (!this.active || this.listLoading || !this.listError) return
Promise.resolve();
+ if (!this.active || this.conversationList.loading ||
!this.conversationList.error) return Promise.resolve();
- this.listLoading = true;
+ this.conversationList = { ...this.conversationList, loading: true };
this.publish();
return this.loadList(this.generation);
};
@@ -164,14 +168,17 @@ export class AssistantPanelModel {
if (!this.active || this.sessions.get(session.key) !== session) return;
if (this.draftKey === session.key) this.draftKey = undefined;
- this.conversations = [conversation, ...this.conversations.filter(item =>
item.id !== conversation.id)];
+ this.conversationList = {
+ ...this.conversationList,
+ conversations: [conversation,
...this.conversationList.conversations.filter(item => item.id !==
conversation.id)]
+ };
this.publish();
};
readonly select = (id: string): void => {
if (!this.active) return;
- const conversation = this.conversations.find(item => item.id === id);
+ const conversation = this.conversationList.conversations.find(item =>
item.id === id);
if (!conversation) return;
const session =
@@ -227,7 +234,7 @@ export class AssistantPanelModel {
readonly deleteConversation = async (id: string):
Promise<AssistantDeletionResult> => {
if (!this.active) return { status: 'ignored' };
- const conversation = this.conversations.find(item => item.id === id);
+ const conversation = this.conversationList.conversations.find(item =>
item.id === id);
if (!conversation) return { status: 'ignored' };
const session =
@@ -245,7 +252,10 @@ export class AssistantPanelModel {
this.deleted.add(id);
this.sessions.delete(session.key);
- this.conversations = this.conversations.filter(item => item.id !== id);
+ this.conversationList = {
+ ...this.conversationList,
+ conversations: this.conversationList.conversations.filter(item =>
item.id !== id)
+ };
if (this.selectedKey === session.key) this.selectDraft();
this.publish();
return result;
@@ -259,9 +269,7 @@ export class AssistantPanelModel {
});
return {
- conversations: this.conversations,
- listLoading: this.listLoading,
- listError: this.listError,
+ conversationList: this.conversationList,
selectedKey: this.selectedKey,
entry: this.sessions.get(this.selectedKey)!.snapshot,
creatingConversation: !!this.draftKey &&
this.sessions.get(this.draftKey)!.snapshot.phase === 'creating',
diff --git
a/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/model/assistantPanelState.ts
b/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/model/assistantPanelState.ts
index 58d231f4ad..7a968ed259 100644
---
a/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/model/assistantPanelState.ts
+++
b/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/model/assistantPanelState.ts
@@ -11,6 +11,7 @@
*/
import type { AssistantConversation, AssistantMessage } from
'@/entities/assistant/model/assistantContract';
+import type { ConversationListState } from
'@/entities/assistant/model/conversationListState';
import type { AssistantAnswerErrorKind, AssistantAnswerView } from
'@/entities/assistant/ui/answerView';
export type AssistantPanelPhase = 'idle' | 'creating' | 'pending' | 'running'
| 'unknown';
@@ -58,9 +59,7 @@ export interface AssistantPanelEntry extends
AssistantPanelHistory {
}
export interface AssistantPanelSnapshot {
- conversations: AssistantConversation[];
- listLoading: boolean;
- listError?: string;
+ readonly conversationList: ConversationListState;
selectedKey: string;
entry: AssistantPanelEntry;
diff --git
a/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/model/useAssistantPanel.spec.tsx
b/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/model/useAssistantPanel.spec.tsx
index e3b2a822fe..cdd7892d6d 100644
---
a/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/model/useAssistantPanel.spec.tsx
+++
b/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/model/useAssistantPanel.spec.tsx
@@ -1090,9 +1090,9 @@ describe('useAssistantPanel', () => {
});
expect(deletion).toEqual({ status: 'failed', message: 'Conversation busy'
});
- expect(panel.result.current.conversations.map(item =>
item.id)).toContain('a');
+ expect(panel.result.current.conversationList.conversations.map(item =>
item.id)).toContain('a');
expect(panel.result.current.entry.failure).toEqual({ message:
'Conversation busy', kind: 'failed' });
- expect(panel.result.current.listError).toBeUndefined();
+ expect(panel.result.current.conversationList.error).toBeUndefined();
expect(panel.result.current.entry.failure?.recovery).toBeUndefined();
await act(async () => {
@@ -1100,7 +1100,7 @@ describe('useAssistantPanel', () => {
});
expect(deletion).toEqual({ status: 'deleted' });
- expect(panel.result.current.conversations.map(item =>
item.id)).not.toContain('a');
+ expect(panel.result.current.conversationList.conversations.map(item =>
item.id)).not.toContain('a');
await act(async () =>
history.resolve({ messages: [{ id: 'late', role: 'user', content:
'Deleted history' }], cursor: null })
@@ -1169,7 +1169,7 @@ describe('useAssistantPanel', () => {
expect(deletion).toEqual({ status: 'deleted' });
expect(harness.api.deleteConversation).toHaveBeenCalledWith('a');
- expect(panel.result.current.conversations.map(item =>
item.id)).not.toContain('a');
+ expect(panel.result.current.conversationList.conversations.map(item =>
item.id)).not.toContain('a');
expect(panel.result.current.entry.conversation).toBeUndefined();
});
@@ -1195,7 +1195,7 @@ describe('useAssistantPanel', () => {
});
expect(panel.result.current.entry.deleting).toBe(true);
- expect(panel.result.current.conversations.map(item =>
item.id)).toContain('a');
+ expect(panel.result.current.conversationList.conversations.map(item =>
item.id)).toContain('a');
expect(signal.aborted).toBe(false);
await act(async () =>
@@ -1261,7 +1261,7 @@ describe('useAssistantPanel', () => {
expect(result).toEqual({ status: 'deleted' });
expect(signal.aborted).toBe(true);
- expect(panel.result.current.conversations.map(item =>
item.id)).not.toContain('a');
+ expect(panel.result.current.conversationList.conversations.map(item =>
item.id)).not.toContain('a');
await act(async () => panel.result.current.select('b'));
const next = await sendQuestion(panel, 'B question');
@@ -1337,7 +1337,7 @@ describe('useAssistantPanel', () => {
expect(newHarness.run).not.toHaveBeenCalled();
expect(panel.result.current.entry).toMatchObject({ draft: '', messages:
[], phase: 'idle' });
expect(panel.result.current.entry.conversation).toBeUndefined();
- expect(panel.result.current.conversations.map(item =>
item.id)).not.toContain('obsolete-created');
+ expect(panel.result.current.conversationList.conversations.map(item =>
item.id)).not.toContain('obsolete-created');
});
it('ignores StrictMode cleanup results and stale source responses', async ()
=> {
@@ -1354,8 +1354,8 @@ describe('useAssistantPanel', () => {
await act(async () => panel.rerender({ source: newHarness.source }));
await act(async () => obsolete.resolve([conversation('obsolete')]));
- expect(panel.result.current.conversations.map(item =>
item.id)).toEqual(['new-source']);
- expect(panel.result.current.listLoading).toBe(false);
+ expect(panel.result.current.conversationList.conversations.map(item =>
item.id)).toEqual(['new-source']);
+ expect(panel.result.current.conversationList.loading).toBe(false);
expect(panel.result.current.entry.draft).toBe('');
expect(panel.result.current.entry.phase).toBe('idle');
});
@@ -1480,8 +1480,9 @@ describe('useAssistantPanel', () => {
const firstNewRender = renders.find(render => render.source ===
newHarness.source)!;
expect(firstNewRender.panel.entry).toMatchObject({ key: 'draft:0', draft:
'', messages: [], phase: 'idle' });
- expect(firstNewRender.panel.conversations).toEqual([]);
- expect(firstNewRender.panel.listLoading).toBe(true);
+ expect(firstNewRender.panel.conversationList.conversations).toEqual([]);
+ expect(firstNewRender.panel.conversationList.hasLoaded).toBe(false);
+ expect(firstNewRender.panel.conversationList.loading).toBe(true);
});
it.each([
@@ -1603,7 +1604,7 @@ describe('useAssistantPanel', () => {
await sending.completion;
});
- expect(panel.result.current.conversations).toEqual(remaining);
+
expect(panel.result.current.conversationList.conversations).toEqual(remaining);
const selectedKey = panel.result.current.selectedKey;
harness.api.getMessages.mockClear();
await act(async () => panel.result.current.select('b'));
@@ -1623,7 +1624,7 @@ describe('useAssistantPanel', () => {
await act(async () => initial.resolve([conversation('a')]));
- expect(panel.result.current.conversations.map(item =>
item.id).sort()).toEqual(['a', 'created']);
+ expect(panel.result.current.conversationList.conversations.map(item =>
item.id).sort()).toEqual(['a', 'created']);
expect(panel.result.current.entry.draft).toBe('A separate local draft');
await act(async () => panel.result.current.select('created'));
@@ -1661,7 +1662,7 @@ describe('useAssistantPanel', () => {
refresh.resolve(returnedByServer ? [conversation('a'), serverCreated]
: [conversation('a')])
);
- expect(panel.result.current.conversations.map(item =>
item.id).sort()).toEqual(['a', 'created']);
+ expect(panel.result.current.conversationList.conversations.map(item =>
item.id).sort()).toEqual(['a', 'created']);
expect(panel.result.current.entry.draft).toBe('Keep the existing
conversation draft');
await act(async () => panel.result.current.select('created'));
expect(panel.result.current.entry).toMatchObject({
@@ -1686,7 +1687,7 @@ describe('useAssistantPanel', () => {
await created.completion;
});
- expect(panel.result.current.conversations).toEqual([conversation('a')]);
+
expect(panel.result.current.conversationList.conversations).toEqual([conversation('a')]);
}
);
@@ -1701,9 +1702,11 @@ describe('useAssistantPanel', () => {
await act(async () => panel.result.current.send('Follow-up question'));
const saved = await source.api.listConversations();
- expect(panel.result.current.conversations).toEqual(saved);
- expect(panel.result.current.conversations[0].id).toBe('c2');
- expect(panel.result.current.conversations[0].updatedAt).toBe(new
Date(FIXTURE_NOW + 1_000).toISOString());
+ expect(panel.result.current.conversationList.conversations).toEqual(saved);
+
expect(panel.result.current.conversationList.conversations[0].id).toBe('c2');
+
expect(panel.result.current.conversationList.conversations[0].updatedAt).toBe(
+ new Date(FIXTURE_NOW + 1_000).toISOString()
+ );
});
it('orders refreshed activity by instant across ISO timestamp formats',
async () => {
@@ -1719,7 +1722,7 @@ describe('useAssistantPanel', () => {
await sending.completion;
});
- expect(panel.result.current.conversations.map(item =>
item.id)).toEqual(['b', 'a']);
+ expect(panel.result.current.conversationList.conversations.map(item =>
item.id)).toEqual(['b', 'a']);
});
it('preserves a session deletion failure across activity refresh without
changing list errors', async () => {
@@ -1742,11 +1745,11 @@ describe('useAssistantPanel', () => {
});
expect(result).toEqual({ status: 'failed', message: 'Conversation busy' });
- expect(panel.result.current.listError).toBeUndefined();
+ expect(panel.result.current.conversationList.error).toBeUndefined();
await act(async () => refresh.resolve([conversation('a'),
conversation('b')]));
- expect(panel.result.current.listError).toBeUndefined();
+ expect(panel.result.current.conversationList.error).toBeUndefined();
expect(panel.result.current.entry.failure).toBeUndefined();
await act(async () => panel.result.current.select('b'));
@@ -1758,15 +1761,17 @@ describe('useAssistantPanel', () => {
const harness = sourceHarness();
harness.api.listConversations.mockRejectedValueOnce(new Error('List
unavailable'));
const panel = await mountPanel(harness.source);
- expect(panel.result.current.listError).toBe('List unavailable');
+ expect(panel.result.current.conversationList.error).toBe('List
unavailable');
+ expect(panel.result.current.conversationList.hasLoaded).toBe(false);
const sending = await sendQuestion(panel, 'Start a conversation');
await act(async () => {
harness.feeds[0].push({ type: 'run.started' }, { type: 'run.completed'
});
await sending.completion;
});
- expect(panel.result.current.listError).toBeUndefined();
- expect(panel.result.current.conversations.map(item =>
item.id)).toContain('a');
+ expect(panel.result.current.conversationList.error).toBeUndefined();
+ expect(panel.result.current.conversationList.hasLoaded).toBe(true);
+ expect(panel.result.current.conversationList.conversations.map(item =>
item.id)).toContain('a');
});
it('ignores an older activity refresh that resolves after a newer send',
async () => {
@@ -1792,7 +1797,7 @@ describe('useAssistantPanel', () => {
await act(async () => newer.resolve([fresh]));
await act(async () => older.resolve([conversation('a')]));
- expect(panel.result.current.conversations.find(item => item.id ===
'a')).toEqual(fresh);
+ expect(panel.result.current.conversationList.conversations.find(item =>
item.id === 'a')).toEqual(fresh);
});
it.each([true, false])(
@@ -2167,7 +2172,7 @@ describe('useAssistantPanel', () => {
await removing;
});
- expect(panel.result.current.conversations.map(item =>
item.id)).not.toContain('a');
+ expect(panel.result.current.conversationList.conversations.map(item =>
item.id)).not.toContain('a');
expect(panel.result.current.entry.conversation).toBeUndefined();
expect(harness.api.getMessages).toHaveBeenCalledTimes(1);
});
diff --git
a/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/ui/AssistantConversationPanel.css.ts
b/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/ui/AssistantConversationPanel.css.ts
index 7a1ba8de20..d93b7df162 100644
---
a/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/ui/AssistantConversationPanel.css.ts
+++
b/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/ui/AssistantConversationPanel.css.ts
@@ -11,7 +11,7 @@
*/
import { style } from '@vanilla-extract/css';
-import { vars } from '@/shared/ui/assistant-theme/AssistantScope.css';
+import { action, vars } from '@/shared/ui/assistant-theme/AssistantScope.css';
export const panel = style({
position: 'relative',
@@ -75,15 +75,6 @@ export const statusArea = style({
overscrollBehavior: 'contain'
});
-export const note = style({
- flexShrink: 0,
- margin: 0,
- padding: `${vars.space2} ${vars.space3}`,
- color: vars.textSecondary,
- fontSize: vars.fontSizeSm,
- overflowWrap: 'anywhere'
-});
-
export const empty = style({
margin: 0,
padding: `${vars.space5} ${vars.space3}`,
@@ -91,34 +82,6 @@ export const empty = style({
textAlign: 'center'
});
-export const warning = style({
- flexShrink: 0,
- margin: vars.space2,
- padding: vars.space2,
- color: vars.text,
- background: vars.fill,
- border: `1px solid ${vars.borderStrong}`,
- borderRadius: vars.radiusSm,
- fontSize: vars.fontSizeSm,
- overflowWrap: 'anywhere'
-});
-
-export const listError = style([
- warning,
- {
- display: 'flex',
- flexWrap: 'wrap',
- alignItems: 'center',
- justifyContent: 'flex-end',
- gap: vars.space2
- }
-]);
-
-export const listErrorMessage = style({
- flex: '1 1 13rem',
- minWidth: 0
-});
-
export const composer = style({
flexShrink: 0,
minWidth: 0,
@@ -139,25 +102,6 @@ export const listView = style({
export const listNavigation = style({ paddingBottom: vars.space2 });
-export const action = style({
- minHeight: 30,
- maxWidth: '100%',
- padding: `${vars.space1} ${vars.space2}`,
- border: `1px solid ${vars.borderStrong}`,
- borderRadius: vars.radiusSm,
- color: vars.text,
- background: vars.bg,
- font: 'inherit',
- fontSize: vars.fontSizeSm,
- lineHeight: vars.lineHeight,
- cursor: 'pointer',
- overflowWrap: 'anywhere',
- selectors: {
- '&:hover:not(:disabled)': { background: vars.fill },
- '&:disabled': { cursor: 'not-allowed', opacity: 0.6 }
- }
-});
-
export const primaryAction = style([
action,
{
diff --git
a/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/ui/AssistantConversationPanel.spec.tsx
b/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/ui/AssistantConversationPanel.spec.tsx
index bcc8ccdbd3..457b866100 100644
---
a/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/ui/AssistantConversationPanel.spec.tsx
+++
b/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/ui/AssistantConversationPanel.spec.tsx
@@ -149,6 +149,7 @@ describe('AssistantConversationPanel', () => {
it('opens saved conversations and restores the trigger after select, Back
and Escape without closing the shell', async () => {
const source = fixture();
const getMessages = vi.spyOn(source.api, 'getMessages');
+ const listConversations = vi.spyOn(source.api, 'listConversations');
const { onKeyDown } = await mountPanel(source);
await select('Revenue analysis');
@@ -177,6 +178,7 @@ describe('AssistantConversationPanel', () => {
expect(document.activeElement).toBe(listTrigger());
expect(onKeyDown).not.toHaveBeenCalled();
expect(getMessages.mock.calls).toEqual([['c1']]);
+ expect(listConversations).toHaveBeenCalledTimes(1);
fireEvent.keyDown(input(), { key: 'ArrowLeft' });
@@ -489,7 +491,55 @@ describe('AssistantConversationPanel', () => {
expect((await source.api.listConversations()).some(item => item.id ===
'c1')).toBe(true);
});
- it('retries a failed conversation list without closing the panel or losing
the draft', async () => {
+ it('shows empty and search no-match states only after the initial list
loads', async () => {
+ const source = fixture();
+ const initial = deferred();
+ vi.spyOn(source.api, 'listConversations').mockImplementationOnce(async ()
=> {
+ await initial.promise;
+ return [];
+ });
+ await mountPanel(source);
+ fireEvent.click(listTrigger());
+
+ const search = screen.getByRole('textbox', { name: 'Search conversations'
});
+ expect(screen.getByText('Loading conversations…')).toBeTruthy();
+ expect(screen.queryByText('No conversations yet.')).toBeNull();
+ fireEvent.change(search, { target: { value: 'Revenue' } });
+ expect(screen.queryByText('No conversations match your
search.')).toBeNull();
+
+ await act(async () => initial.resolve());
+
+ expect(screen.queryByText('Loading conversations…')).toBeNull();
+ expect(screen.getByText('No conversations match your
search.')).toBeTruthy();
+ fireEvent.change(search, { target: { value: '' } });
+ expect(screen.getByText('No conversations yet.')).toBeTruthy();
+ });
+
+ it('keeps a locally created row visible while the initial list is pending',
async () => {
+ const source = fixture('send-rejection');
+ const initial = deferred();
+ vi.spyOn(source.api, 'listConversations').mockImplementationOnce(async ()
=> {
+ await initial.promise;
+ return ASSISTANT_HISTORY_CONVERSATIONS.map(item => item.conversation);
+ });
+ await mountPanel(source);
+ await submit('Create a local row');
+ fireEvent.click(listTrigger());
+
+ expect(screen.getByText('Loading conversations…')).toBeTruthy();
+ expect(screen.getByRole('listitem').textContent).toContain('New
conversation');
+ const search = screen.getByRole('textbox', { name: 'Search conversations'
});
+ fireEvent.change(search, { target: { value: 'Revenue' } });
+ expect(screen.queryByText('No conversations match your
search.')).toBeNull();
+
+ await act(async () => initial.resolve());
+
+ expect(screen.getByRole('button', { name: /^Revenue analysis/
})).toBeTruthy();
+ fireEvent.change(search, { target: { value: 'New conversation' } });
+ expect(screen.getByRole('listitem').textContent).toContain('New
conversation');
+ });
+
+ it.each([false, true])('recovers the list without closing the panel or
losing the draft (empty=%s)', async empty => {
const source = fixture();
const retry = deferred();
const recovery = deferred();
@@ -503,14 +553,20 @@ describe('AssistantConversationPanel', () => {
})
.mockImplementationOnce(async () => {
await recovery.promise;
- return originalList();
+ return empty ? [] : originalList();
});
const create = vi.spyOn(source.api, 'createConversation');
const run = vi.spyOn(source, 'run');
await mountPanel(source);
+ expect(screen.getByRole('alert').textContent).toContain('Conversations
unavailable.');
fireEvent.change(input(), { target: { value: 'Keep this draft through list
recovery' } });
fireEvent.click(listTrigger());
expect(screen.getByRole('alert').textContent).toContain('Conversations
unavailable.');
+ expect(screen.queryByText('No conversations yet.')).toBeNull();
+ const search = screen.getByRole('textbox', { name: 'Search conversations'
});
+ fireEvent.change(search, { target: { value: 'Revenue' } });
+ expect(screen.queryByText('No conversations match your
search.')).toBeNull();
+ fireEvent.change(search, { target: { value: '' } });
const retryButton = () => screen.getByRole('button', { name: 'Retry
loading conversations' });
fireEvent.click(retryButton());
@@ -518,6 +574,10 @@ describe('AssistantConversationPanel', () => {
expect(retryButton().matches(':disabled')).toBe(true);
expect(screen.getByText('Loading conversations…')).toBeTruthy();
+ expect(screen.queryByText('No conversations yet.')).toBeNull();
+ fireEvent.change(search, { target: { value: 'Revenue' } });
+ expect(screen.queryByText('No conversations match your
search.')).toBeNull();
+ fireEvent.change(search, { target: { value: '' } });
fireEvent.click(retryButton());
expect(list).toHaveBeenCalledTimes(2);
await act(async () => retry.resolve());
@@ -525,19 +585,22 @@ describe('AssistantConversationPanel', () => {
expect(screen.getByRole('alert').textContent).toContain('Conversations are
still unavailable.');
expect(retryButton().matches(':disabled')).toBe(false);
fireEvent.click(retryButton());
+ expect(screen.getByText('Loading conversations…')).toBeTruthy();
+ expect(screen.queryByText('No conversations yet.')).toBeNull();
await act(async () => recovery.resolve());
expect(list).toHaveBeenCalledTimes(3);
expect(screen.queryByRole('alert')).toBeNull();
expect(screen.queryByText('Loading conversations…')).toBeNull();
- expect(screen.getByRole('button', { name: /^Revenue analysis/
})).toBeTruthy();
+ expect(!!screen.queryByText('No conversations yet.')).toBe(empty);
+ expect(!!screen.queryByRole('button', { name: /^Revenue analysis/
})).toBe(!empty);
fireEvent.click(screen.getByRole('button', { name: 'Back' }));
expect(input().value).toBe('Keep this draft through list recovery');
expect(create).not.toHaveBeenCalled();
expect(run).not.toHaveBeenCalled();
- await select('Revenue analysis');
- expect(within(messages()).getByText('Which region should we investigate
next?')).toBeTruthy();
+ if (!empty) await select('Revenue analysis');
+ expect(!!within(messages()).queryByText('Which region should we
investigate next?')).toBe(!empty);
});
it('shows create failure, retains the draft, and retries creation only on an
explicit send', async () => {
diff --git
a/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/ui/AssistantConversationPanel.tsx
b/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/ui/AssistantConversationPanel.tsx
index be570d3f28..a66f637e0d 100644
---
a/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/ui/AssistantConversationPanel.tsx
+++
b/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/ui/AssistantConversationPanel.tsx
@@ -16,6 +16,7 @@ import { AssistantComposer } from
'@/entities/assistant/ui/AssistantComposer';
import { ConversationHeader } from
'@/entities/assistant/ui/ConversationHeader';
import { ConversationList } from '@/entities/assistant/ui/ConversationList';
import type { AssistantContentRenderer } from
'@/entities/assistant/ui/answerView';
+import { action, note, warning } from
'@/shared/ui/assistant-theme/AssistantScope.css';
import { useDeleteConfirmation } from '../lib/useDeleteConfirmation';
import type { AssistantPanel } from '../model/assistantPanelState';
import { ConversationMessages } from './ConversationMessages';
@@ -32,7 +33,7 @@ export interface AssistantConversationPanelProps {
const ignoreSearchChange = () => undefined;
export const AssistantConversationPanel = ({ panel, scope, now, renderAnswer
}: AssistantConversationPanelProps) => {
- const { entry, send: sendQuestion, reload: reloadHistory } = panel;
+ const { conversationList, entry, send: sendQuestion, reload: reloadHistory,
retryList } = panel;
const [listOpen, setListOpen] = useState(false);
const listTrigger = useRef<HTMLButtonElement>(null);
@@ -42,8 +43,8 @@ export const AssistantConversationPanel = ({ panel, scope,
now, renderAnswer }:
const fallbackFocus = useCallback(() => (listOpen ? back.current :
listTrigger.current), [listOpen]);
const confirmation = useDeleteConfirmation({
scope,
- conversations: panel.conversations,
- listLoading: panel.listLoading,
+ conversations: conversationList.conversations,
+ listLoading: conversationList.loading,
deletingConversationIds: panel.deletingConversationIds,
onDelete: panel.deleteConversation,
fallbackFocus
@@ -108,13 +109,13 @@ export const AssistantConversationPanel = ({ panel,
scope, now, renderAnswer }:
/>
<div className={styles.statusArea}>
- {panel.listError && (
- <p role="alert" className={styles.warning}>
- {panel.listError}
+ {conversationList.error && (
+ <p role="alert" className={warning}>
+ {conversationList.error}
</p>
)}
{entry.uncertainty && (
- <p role="alert" className={styles.warning}>
+ <p role="alert" className={warning}>
{entry.uncertainty}
</p>
)}
@@ -122,7 +123,7 @@ export const AssistantConversationPanel = ({ panel, scope,
now, renderAnswer }:
<AssistantAnswerError kind={entry.failure.kind}
message={entry.failure.message} onRetry={retry} />
)}
{(entry.phase === 'creating' || entry.phase === 'pending') && (
- <p className={styles.note} role="status">
+ <p className={note} role="status">
{entry.phase === 'creating' ? 'Creating conversation…' :
'Sending question…'}
</p>
)}
@@ -155,33 +156,13 @@ export const AssistantConversationPanel = ({ panel,
scope, now, renderAnswer }:
{listOpen && (
<div className={styles.listView}>
<div className={styles.listNavigation}>
- <button ref={back} type="button" className={styles.action}
onClick={closeList}>
+ <button ref={back} type="button" className={action}
onClick={closeList}>
Back
</button>
</div>
- {panel.listLoading && (
- <p role="status" className={styles.note}>
- Loading conversations…
- </p>
- )}
- {panel.listError && (
- <div className={styles.listError}>
- <div role="alert" className={styles.listErrorMessage}>
- {panel.listError}
- </div>
- <button
- type="button"
- className={styles.action}
- aria-label="Retry loading conversations"
- disabled={panel.listLoading}
- onClick={() => void panel.retryList()}
- >
- Retry
- </button>
- </div>
- )}
<ConversationList
- conversations={panel.conversations}
+ listState={conversationList}
+ onRetry={() => void retryList()}
selectedId={entry.conversation?.id}
onSelect={id => {
panel.select(id);
diff --git
a/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/ui/ConversationMessages.tsx
b/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/ui/ConversationMessages.tsx
index 36ebb817cd..79d37e209b 100644
---
a/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/ui/ConversationMessages.tsx
+++
b/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/ui/ConversationMessages.tsx
@@ -14,6 +14,7 @@ import { useMemo } from 'react';
import { AssistantAnswer } from '@/entities/assistant/ui/AssistantAnswer';
import { AssistantMessageItem } from
'@/entities/assistant/ui/AssistantMessageItem';
import type { AssistantContentRenderer } from
'@/entities/assistant/ui/answerView';
+import { note } from '@/shared/ui/assistant-theme/AssistantScope.css';
import { useConversationScroll } from '../lib/useConversationScroll';
import type { AssistantPanelEntry } from '../model/assistantPanelState';
import * as styles from './AssistantConversationPanel.css';
@@ -96,12 +97,12 @@ export const ConversationMessages = ({
>
<div ref={content} className={styles.messageStack}>
{entry.loadingEarlier && (
- <p className={styles.note} role="status">
+ <p className={note} role="status">
Loading earlier messages…
</p>
)}
{entry.loading && messages.length === 0 && !answer && (
- <p className={styles.note} role="status">
+ <p className={note} role="status">
Loading conversation…
</p>
)}
diff --git
a/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/ui/DeleteConversationDialog.tsx
b/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/ui/DeleteConversationDialog.tsx
index c91b1bc8df..76af09cc03 100644
---
a/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/ui/DeleteConversationDialog.tsx
+++
b/zeppelin-web-angular/projects/zeppelin-react/src/pages/assistant-workspace/ui/DeleteConversationDialog.tsx
@@ -11,6 +11,7 @@
*/
import { useId, useLayoutEffect, useRef, type KeyboardEvent } from 'react';
+import { action, note, warning } from
'@/shared/ui/assistant-theme/AssistantScope.css';
import * as styles from './AssistantConversationPanel.css';
interface DeleteConversationDialogProps {
@@ -83,17 +84,17 @@ export const DeleteConversationDialog = ({
Delete “{title}”? This conversation and its messages will be removed.
</p>
{error && (
- <p role="alert" className={styles.warning}>
+ <p role="alert" className={warning}>
{error}
</p>
)}
{deleting && (
- <p role="status" className={styles.note}>
+ <p role="status" className={note}>
Deleting conversation…
</p>
)}
<div className={styles.confirmationActions}>
- <button ref={cancel} type="button" className={styles.action}
onClick={onCancel}>
+ <button ref={cancel} type="button" className={action}
onClick={onCancel}>
{deleting ? 'Close' : 'Cancel'}
</button>
<button type="button" className={styles.primaryAction}
disabled={deleting} onClick={onConfirm}>
diff --git
a/zeppelin-web-angular/projects/zeppelin-react/src/shared/ui/assistant-theme/AssistantScope.css.ts
b/zeppelin-web-angular/projects/zeppelin-react/src/shared/ui/assistant-theme/AssistantScope.css.ts
index 3ec27f7307..7b4857fcdd 100644
---
a/zeppelin-web-angular/projects/zeppelin-react/src/shared/ui/assistant-theme/AssistantScope.css.ts
+++
b/zeppelin-web-angular/projects/zeppelin-react/src/shared/ui/assistant-theme/AssistantScope.css.ts
@@ -75,6 +75,46 @@ globalStyle(`${scope}
.zeppelin-ai-btn:not(:disabled):focus-visible`, {
});
globalStyle(`${scope} :focus:not(:focus-visible)`, { outline: 'none' });
+export const note = style({
+ flexShrink: 0,
+ margin: 0,
+ padding: `${vars.space2} ${vars.space3}`,
+ color: vars.textSecondary,
+ fontSize: vars.fontSizeSm,
+ overflowWrap: 'anywhere'
+});
+
+export const warning = style({
+ flexShrink: 0,
+ margin: vars.space2,
+ padding: vars.space2,
+ color: vars.text,
+ background: vars.fill,
+ border: `1px solid ${vars.borderStrong}`,
+ borderRadius: vars.radiusSm,
+ fontSize: vars.fontSizeSm,
+ overflowWrap: 'anywhere'
+});
+
+export const action = style({
+ minHeight: 30,
+ maxWidth: '100%',
+ padding: `${vars.space1} ${vars.space2}`,
+ border: `1px solid ${vars.borderStrong}`,
+ borderRadius: vars.radiusSm,
+ color: vars.text,
+ background: vars.bg,
+ font: 'inherit',
+ fontSize: vars.fontSizeSm,
+ lineHeight: vars.lineHeight,
+ cursor: 'pointer',
+ overflowWrap: 'anywhere',
+ selectors: {
+ '&:hover:not(:disabled)': { background: vars.fill },
+ '&:disabled': { cursor: 'not-allowed', opacity: 0.6 }
+ }
+});
+
export const visuallyHidden = style({
position: 'absolute',
width: 1,