Skip to content

Commit 94e3734

Browse files
committed
Added missing properties to generated dgml file. Removed unused properties.
Changed property TsFilename to TypescriptFilepath and made it a reference attribute.
1 parent 7855897 commit 94e3734

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

src/commands/generateDependencyInjectionGraph.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ export class GenerateDependencyInjectionGraph extends ShowHierarchyBase {
9090

9191
addNodesAndEdges(project: Project, appendNodes: (nodeList: Node[]) => void, appendEdges: (edgeList: Edge[]) => void) {
9292
project.components.forEach(component => {
93-
const componentFilename = component.filename.replace(this.workspaceDirectory, '');
93+
let componentFilename = component.filename.replace(this.workspaceDirectory, '.');
94+
componentFilename = componentFilename.split('\\').join('/');
9495
appendNodes([new Node(component.name, this.generatedComponentNode(component), componentFilename, false, NodeType.component)]);
9596
component.dependencyInjections.forEach(injectable => {
9697
appendNodes([new Node(injectable.name, injectable.name, injectable.filename.replace(this.workspaceDirectory, ''), false, NodeType.injectable)]);

src/commands/showComponentHierarchy.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ export class ShowComponentHierarchy extends ShowHierarchyBase {
7373
}
7474

7575
private generateDirectedGraphNodes(components: Component[], component: Component, isRoot: boolean, parentSelector: string, appendNodes: (nodeList: Node[]) => void) {
76-
const componentFilename = component.tsFilename.replace(this.directoryPath, '');
76+
let componentFilename = component.tsFilename.replace(this.directoryPath, '.');
77+
componentFilename = componentFilename.split('\\').join('/');
7778
appendNodes([new Node(component.selector, component.selector, componentFilename, isRoot, isRoot ? NodeType.rootNode : NodeType.component)]);
7879
if (components.length > 0) {
7980
components.forEach((subComponent) => {

src/commands/showModuleHierarchy.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ export class ShowModuleHierarchy extends ShowHierarchyBase {
6060

6161
private addNodesAndEdges(project: Project, appendNodes: (nodeList: Node[]) => void, appendEdges: (edgeList: Edge[]) => void) {
6262
project.modules.forEach(module => {
63-
const moduleFilename = module.filename.replace(this.workspaceDirectory, '');
63+
let moduleFilename = module.filename.replace(this.workspaceDirectory, '.');
64+
moduleFilename = moduleFilename.split('\\').join('/');
6465
appendNodes([new Node(module.moduleName, module.moduleName, moduleFilename, false, NodeType.module)]);
6566
module.imports.forEach(_import => {
6667
const nodeType = Node.getNodeType(project, _import);

src/dgmlManager.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export class DgmlManager {
123123
});
124124
}
125125
if (node.tsFilename) {
126-
nodeElement.setAttribute("TsFilename", node.tsFilename);
126+
nodeElement.setAttribute("TypescriptFilepath", node.tsFilename);
127127
}
128128
this.addNode(nodesElement, nodeElement);
129129
}
@@ -164,20 +164,26 @@ export class DgmlManager {
164164

165165
private addProperties(xmlDoc: Document) {
166166
const propertiesElement = this.addNodeToRoot(xmlDoc, "Properties");
167-
this.addProperty(xmlDoc, propertiesElement, "TsFilename", "System.String");
167+
this.addProperty(xmlDoc, propertiesElement, "TypescriptFilepath", "System.String", "Typescript filepath", true);
168168
this.addProperty(xmlDoc, propertiesElement, "Background", "System.Windows.Media.Brush");
169169
this.addProperty(xmlDoc, propertiesElement, "GraphDirection", "Microsoft.VisualStudio.Diagrams.Layout.LayoutOrientation");
170-
this.addProperty(xmlDoc, propertiesElement, "IsTag", "System.Boolean");
170+
this.addProperty(xmlDoc, propertiesElement, "UseManualLocation", "System.Boolean");
171171
this.addProperty(xmlDoc, propertiesElement, "Label", "System.String");
172172
this.addProperty(xmlDoc, propertiesElement, "Layout", "System.String");
173173
this.addProperty(xmlDoc, propertiesElement, "ZoomLevel", "System.String");
174-
this.addProperty(xmlDoc, propertiesElement, "Expression", "System.String");
174+
this.addProperty(xmlDoc, propertiesElement, "Bounds", "System.Windows.Rect");
175175
}
176176

177-
private addProperty(xmlDoc: Document, propertiesElement: Element | null, idValue: string, datatypeValue: string) {
177+
private addProperty(xmlDoc: Document, propertiesElement: Element | null, idValue: string, datatypeValue: string, label: string | undefined = undefined, isReference: boolean | undefined = undefined) {
178178
const propertyElement = xmlDoc.createElement("Property");
179179
propertyElement.setAttribute("Id", idValue);
180180
propertyElement.setAttribute("DataType", datatypeValue);
181+
if ( label !== undefined && label.length > 0) {
182+
propertyElement.setAttribute("Label", label);
183+
}
184+
if (isReference !== undefined && isReference) {
185+
propertyElement.setAttribute("IsReference", isReference.toString());
186+
}
181187
this.addNode(propertiesElement, propertyElement);
182188
}
183-
}
189+
}

0 commit comments

Comments
 (0)