Skip to content

Commit

Permalink
added a graph is edited icon and fixed an issue with undo and the act…
Browse files Browse the repository at this point in the history
…ive graph config state
  • Loading branch information
M-Wicenec committed Oct 31, 2024
1 parent db35f4d commit d116ab4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 68 deletions.
67 changes: 0 additions & 67 deletions src/Eagle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1498,8 +1498,6 @@ export class Eagle {

c.setName('newConfig');

// NOTE: don't add new config to the list of configs in the LogicalGraph until it is saved!

// adding a new graph config to the array, then setting it as active
this.logicalGraph().addGraphConfig(c)
this.logicalGraph().setActiveGraphConfig(c.getId());
Expand All @@ -1513,73 +1511,8 @@ export class Eagle {
setTimeout(() => {
$('#graphConfigurationsTableWrapper .activeConfig .column-name input').focus().select()
}, 100);


// Utils.requestUserString("New Config", "Enter Config name", Utils.generateGraphConfigName(c), false, (completed : boolean, userString : string) : void => {
// if (!completed)
// { // Cancelling action.
// return;
// }
// if (userString === ""){
// Utils.showNotification("Invalid name", "Please enter a name for the new object", "danger");
// return;
// }

// c.setName(userString);

// // NOTE: don't add new config to the list of configs in the LogicalGraph until it is saved!

// // adding a new graph config to the array, then setting it as active
// this.logicalGraph().addGraphConfig(c)
// this.logicalGraph().setActiveGraphConfig(c.getId());

// Utils.showNotification("New Graph Config Created", userString, "success");

// // re-open graph configurations modal (if required)
// if (modalOpen){
// GraphConfigurationsTable.openModal();
// }
// });
}

// saveConfig = () : void => {
// const activeConfig: GraphConfig = this.logicalGraph().getActiveGraphConfig();

// // check if config is not modified
// if (!activeConfig.getIsModified()){
// Utils.showNotification("Can't Save Config", "The Active Graph Configuration is unmodified", "danger");
// return;
// }

// // check if config is empty
// if (activeConfig.getName() === ""){
// Utils.showNotification("Can't Save Config", "The Active Graph Configuration is empty", "danger");
// return;
// }

// // ask user for a description
// Utils.requestUserString("Enter Config Description", "Please enter a description for this graph configuration", activeConfig.getDescription(), false, (completed: boolean, userString: string) => {
// if (!completed){
// return;
// }

// if (userString === ""){
// Utils.showNotification("Empty description", "Please enter a helpful description for this graph configuration", "danger");
// return;
// }

// // copy active config into the list of configs in the LG
// activeConfig.setIsModified(false);
// this.logicalGraph().addGraphConfig(activeConfig);
// this.logicalGraph().setActiveGraphConfig(activeConfig);
// activeConfig.setDescription(userString);

// Utils.showNotification("Graph Config Saved", "Config '" + activeConfig.getName() + "' saved to Logical Graph", "success");
// });


// }

saveGraph = () : void => {
switch (this.logicalGraph().fileInfo().repositoryService){
case Repository.Service.File:
Expand Down
5 changes: 4 additions & 1 deletion src/LogicalGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export class LogicalGraph {
private nodes : ko.ObservableArray<Node>;
private edges : ko.ObservableArray<Edge>;
private graphConfigs : ko.ObservableArray<GraphConfig>;
// private activeGraphConfig : ko.Observable<GraphConfig>;
private activeGraphConfigId : ko.Observable<GraphConfig.Id>

private issues : ko.ObservableArray<{issue:Errors.Issue, validity:Errors.Validity}> //keeps track of higher level errors on the graph
Expand Down Expand Up @@ -422,6 +421,7 @@ export class LogicalGraph {
this.nodes([]);
this.edges([]);
this.graphConfigs([]);
this.activeGraphConfigId(undefined)
}

clone = () : LogicalGraph => {
Expand All @@ -444,6 +444,9 @@ export class LogicalGraph {
result.graphConfigs.push(graphConfig.clone());
}

//copy active graph config id state
result.activeGraphConfigId(this.activeGraphConfigId());

return result;
}

Expand Down
8 changes: 8 additions & 0 deletions static/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -2040,6 +2040,14 @@ ul.nav.navbar-nav .dropdown-item:hover{
color: rgb(219, 219, 219);
}

#graphNameWrapper #fileIsModified{
position: absolute;
padding-left: 5px;
font-size: 20px;
top: 50%;
transform: translateY(-50%);
}

.navbar-light .navbar-nav .nav-link {
color: rgba(255, 255, 255, 0.55);
}
Expand Down
1 change: 1 addition & 0 deletions templates/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -246,4 +246,5 @@
</nav>
<div id="graphNameWrapper" data-bind="style: { 'visibility':eagle.getEagleIsReady()}">
<span id="filename" data-bind="text: repositoryFileName"></span>
<span id="fileIsModified" class="material-icons md-18" data-bind="visible: eagle.logicalGraph().fileInfo().modified">draw</span>
</div>

0 comments on commit d116ab4

Please sign in to comment.