Adding inline actions to OE (#23101)

This commit is contained in:
Aasim Khan
2023-05-13 09:24:49 -07:00
committed by GitHub
parent 31a88cc9eb
commit 2beba9ac08
18 changed files with 279 additions and 66 deletions

View File

@@ -46,14 +46,6 @@
color: #ffffff;
}
.server-explorer-viewlet .monaco-action-bar .action-label {
margin-right: 0.3em;
margin-left: 0.3em;
line-height: 15px;
width: 10px !important;
height: 10px !important;
}
/* Add space beneath the button */
.new-connection .monaco-text-button {
margin-bottom: 2px;
@@ -276,3 +268,21 @@
background-repeat: no-repeat;
background-size: 16px 16px;
}
.server-explorer-viewlet .monaco-list .monaco-list-row .actions {
display: none;
padding-right: 10px;
}
.server-explorer-viewlet .monaco-list .monaco-list-row .actions .action-label {
background-size: 14px 14px;
background-repeat: no-repeat;
background-position: center;
}
.server-explorer-viewlet .monaco-list .monaco-list-row:hover .actions,
.server-explorer-viewlet .monaco-list .monaco-list-row.selected .actions,
.server-explorer-viewlet .monaco-list .monaco-list-row.focused .actions {
display: block;
}

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<path d="M0,1H16V2.7l-6,6V15H6V8.7l-6-6ZM15,2.3V2H1v.3l6,6V14H9V8.3Zm.3,7.7.7.7-1.8,1.8L16,14.3l-.7.7-1.8-1.8L11.7,15l-.7-.7,1.8-1.8L11,10.7l.7-.7,1.8,1.8Z" />
</svg>

After

Width:  |  Height:  |  Size: 253 B

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<path fill="#fff" d="M0,1H16V2.7l-6,6V15H6V8.7l-6-6ZM15,2.3V2H1v.3l6,6V14H9V8.3Zm.3,7.7.7.7-1.8,1.8L16,14.3l-.7.7-1.8-1.8L11.7,15l-.7-.7,1.8-1.8L11,10.7l.7-.7,1.8,1.8Z" />
</svg>

After

Width:  |  Height:  |  Size: 265 B

View File

@@ -10,7 +10,8 @@
}
.monaco-workbench.vs-dark .actions-container .action-label.add-server-action,
.monaco-workbench.hc-black .actions-container .action-label.add-server-action {
.monaco-workbench.hc-black .actions-container .action-label.add-server-action,
.monaco-list:focus .monaco-list-rows .actions-container .action-label.add-server-action {
background-image: url('add_server_inverse.svg') !important;
}
@@ -44,6 +45,17 @@
background-image: url('server_page_inverse.svg') !important;
}
.monaco-workbench .actions-container .action-label.remove-filter-action,
.monaco-workbench.hc-light .actions-container .action-label.remove-filter-action {
background-image: url('remove_filter.svg') !important;
}
.monaco-workbench.vs-dark .actions-container .action-label.remove-filter-action,
.monaco-workbench.hc-black .actions-container .action-label.remove-filter-action,
.monaco-list:focus .monaco-list-rows .actions-container .action-label.remove-filter-action {
background-image: url('remove_filter_inverse.svg') !important;
}
/* styles for action labels - without these, the buttons for the Servers view will not be sized correctly */
.monaco-pane-view .pane > .pane-header > .actions .action-label.icon,
.monaco-pane-view .pane > .pane-header > .actions .action-label.codicon {

View File

@@ -930,7 +930,7 @@ export class ServerTreeView extends Disposable implements IServerTreeView {
}
}
private getActionContext(element: ServerTreeElement): any {
public getActionContext(element: ServerTreeElement): any {
let actionContext: any;
if (element instanceof TreeNode) {
let context = new ObjectExplorerActionsContext();

View File

@@ -17,6 +17,7 @@ import { ItemContextKey } from 'sql/workbench/contrib/dashboard/browser/widgets/
import { EditDataAction } from 'sql/workbench/browser/scriptingActions';
import { DatabaseEngineEdition } from 'sql/workbench/api/common/sqlExtHostTypes';
import { ServerInfoContextKey } from 'sql/workbench/services/connection/common/serverInfoContextKey';
import { Codicon } from 'vs/base/common/codicons';
//#region -- Data Explorer
// Script as Create
@@ -287,6 +288,27 @@ MenuRegistry.appendMenuItem(MenuId.ObjectExplorerItemContext, {
TreeNodeContextKey.NodeType.isEqualTo(NodeType.TableValuedFunction))
});
MenuRegistry.appendMenuItem(MenuId.ObjectExplorerItemContext, {
group: 'inline',
order: 7,
command: {
id: commands.OE_REFRESH_COMMAND_ID,
title: localize('refreshNode', "Refresh"),
icon: Codicon.refresh
},
when: ContextKeyExpr.or(
TreeNodeContextKey.NodeType.isEqualTo(NodeType.Table),
TreeNodeContextKey.NodeType.isEqualTo(NodeType.View),
TreeNodeContextKey.NodeType.isEqualTo(NodeType.Schema),
TreeNodeContextKey.NodeType.isEqualTo(NodeType.User),
TreeNodeContextKey.NodeType.isEqualTo(NodeType.UserDefinedTableType),
TreeNodeContextKey.NodeType.isEqualTo(NodeType.StoredProcedure),
TreeNodeContextKey.NodeType.isEqualTo(NodeType.AggregateFunction),
TreeNodeContextKey.NodeType.isEqualTo(NodeType.PartitionFunction),
TreeNodeContextKey.NodeType.isEqualTo(NodeType.ScalarValuedFunction),
TreeNodeContextKey.NodeType.isEqualTo(NodeType.TableValuedFunction))
});
//#endregion
//#region -- explorer widget