mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -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"
|
"icon": "images/data-workspace.svg"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
"viewsWelcome": [
|
||||||
|
{
|
||||||
|
"view": "dataworkspace.views.main",
|
||||||
|
"contents": "%projects-view-no-workspace-content%",
|
||||||
|
"when": "workbenchState != workspace"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"vscode-nls": "^4.0.0"
|
"vscode-nls": "^4.0.0"
|
||||||
|
|||||||
@@ -5,5 +5,6 @@
|
|||||||
"main-view-name": "Projects",
|
"main-view-name": "Projects",
|
||||||
"add-project-command": "Add Project",
|
"add-project-command": "Add Project",
|
||||||
"refresh-workspace-command": "Refresh",
|
"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 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 SelectProjectFileActionName = localize('SelectProjectFileActionName', "Select");
|
||||||
|
export const AllProjectTypes = localize('AllProjectTypes', "All Project Types");
|
||||||
|
|
||||||
|
|||||||
@@ -70,18 +70,3 @@ export interface IWorkspaceService {
|
|||||||
*/
|
*/
|
||||||
readonly onDidWorkspaceProjectsChange: vscode.Event<void>;
|
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 * as vscode from 'vscode';
|
||||||
import { IWorkspaceService, WorkspaceTreeItem as WorkspaceTreeItem } from './interfaces';
|
import { IWorkspaceService } from './interfaces';
|
||||||
import { UnknownProjectsErrorMessage } from './constants';
|
import { UnknownProjectsErrorMessage } from './constants';
|
||||||
|
import { WorkspaceTreeItem } from 'dataworkspace';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tree data provider for the workspace main view
|
* 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 }
|
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 * as path from 'path';
|
||||||
import { WorkspaceTreeDataProvider } from './common/workspaceTreeDataProvider';
|
import { WorkspaceTreeDataProvider } from './common/workspaceTreeDataProvider';
|
||||||
import { WorkspaceService } from './services/workspaceService';
|
import { WorkspaceService } from './services/workspaceService';
|
||||||
import { SelectProjectFileActionName } from './common/constants';
|
import { AllProjectTypes, SelectProjectFileActionName } from './common/constants';
|
||||||
import { WorkspaceTreeItem } from './common/interfaces';
|
import { WorkspaceTreeItem } from 'dataworkspace';
|
||||||
|
|
||||||
export function activate(context: vscode.ExtensionContext): void {
|
export function activate(context: vscode.ExtensionContext): void {
|
||||||
const workspaceService = new WorkspaceService();
|
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
|
// To Sakshi - You can replace the implementation with your complete dialog implementation
|
||||||
// but all the code here should be reusable by you
|
// but all the code here should be reusable by you
|
||||||
if (vscode.workspace.workspaceFile) {
|
if (vscode.workspace.workspaceFile) {
|
||||||
const filter: { [name: string]: string[] } = {};
|
const filters: { [name: string]: string[] } = {};
|
||||||
const projectTypes = await workspaceService.getAllProjectTypes();
|
const projectTypes = await workspaceService.getAllProjectTypes();
|
||||||
|
filters[AllProjectTypes] = projectTypes.map(type => type.projectFileExtension);
|
||||||
projectTypes.forEach(type => {
|
projectTypes.forEach(type => {
|
||||||
filter[type.displayName] = projectTypes.map(projectType => projectType.projectFileExtension);
|
filters[type.displayName] = [type.projectFileExtension];
|
||||||
});
|
});
|
||||||
let fileUris = await vscode.window.showOpenDialog({
|
let fileUris = await vscode.window.showOpenDialog({
|
||||||
canSelectFiles: true,
|
canSelectFiles: true,
|
||||||
@@ -29,7 +30,7 @@ export function activate(context: vscode.ExtensionContext): void {
|
|||||||
canSelectMany: false,
|
canSelectMany: false,
|
||||||
defaultUri: vscode.Uri.file(path.dirname(vscode.workspace.workspaceFile.path)),
|
defaultUri: vscode.Uri.file(path.dirname(vscode.workspace.workspaceFile.path)),
|
||||||
openLabel: SelectProjectFileActionName,
|
openLabel: SelectProjectFileActionName,
|
||||||
filters: filter
|
filters: filters
|
||||||
});
|
});
|
||||||
if (!fileUris || fileUris.length === 0) {
|
if (!fileUris || fileUris.length === 0) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ import * as vscode from 'vscode';
|
|||||||
import * as should from 'should';
|
import * as should from 'should';
|
||||||
import { WorkspaceTreeDataProvider } from '../common/workspaceTreeDataProvider';
|
import { WorkspaceTreeDataProvider } from '../common/workspaceTreeDataProvider';
|
||||||
import { WorkspaceService } from '../services/workspaceService';
|
import { WorkspaceService } from '../services/workspaceService';
|
||||||
import { WorkspaceTreeItem } from '../common/interfaces';
|
import { IProjectProvider, WorkspaceTreeItem } from 'dataworkspace';
|
||||||
import { IProjectProvider } from 'dataworkspace';
|
|
||||||
import { MockTreeDataProvider } from './projectProviderRegistry.test';
|
import { MockTreeDataProvider } from './projectProviderRegistry.test';
|
||||||
|
|
||||||
suite('workspaceTreeDataProvider Tests', function (): void {
|
suite('workspaceTreeDataProvider Tests', function (): void {
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import { BuildHelper } from '../tools/buildHelper';
|
|||||||
import { PublishProfile, load } from '../models/publishProfile/publishProfile';
|
import { PublishProfile, load } from '../models/publishProfile/publishProfile';
|
||||||
import { AddDatabaseReferenceDialog } from '../dialogs/addDatabaseReferenceDialog';
|
import { AddDatabaseReferenceDialog } from '../dialogs/addDatabaseReferenceDialog';
|
||||||
import { ISystemDatabaseReferenceSettings, IDacpacReferenceSettings, IProjectReferenceSettings } from '../models/IDatabaseReferenceSettings';
|
import { ISystemDatabaseReferenceSettings, IDacpacReferenceSettings, IProjectReferenceSettings } from '../models/IDatabaseReferenceSettings';
|
||||||
|
import { WorkspaceTreeItem } from 'dataworkspace';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller for managing project lifecycle
|
* Controller for managing project lifecycle
|
||||||
@@ -188,7 +189,7 @@ export class ProjectsController {
|
|||||||
* @returns path of the built dacpac
|
* @returns path of the built dacpac
|
||||||
*/
|
*/
|
||||||
public async buildProject(project: Project): Promise<string>;
|
public async buildProject(project: Project): Promise<string>;
|
||||||
public async buildProject(context: Project | BaseProjectTreeItem): Promise<string | undefined> {
|
public async buildProject(context: Project | BaseProjectTreeItem | WorkspaceTreeItem): Promise<string | undefined> {
|
||||||
const project: Project = this.getProjectFromContext(context);
|
const project: Project = this.getProjectFromContext(context);
|
||||||
|
|
||||||
// Check mssql extension for project dlls (tracking issue #10273)
|
// Check mssql extension for project dlls (tracking issue #10273)
|
||||||
@@ -564,7 +565,11 @@ export class ProjectsController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private getProjectFromContext(context: Project | BaseProjectTreeItem) {
|
private getProjectFromContext(context: Project | BaseProjectTreeItem | WorkspaceTreeItem) {
|
||||||
|
if ('element' in context) {
|
||||||
|
return context.element.project;
|
||||||
|
}
|
||||||
|
|
||||||
if (context instanceof Project) {
|
if (context instanceof Project) {
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user