Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eagle 1375 #805

Merged
merged 4 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/Eagle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,15 @@ export class Eagle {
return "";
}

return fileInfo.getText();
return fileInfo.getHtml();
}, this);

activeConfigHtml : ko.PureComputed<string> = ko.pureComputed(() => {
if (this.logicalGraph().getActiveGraphConfig() === null){
return "";
}

return "<strong>Config:</strong> " +this.logicalGraph().getActiveGraphConfig().getName()
}, this);

toggleWindows = () : void => {
Expand Down
12 changes: 12 additions & 0 deletions src/FileInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,18 @@ export class FileInfo {
}
}

getHtml = () : string => {
if (this.repositoryName !== ""){
if (this.path === ""){
return "<strong>" + this.repositoryService + "</strong>: " + this.repositoryName + " (" + this.repositoryBranch + "): " + this.name;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 issue (security): Consider using a safe HTML encoding method for repository information

Direct string concatenation with HTML tags could lead to XSS vulnerabilities if any of the fields contain special characters. Consider using a sanitization function or template system.

} else {
return "<strong>" + this.repositoryService + "</strong>: " + this.repositoryName + " (" + this.repositoryBranch + "): " + this.path + "/" + this.name;
}
} else {
return this.name;
}
}

toString = () : string => {
let s = "";

Expand Down
4 changes: 4 additions & 0 deletions static/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -2057,6 +2057,10 @@ ul.nav.navbar-nav .dropdown-item:hover{
transform: translateY(-50%);
}

#activeConfig{
margin-left:5px;
}

.navbar-light .navbar-nav .nav-link {
color: rgba(255, 255, 255, 0.55);
}
Expand Down
1 change: 1 addition & 0 deletions static/tables.css
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ td:first-child input {

#graphConfigurationsTableWrapper thead{
top: 0px;
border-top: 1px white solid;
}

.eagleTableWrapper th{
Expand Down
29 changes: 23 additions & 6 deletions templates/inspector.html
Original file line number Diff line number Diff line change
Expand Up @@ -271,17 +271,18 @@ <h4>Graph Info</h4>
<div class="headerButtons inspectorHeaderButtons" id="objectInspectorHeaderIconRow">
<div class="row">
<div class="col col-6">
<i class="material-icons interactive" data-bs-placement="right" data-bind="eagleTooltip: $root.logicalGraph().fileInfo().fullPath()" data-bs-toggle="tooltip" data-html="true">link</i>
<i class="material-icons interactive clickable" data-bs-placement="right" data-bind="eagleTooltip: $root.logicalGraph().fileInfo().shortDescription, click: function(){Utils.showModelDataModal('Graph Info', $root.logicalGraph().fileInfo());}" data-bs-toggle="tooltip" data-html="true">sticky_note_2</i>
<i class="material-icons interactive clickable" data-bs-placement="right" data-bind="eagleTooltip: $root.logicalGraph().fileInfo().detailedDescription, click: function(){Utils.showModelDataModal('Graph Info', $root.logicalGraph().fileInfo());}" data-bs-toggle="tooltip" data-html="true">menu_book</i>
</div>
<div class="col-6 col text-right">
<!-- ko if: $root.logicalGraph().fileInfo().repositoryService === Repository.Service.File -->
<i class="material-icons interactive" data-bs-placement="right" data-bind="eagleTooltip: 'This is a Local Graph File'" data-bs-toggle="tooltip" data-html="true">folder_open</i>
<i class="material-icons interactive" data-bs-placement="right" data-bind="eagleTooltip: 'This is a Local Graph File'" data-bs-toggle="tooltip" data-html="true">folder_open</i>
<!-- /ko -->
<!-- ko if: $root.logicalGraph().fileInfo().repositoryService === Repository.Service.GitHub || $root.logicalGraph().fileInfo().repositoryService === Repository.Service.GitLab -->
<i class="material-icons interactive" data-bs-placement="right" data-bind="eagleTooltip: 'This is a Graph File from GitHub or GitLab'" data-bs-toggle="tooltip" data-html="true">account_tree</i>
<!-- /ko -->
<i class="material-icons interactive" data-bs-placement="right" data-bind="eagleTooltip: $root.logicalGraph().fileInfo().fullPath()" data-bs-toggle="tooltip" data-html="true">link</i>
<i class="material-icons interactive clickable" data-bs-placement="right" data-bind="eagleTooltip: $root.logicalGraph().fileInfo().shortDescription, click: function(){Utils.showModelDataModal('Graph Info', $root.logicalGraph().fileInfo());}" data-bs-toggle="tooltip" data-html="true">sticky_note_2</i>
<i class="material-icons interactive clickable" data-bs-placement="right" data-bind="eagleTooltip: $root.logicalGraph().fileInfo().detailedDescription, click: function(){Utils.showModelDataModal('Graph Info', $root.logicalGraph().fileInfo());}" data-bs-toggle="tooltip" data-html="true">menu_book</i>
</div>
<div class="col-6 col text-right">
<i class="material-icons interactive clickable" data-bs-placement="right" data-bind="eagleTooltip: 'View graph configurations table', click: GraphConfigurationsTable.openTable" data-bs-toggle="tooltip" data-html="true">dns</i>
</div>
</div>
</div>
Expand Down Expand Up @@ -310,6 +311,22 @@ <h5>Modified Author: </h5>
<span data-bind="text:$root.logicalGraph().fileInfo().lastModifiedName, eagleTooltip:$root.logicalGraph().fileInfo().lastModifiedName"></span>
</div>
</div>
<div class="row inspectorEdgeSrcNodeId contentObject">
<div class="col-6 col contentObjectTitle">
<h5>Active Config: </h5>
</div>
<div class="col-6 col contentObjectValue">
<span data-bind="text:$root.logicalGraph().getActiveGraphConfig()?.getName(), eagleTooltip:$root.logicalGraph().getActiveGraphConfig()?.getDescription()"></span>
</div>
</div>
<div class="row inspectorEdgeSrcNodeId contentObject">
<div class="col-6 col contentObjectTitle">
<h5>Config Fields: </h5>
</div>
<div class="col-6 col contentObjectValue">
<span data-bind="text:$root.logicalGraph().getActiveGraphConfig()?.numFields(), eagleTooltip:'Number of fields overwritten by the active config.'"></span>
</div>
</div>
</div>
</div>
<!-- /ko -->
Expand Down
3 changes: 2 additions & 1 deletion templates/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@
</div>
</nav>
<div id="graphNameWrapper" data-bind="style: { 'visibility':eagle.getEagleIsReady()}">
<span id="filename" data-bind="text: repositoryFileName"></span>
<span id="filename" data-bind="html: repositoryFileName"></span>
<span id="activeConfig" data-bind="html: activeConfigHtml, eagleTooltip:'Name of the active graph configuration'"></span>
<span id="fileIsModified" class="material-icons md-18" data-bind="visible: eagle.logicalGraph().fileInfo().modified">draw</span>
</div>
Loading