mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
data workspace review feedback implementation (#12489)
* add a view to handle no workspace scenario * text update * project type filter improvement * fix the project level context menu issue * update strings
This commit is contained in:
@@ -105,7 +105,14 @@
|
||||
"icon": "images/data-workspace.svg"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"viewsWelcome": [
|
||||
{
|
||||
"view": "dataworkspace.views.main",
|
||||
"contents": "%projects-view-no-workspace-content%",
|
||||
"when": "workbenchState != workspace"
|
||||
}
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"vscode-nls": "^4.0.0"
|
||||
|
||||
@@ -5,5 +5,6 @@
|
||||
"main-view-name": "Projects",
|
||||
"add-project-command": "Add Project",
|
||||
"refresh-workspace-command": "Refresh",
|
||||
"remove-project-command":"Remove Project"
|
||||
"remove-project-command": "Remove Project",
|
||||
"projects-view-no-workspace-content": "To use projects, open a workspace and add projects to it, or use the 'Add Project' feature and we will create a workspace for you.\n[Open Workspace](command:workbench.action.openWorkspace)\n[Add Project](command:projects.addProject)"
|
||||
}
|
||||
|
||||
@@ -11,4 +11,5 @@ export const ExtensionActivationErrorMessage = (extensionId: string, err: any):
|
||||
export const UnknownProjectsErrorMessage = (projectFiles: string[]): string => { return localize('UnknownProjectsError', "No provider was found for the following projects: {0}", projectFiles.join(EOL)); };
|
||||
|
||||
export const SelectProjectFileActionName = localize('SelectProjectFileActionName', "Select");
|
||||
export const AllProjectTypes = localize('AllProjectTypes', "All Project Types");
|
||||
|
||||
|
||||
@@ -70,18 +70,3 @@ export interface IWorkspaceService {
|
||||
*/
|
||||
readonly onDidWorkspaceProjectsChange: vscode.Event<void>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the item for the workspace tree
|
||||
*/
|
||||
export interface WorkspaceTreeItem {
|
||||
/**
|
||||
* Gets the tree data provider
|
||||
*/
|
||||
treeDataProvider: vscode.TreeDataProvider<any>;
|
||||
|
||||
/**
|
||||
* Gets the raw element returned by the tree data provider
|
||||
*/
|
||||
element: any;
|
||||
}
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import { IWorkspaceService, WorkspaceTreeItem as WorkspaceTreeItem } from './interfaces';
|
||||
import { IWorkspaceService } from './interfaces';
|
||||
import { UnknownProjectsErrorMessage } from './constants';
|
||||
import { WorkspaceTreeItem } from 'dataworkspace';
|
||||
|
||||
/**
|
||||
* Tree data provider for the workspace main view
|
||||
|
||||
15
extensions/data-workspace/src/dataworkspace.d.ts
vendored
15
extensions/data-workspace/src/dataworkspace.d.ts
vendored
@@ -62,4 +62,19 @@ declare module 'dataworkspace' {
|
||||
*/
|
||||
readonly icon: string | vscode.Uri | { light: string | vscode.Uri, dark: string | vscode.Uri }
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the item for the workspace tree
|
||||
*/
|
||||
export interface WorkspaceTreeItem {
|
||||
/**
|
||||
* Gets the tree data provider
|
||||
*/
|
||||
treeDataProvider: vscode.TreeDataProvider<any>;
|
||||
|
||||
/**
|
||||
* Gets the raw element returned by the tree data provider
|
||||
*/
|
||||
element: any;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ import * as vscode from 'vscode';
|
||||
import * as path from 'path';
|
||||
import { WorkspaceTreeDataProvider } from './common/workspaceTreeDataProvider';
|
||||
import { WorkspaceService } from './services/workspaceService';
|
||||
import { SelectProjectFileActionName } from './common/constants';
|
||||
import { WorkspaceTreeItem } from './common/interfaces';
|
||||
import { AllProjectTypes, SelectProjectFileActionName } from './common/constants';
|
||||
import { WorkspaceTreeItem } from 'dataworkspace';
|
||||
|
||||
export function activate(context: vscode.ExtensionContext): void {
|
||||
const workspaceService = new WorkspaceService();
|
||||
@@ -18,10 +18,11 @@ export function activate(context: vscode.ExtensionContext): void {
|
||||
// To Sakshi - You can replace the implementation with your complete dialog implementation
|
||||
// but all the code here should be reusable by you
|
||||
if (vscode.workspace.workspaceFile) {
|
||||
const filter: { [name: string]: string[] } = {};
|
||||
const filters: { [name: string]: string[] } = {};
|
||||
const projectTypes = await workspaceService.getAllProjectTypes();
|
||||
filters[AllProjectTypes] = projectTypes.map(type => type.projectFileExtension);
|
||||
projectTypes.forEach(type => {
|
||||
filter[type.displayName] = projectTypes.map(projectType => projectType.projectFileExtension);
|
||||
filters[type.displayName] = [type.projectFileExtension];
|
||||
});
|
||||
let fileUris = await vscode.window.showOpenDialog({
|
||||
canSelectFiles: true,
|
||||
@@ -29,7 +30,7 @@ export function activate(context: vscode.ExtensionContext): void {
|
||||
canSelectMany: false,
|
||||
defaultUri: vscode.Uri.file(path.dirname(vscode.workspace.workspaceFile.path)),
|
||||
openLabel: SelectProjectFileActionName,
|
||||
filters: filter
|
||||
filters: filters
|
||||
});
|
||||
if (!fileUris || fileUris.length === 0) {
|
||||
return;
|
||||
|
||||
@@ -9,8 +9,7 @@ import * as vscode from 'vscode';
|
||||
import * as should from 'should';
|
||||
import { WorkspaceTreeDataProvider } from '../common/workspaceTreeDataProvider';
|
||||
import { WorkspaceService } from '../services/workspaceService';
|
||||
import { WorkspaceTreeItem } from '../common/interfaces';
|
||||
import { IProjectProvider } from 'dataworkspace';
|
||||
import { IProjectProvider, WorkspaceTreeItem } from 'dataworkspace';
|
||||
import { MockTreeDataProvider } from './projectProviderRegistry.test';
|
||||
|
||||
suite('workspaceTreeDataProvider Tests', function (): void {
|
||||
|
||||
Reference in New Issue
Block a user