Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/jupyter-chat/style/chat.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
}

/*
*
* Selectors must be nested in `.jp-ThemedContainer` to have a higher
* specificity than selectors in rules provided by JupyterLab.
*
Expand Down Expand Up @@ -147,7 +146,6 @@
}

/* Keyframe animations */

@keyframes jp-chat-typing-bounce {
0%,
80%,
Expand Down
6 changes: 2 additions & 4 deletions packages/jupyter-chat/style/input.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,15 @@
padding: 8px 0;
}

/* stylelint-disable-next-line selector-class-pattern */
.jp-chat-input-container .MuiTextField-root {
padding-bottom: 8px;
}

.jp-chat-input-container.jp-chat-drag-hover::after {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
inset: 0;
background: rgb(33 150 243 / 10%);
border: 2px dashed var(--jp-brand-color1);
border-radius: 4px;
Expand Down
17 changes: 0 additions & 17 deletions packages/jupyterlab-chat-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -760,23 +760,6 @@ const chatPanel: JupyterFrontEndPlugin<ChatPanel> = {
restorer.add(chatPanel, 'jupyter-chat');
}

// Use events system to watch changes on files, and update the chat list if a chat
// file has been created, deleted or renamed.
const schemaID =
'https://events.jupyter.org/jupyter_server/contents_service/v1';
const actions = ['create', 'delete', 'rename'];
app.serviceManager.events.stream.connect((_, emission) => {
if (emission.schema_id === schemaID) {
const action = emission.action as string;
if (
actions.includes(action) &&
(emission.path as string).endsWith(chatFileType.extensions[0])
) {
chatPanel.updateChatList();
}
}
});

/*
* Command to move a chat from the main area to the side panel.
*/
Expand Down
22 changes: 20 additions & 2 deletions packages/jupyterlab-chat/src/widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,24 @@ export class ChatPanel extends SidePanel {

const content = this.content as AccordionPanel;
content.expansionToggled.connect(this._onExpansionToggled, this);

this._contentsManager.fileChanged.connect((_, args) => {
if (args.type === 'delete') {
this.widgets.forEach(widget => {
if ((widget as ChatSection).path === args.oldValue?.path) {
widget.dispose();
}
});
this.updateChatList();
}
const updateActions = ['new', 'rename'];
if (
updateActions.includes(args.type) &&
args.newValue?.path?.endsWith(chatFileType.extensions[0])
) {
this.updateChatList();
}
});
}

/**
Expand Down Expand Up @@ -236,9 +254,9 @@ export class ChatPanel extends SidePanel {
}

/**
* A message handler invoked on an `'after-show'` message.
* A message handler invoked on an `'after-attach'` message.
*/
protected onAfterShow(msg: Message): void {
protected onAfterAttach(msg: Message): void {
// Wait for the component to be rendered.
this._openChat.renderPromise?.then(() => this.updateChatList());
}
Expand Down
6 changes: 6 additions & 0 deletions ui-tests/tests/side-panel.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/*
* Copyright (c) Jupyter Development Team.
* Distributed under the terms of the Modified BSD License.
Expand Down Expand Up @@ -142,13 +142,19 @@
});

test.describe('#openingClosing', () => {
test.use({ autoGoto: false });

const name = FILENAME.replace('.chat', '');
const NEW_DIR = 'chats_dir';
let panel: Locator;
let select: Locator;

test.beforeEach(async ({ page }) => {
await page.filebrowser.contents.uploadContent('{}', 'text', FILENAME);
await page.waitForCondition(
async () => await page.filebrowser.contents.fileExists(FILENAME)
);
await page.goto();
});

test.afterEach(async ({ page }) => {
Expand All @@ -173,7 +179,7 @@
select = panel.locator(
'.jp-SidePanel-toolbar .jp-Toolbar-item.jp-lab-chat-open select'
);
await select.selectOption(name);

Check failure on line 182 in ui-tests/tests/side-panel.spec.ts

View workflow job for this annotation

GitHub Actions / jupyterlab

tests/side-panel.spec.ts:177:9 › #sidepanel › #openingClosing › should attach a spinner while loading the chat

5) tests/side-panel.spec.ts:177:9 › #sidepanel › #openingClosing › should attach a spinner while loading the chat Error: locator.selectOption: Test timeout of 60000ms exceeded. Call log: - waiting for locator('.jp-SidePanel.jp-lab-chat-sidepanel').first().locator('.jp-SidePanel-toolbar .jp-Toolbar-item.jp-lab-chat-open select') - locator resolved to <select>…</select> - attempting select option action - waiting for element to be visible and enabled - did not find some options - retrying select option action, attempt #1 - waiting for element to be visible and enabled - did not find some options - retrying select option action, attempt #2 - waiting 20ms - waiting for element to be visible and enabled - did not find some options - retrying select option action, attempt #3 - waiting 100ms - waiting for element to be visible and enabled - did not find some options - retrying select option action, attempt #4 - waiting 100ms - waiting for element to be visible and enabled - did not find some options - retrying select option action, attempt #5 - waiting 500ms - waiting for element to be visible and enabled - did not find some options - retrying select option action, attempt #6 - waiting 500ms - waiting for element to be visible and enabled - did not find some options - retrying select option action, attempt #7 - waiting 500ms - waiting for element to be visible and enabled - did not find some options - retrying select option action, attempt #8 - waiting 500ms - waiting for element to be visible and enabled - did not find some options - retrying select option action, attempt #9 - waiting 500ms - waiting for element to be visible and enabled - did not find some options - retrying select option action, attempt #10 - waiting 500ms - waiting for element to be visible and enabled - did not find some options - retrying select option action, attempt #11 - waiting 500ms - waiting for element to be visible and enabled - did not find some options - retrying select option action, attempt #12 - waiting 500ms - waiting for element to be visible and enabled - did not find some options - retrying select option action, attempt #13 - waiting 500ms - waiting for element to be visible and enabled - did not find some options - retrying select option action, attempt #14 - waiting 500ms - waiting for element to be visible and enabled - did not find some options - retrying select option action, attempt #15 - waiting 500ms - waiting for element to be visible and enabled - did not find some options - retrying select option action, attempt #16 - waiting 500ms - waiting for element to be visible and enabled - did not find some options - retrying select option action, attempt #17 - waiting 500ms - waiting for element to be visible and enabled - did not find some options - retrying select option action, attempt #18 - waiting 500ms - waiting for element to be visible and enabled - did not find some options - retrying select option action, attempt #19 - waiting 500ms - waiting for element to be visible and enabled - did not find some options - retrying select option action, attempt #20 - waiting 500ms - waiting for element to be visible and enabled - did not find some options - retrying select option action, attempt #21 - waiting 500ms - waiting for element to be visible and enabled - did not find some options - retrying select option action, attempt #22 - waiting 500ms - waiting fo
await expect(panel.locator('.jp-Spinner')).toBeAttached();
await expect(panel.locator('.jp-Spinner')).not.toBeAttached();
});
Expand Down
Loading