mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 09:35:36 -05:00
3491 Added Function to NodeTypes. Added Function to CanAlter and CanExecute. Added function support to css. Added drag and drop support for functions (#11990)
This commit is contained in:
@@ -15,7 +15,7 @@ import { TreeNode } from 'sql/workbench/services/objectExplorer/common/treeNode'
|
||||
import { AsyncServerTree } from 'sql/workbench/services/objectExplorer/browser/asyncServerTree';
|
||||
|
||||
export function supportsNodeNameDrop(nodeId: string): boolean {
|
||||
if (nodeId === 'Table' || nodeId === 'Column' || nodeId === 'View') {
|
||||
if (nodeId === 'Table' || nodeId === 'Column' || nodeId === 'View' || nodeId === 'Function') {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -97,7 +97,12 @@ export class ServerTreeDragAndDrop implements IDragAndDrop {
|
||||
if (supportsNodeNameDrop(element.nodeTypeId)) {
|
||||
escapedSchema = escapeString(element.metadata.schema);
|
||||
escapedName = escapeString(element.metadata.name);
|
||||
finalString = escapedSchema ? `[${escapedSchema}].[${escapedName}]` : `[${escapedName}]`;
|
||||
let providerName = this.getProviderNameFromElement(element);
|
||||
if (providerName === 'KUSTO') {
|
||||
finalString = element.nodeTypeId !== 'Function' && escapedName.indexOf(' ') > 0 ? `[@"${escapedName}"]` : escapedName;
|
||||
} else {
|
||||
finalString = escapedSchema ? `[${escapedSchema}].[${escapedName}]` : `[${escapedName}]`;
|
||||
}
|
||||
originalEvent.dataTransfer.setData(DataTransfers.RESOURCES, JSON.stringify([`${element.nodeTypeId}:${element.id}?${finalString}`]));
|
||||
}
|
||||
if (supportsFolderNodeNameDrop(element.nodeTypeId, element.label)) {
|
||||
@@ -115,6 +120,14 @@ export class ServerTreeDragAndDrop implements IDragAndDrop {
|
||||
return;
|
||||
}
|
||||
|
||||
private getProviderNameFromElement(element: TreeNode): string | undefined {
|
||||
if (element.connection) {
|
||||
return element.connection.providerName;
|
||||
}
|
||||
|
||||
return this.getProviderNameFromElement(element.parent);
|
||||
}
|
||||
|
||||
|
||||
public canDragToConnectionProfileGroup(source: any, targetConnectionProfileGroup: ConnectionProfileGroup) {
|
||||
let canDragOver: boolean = true;
|
||||
|
||||
@@ -546,6 +546,9 @@
|
||||
background: url("SystemUnicodeCharacterString.svg") center center no-repeat;
|
||||
}
|
||||
|
||||
.vs .icon.function,
|
||||
.vs-dark .icon.function,
|
||||
.hc-black .icon.function,
|
||||
.vs .icon.tablevaluedfunction,
|
||||
.vs-dark .icon.tablevaluedfunction,
|
||||
.hc-black .icon.tablevaluedfunction {
|
||||
|
||||
@@ -27,9 +27,9 @@ export class MssqlNodeContext extends Disposable {
|
||||
static readonly canCreateOrDelete = new Set([NodeType.AggregateFunction, NodeType.PartitionFunction, NodeType.ScalarValuedFunction,
|
||||
NodeType.Schema, NodeType.StoredProcedure, NodeType.Table, NodeType.TableValuedFunction,
|
||||
NodeType.User, NodeType.UserDefinedTableType, NodeType.View]);
|
||||
static readonly canExecute = new Set([NodeType.StoredProcedure]);
|
||||
static readonly canExecute = new Set([NodeType.StoredProcedure, NodeType.Function]);
|
||||
static readonly canAlter = new Set([NodeType.AggregateFunction, NodeType.PartitionFunction, NodeType.ScalarValuedFunction,
|
||||
NodeType.StoredProcedure, NodeType.TableValuedFunction, NodeType.View]);
|
||||
NodeType.StoredProcedure, NodeType.TableValuedFunction, NodeType.View, NodeType.Function]);
|
||||
|
||||
// General node context keys
|
||||
static NodeProvider = new RawContextKey<string>('nodeProvider', undefined);
|
||||
|
||||
@@ -93,10 +93,11 @@ export class NodeType {
|
||||
public static ExternalTable = 'ExternalTable';
|
||||
public static ColumnMasterKey = 'ColumnMasterKey';
|
||||
public static ColumnEncryptionKey = 'ColumnEncryptionKey';
|
||||
public static Function = 'Function';
|
||||
|
||||
public static readonly SCRIPTABLE_OBJECTS = [NodeType.Table, NodeType.View, NodeType.Schema, NodeType.User, NodeType.UserDefinedTableType,
|
||||
NodeType.StoredProcedure, NodeType.AggregateFunction, NodeType.PartitionFunction, NodeType.ScalarValuedFunction,
|
||||
NodeType.TableValuedFunction];
|
||||
NodeType.TableValuedFunction, NodeType.Function];
|
||||
}
|
||||
|
||||
export interface SqlThemeIcon {
|
||||
|
||||
Reference in New Issue
Block a user