Skip to content

Commit

Permalink
Display current config in config dropdown menu. Function to add confi…
Browse files Browse the repository at this point in the history
…g to existing list
  • Loading branch information
james-strauss-uwa committed Aug 14, 2024
1 parent 61290a8 commit 93196db
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/Eagle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class Eagle {

this.palettes = ko.observableArray();
this.logicalGraph = ko.observable(null);
this.currentConfig = ko.observable(new GraphConfig());
this.currentConfig = ko.observable();
this.eagleIsReady = ko.observable(false);

this.leftWindow = ko.observable(new SideWindow(Eagle.LeftWindowMode.Palettes, Utils.getLeftWindowWidth(), false));
Expand Down Expand Up @@ -1575,6 +1575,9 @@ export class Eagle {
c.setName(userString);
c.setIsModified(false);

// add to list of configs
this.logicalGraph().addGraphConfig(c);

// replace existing config
this.currentConfig(c);

Expand Down
4 changes: 4 additions & 0 deletions src/LogicalGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,10 @@ export class LogicalGraph {
this.graphConfigs(graphConfigs);
}

addGraphConfig = (config: GraphConfig): void => {
this.graphConfigs.push(config);
}

countEdgesIncidentOnNode = (node : Node) : number => {
let result: number = 0;

Expand Down
2 changes: 1 addition & 1 deletion templates/translation_menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ <h5>
</div>

<div class="row mt-2">
<select id="currentConfigSelect" class="form-control" data-bind="options: logicalGraph().graphConfigs, optionsText: 'name'">
<select id="currentConfigSelect" class="form-control" data-bind="options: logicalGraph().graphConfigs, optionsText: 'name', value: currentConfig">
</select>
<button class="btn btn-primary btn-block" type="button" data-bs-placement="bottom" data-bind="click: function(){ParameterTable.openModal(ParameterTable.Mode.GraphConfig, ParameterTable.SelectType.Normal)}, eagleTooltip: `Display Graph Configuration ` + Utils.getKeyboardShortcutTextByKey('open_graph_configuration_table_modal', true)">Open Graph Configuration</button>
</div>
Expand Down

0 comments on commit 93196db

Please sign in to comment.