mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
resource deployment ext implementation -wip (#5508)
* resource types * implement the dialog * remove unused method * fix issues * formatting * 5-17 * address comments and more tests
This commit is contained in:
@@ -6,15 +6,45 @@
|
||||
|
||||
import vscode = require('vscode');
|
||||
import { ResourceDeploymentDialog } from './ui/resourceDeploymentDialog';
|
||||
import { ToolsService } from './services/toolsService';
|
||||
import { NotebookService } from './services/notebookService';
|
||||
import { ResourceTypeService } from './services/resourceTypeService';
|
||||
import { PlatformService } from './services/platformService';
|
||||
import * as nls from 'vscode-nls';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
const platformService = new PlatformService();
|
||||
const toolsService = new ToolsService();
|
||||
const notebookService = new NotebookService(platformService);
|
||||
const resourceTypeService = new ResourceTypeService(platformService, toolsService);
|
||||
|
||||
const resourceTypes = resourceTypeService.getResourceTypes();
|
||||
const validationFailures = resourceTypeService.validateResourceTypes(resourceTypes);
|
||||
if (validationFailures.length !== 0) {
|
||||
const errorMessage = localize('resourceDeployment.FailedToLoadExtension', 'Failed to load extension: {0}, Error detected in the resource type definition in package.json, check debug console for details.', context.extensionPath);
|
||||
vscode.window.showErrorMessage(errorMessage);
|
||||
validationFailures.forEach(message => console.error(message));
|
||||
return;
|
||||
}
|
||||
|
||||
const openDialog = (resourceTypeName: string) => {
|
||||
const filtered = resourceTypes.filter(resourceType => resourceType.name === resourceTypeName);
|
||||
if (filtered.length !== 1) {
|
||||
vscode.window.showErrorMessage(localize('resourceDeployment.UnknownResourceType', 'The resource type: {0} is not defined', resourceTypeName));
|
||||
}
|
||||
else {
|
||||
let dialog = new ResourceDeploymentDialog(context, notebookService, toolsService, resourceTypeService, filtered[0]);
|
||||
dialog.open();
|
||||
}
|
||||
};
|
||||
|
||||
vscode.commands.registerCommand('azdata.resource.sql-image.deploy', () => {
|
||||
let dialog = new ResourceDeploymentDialog();
|
||||
dialog.open();
|
||||
openDialog('sql-image');
|
||||
});
|
||||
vscode.commands.registerCommand('azdata.resource.sql-bdc.deploy', () => {
|
||||
let dialog = new ResourceDeploymentDialog();
|
||||
dialog.open();
|
||||
openDialog('sql-bdc');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user