mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-01 09:35:41 -05:00
Show database references in project tree (#10837)
* add database references to same itemgroup * show database references in tree * update tests * refresh project tree after a reference is added * addressing comments * add validation * Add test * sort imports
This commit is contained in:
@@ -22,6 +22,7 @@ export class Project {
|
||||
public files: ProjectEntry[] = [];
|
||||
public dataSources: DataSource[] = [];
|
||||
public importedTargets: string[] = [];
|
||||
public databaseReferences: string[] = [];
|
||||
public sqlCmdVariables: Record<string, string> = {};
|
||||
|
||||
public get projectFolderPath() {
|
||||
@@ -60,6 +61,16 @@ export class Project {
|
||||
const importTarget = this.projFileXmlDoc.documentElement.getElementsByTagName(constants.Import)[i];
|
||||
this.importedTargets.push(importTarget.getAttribute(constants.Project));
|
||||
}
|
||||
|
||||
// find all database references to include
|
||||
for (let r = 0; r < this.projFileXmlDoc.documentElement.getElementsByTagName(constants.ArtifactReference).length; r++) {
|
||||
const filepath = this.projFileXmlDoc.documentElement.getElementsByTagName(constants.ArtifactReference)[r].getAttribute(constants.Include);
|
||||
if (!filepath) {
|
||||
throw new Error(constants.invalidDatabaseReference);
|
||||
}
|
||||
|
||||
this.databaseReferences.push(path.parse(filepath).name);
|
||||
}
|
||||
}
|
||||
|
||||
public async updateProjectForRoundTrip() {
|
||||
@@ -259,7 +270,8 @@ export class Project {
|
||||
referenceNode.appendChild(databaseVariableLiteralValue);
|
||||
}
|
||||
|
||||
this.findOrCreateItemGroup().appendChild(referenceNode);
|
||||
this.findOrCreateItemGroup(constants.ArtifactReference).appendChild(referenceNode);
|
||||
this.databaseReferences.push(path.parse(entry.fsUri.fsPath.toString()).name);
|
||||
}
|
||||
|
||||
private async updateImportedTargetsToProjFile(condition: string, projectAttributeVal: string, oldImportNode?: any): Promise<any> {
|
||||
|
||||
Reference in New Issue
Block a user