Skip to content

Commit 6f0697a

Browse files
Variable Explorer UI cleanup (microsoft#5379)
* variable explorer UI feedback fixes * add new entry * review feedback
1 parent 722ba83 commit 6f0697a

File tree

14 files changed

+57
-3
lines changed

14 files changed

+57
-3
lines changed

news/1 Enhancements/5274.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Variable explorer UI fixes via PM / designer

package.nls.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@
222222
"DataScience.variableExplorerTypeColumn": "Type",
223223
"DataScience.variableExplorerSizeColumn": "Count",
224224
"DataScience.variableExplorerValueColumn": "Value",
225-
"DataScience.showDataExplorerTooltip": "Show variable in data explorer.",
225+
"DataScience.showDataExplorerTooltip": "Show variable in data viewer.",
226226
"DataScience.dataExplorerInvalidVariableFormat": "'{0}' is not an active variable.",
227227
"DataScience.jupyterGetVariablesExecutionError": "Failure during variable extraction:\r\n{0}",
228228
"DataScience.loadingMessage": "loading ...",

src/client/common/application/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,7 @@ export type WebPanelMessage = {
879879
// Wraps the VS Code webview panel
880880
export const IWebPanel = Symbol('IWebPanel');
881881
export interface IWebPanel {
882+
title: string;
882883
/**
883884
* Makes the webpanel show up.
884885
* @return A Promise that can be waited on

src/client/common/application/webPanel.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,16 @@ export class WebPanel implements IWebPanel {
7272
}
7373
}
7474

75+
public get title(): string {
76+
return this.panel ? this.panel.title : '';
77+
}
78+
79+
public set title(newTitle: string) {
80+
if (this.panel) {
81+
this.panel.title = newTitle;
82+
}
83+
}
84+
7585
// tslint:disable-next-line:no-any
7686
private async load(mainScriptPath: string, embeddedCss?: string, settings?: any) {
7787
if (this.panel) {

src/client/datascience/data-viewing/dataViewer.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ export class DataViewer extends WebViewHost<IDataViewerMapping> implements IData
5151
// Fill in our variable's beginning data
5252
this.variable = await this.prepVariable(variable);
5353

54+
// Create our new title with the variable name
55+
let newTitle = `${localize.DataScience.dataExplorerTitle()} - ${variable.name}`;
56+
const TRIM_LENGTH = 40;
57+
if (newTitle.length > TRIM_LENGTH) {
58+
newTitle = `${newTitle.substr(0, TRIM_LENGTH)}...`;
59+
}
60+
61+
super.setTitle(newTitle);
62+
5463
// Then show our web panel. Eventually we need to consume the data
5564
await super.show(true);
5665

src/client/datascience/webViewHost.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ export class WebViewHost<IMapping> implements IDisposable {
8787
}
8888
}
8989

90+
public setTitle(newTitle: string) {
91+
if (!this.isDisposed && this.webPanel) {
92+
this.webPanel.title = newTitle;
93+
}
94+
}
95+
9096
//tslint:disable-next-line:no-any
9197
protected onMessage(message: string, payload: any) {
9298
switch (message) {

src/datascience-ui/history-react/image.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export enum ImageName {
1515
ExpandAll,
1616
GoToSourceCode,
1717
Interrupt,
18+
OpenInNewWindow,
1819
PopIn,
1920
PopOut,
2021
Redo,
@@ -51,6 +52,11 @@ const images: { [key: string] : { light: string; dark: string } } = {
5152
light: require('./images/Interrupt/Interrupt_16x_vscode.svg'),
5253
dark : require('./images/Interrupt/Interrupt_16x_vscode_dark.svg')
5354
},
55+
OpenInNewWindow:
56+
{
57+
light: require('./images/OpenInNewWindow/OpenInNewWindow_16x_vscode.svg'),
58+
dark : require('./images/OpenInNewWindow/OpenInNewWindow_16x_vscode_dark.svg')
59+
},
5460
PopIn:
5561
{
5662
light: require('./images/PopIn/PopIn_16x_vscode.svg'),
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

src/datascience-ui/history-react/variableExplorer.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@
22
margin: 5px;
33
background-color: var(--vscode-editor-background);
44
}
5+
6+
#variable-explorer-data-grid {
7+
margin: 4px;
8+
}

0 commit comments

Comments
 (0)