Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use UI toolkit for variable table #291

Merged

Conversation

kentarolim10
Copy link
Contributor

@kentarolim10 kentarolim10 commented Nov 24, 2023

Description

  • Uses jupyter-ui-toolkit for the table styling

Old styling

image

Pr for #277

Copy link

Binder 👈 Launch a Binder on branch kentarolim10/jupyterlab-variableInspector/switch-to-jupyter-ui-toolkit

@fcollonval fcollonval added the enhancement New feature or request label Nov 29, 2023
Copy link
Member

@fcollonval fcollonval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kentarolim10

Here are some suggestions. And in addition to those there is one point that needs to be addressed:

Could you please add the following statement in the variableinspector plugin (in index.ts):

addJupyterLabThemeChangeListener();

This will link the toolkit theme with the JupyterLab theme.

Search,
Button
} from '@jupyter/web-components';
provideJupyterDesignSystem().register(allComponents);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should import the jp... variant of the components.

Then could import as fine grain the proper components to optimize what is loaded:

Suggested change
provideJupyterDesignSystem().register(allComponents);
provideJupyterDesignSystem().register(jpDataGrid(), jpDataGridRow(), ...);

Comment on lines 424 to 432
export function createCellTemplate(table: WebDataGrid): HTMLTemplateElement {
const template = document.createElement('template');
const container = document.createElement('div');
container.innerText = 'testing';
template.appendChild(container);
table.appendChild(template);
return template;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dead code?

Suggested change
export function createCellTemplate(table: WebDataGrid): HTMLTemplateElement {
const template = document.createElement('template');
const container = document.createElement('div');
container.innerText = 'testing';
template.appendChild(container);
table.appendChild(template);
return template;
}

@@ -52,6 +52,7 @@

.filter-search-container {
display: flex;
align-items: center;
padding: 0 1rem;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rule .filter-type should be removed

ico.onclick = (ev: MouseEvent): any => {
console.log('Click on ' + name);
console.log('Click on ' + item.varName);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove this

Suggested change
console.log('Click on ' + item.varName);


// Add onclick event for inspection
cell = row.insertCell(1);
cell = document.createElement('jp-data-grid-cell') as DataGridCell;
if (item.isMatrix) {
cell.title = 'View Contents';
cell.className = 'jp-VarInspector-inspectButton';
const ico = searchIcon.element();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind using a jp-button to wrap the icon in it (you can use the appearance stealth)?

cell.title = 'Delete Variable';
cell.className = 'jp-VarInspector-deleteButton';
cell.gridColumn = '1';
const ico = closeIcon.element();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you wrap this icon in a jp-button with appearance stealth?

import wildcardMatch from 'wildcard-match';

const TITLE_CLASS = 'jp-VarInspector-title';
const PANEL_CLASS = 'jp-VarInspector';
const TABLE_CLASS = 'jp-VarInspector-table';
const TABLE_BODY_CLASS = 'jp-VarInspector-content';
// const TABLE_BODY_CLASS = 'jp-VarInspector-content';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dead code?

Suggested change
// const TABLE_BODY_CLASS = 'jp-VarInspector-content';

nameOption.value = 'name';
nameOption.innerHTML = 'Name';
filterType.appendChild(varTypeOption);
filterType.appendChild(nameOption);
const searchContainer = document.createElement('div');
searchContainer.className = 'jp-InputGroup filter-search-container';
const input = document.createElement('input');
const input = document.createElement('jp-search') as Search;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The jp-text-field will be more appropriate than the search component.

@kentarolim10
Copy link
Contributor Author

@fcollonval I have made the request changes to the PR 👍

Copy link
Member

@fcollonval fcollonval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kentarolim10

@fcollonval fcollonval merged commit 2b00d3e into jupyterlab-contrib:main Dec 7, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants