mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
* Fix to enable two projects showing only their data even if opening together * Fixing a typo * Taking in PR comments
This commit is contained in:
@@ -23,7 +23,7 @@ export const DoNotShowAgain = localize('dataworkspace.doNotShowAgain', "Do not s
|
||||
export const ProjectsFailedToLoad = localize('dataworkspace.projectsFailedToLoad', "Some projects failed to load. Please open console for more information");
|
||||
export const fileDoesNotExist = (name: string): string => { return localize('fileDoesNotExist', "File '{0}' doesn't exist", name); };
|
||||
export const projectNameNull = localize('projectNameNull', "Project name is null");
|
||||
export const noPreviousData = (tableName: string): string => { return localize('noPreviousData', "Prior {0} will appear here, please run to see the results.", tableName); };
|
||||
export const noPreviousData = (tableName: string): string => { return localize('noPreviousData', "Prior {0} for the current project will appear here, please run to see the results.", tableName); };
|
||||
|
||||
// config settings
|
||||
export const projectsConfigurationKey = 'projects';
|
||||
|
||||
10
extensions/data-workspace/src/dataworkspace.d.ts
vendored
10
extensions/data-workspace/src/dataworkspace.d.ts
vendored
@@ -67,6 +67,11 @@ declare module 'dataworkspace' {
|
||||
*/
|
||||
createProject(name: string, location: vscode.Uri, projectTypeId: string): Promise<vscode.Uri>;
|
||||
|
||||
/**
|
||||
* Gets the project data corresponding to the project file, to be placed in the dashboard container
|
||||
*/
|
||||
getDashboardComponents(projectFile: string): IDashboardTable[];
|
||||
|
||||
/**
|
||||
* Gets the supported project types
|
||||
*/
|
||||
@@ -77,11 +82,6 @@ declare module 'dataworkspace' {
|
||||
*/
|
||||
readonly projectActions: (IProjectAction | IProjectActionGroup)[];
|
||||
|
||||
/**
|
||||
* Gets the project data to be placed in the dashboard container
|
||||
*/
|
||||
readonly dashboardComponents: IDashboardTable[];
|
||||
|
||||
/**
|
||||
* Gets the project image to be used as background in dashboard container
|
||||
*/
|
||||
|
||||
@@ -44,7 +44,7 @@ export class ProjectDashboard {
|
||||
await this.dashboard!.open();
|
||||
}
|
||||
|
||||
private async createDashboard(title: string, location: string): Promise<void> {
|
||||
private async createDashboard(title: string, projectFilePath: string): Promise<void> {
|
||||
this.dashboard = azdata.window.createModelViewDashboard(title, 'ProjectDashboard', { alwaysShowTabs: false });
|
||||
this.dashboard.registerTabs(async (modelView: azdata.ModelView) => {
|
||||
this.modelView = modelView;
|
||||
@@ -52,8 +52,8 @@ export class ProjectDashboard {
|
||||
this.overviewTab = {
|
||||
title: '',
|
||||
id: 'overview-tab',
|
||||
content: this.createContainer(title, location),
|
||||
toolbar: this.createToolbarContainer()
|
||||
content: this.createContainer(title, projectFilePath),
|
||||
toolbar: this.createToolbarContainer(projectFilePath)
|
||||
};
|
||||
return [
|
||||
this.overviewTab
|
||||
@@ -61,7 +61,7 @@ export class ProjectDashboard {
|
||||
});
|
||||
}
|
||||
|
||||
private createToolbarContainer(): azdata.ToolbarContainer {
|
||||
private createToolbarContainer(projectFilePath: string): azdata.ToolbarContainer {
|
||||
const projectActions: (IProjectAction | IProjectActionGroup)[] = this.projectProvider!.projectActions;
|
||||
|
||||
// Add actions as buttons
|
||||
@@ -92,7 +92,7 @@ export class ProjectDashboard {
|
||||
|
||||
refreshButton.onDidClick(() => {
|
||||
this.rootContainer?.removeItem(this.tableContainer!);
|
||||
this.tableContainer = this.createTables();
|
||||
this.tableContainer = this.createTables(projectFilePath);
|
||||
this.rootContainer?.addItem(this.tableContainer);
|
||||
});
|
||||
|
||||
@@ -123,7 +123,7 @@ export class ProjectDashboard {
|
||||
return button;
|
||||
}
|
||||
|
||||
private createContainer(title: string, location: string): azdata.FlexContainer {
|
||||
private createContainer(title: string, projectFilePath: string): azdata.FlexContainer {
|
||||
this.rootContainer = this.modelView!.modelBuilder.flexContainer().withLayout(
|
||||
{
|
||||
flexFlow: 'column',
|
||||
@@ -131,8 +131,8 @@ export class ProjectDashboard {
|
||||
height: '100%'
|
||||
}).component();
|
||||
|
||||
const headerContainer = this.createHeader(title, location);
|
||||
this.tableContainer = this.createTables();
|
||||
const headerContainer = this.createHeader(title, projectFilePath);
|
||||
this.tableContainer = this.createTables(projectFilePath);
|
||||
|
||||
this.rootContainer.addItem(headerContainer);
|
||||
this.rootContainer.addItem(this.tableContainer);
|
||||
@@ -188,8 +188,8 @@ export class ProjectDashboard {
|
||||
/**
|
||||
* Adds all the tables to the container
|
||||
*/
|
||||
private createTables(): azdata.Component {
|
||||
const dashboardData: IDashboardTable[] = this.projectProvider!.dashboardComponents;
|
||||
private createTables(projectFile: string): azdata.Component {
|
||||
const dashboardData: IDashboardTable[] = this.projectProvider!.getDashboardComponents(projectFile);
|
||||
|
||||
const tableContainer = this.modelView!.modelBuilder.flexContainer().withLayout(
|
||||
{
|
||||
|
||||
@@ -33,7 +33,9 @@ export function createProjectProvider(projectTypes: IProjectType[], projectActio
|
||||
return Promise.resolve(location);
|
||||
},
|
||||
projectActions: projectActions,
|
||||
dashboardComponents: dashboardComponents
|
||||
getDashboardComponents: (projectFile: string): IDashboardTable[] => {
|
||||
return dashboardComponents;
|
||||
}
|
||||
};
|
||||
return projectProvider;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IProjectProvider, WorkspaceTreeItem } from 'dataworkspace';
|
||||
import { IDashboardTable, IProjectProvider, WorkspaceTreeItem } from 'dataworkspace';
|
||||
import 'mocha';
|
||||
import * as should from 'should';
|
||||
import * as sinon from 'sinon';
|
||||
@@ -111,7 +111,8 @@ suite('workspaceTreeDataProvider Tests', function (): void {
|
||||
id: 'Target Version',
|
||||
run: async (): Promise<any> => { return Promise.resolve(); }
|
||||
}],
|
||||
dashboardComponents: [{
|
||||
getDashboardComponents: (projectFile: string): IDashboardTable[] => {
|
||||
return [{
|
||||
name: 'Deployments',
|
||||
columns: [{ displayName: 'c1', width: 75, type: 'string' }],
|
||||
data: [['d1']]
|
||||
@@ -120,8 +121,8 @@ suite('workspaceTreeDataProvider Tests', function (): void {
|
||||
name: 'Builds',
|
||||
columns: [{ displayName: 'c1', width: 75, type: 'string' }],
|
||||
data: [['d1']]
|
||||
}]
|
||||
};
|
||||
}];
|
||||
}};
|
||||
const getProjectProviderStub = sinon.stub(workspaceService, 'getProjectProvider');
|
||||
getProjectProviderStub.onFirstCall().resolves(undefined);
|
||||
getProjectProviderStub.onSecondCall().resolves(projectProvider);
|
||||
|
||||
Reference in New Issue
Block a user